also expect one directory higher; incorporates #207 (@iuyiuy) - Breaking change: Separate `extIconsPath` from `extPath` (not copying over icons) - Breaking change: Don't reference `custom.css` in HTML; can instead be referenced in JavaScript through the config file (provided in `svgedit-config-sample-iife.js`/`svgedit-config-sample-es.js` as `svgedit-custom.css` for better namespacing); incorporates #207 (@iuyiuy) - Breaking change: Remove minified jgraduate/spinbtn files (minified within Rollup routine) - Fix: Zoom when scrolled; incorporates #169 (@AndrolGenhald), adapting for conventions; also allow avoidance when shift key pressed - Fix: Update Atom feed reference in HTML - Fixes related to recent commits: Some path and method name fixes needed, function order, missing methods, variable scope declaration, no need for DOMContentLoaded listeners in modules, switch back to non-default export, avoid trimming nullish, deal with mock tests, fix `math.matrixMultiply`, use jquery-svg where needed for array/SVG attributes; add babel-polyfill and defer script to imagelib; other misc. fixes - Enhancement: Move config-sample.js out of `editor` directory - Enhancement: For `callback`-style extensions, also provide config object; add following to that object: buildCanvgCallback, canvg, decode64, encode64, executeAfterLoads, getTypeMap, isChrome, ieIE, NS, text2xml - Enhancement: Complete ES6 modules work (extensions, locales, tests), along with Babel; make Node build routine for converting modular source to non-modular, use `loadStylesheets` for modular stylehsheet defining (but parallel loading); - Enhancement: Add `stylesheets` config for modular but parallel stylesheet loading with `@default` option for simple inclusion/exclusion of defaults (if not going with default). - Refactoring: Clean up `svg-editor.html`: consistent indents; avoid extra lbs, avoid long lines - Refactoring: Avoid embedded API adding inline JavaScript listener - Refactoring: Move layers and context code to `draw.js` - Refactoring: Move `pathActions` from `svgcanvas.js` (though preserve aliases to these methods on `canvas`) and `convertPath` from `svgutils.js` to `path.js` - Refactoring: Move `getStrokedBBox` from `svgcanvas.js` (while keeping an alias) to `svgutils.js` (as `getStrokedBBoxDefaultVisible` to avoid conflict with existing) - Docs: Remove "dependencies" comments in code except where summarizing role of jQuery or a non-obvious dependency - Refactoring/Linting: Enfore `no-extra-semi` and `quote-props` rules - Refactoring: Further avoidance of quotes on properties (as possible) - Refactoring: Use `class` in place of functions where intended as classes - Refactoring: Consistency and granularity in extensions imports - Testing: Update QUnit to 2.6.1 (node_modules) and Sinon to 5.0.8 (and add sinon-test at 2.1.3) and enforce eslint-plugin-qunit linting rules; update custom extensions - Testing: Add node-static for automating (and accessing out-of-directory contents) - Testing: Avoid HTML attributes for styling - Testing: Add npm `test` script - Testing: Comment out unused jQuery SVG test - Testing: Add test1 and svgutils_performance_test to all tests page - Testing: Due apparently to Path having not been a formal class, the test was calling it without `new`; refactored now with sufficient mock data to take into account it is a class - npm: Update devDeps - npm: Add html modules and config build to test script
160 lines
5.8 KiB
JavaScript
160 lines
5.8 KiB
JavaScript
// DO NOT EDIT THIS FILE!
|
|
// THIS FILE IS JUST A SAMPLE; TO APPLY, YOU MUST
|
|
// CREATE A NEW FILE svgedit-config-es.js AND ADD CONTENTS
|
|
// SUCH AS SHOWN BELOW INTO THAT FILE. THEN, TO BUILD AN
|
|
// IIFE VERSION (AS CAN WORK ON OLDER BROWSERS), RUN THE
|
|
// FOLLOWING ON THE COMMAND LINE FROM THE PROJECT ROOT:
|
|
// `npm run build-config`. REPEAT AFTER ANY MODIFICATIONS
|
|
// TO svgedit-config-es.js.
|
|
|
|
/*
|
|
The svgedit-config-es.js file is intended for the setting of configuration or
|
|
preferences which must run early on; if this is not needed, it is
|
|
recommended that you create an extension instead (for greater
|
|
reusability and modularity). This file needs to be in the parent
|
|
folder of the editor folder. It is referenced in the code as
|
|
'../svgedit-config-es.js'.
|
|
*/
|
|
|
|
// CONFIG AND EXTENSION SETTING
|
|
/*
|
|
See defaultConfig and defaultExtensions in svg-editor.js for a list
|
|
of possible configuration settings.
|
|
|
|
See svg-editor.js for documentation on using `setConfig()`.
|
|
*/
|
|
|
|
import svgEditor from './editor/svg-editor.js';
|
|
|
|
// <CONDITIONAL-ADD>: window.svgEditor = svgEditor; // DO NOT DELETE THIS LINE: USED BY AUTOMATED SCRIPT
|
|
// <CONDITIONAL-ADD>: window.svgEditor.modules = false; // DO NOT DELETE THIS LINE: USED BY AUTOMATED SCRIPT
|
|
|
|
// URL OVERRIDE CONFIG
|
|
svgEditor.setConfig({
|
|
/**
|
|
To override the ability for URLs to set URL-based SVG content,
|
|
uncomment the following:
|
|
*/
|
|
// preventURLContentLoading: true,
|
|
/**
|
|
To override the ability for URLs to set other configuration (including
|
|
extension config), uncomment the following:
|
|
*/
|
|
// preventAllURLConfig: true,
|
|
/**
|
|
To override the ability for URLs to set their own extensions,
|
|
uncomment the following (note that if `setConfig()` is used in
|
|
extension code, it will still be additive to extensions,
|
|
however):
|
|
*/
|
|
// lockExtensions: true,
|
|
});
|
|
|
|
svgEditor.setConfig({
|
|
/*
|
|
Provide default values here which differ from that of the editor but
|
|
which the URL can override
|
|
*/
|
|
}, {allowInitialUserOverride: true});
|
|
|
|
// EXTENSION CONFIG
|
|
svgEditor.setConfig({
|
|
extensions: [
|
|
// 'ext-overview_window.js', 'ext-markers.js', 'ext-connector.js', 'ext-eyedropper.js', 'ext-shapes.js', 'ext-imagelib.js', 'ext-grid.js', 'ext-polygon.js', 'ext-star.js', 'ext-panning.js', 'ext-storage.js'
|
|
]
|
|
// , noDefaultExtensions: false, // noDefaultExtensions can only be meaningfully used in svgedit-config-es.js or in the URL
|
|
});
|
|
|
|
// STYLESHEET CONFIG
|
|
svgEditor.setConfig({
|
|
stylesheets: ['@default', 'svgedit-custom.css']
|
|
});
|
|
|
|
// OTHER CONFIG
|
|
svgEditor.setConfig({
|
|
// canvasName: 'default',
|
|
// canvas_expansion: 3,
|
|
// initFill: {
|
|
// color: 'FF0000', // solid red
|
|
// opacity: 1
|
|
// },
|
|
// initStroke: {
|
|
// width: 5,
|
|
// color: '000000', // solid black
|
|
// opacity: 1
|
|
// },
|
|
// initOpacity: 1,
|
|
// colorPickerCSS: null,
|
|
// initTool: 'select',
|
|
// exportWindowType: 'new', // 'same'
|
|
// wireframe: false,
|
|
// showlayers: false,
|
|
// no_save_warning: false,
|
|
// PATH CONFIGURATION
|
|
// imgPath: 'images/',
|
|
// langPath: 'locale/',
|
|
// extPath: 'extensions/',
|
|
// jGraduatePath: 'jgraduate/images/',
|
|
/*
|
|
Uncomment the following to allow at least same domain (embedded) access,
|
|
including file:// access.
|
|
Setting as `['*']` would allow any domain to access but would be unsafe to
|
|
data privacy and integrity.
|
|
*/
|
|
// allowedOrigins: [window.location.origin || 'null'], // May be 'null' (as a string) when used as a file:// URL
|
|
// DOCUMENT PROPERTIES
|
|
// dimensions: [640, 480],
|
|
// EDITOR OPTIONS
|
|
// gridSnapping: false,
|
|
// gridColor: '#000',
|
|
// baseUnit: 'px',
|
|
// snappingStep: 10,
|
|
// showRulers: true,
|
|
// EXTENSION-RELATED (GRID)
|
|
// showGrid: false, // Set by ext-grid.js
|
|
// EXTENSION-RELATED (STORAGE)
|
|
// noStorageOnLoad: false, // Some interaction with ext-storage.js; prevent even the loading of previously saved local storage
|
|
// forceStorage: false, // Some interaction with ext-storage.js; strongly discouraged from modification as it bypasses user privacy by preventing them from choosing whether to keep local storage or not
|
|
// emptyStorageOnDecline: true, // Used by ext-storage.js; empty any prior storage if the user declines to store
|
|
});
|
|
|
|
// PREF CHANGES
|
|
/**
|
|
setConfig() can also be used to set preferences in addition to
|
|
configuration (see defaultPrefs in svg-editor.js for a list of
|
|
possible settings), but at least if you are using ext-storage.js
|
|
to store preferences, it will probably be better to let your
|
|
users control these.
|
|
As with configuration, one may use allowInitialUserOverride, but
|
|
in the case of preferences, any previously stored preferences
|
|
will also thereby be enabled to override this setting (and at a
|
|
higher priority than any URL preference setting overrides).
|
|
Failing to use allowInitialUserOverride will ensure preferences
|
|
are hard-coded here regardless of URL or prior user storage setting.
|
|
*/
|
|
svgEditor.setConfig({
|
|
// lang: '', // Set dynamically within locale.js if not previously set
|
|
// iconsize: '', // Will default to 's' if the window height is smaller than the minimum height and 'm' otherwise
|
|
/**
|
|
* When showing the preferences dialog, svg-editor.js currently relies
|
|
* on curPrefs instead of $.pref, so allowing an override for bkgd_color
|
|
* means that this value won't have priority over block auto-detection as
|
|
* far as determining which color shows initially in the preferences
|
|
* dialog (though it can be changed and saved).
|
|
*/
|
|
// bkgd_color: '#FFF',
|
|
// bkgd_url: '',
|
|
// img_save: 'embed',
|
|
// Only shows in UI as far as alert notices
|
|
// save_notice_done: false,
|
|
// export_notice_done: false
|
|
});
|
|
svgEditor.setConfig(
|
|
{
|
|
// Indicate pref settings here if you wish to allow user storage or URL settings
|
|
// to be able to override your default preferences (unless other config options
|
|
// have already explicitly prevented one or the other)
|
|
},
|
|
{allowInitialUserOverride: true}
|
|
);
|