Commit Graph

1097 Commits (2fa2bfac1e2e37f65e49731777a3164aa5c8128f)

Author SHA1 Message Date
Brett Zamir b7f8a63158 - Build: Update
- npm: Update devDeps.
2020-02-05 23:42:38 +08:00
cuixiping 2235f81ee7 Fix: remove "null" attributes in svg source #76 2020-01-17 15:34:00 +08:00
cuixiping b30036a424 Fix: Pressing 'Ctrl+A' causes js error when canvas is empty 2020-01-14 10:57:24 +08:00
cuixiping 6988dc4d7b Fix: let the checkerboard background style has pointer-events:none 2020-01-07 17:52:42 +08:00
cuixiping 4a5a24f374 Feature: checkerboard background 2020-01-07 17:20:29 +08:00
cuixiping 471035c0da Fix: Reset control points before freehand draw 2020-01-07 16:37:59 +08:00
Brett Zamir 0029a932b2 - Fix: Misspelling for `dropXMLInternalSubset` method (also fixes
use in imagelib when defaulting to image's title)
- Fix: Redirect paths for imagelib redirect checks
2020-01-04 17:32:19 +08:00
Brett Zamir d9d4d94976 - Linting (ESLint): Apply per latest ash-nazg (jsdoc: complete sentence descriptions)
- npm: Update devDeps
2019-12-31 15:27:16 +08:00
Brett Zamir 477d5fdb6c - Linting (ESLint): Update as per latest ash-nazg (bad jsdoc)
- npm: Update devDeps
2019-12-31 13:14:33 +08:00
Brett Zamir 31a98c1408 - Linting (ESLint): Apply latest ash-nazg (with latest unicorn)
- npm: Update devDeps
2019-12-23 09:16:16 +08:00
Brett Zamir a59170fbe1 - Linting (ESLint): Simplify regexes
- npm: Update scripts to reflect removal of `all_tests.html`;
  remove `browser-test` script
- npm: Update devDeps
2019-11-30 11:41:01 +08:00
Brett Zamir 19f7962c4a - Revert `prefer-named-capture-group` due to apparently problematic Babel plugin 2019-11-16 10:08:38 +08:00
Brett Zamir 404911827e - Linting (ESLint): Apply new rules ("fixme"->"todo"; prefer regex literals; defaults at end)
- Optimization: Image size
- npm: Bump devDeps (Babel/eslint/rollup-related; imageoptim, testcafe)
2019-09-20 12:40:31 +08:00
Brett Zamir e4231aeb10 - Linting (ESLint): Lint per latest ash-nazg (e.g., named capture)
- Linting (ESLint): Add HTML files to linting and add devDeps for new ash-nazg
- npm: Update devDeps
2019-07-03 17:50:46 +08:00
Brett Zamir 7f2c5f5359 - Linting (ESLint): Avoid disabling rule with jsdoc linter fix
- npm: Update devDep (linting jsdoc)
2019-06-27 14:27:20 +08:00
Brett Zamir b07d0861b4 - Linting (ESLint): Fix per stricter eslint-plugin-jsdoc context checking
- npm: Update devDep (jsdoc linting plugin)
2019-06-27 13:54:40 +08:00
Brett Zamir efcde397ac - Optimization: Re-rerun image optimization per update
- Linting (ESLint): Adjust per now applied rules
- Testing: Accessibility test API update
- Docs: Clarify need for Node.js/npm being installed
- npm: Update devDeps and core-js-bundle copy; add new axe testing peer dep. axe-core
2019-06-27 12:24:37 +08:00
Brett Zamir 4177146acd - Linting (ESLint): Remove now unneeded config and add per new update
- Refactoring: Prefer for-of, event.key (newly enforced linting)
- Refactoring: Better var. names
- npm: Update devDeps and update local copies
2019-06-11 16:40:28 +08:00
Brett Zamir 1d56d75837 - Linting (JSDoc): Reenable jsdoc/valid-jsdoc as fixed; notes re: `valid-jsdoc` replacement; use same namepath
- npm: Update devDep
2019-04-17 19:12:55 +08:00
Brett Zamir d84f39cb3f - Docs (JSDoc): Further on preferring `void` 2019-04-16 08:59:53 +08:00
Brett Zamir 894fed3e80 - Linting (JSDoc): Update per newly enforced `require-returns`; avoid Closure syntax
- Docs (JSDoc): Prefer `void`
- npm: Update devDeps
2019-04-16 08:58:40 +08:00
Brett Zamir 91c0dc549b - Enhancement: Return a Promise for Editor's `setCustomHandlers`,
`loadFromString`, `loadFromDataURI` so known when ready and set
- Docs (Refactoring): Formally specify `Promise` resolve type;
    add `typedef` for dialog result object; add an
    `ArbitraryCallbackResult` type
2019-04-05 22:59:41 +08:00
Brett Zamir 1ae6e91bb0 - 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
- npm: Update devDeps (removing one unneeded)
2019-03-31 17:39:19 +08:00
Brett Zamir d01abf19d2 - npm: Update devDeps
- Linting (ESLint): New ash-nazg rules
2019-02-21 19:41:09 +08:00
Brett Zamir db06248b7e - Optimization fix: Properly run code conditionally on browser check;
fixes #312 (@ianli-sc)
2018-12-27 09:51:26 +08:00
Brett Zamir 845dbbd7d7 - Linting (ESLint): Prefer `addEventListener`, exponentiation operator, avoiding catastrophic regexes, prefer spread, prefer startsWith/endsWith, no fn ref in iterator
- npm: Update devDeps (rollup and eslint-config-ash-nazg)
2018-11-21 21:03:14 +08:00
Brett Zamir c42791b2b2 - Fix (regression): Arg names not being passed on properly for `addExtension` 2018-11-16 13:02:14 +08:00
Brett Zamir 2e5c7557a9 - 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
- 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 (storage preference cookies): Namespace the cookie as "svgeditstore" instead of just "store"
- 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 return a Promise
- 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
- Refactoring: Internal `PaintBox` as class; other misc. tweaks; no bitwise in canvg
- Linting (ESLint): Further linting changes (for editor); rename `.eslintrc` -> `.eslintrc.json` per recommendation
- Optimization: Recompress images (imageoptim-cli updated)
- npm: Update devDeps
- npm: Bump to 4.0.0
2018-11-16 12:48:23 +08:00
Brett Zamir 7c470e9909 - Linting (ESLint): Stricter rules (or switch to warning)
- 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
- Refactoring: Reuse utilities base64 encoder for SVG icons plugin
- 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
2018-11-08 14:42:48 +08:00
Brett Zamir 901c9547fe TODO: Besides splitting this out from previous commit, should really avoid markdown field in favor of modifying jsdoc to report wherever it lays out "prettyprint"; still probably missing some one-liners; see https://github.com/google/code-prettify; update builds to confirm new stackblur is working; add below to CHANGES; add back for eslint-plugin-jsdoc once merged (though need new version `^3.9.1`); move any linting changes to other linting branch
- Refactoring (minor): Add favicon to canvas demo
- 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
- Linting (ESLint): Completely avoid unescaped tabs in files
- Docs (Linting): Add linting info file
- npm: Rename `copy-deps` script to `copy`
- Refactoring: Add stackblur-canvas as a dependency and copy it in (until such time as we can do so for canvg)
2018-11-07 14:51:09 +08:00
Brett Zamir aef7b095ef - 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/eslint/issues/11036> and
  <https://github.com/eslint/eslint/issues/11037>
- 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
2018-10-31 00:31:12 +08:00
Brett Zamir 283ef0b521 - 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)
- Fix (Embedded editor regression): Ensure event handlers are added even if
    document cannot be directly modified
- Enhancement: Add `opts` object to `rasterExport` with `avoidEvent` property
  to avoid calling the `exported` event
- Docs (CHANGES): Update
- Docs (README): Deemphasize unstable embedded editor fixes
2018-10-24 14:56:09 +08:00
Brett Zamir 07f59ba01a - Refactoring: Reorder path config to group (non-modular-dependent) image
paths together (and correct code comment)
- Docs: CHANGES clarifications/fixes
- Docs: Migrations documents section
- Docs: Add code comment re: use of `extIconsPath` in Mathjax
- Docs: Add JSDoc indicate @this for `ExtensionInitResponse#callback`
- Build: Update build files
- npm: Bump to 3.1.0
2018-10-24 13:52:08 +08:00
Brett Zamir a714c122d3 - Fix (Embedded editor): (Though embedding cross-origin iframes apparently
only working now in Chrome if same origin or if https?--at least not
  localhost of different ports), PDF export has been fixed (we download the
  PDF to workaround data URI limitations in Chrome)
- 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
- Enhancement: For PDF export, switch Chrome by default to "save" `outputType`
- Docs (JSdoc): Denote optional arguments
2018-10-23 22:24:09 +08:00
Brett Zamir 2835ec11b6 - Refactoring: Avoid redundant use of *AttributeNS methods with
`null` value; just use *Attribute methods without namespace
2018-10-23 18:14:27 +08:00
Brett Zamir f4bbd34d34 - Fix: Revert fix to have extension `mouseup` events run on "zoom" and
"select" modes (#159); breaks polygon selection
- npm: Bump to 3.0.1
2018-10-22 23:43:59 +08:00
Brett Zamir c37e60fd87 - Fix: Centering of canvas wasn't being set at proper time; fixes #272
- Refactoring: Avoid unneeded internal IIFEs; simplify w/h formula
2018-10-21 01:17:44 +08:00
Brett Zamir 8024304a96 - 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
2018-10-19 20:42:10 +08:00
Brett Zamir 11baad0402 - Security fix/Breaking change (Imagelib): Require `allowedImageLibOrigins`
config array be set with safe origins or otherwise reject `postMessage`
  messages in case from untrusted sources
- Security fix/Breaking change (xdomain): Namespace xdomain file to avoid
  it being used to modify non-xdomain storage
- Security fix (Imagelib): Expose `dropXMLInternalSubset` to extensions
  for preventing billion laughs attack (and use in Imagelib)
2018-09-24 20:59:47 +08:00
Brett Zamir be17cd249c LGTM.com-inspired changes:
- Fix: Ensure all apostrophes are escaped for `toXml` utility
- Fix: Avoid error if `URL` is not defined
- Fix (jPicker): Precision argument had not been passed in previously
- Fix (Star extension): Minor: Avoid erring if `inradius` is `NaN`
- Refactoring: Avoid passing unused arguments, setting unused variables,
  and making unnecessary checks; avoid useless call to `createSVGMatrix`
- Linting (LGTM): Add `lgtm.yml` file (still some remaining items flagged
  but hoping for in-code flagging)
- Docs: Contributing file
2018-09-21 10:56:07 +08:00
Brett Zamir b0bad24645 - Linting (ESLint): Apply coding standards
- Breaking change (minor): Change export filename to check `exportWindowName` and change default from `download.pdf` to `svg.pdf` to distinguish from other downloads
- Enhancement: Restore old dataURI functionality for non-Chrome browsers
2018-09-13 09:13:05 +08:00
eric fc1f36714e fix pdf export issue. #124 and #254 2018-09-13 07:47:19 +08:00
Brett Zamir 4b22c248e4 - npm: Update devDeps
- Build: Switch to `terser` plugin with `uglify` plugin not
    supporting ES6+-capable minifier
- Linting (ESLint): Consistent curly spacing; follow new "standard"
2018-09-07 08:19:45 +08:00
Brett Zamir 0a2da503f1 - 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 callback
- Fix: Ensure SVG icon of flyout right-arrow is cloned to can be applied to
    more than one extension
- Fix: Ensure line tool shows as selected when "L" key command is used
- 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
2018-07-28 19:16:55 -07:00
Brett Zamir e2d378cfe6 - Optimize: Avoid rewriting `points` attribute for free-hand path; incorporates #176 (fixes #175)
- Docs: Update CHANGES
2018-07-26 00:01:58 -07:00
Brett Zamir 0a25236477 - 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
- Build: Update ext-xdomain-messaging
- Fix (extension): ForeignObject editor
- Docs: Avoid reporting deliberate "Any" type
- Docs: Further docs (`logMatrix`, `getPrivateMethods`)
- Docs: Suggest `npm pack`
2018-07-19 14:58:30 -07:00
Brett Zamir a3f0b8e501 - Security fix: 'extPath', 'imgPath', 'extIconsPath', 'canvgPath', 'langPath', 'jGraduatePath', and 'jspdfPath' were not being prevented
- 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: Have `exportPDF` resolve with `output` and `outputType` rather than `dataurlstring` (as type may vary)
- Breaking change: Rename `extensions/mathjax/MathJax.js` to `extensions/mathjax/MathJax.min.js`
- Breaking change: Avoid recent change to have editor ready callbacks return Promises (we're not using and advantageous to keep sequential)
- Breaking change: Avoid recent addition of locale-side function in ext-imagelib for l10n
- Breaking change: Change name of ext-arrows.js from `Arrows` to `arrows` for sake of file path (not localized anyways).
- Breaking change: Change `addlangData` extension event to `addLangData` for consistency with method name
- Breaking change: Have `readLang`  return lang and data but do not call `setLang`
- 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: Ensure call to `rasterExport` without `imgType` properly sets MIME type to PNG
- Fix: Wrong name for moinsave
- Update: Update WebAppFind per new API changes
- 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: 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 (also fixed issue with some console warnings about missing locale strings); i18nize Hello World too
- Enhancement: Allowing importing of locales within `addLangData`
- npm: Update devDeps
- 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 had their absolute URL links preserved
- Docs: Begin deleting `SvgCanvas.md` as ensuring jsdoc has replacements
- Docs: Add Edtior doc file for help to general users
- Docs: Clarify/simplify install instructions
- npm/Docs (JSDoc): Add script to check for overly generic types
- 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): 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`
- 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
- Refactoring: Drop code for extension as function (already requiring export to be an object)
- 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
- Testing: Use new Sinon
2018-07-08 22:39:46 -07:00
Brett Zamir efc3f5aaba - Avoid erring during resize on encountering MathML (which have no `style`) 2018-06-25 13:26:13 +08:00
Brett Zamir 30b2f3cfe1 - Fix rectangle/image/square/foreignObject (fixes #262) 2018-06-25 13:12:27 +08:00
Brett Zamir ccb793e78c - Fix: Detection of whether to keep ellipse (rx and ry when just created are now returning 0 instead of null); fixes #262
- Refactoring: Simplify `isValidUnit`
2018-06-25 12:39:10 +08:00