- Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally)
- Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order
to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called)
- Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals`
- Breaking change (ext-imagelib): Change to object-based encoding for namespacing of
messages (though keep stringifying/parsing ourselves until we remove IE9 support)
- Breaking change: Rename `jquery.js` to `jquery.min.js`
- Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and
obsolete; also move to head (after other stylesheets)
- Enhancement: Make SpinButton plugin independent of SVGEdit via
generic state object for tool_scale
- Enhancement: Remove now unused Python l10n scripts (#238)
- Enhancement: ES6 Modules (including jQuery plugins but not jQuery)
- Enhancement: Further JSDoc (incomplete)
- Enhancement (Optimization): Compress images using imageoptim (and add
npm script) (per #215)
- Fix: i18nize path.js strings and canvas notifications
- Fix: Attempt i18n for ext-markers
- Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this)
- Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had
been using from server)
- Refactoring: For MathJax, add local copy (using old 2.3 as had been using from
server); server had not been working
- Refactoring: Remove `use strict` (implicit in modules)
- Refactoring: Remove trailing whitespace, fix some code within comments
- Refactoring: Expect `jQuery` global rather than `$` for better modularity
(also to adapt line later once available via `import`)
- Refactoring: Prefer `const` (and then `let`)
- Refactoring: Add block scope keywords closer to first block in which they appear
- Refactoring: Use ES6 `class`
- Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods
with simple VanillaJS replacements
- Refactoring: Use abbreviated object property syntax
- Refactoring: Object destructuring
- Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale)
- Refactoring: Add favicon to embedded API file
- Refactoring: Use arrow functions for brief functions (incomplete)
- Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`;
`String.prototype.startsWith`, `String.prototype.trim`
- Refactoring: Remove now unnecessary svgutils do/while resetting of variables
- Refactoring: Use shorthand methods for object literals (avoid ": function")
- Refactoring: Avoid quoting object property keys where unnecessary
- Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0
- Refactoring (Testing): Avoid jQuery usage within most test files (defer script,
also in preparation for future switch to ES6 modules for tests)
- Refactoring: Make jpicker variable declaration indent bearable
- Refactoring (Linting): Finish svgcanvas.js
- Docs: Mention in comment no longer an entry file as before
- Docs: Migrate old config, extensions, and FAQ docs
- Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for
jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it
contains license information (of type MIT) for Raphael icons
146 lines
5.1 KiB
JavaScript
146 lines
5.1 KiB
JavaScript
// DO NOT EDIT THIS FILE!
|
|
// THIS FILE IS JUST A SAMPLE; TO APPLY, YOU MUST
|
|
// CREATE A NEW FILE config.js AND ADD CONTENTS
|
|
// SUCH AS SHOWN BELOW INTO THAT FILE.
|
|
|
|
/*
|
|
The config.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).
|
|
*/
|
|
|
|
// 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 './svg-editor.js';
|
|
|
|
// 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 config.js or in the URL
|
|
});
|
|
|
|
// 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}
|
|
);
|