UNPKG

svgedit

Version:

Powerful SVG-Editor for your browser

976 lines (927 loc) 67.4 kB
# SVG-Edit CHANGES ## 7.3.8 - Update svgcanvas to 7.2.7 ## 7.3.7 - Fixed issue where foreignObject styles were removed during object moves (#1053) - Fixed svgToString converting HTML elements to uppercase (#1051) - Updated README to correct config() and init() order (#1049) for proper initialization sequence. - Fixed rendering issue with SVG filters (#1042) - Added custom SVG cursors (commit) - update dependencies ## 7.3.6 - #1040: Fixed bug in Editor.loadFromURL where the promise was not resolving - #1038: Fixed bug in ext-opensave.js when dropping text - #1035: Consider pathedit mode when zooming - #1033: Fix gradient - update dependencies ## 7.3.5 - update dependencies - minor fixes ## 7.3.4 - update dependencies - package @rollup/rollup-linux-x64-gnu was added for a bug in the CI ## 7.3.3 - npm packages ugrade - fix export and xy panel ## 7.3.2 - npm packages ugrade - refactor, fix and and put back the connector extension ## 7.3.1 - npm packages ugrade - refresh Arabic language ## 7.3.0 - bug fixes - add Ukrainien and Swedish languages ## 7.2.0 - introduce the notion of workspace - separate svgcanvas into a package **Warning: This version will break applications using svgcanvas directly. You need to change your import to "@svgedit/svgcanvas"** ## 7.1.4 - Implement horizontal or vertical distribution alignment (mulder3062) - fix several bugs and update to latest dependencies - new tr translation (zktosu) ## 7.1.3 - fix issue #736. could not move layers ## 7.1.2 - add the current document title in the toolbar - allow user extensions to define optional parameters - more events for renamedElement, beforeClear, afterClear, sourceChanged - remove "message" event used for iframe integration not used anymore. can be readded through a new extension if necessary - default precision down to 2 digits (and applied in rotation) ## 7.1.1 - Fix an issue when moving a text with an existing transformation (issue #689) ## 7.1.0 - Large refactoring of svgcanvas (a lot of remaining work with the goal to separate in its own package).This explains the move to a minor version - move to a new linter (standard). - Several issues fixed ## 7.0.2 - create an IIFE build. ## 7.0.1 - remove ext-overview in default extensions for performance reasons ## 7.0.0 - New UI - Rearchitecture the code (more modular) - Simplify and refresh the build process - Introduce Web Component to replace jQuery UI - Update dependencies ## 6.0.0 (unreleased) - Project: Add `FUNDING.yml` to accept contributions - License: Reflect actual license of library in `package.json` based not only on licenses of repository as a whole (i.e., "MIT") but individual component files; see `filesByLicense` in `licenseInfo.json` for a map of license to these files within the repo with their own licenses. See the new license badges on the README for a summary of the licenses including either bundled devDependencies or all `devDependencies` (we have no direct npm `dependencies` currently). - License: Add note about unclear provenance of some images - License: Relicense ext-mathjax from Apache-2.0 to MIT per <https://github.com/josegaert/ext-mathjax/issues/6> - License: Clarify in `@license` that `ext-server_moinsave.js` is "(MIT OR GPL-2.0-or-later)" per subsequent text - License: Reorder license listing in `jquery.contextMenu.js` so that more permissive is noticeable first - License: Replace CC-BY-SA-2.0 polygon image (thanks, @mowijo !) - BREAKING CHANGE: Remove `$.pref` in favor of new `svgEditor.pref` (avoiding polluting jQuery). (Might be moved to own module in future.) - BREAKING CHANGE: `putLocale` (a function called automatically by `svg-editor.js`) no longer checks `pref`. Should not impact average consumers. - BREAKING CHANGE: Move clipboard from `localStorage` to `sessionStorage` (@NeilFraser) - Fix: main menu style and text #371 - Fix (Accessibility): Avoid duplicate IDs - Fix (openclipart browser): Redirect on lacking browser support - Fix: Misspelling for `dropXMLInternalSubset` method (also fixes use in imagelib when defaulting to image's title) - Fix: Redirect paths for imagelib redirect checks - Fix: Ensure `setupCurPrefs` is run (including when `source` or `url` is set within the URL) - Fix: Pressing 'Ctrl+A' causes js error when canvas is empty (@cuixiping) - Fix: Path element cannot be exported to PDF; export path with holes to PDF; export path element to PDF, support more path commands; #269 (@cuixiping) - Fix: remove "null" attributes in svg source #76 (@cuixiping) - Fix: A bug of `convertPath` function when converting H and V to relative (@cuixiping) - Fix: Layer `removeGroup` not returning element (@brettz9) - Fix: issue with undo because `this.elem` was overwritten with `node.remove()`; #359 (@jhenon) - Fix: Double click not working to edit text within a group. #407 (@jhenon) - Fix: Showing SVG content when the context is changed. #408 (@jhenon) - Optimization: Remove unused `jquery-ui-1.8.custom.min.js` file - Optimization: Remove old build/tools closure/yuicompressor code - Optimization: Remove unmaintained chrome-app, firefox-extension, opera-widget (an updated WebExtensions replacement (or such) would be welcome.) - Localization: Add 'SVG-Edit Home Page' to locale files - Docs: Remove outdated info on jsdoc linting (now just part of eslint config) - Docs: Add testing badge - Docs: Update coverage badge per latest coveradge - Docs: Add license badges and `licenseInfo.json` (has a `filesByLicense` map of files to licenses (not yet used programmatically) and `bundledRootPackages` which is used by `license-badger` to know which dev. packages are being bundled (added by `npm run copy`) for determining summary of all licenses including bundled). - Docs: Reprioritize `docs` in commit lists (prioritize user-facing) - Docs: Update Pavol's email address (@prusnak) - Docs: Update license badges to reflect lack of (known) CC-BY-SA-2.0 usage - Docs: Update Contributing, Testing (renamed to Development), Linting and ReleaseInstructions - Docs: Add feature and PR templates - Update: Cypress code coverage plugin - Refactoring: Switch from `$.param.querystring` to `URL` - Refactoring: Ensure file-global jsdoc tags are at beginning of file - Refactoring: Move `build-html` to `build` directory - Refactoring: Add favicon no-op to suppress favicon 404s until loaded dynamically (might make configurable in future) - Refactoring: create a src folder and subfolders for svgcanvas, editor, common and externals. - Linting (ESLint): Simplify regexes - Linting (ESLint): Replace `innerHTML` with `textContent` from old demo - Linting (ESLint): Update as per latest ash-nazg - Linting (ESLint): Add rules to check for file-level tags - Linting (ESLint): Check hidden rc files - Linting (ESLint): Add linting plugins (mocha, chai-expect, chai-friendly, cypress) - Linting (ESLint): Add `@fintechstudieos/eslint-plugin-chai-as-promised`, `eslint-plugin-chai-expect-keywords`, and `eslint-plugin-mocha-cleanup` plugins - Testing: Switch to Cypress with code coverage for UI testing; use ESM version for faster debugging - Testing: Add map file for underscore - Testing: Separate tests into unit/ui; split UI tests by specific domain; setup browser-bug folder and ui issues folder - Testing: Create test utilities for selecting English and visiting and approving storage - Testing: Produce mochawesome report - Testing: Cypress with multiple reporters in case we need - Build: Update underscore and core-js-bundle copies - Build: Use "json" extension for babelrc (easier out-of-the-box syntax recognition by IDEs, etc.) - npm: Add `underscore` to copy script - npm: Make `copy`, `compress-images`, `start-embedded`, `build-docs-remove` scripts cross-platform; add `start-allow-origin` script - npm: Rename open script to open-tests, and add `open` script for opening instance of svgedit - npm: Ensure starting server for open scripts - npm/Linting: Add `--cache` to speed up subsequent linting - npm: Fix scripts for Windows development (needed for building docs and instrumenting) - npm: Update scripts to reflect removal of `all_tests.html`; remove `browser-test` script - npm: Add `add-release` script - npm: Add reporting scripts (tests and coverage) - npm: Add `license-badges`, `build-docs`, and `copy` scripts to `prepublishOnly` script - npm: Rename `test-prep` to `prep` and other misc. script naming changes - npm: Update `package-lock.json` - npm: Update from deprecated `rollup-plugin-babel` to `@rollup/plugin-babel` (and make `babelHelpers` explicit) - npm: Update devDeps, peerDeps ## 5.1.0 - Deprecated: Should now use `avoidClientSideDownload` in place of `avoidClientSide` (config for `ext-server_opensave.js`). - Fix: IE 11 issue; fixes #363 - Fix: Avoid race condition in `jQuery.svgIcons.js` (evident when attempting to load from `file:` URL in Chrome) - Fix: Input width (@seahindeniz) - Fix: Use change event to be sure that file is loaded before the function (@Moliman) - Enhancement: Added `avoidClientSideOpen` config for `ext-server_opensave.js` - Optimization: Re-rerun image optimization per update - Linting (ESLint): Adjust per now applied rules - Linting (ESLint): Add HTML files to linting - Linting (ESLint): Avoid shadowing - Linting: Assorted changes; ensure license versions are valid semver - Refactoring: Use `static` keyword for classes - Refactoring: Prefer `for...of`, `event.key` (newly enforced linting) - Refactoring: Better var. names - Testing: Accessibility test API update - Docs: Clarify need for Node.js/npm being installed - Build: Remove `types-docs` script as being handled in ESLint - Maintenance: Add `.editorconfig` - npm: Add script to fix eslint errors - npm: Rename `build-config` to `build-by-config` - npm: Update devDeps (including switching from deprecated opn-cli package to open-cli); update core-js-bundle copy; add new axe testing peer dep. axe-core in devDeps ## 5.0.0 - Breaking change: Switch from deprecated `@babel/polyfill` to `core-js-bundle` and `regenerator-runtime` replacements - Build: Require Node 8.5 - Fix: Ensure PHP files are present in `dist/extensions` alongside JavaScript extension files using them - Fix: Bug in obtaining `extPath` in `ext-server_opensave.js` - Fix: Fully redirect extension entrances for lacking browser support - Enhancement: Add config `avoidClientSide` to avoid using client-side support by default (and always require server) - Enhancement: Return a Promise for Editor's `setCustomHandlers`, `loadFromString`, `loadFromDataURI` so known when ready and set - Refactoring: Destructuring, templates, label Unicode code point - Linting (JSDoc): Update per newly enforced `require-returns`; avoid Closure syntax; reenable `jsdoc/valid-jsdoc` as fixed; notes re: valid-jsdoc replacement; use same namepath - Linting: Update per ash-nazg/plugin-node update - Docs: Simplify comments in HTML files re: script purposes - Docs: Update release instructions - Docs (Refactoring): Formally specify `Promise` resolve type; add `typedef` for dialog result object; add an `ArbitraryCallbackResult` type; prefer `void` - npm: Rename (`build-doc` to `build-docs`, `types-doc` to `types-docs`); add `open-docs` script - npm: Update devDeps - npm: Remove unused devDeps; update insecure devDeps ## 4.3.0 - Fix: Droplets for gradient pickers can now be double-clicked in other browsers in addition to Firefox such as Chrome to allow change of color (fixes #181) (@ajinkyas); may be different between the browsers as a result of <https://github.com/w3c/uievents/issues/141> - Fix: Delay icon setting until locales available (fixes #323) - Fix: Extension with no `placement` to be added to end; for #326 (@sjernigan) - Fix: Error on dragging control point of arc; fixes #268 (@cuixiping) - Fix: With locales loading before extensions, ensure extensions' `langReady` runs properly; fixes #334 (@cuixiping) - Optimization fix: Properly run code conditionally on browser check; fixes #312 (@ianli-sc) - Enhancement: Add CAD Placemark extension (@NeiroNx) - Enhancement (svgIcons): Fix JSDoc param def; add `alt` options - Accessibility: Begin work, add aria-label to some buttons and form controls; add `role=main`; `<img alt>`; `<iframe title>` - i18n: Add `lang` attribute - Refactoring: lbs, simplify i18nized element retrieval call - Refactoring: Make dialog OK button retrievable locale-independently via a `data-ok` attribute (using for testing) - Linting (ESLint): Update polyfills to new compat rules of eslint-config-ash-nazg and adhere to new rules (prefer `for-of` (or array methods) to `for`, catch preferred `includes` to `indexOf`); avoid `no-zero-fractions` rule for now - Testing (UI Refactoring): Abstract out to helper file functions - Testing (UI Refactoring): Avoid testing being locale-dependent; approve storage (and set locale to English) before each test - Testing: Avoid reporting meta-viewport (have own zooming controls and difficult to fix) - Testing: Skip js errors in Testcafe; we're getting some uncaught error despite not replicating manually; should file a Testcafe issue - Docs: Some JSDoc descriptions, JSDoc spacing, fix svgIcons param def - Docs (Accessibility): Refer to known issues - npm: Update devDeps; update nested deps for security audit; remove one unneeded) ## 4.2.0 - Fix: Problem with retaining lines with grid mode (@NeiroNx) - l10n: Add Chinese (simplified) extension locales (@enlove) - l10n: Add Russian translation to some strings (@NeiroNx) - Refactoring: Avoid Firefox console errors with hidden iframe - npm: Update devDeps ## 4.1.0 - Fix: Avoid cross-frame unsafe `instanceof` - Enhancement: Add svgcanvas distributions - Demo: Rename import to match named dist export - Linting (ESLint): Prefer `addEventListener`, exponentiation operator, avoiding catastrophic regexes, prefer spread, prefer `startsWith`/`endsWith`, no fn ref in iterator - npm: Update devDeps ## 4.0.1 - Fix: Adjust side panel width checking based on device zoom (fixes #298) - Fix (regression): RGBColor ## 4.0.0 - Breaking change (storage preference cookies): Namespace the cookie as "svgeditstore" instead of just "store" - Breaking change: `loadSvgString` now returns a `Promise` rather than accepting a callback. - Breaking change: Treat callbacks to `editor.ready` as Promises, only resolving after all resolve. May require no changes unless for timing. - Breaking change: Make `editor.runCallbacks` return a `Promise` which resolves upon all callbacks resolving. - Breaking change: Require `npx` (used with `babel-node`) to allow Node files for HTML building and JSDoc type checking to be expressed as ESM. - Breaking change: `addExtension` now throws upon a repeated attempt to add an already-added extension - Breaking change (API): Remove `svgCanvas.rasterExport` fourth (callback) argument, collapsing fifth (options) to fourth - Breaking change (API): Remove `svgCanvas.exportPDF` third (callback) argument - Breaking change (API): `editor/contextmenu.js` `add` now throws instead of giving a console error only upon detecting a bad menuitem or preexisting context menu - Breaking change (API): Remove `svgCanvas.embedImage` second (callback) argument - Breaking change (API): Make `getHelpXML` a class instead of instance method of `RGBColor` - Breaking change (internal API): Refactor `dbox` (and `alert`/`confirm`/`process`/`prompt`/`select`) to avoid a callback argument in favor of returning a Promise - Breaking internal API change: `updateGripCursor` moved to be class method of Selector rather than instance method - Breaking internal API change: `subpathIsClosed` moved to be class method of `Path` rather than instance method - Fix: Avoid running in extension `langReady` multiple times or serially - Enhancement (API): Add `svgCanvas.runExtension` to run just one extension and add `nameFilter` callback to `runExtensions` - Enhancement (API): Supply `$` (our wrapped jQuery) to extensions so can use its plugins, e.g., dbox with its `alert` - Enhancement: Use alert dialog in place of `alert` in webappfind - Enhancement: `editor.ready` now returns a Promise resolving when all callbacks have resolved - Enhancement: Allow `noAlert` option as part of second argument to `loadSvgString` (and `loadFromURL` and `loadFromDataURI`) to avoid UI alert (and trigger promise rejection) - Enhancement: Make `dbox` as a separate module for alert, prompt, etc. dialogs - Optimization: Recompress images (imageoptim-cli updated) - Refactoring: Internal `PaintBox` as class; other misc. tweaks; no bitwise in canvg - Refactoring: Reuse utilities base64 encoder for SVG icons plugin - Linting (ESLint): Further linting changes (for editor); rename `.eslintrc` -> `.eslintrc.js` per recommendation and to more transparently allow comments; apply new strict `eslint-config-ash-nazg` rules. - Linting (ESLint): Stricter rules (or switch to warning) - Docs (JSDoc): Fix return of the `mouseUp` (can also be an object) and `mouseDown` (may also be a boolean) of `pathActions`; other JSDoc additions/improvements - npm: Update devDeps ## 3.2.0 - Refactoring: Avoid unnecessary `addEventListener` `false`; change internal jPicker function to class (used with `new`) - Linting (ESLint): Add `valid-jsdoc` rule and make fixes, but turn off for now due to <https://github.com/eslint/doctrine/issues/221> and <https://github.com/eslint/doctrine/issues/222> - Linting (ESLint compat): Add `eslint-plugin-compat` to get browser support warnings - Linting (ESLint Markdown JavaScript): Add `eslint-plugin-markdown` with slightly loosened config (`no-undef` and `padded-blocks` off and `no-unused-vars` as a warning) - Linting (ESLint JSDoc code comments): Add `eslint-plugin-jsdoc` and apply to JSDoc code comments though disable `jsdoc/valid-types` rule for now due to <https://github.com/Kuniwak/jsdoctypeparser/issues/47> and disable rule `jsdoc/require-param` due to <https://github.com/gajus/eslint-plugin-jsdoc/issues/100>; also of possible interest: <https://github.com/AtomLinter/linter-eslint/issues/1192>, <https://github.com/gajus/eslint-plugin-jsdoc/issues/103>, <https://github.com/eslint/eslint-plugin-markdown/issues/109>, <https://github.com/gajus/eslint-plugin-jsdoc/issues/101>, <https://github.com/gajus/eslint-plugin-jsdoc/issues/99>, <https://github.com/eslint/eslint/issues/11043>; NOTE: if we need to tap into Markdown within JSDoc, see <https://github.com/jsdoc3/jsdoc#b21427343c7294bbf1f14c718a390f3e955e37cb> for commit not present in npm. - Docs (README): Indicate minimal polyfills needed for older browsers (IE <= 11, IE Mobile, Opera Mini, Blackberry Browser <= 10, Android Browser 4.4.3-4.4.4) - Docs (JSDoc): Add some Markdown for variables, line breaks; tighten checks for overly generic types (though allow for `.Function` as in `jQuery.Function`) and avoid one previously missed instance - Docs (3.0.0): Clarify - Docs (ReleaseInstructions): Clarify need for npm permissions to publish - npm: Update devDeps (including some resolving security vulnerabilities) - npm: Do a fresh install of all packages and update `package-lock.json` accordingly; update qunit dist ## 3.1.1 - Fix: Save broken on Firefox (since FF version?) - Docs (ReleaseInstructions): Clarify build instructions for release - Docs (ReleaseInstructions): Update per new testing; update `grep-doc` -> `types-doc` and indicate current failing status; indicate when `build-doc` will be used; clarify `npm pack` - Docs: For clarity, rename `grep-jsdoc.js` to `jsdoc-check-overly-generic-types.js` - Docs: Move `GenericCallback` to `typedefs.js` for possible (if unlikely) reuse - Docs: Mention potentially more frequent release schedule - npm: Update "grep-doc" to "types-doc" for greater clarity - npm: Per convention, switch Node-based (headless browser) testing script to `npm test` and change the browser tests to "browser-test" ## 3.1.0 - Fix (Embedded editor): (Though cross-origin DOM access of iframes apparently doesn't work now in Chrome or Firefox (which we had been using to disable a button) nor does cross-origin storage access work in Chrome), PDF export has been fixed (we download the PDF to workaround data URI limitations in Chrome) and we avoid opening an extra tab in Chrome PNG export - Fix (Embedded editor): Avoid using same origin shortcut if there is no global available to use (e.g., if using the modular editor) - Fix (Embedded editor): Add events only after load is complete and svgCanvas is available; also log blocked error objects - Fix: Have export handler, if triggered, always open a window even if no window name was given (needed in Chrome to avoid opening an extra window) - Enhancement: For anyone visiting the ES6 modules entrance file without ESM support, redirect to non-modular version - Enhancement: For PDF export, switch Chrome by default to "save" `outputType` - Enhancement: Add `opts` object to `rasterExport` with `avoidEvent` property to avoid calling the `exported` event - Refactoring (canvg): Better type-checking on `canvasRGBA_` (but set correctly by default anyways) - Refactoring: Avoid redundant use of \*AttributeNS methods with `null` value; just use \*Attribute methods without namespace - Refactoring: Display inline styles within a template for readability (until we may refactor as class swapping) - Refactoring: Line breaks - Refactoring: Reorder path config to group (non-modular-dependent) image paths together (and correct code comment) - Docs (CHANGES): clarifications/fixes - Docs (README): Deemphasize unstable embedded editor fixes - Docs: Versions section (for migrating) - Docs: More info on `importLocale` for extensions - Docs: Add code comment re: use of `extIconsPath` in Mathjax - Docs (JSDoc): Denote optional arguments - Docs (JSDoc): Add @this to indicate `ExtensionInitResponse#callback` - Build: Add comment not to edit xdomain editor directly - Build: Remove unused `Makefile` ## 3.0.1 - Fix: Revert fix to have extension `mouseup` events run on "zoom" and "select" modes (#159); breaks polygon selection - Fix (jgraduate->jpicker): Actually fix issue with color val check when no other proper results (equal to "all"); prior fix had not covered original intention ## 3.0.0 - See pre-release version notes below for other changes that are a part of 3.0.0 - Breaking change: For checkbox for persisting choice of initial use storage approval in storage extension dialog, turn on by default for convenience of most users (must still hit "ok" and users can still turn off the checkbox) - Breaking change: Remove `storagePromptClosed` state boolean in favor of `storagePromptState`; used by `ext-storage.js` - Fix: Map extension click events to "mousedown" so they can be received on touch devices (since `touch.js` changes `touchstart` to `mousedown`) (@ClemArt); closes #168 - Fix: Ensure extension `mouseup` events run on "zoom" and "select" modes (@iuyiuy); closes #159 - Fix: Allow language to be properly set back to a different locale and retaining preference (and ensure language changes are available before dialog closed) - Fix: Centering of canvas wasn't being set at proper time; fixes #272 - Fix (extensions): Ensure `langReady` changes are available by time prefs dialog is closed and that its changes have occurred by time extensions have first loaded (`setLang` now returns a Promise rather than `undefined` as it waits for extension's `langReady` to resolve); this is also useful with `ext-storage.js` so we know that `extensions_loaded` (which conditionally updates the canvas based on `storagePromptState`) has seen `langReady` and the storage extension hasn't set a `storagePromptState` of "waiting" - Fix (regression): Extension locale loading for non-English locales - Enhancement: Allow "Escape" to work with hotkeys within text boxes; allows escaping out of source textarea (part of #291) - Enhancement: Allow 'a' also with meta key (command in Mac, ctrl otherwise) to select all (part of #291) - Enhancement: Add a global escape key listener to clear the selection - Refactoring: Change 'a' to lower case in key command to avoid impression that shift is needed - Refactoring: Avoid unneeded internal IIFEs; simplify w/h formula - Refactoring: array extra/spread operator - npm: Update devDeps ## 3.0.0-rc.3 - Security fix: Ensure all apostrophes are escaped for `toXml` utility - Security fix/Breaking change (Imagelib): Only allow origins within `imgLibs` to be accepted for `message` listener - Security fix/Breaking change (xdomain): Namespace xdomain file to avoid it being used to modify non-xdomain storage - Security fix (Imagelib): Avoid XSS - Security fix (Imagelib): Expose `dropXMLInternalSubset` to extensions for preventing billion laughs attack (and use in Imagelib) - Security fix (minor): For embedded API, avoid chance for arbitrary property setting (though this was only for trusted origins anyways) - Security fix (minor): For embedded API example, copy params to iframe source without XSS risk (though params should already be XML-safe given `encodeURIComponent` and lack of a single quote attribute context) - Situational regression: Remove Openclipart as its site's now setting of `X-Frame-Options` to `"sameorigin"` makes it unusable on our end for our cross-origin uses (even with an attempt to use their API) - Breaking change (minor): Change export to check `exportWindowName` for filename and change default from `download` to `svg.pdf` to distinguish from other downloads - Fix: Given lack of support now for dataURI export in Chrome, provide PDF download as export (#273 @cuixiping); fixes #124 and #254 - Fix: Polygon/polyline in PDF export (#287 @cuixiping); fixes #280 - Fix: Avoid error if `URL` is not defined (export) - Fix: Ensure repeated selection of same file overwrites with that file's contents (fix #289) - Fix: Avoid errors occurring in Chrome now for `supportsGoodTextCharPos` - Fix (jPicker): Avoid setting `Math.precision` pseudo-global - Fix (jPicker): Precision argument had not been passed in previously - Fix (image import): Put src after onload to avoid missing event; check other width/height properties in case offset is 0; fixes #278 - Fix (image export): Export in Chrome; fixes #282 - Fix (Context menus regression): Avoid showing double shortcuts (#285); add some missing ones - Fix (Star extension): Minor: Avoid erring if `inradius` is `NaN` - Forward compatibility enhancement: Once IE9 support may be dropped, we may post messages as objects, so don't break if objects received (embedded API, xdomain, Imagelib) - Forward compatibility enhancement: For IAN image library, add `svgedit=3` param to URL so that it can keep using old API for SVG-Edit versions before 3, while conditionally using new object-based API now (and if we switch exclusively to the object-based API in the future, this site will continue to work) - Imagelib backward compatibility regression fix: Allow string based API again so as not to break old SVG-Edit which fail at *presence* of `namespace` (fixes #274) - Refactoring: Avoid passing unused arguments, setting unused variables, and making unnecessary checks; avoid useless call to `createSVGMatrix` - Refactoring: Avoid useless assignment (courtesty lgtm) - Refactoring: Destructuring, spread - Refactoring (jPicker): Use ES6 templates; avoid unnecessary check - Linting (LGTM): Add `lgtm.yml` file (still some remaining items flagged but hoping for in-code flagging) - Linting (LGTM): Flag origin-checked item as safe - Linting (ESLint): Consistent spacing; new "standard" - Testing: Add testcafe (ESLint plugin/rules, accessibility test (failing), ui test beginnings (passing)) - Docs: Contributing file - Docs (JSDoc): Missing return value - Update (Imagelib): Remove extra (and more outdated) jQuery copy - Build (prerelease change): Switch to `terser` plugin with `uglify` plugin not supporting ES6+-capable minifier - npm: Update devDeps - npm: Point to official sinon-test package now that ES6 Modules support landed ## 3.0.0-rc.2 - Fix: Avoid extension `includeWith` button conflicts/redundancies; Incorporates #147 - Fix: Ensure shift-key cycling through flyouts works with extension-added `includeWith` as well as toolbarbuttons - Fix: Apply flyout arrows after extensions loaded (avoid race condition) - Fix: Ensure SVG icon of flyout right-arrow is cloned so can be applied to more than one extension - Fix: Ensure line tool shows as selected when "L" key command is used - Fix: Add images (and references) for fallback (#135) - Fix (svgIcons plugin regression): Race condition - Fix (canvg): Regression for `text` and `tspan` elements as far as `captureTextNodes` with canvg (inheriting class had set `captureTextNodes` too late) - Fix (canvg): Regression on blur - Fix (canvg): Avoid errors for `tspan` passed to `getGradient` - Fix (regression): Reapply locale strings - i18n: picking stroke/fill paint and opacity - i18n: Remove eyedropper and imagelib references from main locale (in extension locale now) - i18n: Add placeholders for `pick_stroke_paint_opacity`, `pick_fill_paint_opacity`, `popupWindowBlocked` - i18n: Update `saveFromBrowser` - Enhancement: Create xdomain file build which works without ES6 Modules - Enhancement: Build xdomain files dynamically - Optimize: Further image optimizing - Optimize: Avoid rewriting `points` attribute for free-hand path; incorporates #176 (fixes #175) - Refactoring: Avoid passing on `undefined` var. (#147) - Refactoring: lbs; avoid indent in connector, destructuring, use map over push - Docs: Clarify nature of fixes - Docs: JSDoc for `setupFlyouts`, `Actions`, `toggleSidePanel`; missing for ToolbarButton ## 3.0.0-rc.1 - Security fix: 'extPath', 'imgPath', 'extIconsPath', 'canvgPath', 'langPath', 'jGraduatePath', and 'jspdfPath' were not being prevented from URL setting - Breaking change: Rename "svgutils.js" to "utilities.js" (make in conformity with JSDoc module naming convention) - Breaking change: Rename "svgedit.js" to "namespaces.js" (to make clear purpose and avoid confusing with editor) - Breaking change: Rename "jquery-svg.js" to "jQuery.attr.js" - Breaking change: Rename "jquery.contextMenu.js" to "jQuery.contextMenu.js" - Breaking change: Rename "jquery.jpicker.js" to "jQuery.jPicker.js" - Breaking change: Rename "JQuerySpinBtn.css" to "jQuery.SpinButton.css" - Breaking change: Rename "JQuerySpinBtn.js" to "jQuery.SpinButton.js" (to have file name more closely reflect name) - Breaking change: Rename "jquery.svgicons.js" to "jQuery.svgIcons.js" - Breaking change: Rename "jquery.jgraduate.js" to "jQuery.jGraduate.js" - Breaking change: Rename "pathseg.js" to "svgpathseg.js" (as it is a poyfill of SVGPathSeg) - Breaking change: Rename `addSvgElementFromJson()` to `addSVGElementFromJson` for consistency - Breaking change: Rename `changeSvgContent()` to `changeSVGContent()` for consistency - Breaking change: Rename `extensions/mathjax/MathJax.js` to `extensions/mathjax/MathJax.min.js` - Breaking change: Change name of `ext-arrows.js` from `Arrows` to `arrows` for sake of file path (not localized anyways). - Breaking change: In interests of modularity/removing globals, remove `window.svgCanvas` and `svgCanvas.ready` as used by older extensions; use `svgEditor.canvas` and `svgEditor.ready` instead - Breaking change: Extension now formatted as export (and `this` is set to editor, including for `callback`) - Breaking change: Locale now formatted as export - Breaking change: `RGBColor` must accept `new` - Breaking change: Avoid passing `canvg`/`buildCanvgCallback` to extensions (have them import) - Breaking change: Have `readLang` now return a value (lang and data) (as well as `putLocale` which returns a call to it) but do not call `setLang` - Breaking change: Avoid adding `assignAttributes`, `addSVGElementFromJson`, `call`, `copyElem`, `findDefs`, `getElem`, `getId`, `getIntersectionList`, `getMouseTarget`, `getNextId`, `getUrlFromAttr`, `hasMatrixTransform`, `matrixMultiply`, `recalculateAllSelectedDimensions`, `recalculateDimensions`, `remapElement`, `removeUnusedDefElems`, `round`, `runExtensions`, `sanitizeSvg`, `setGradient` `transformListToTransform` (and mistaken `toString` export) to `getPrivateMethods` (passed to extensions) as available as public ones (on canvas or editor that is available to extensions) - Breaking change (prerelease): Avoid recent addition of locale-side function in ext-imagelib for l10n - Breaking change (prerelease): Avoid recent change to have editor ready callbacks return Promises (we're not using and advantageous to keep sequential) - Breaking change (prerelease): Have `exportPDF` resolve with `output` and `outputType` rather than `dataurlstring` (as type may vary) - Breaking change (prerelease): Change `addlangData` extension event to `addLangData` for consistency with method name - Breaking change (prerelease): Moved out remaining modular i18n (imagelib) to own folder - Breaking change (prerelease): Drop `executeAfterLoads` (and getJSPDF/getCanvg) - Breaking change (prerelease): canvg - `stackBlurCanvasRGBA` must be set now by function (`setStackBlurCanvasRGBA`) rather than global (though it imports default now); `canvg` now a named export - npm: Add `prepublishOnly` script to ensure building/testing before publish - npm: Update devDeps including Rollup, Sinon - Fix: Remove redundant (and incorrect) length set in `removeFromSelection`. (#256; fixes #255) - Fix: Detection of whether to keep ellipse (rx and ry when just created are now returning 0 instead of null); also with rectangle/square; fixes #262 - Fix: Avoid erring during resize on encountering MathML (which have no `style`) - Fix: Have general locales load first so extensions may use - Fix: Provide `importLocale` to extensions `init` so it may delay adding of the extension until locale data loaded - Fix: i18nize imaglib more deeply - Fix: Positioning of Document Properties dialog (Fixes #246) - Fix (regression): PDF Export (Fixes #249) - Fix (regression): Add polyfill for `ChildNode`/`ParentNode` (and use further) - Fix (regression): Apply Babel universally to dependencies - Fix (regression): Ordering of `uaPrefix` function in `svgEditor.js` - Fix (regression): Embedded API - Fix (embedded editor): Fix backspace key in Firefox so it doesn't navigate out of frame - Fix: Alert if no `exportWindow` for PDF (e.g., if blocked) - Fix: Ensure call to `rasterExport` without `imgType` properly sets MIME type to PNG - Fix (extension): Wrong name for moinsave - Fix (extension): ForeignObject editor - Fix (Embedded API): Avoid treating as cross-origin if even access to `origin` on `contentDocument` is restricted - Fix (Embedded API): Avoid adding URL to iframe src if there are no arguments - Fix (Embedded API): Handle origin issues (fixes #173) - Fix (Cross-origin usage): Recover from exceptions with `localStorage` - Fix regression (Imagelib): Fix path for non-module version - Update: Update WebAppFind per new API changes - Enhancement: Link to rawgit/raw.githack for live master demos (fixes #43) - Enhancement: Make `setStrings` public on editor for late setting (used by `ext-shapes.js`) - Enhancement: Add `extensions_added` event - Enhancement: Add `message` event (Relay messages including those which have been been received prior to extension load) - Enhancement: Sort SVG attributes alphabetically (#252 @Neil Fraser) - Enhancement: Allow callback argument and return promise for canvas methods: `rasterExport` and `exportPDF` - Enhancement: Add `pointsAdded` canvas event (Fixes #141) - Enhancement: Allow SVGEdit to work out of the box--avoid need for copying sample config file. Should also help with Github-based file servers - Enhancement: Allow avoiding "name" in extension export (just extract out of file name) - Enhancement: Add stack blur to canvg by default (and refactoring it) - Enhancement: Return `Promise` for `embedImage` (as with some other loading methods) - Enhancement: Supply `importLocale` to `langReady` to facilitate extension locale loading - Enhancement: Recover if an extension fails to load (just log and otherwise ignore) - Enhancement: More i18n of extensions - Enhancement: Allowing importing of locales within `addLangData` - i18n: Clarify locale messages (where still available as English) to reflect fact that Chrome only has "Save as" via context menu/right-click, not via file menu (toward #192) - Refactoring: Sort Embedded functions alphabetically and add lbs for better visibility in code - Refactoring: Simplify `isValidUnit` - Refactoring( RGBColor) `RGBColor` as class, without rebuilding constants, optimize string replacement, move methods to prototype, use templates and object literals, use `Object.keys` - Refactoring (canvg) Use classes more internally, use shorthand objects; array extras, return to lazy-loading - Refactoring: Use Promises in place of `$.getScript`; always return Promises in case deciding to await resolving - Refactoring: Avoid importing `RGBColor` into `svgutils.js` (jsPDF imports it itself) - Refactoring: Arrow functions, destructuring, shorter property references - Refactoring: Fix `lang` and `dir` for locales (though not in use currently anyways) - Refactoring: Provide path config for canvg, jspdf - Refactoring: Drop code for `callback` as init function (still may be present on *return* from the extension `init` method, however). - Refactoring: Object destructuring, `Object.entries`, Object shorthand, array extras, more camelCase variable names - Refactoring: Add a `Command` base class - Refactoring: Simplify svgicons `callback` ready detection - Refactoring: Put `let` or `const` closer to scope - Refactoring: Remove unneeded `delimiter` from regex escaping utility - Refactoring: Clearer variable names - Refactoring: Use (non-deprecated) Event constructors - Refactoring (minor): variadic args through spread operator - Refactoring (minor): `getIssues` to return codes and strings, lbs - Refactoring (minor): Use single quotes in PHP - Docs (Code comments): Coding standards within - Docs: Transfer some changes from ExtensionDocs on wiki (need to fully reconcile) - Docs: Reference JSDocs in README - Docs (ReleaseInstructions): Update - Docs: Migrate copies of all old wiki pages to docs/from-old-wiki folder; intended for a possible move to Markdown, so raw HTML (with formatting) was not preserved, though named links were carried over with absolute URLs - Docs: Begin deleting `SvgCanvas.md` as ensuring jsdoc has replacements - Docs: Add Editor doc file for help to general users - Docs: Clarify/simplify install instructions - Docs: Generally update/improve docs (fixes #92) - Docs: Update links to `latest` path (Avoid needing to update such references upon each release) - Docs: 80 chars max - npm/Docs (JSDoc): Add script to check for overly generic types - Docs (JSDoc): Move jsdoc output to public directory so may be visible on releases (while still having in a `.gitignore`) - Docs (JSDoc): Exclusions - Docs (JSDoc): Add items; fix table layout - Docs (JSDoc): For config/prefs and extension creating, link to tutorials (moved tutorials to own directory to avoid recursion problems by jsdoc) - Docs (JSDoc): Add modules (upper case for usual main entrance files or regular names) - Docs (JSDoc): Fill out missing areas; indicate return of `undefined`; consistency with `@returns` - Docs (JSDoc): Use Markdown plugin over HTML - Docs (JSDoc): Add our own layout template to support overflow - Docs (JSDoc): Use cleverLinks and disallow unknown tags - Docs (JSDoc): Insist on "pedantic" flag; put output directory in config - Docs (JSDoc): Use more precise Integer/Float over number, the specific type of array/function/object - Docs (JSDoc): Use `@throws`, `@enum`, `@event`/`@fires`/`@listens` - Linting (ESLint): Avoid linting jsdoc folder - Testing: Use new Sinon ## 3.0.0-alpha.4 - Docs: Convert more docs to JSDoc and add JSDoc script (thanks, tetedacier!) - Fix `main` on `package.json` to reference UMD distribution and `module` to point to ES6 Module dist - Fix (regression): Bad name on function passed to `path.js` - Fix (regression): Star tool (radialshift) - Fix (regression): Favicon setting ## 3.0.0-alpha.3 - Change: Default to stylesheet above `editor` directory - Docs: Installation steps - Fix regression (Connector extension): Get config object when available - Fix regression (Extensions): Use `extIconsPath` for now given that `extPath` will not work relative to `dist` - Fix regression: Enforce stylesheet ordering sequence - Fix regression: Ensure SVG-edit hidden until stylesheets loaded - Fix regression: Avoid abandoning stylesheet loading if one load fails - Fix (ext-connector): Handle case of 2 connecting elements with same y-coordinate (fixes #210 ; thanks, @iuyiuy!) - Enhancement: Delete the image upon cancel if it is a new image (fixes #177) - Enhancement: Allow `addSvgElementFromJson` to accept non-SVG namespaces with explicit `namespace` property as well as the default SVG namespace (fixes #155); document - Optimization: For `setSvgString`, if element content is not SVG, return `false` earlier (Fixes #152); thanks iuyiuy! - Demos: Add svgcanvas demo (Neil Fraser) - npm: Update devDeps ## 3.0.0-alpha.2 - Licensing: Indicate MIT is license type of rgbcolor and rename file to reflect it; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); contains license information (of type MIT) for Raphael icons - Breaking change: Rename config file to `svgedit-config-iife.js` (or for the module version, `svgedit-config-es.js`); 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) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: `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) - Breaking change: Avoid zoom with scroll unless shift key pressed - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Fix: Zoom centered on cursor when scrolled; incorporates #169 (@AndrolGenhald), adapting for conventions - Fix: Update Atom feed reference in HTML - Fix: Broken "lv" locale (and inconsistent tabs/spaces pt-PR) - Fix: Inadvertent global assignments (uncovered by ESLint): * `addBezierCurve` in `canvg.js` had undeclared `i` * Fix: Undeclared variable in opera widget * jgraduate->jpicker: Fix missing `var` for some `i` loops * Fix: Globals (`x`, `y`) in `mouseMove` * Fix: Global (`element`, `d_attr` (now renamed to `dAttr`)) in `mouseDown` * Testing (math_test): Fix undeclared variables * Screencast `showNotes` - Fix: Bad scope closure references * An apparent bug in `jquery.svgicons.js` whereby a variable `holder` was declared in too nested of a scope * Fix: Avoid `drawnPath` not defined error (currently adds as a global, but should be switching to modules anyways) - Fix (jquery.jgraduate.js): Ensure `numstops` is present before check - Fix (history.js) Relocation of rotational transform had undeclared variable (`elem`) - Fix (Editor): Restore save alert - Fix (Firefox svgutils.js): tspan (and textPath apparently) have no `getBBox` in Firefox, so recover (fixes FF issue with recalculate test 3: "recalculateDimensions() on text w/tspan with simple translate") - Fix (Chrome recalculate.js): Chrome has a [bug](https://bugs.chromium.org/p/chromium/issues/detail?id=843901) in not performing `removeAttribute` after `removeItem`; deal with it (though only if there is a single identity matrix) (fixes Chrome issue with recalculate test 1: "recalculateDimensions() on rect with identity matrix") - Fix (HTML): Update assorted links, including using `https://` - Enhancement: ES6 modules (including jQuery plugins, extensions, locales, tests), along with Babel; make Node build routine for converting modular HTML source to non-modular - Enhancement: use `loadStylesheets` for modular stylesheet 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). - Enhancement (Project size): Remove now unused Python l10n scripts (#238) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Enhancement (Editor): Use `https` (instead of `http`) for link placeholder - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for `tool_scale` - 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` - npm: Add ESLint, uglify, start scripts - npm: Update devDeps - npm: Add html modules and config build to test script - Docs: Remove "dependencies" comments in code except where summarizing role of jQuery or a non-obvious dependency - Linting: 2 spaces, remove BOM, remove carriage returns, bad characters in Persian locale file - Linting (ESLint): Numerous changes - Refactoring: Throw Error objects instead of strings (including in jgraduate->jpicker) - Refactoring: Switch to ESLint in source - Refactoring: Move scripts to own files - 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) - Refactoring/Linting: Enforce `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 - 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: Make jpicker variable declaration indent bearable - 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 (imagelib): Add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring (MathJax): Add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Docs: Further JSDoc (incomplete) - Bu