Commit Graph

1049 Commits (30b2f3cfe1e59af3aacb2367991d9cdf02f7b409)

Author SHA1 Message Date
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
Brett Zamir 9f65b1adb9 - 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: Moved out remaining modular i18n (imagelib) to own folder
- Breaking change: Drop `executeAfterLoads` (and getJSPDF/getCanvg)
- Breaking change: `RGBColor` must accept `new`
- Breaking change: canvg - `stackBlurCanvasRGBA` must be set now by function (`setStackBlurCanvasRGBA`) rather than global; `canvg` now a named export
- Breaking change: Avoid passing `canvg`/`buildCanvgCallback` to extensions (have them import)
- 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)
- 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
2018-06-12 06:50:28 +08:00
Neil Fraser a2df54881f Remove redundant (and incorrect) length set. (#256)
* Remove redundant (and incorrect) length set.

Fixes issue #255

* Simplify code by using push instead of a variable
2018-06-11 08:44:45 -07:00
Brett Zamir e7f3fbc841 - npm: Update devDep Rollup
- Linting (ESLint): Prefer `const` over `let`
- Build: Update `dist` files
2018-06-06 16:44:19 +08:00
Neil Fraser 2deaf4710a Sort SVG attributes alphabetically. (#252)
* Sort SVG attributes alphabetically.

This makes the exported SVG deterministic and diffable.

* Simplify attr variable
2018-06-03 02:44:57 -07:00
Brett Zamir 5469084919 - Refactoring (minor): `getIssues` to return codes and strings, lbs
- JSDoc: Fix param
2018-06-01 15:59:17 +08:00
Brett Zamir a27a5d5637 - Docs: Exclude from jsdoc firefox-extension, opera-widget, screencasts, test folders and build.html.js/rollup files
- Docs: Further JSDoc of methods
- Docs: Transfer some changes from ExtensionDocs on wiki (need to fully reconcile)
- Refactoring (minor): variadic args through ellipsis
2018-05-31 16:07:44 +08:00
Brett Zamir 6ccaf2491c - Enhancement: Add `pointsAdded` canvas event (Fixes #141) 2018-05-31 09:43:18 +08:00
Brett Zamir 8f53e34c0c - Docs (JSDoc)
- Fix regression (Imagelib): Fix path for non-module version
2018-05-30 21:49:32 +08:00
Brett Zamir d173df34d2 - Fix (Embedded API): Cross-domain may fail to even access `origin` or `contentDocument`
- Fix (Embedded API): Avoid adding URL to iframe src if there are no arguments
- Fix (Cross-domain usage): Recover from exceptions with `localStorage`
- Docs (JSDoc): Missing function
2018-05-30 19:39:00 +08:00
Brett Zamir f2b1a1ff0c - Enhancement: Allow callback argument and return promise
for canvas methods: `rasterExport` and `exportPDF`
2018-05-30 16:47:43 +08:00
Brett Zamir 81dc19cc17 - Fix (regression): Bad name on function passed to `path.js`
- Linting (ESLint): Fix semi-colon error
2018-05-30 08:25:56 +08:00
tetedacier d098dc0914 Bugfix/separate declaration from exposition (#245)
* Separate definition from exposition

* Suppress previous documentation before generating new one

* Restore deleted line

* Set up verbosity to provide details on what's going on
2018-05-29 09:43:02 -07:00
Brett Zamir dc79fe7fde - npm: Alphabetize scripts
- JSDoc: Exclude svgedit config files
- JSDoc: Convert remaining items in old format to JSDoc (as could easily be found)
2018-05-29 20:31:24 +08:00
Brett Zamir 54d6fd41b6 - Allow `addSvgElementFromJson` to accept non-SVG namespaces with explicit
`namespace` property as well as the default SVG namespace (fixes #155);
    document
2018-05-28 21:17:27 +08:00
Brett Zamir 28ba66d98d - Optimization: For `setSvgString`, if element content is not SVG, return `false` earlier (Fixes #152); thanks iuyiuy! 2018-05-28 20:42:37 +08:00
Brett Zamir 8c9e40d349 - 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)
- 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
2018-05-25 20:03:14 +08:00
Brett Zamir ae2394f086 (INCOMPLETE: ES6 Module conversion and linting)
- 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
2018-05-22 18:02:57 +08:00
Brett Zamir 10291dc556 - Remove carriage returns; fixes #37
- Remove extra spaces from svgcanvas, embedapi
2018-05-18 15:39:36 +08:00
Brett Zamir 52353c6321 - Further convert tabs -> 2 spaces in JS code comments (except in test performance
file where used for alignment though use tab escape within JS), CSS
    (including comments), PHP, SVG, JSON, XUL
- Remove extra spaces in svgcanvas.js, ext-connector.js
2018-05-18 14:41:43 +08:00
Brett Zamir dc6ab72480 - Update Opera and jQuery links
- Use `https://` (fix #172), including in prompt for URL and relevant code comments (where available and naturally not on namespaces)
- Comment out broken link in svg-editor.html
- Trailing space
2018-05-18 13:48:47 +08:00
codedread 4043c6e537 Change all tab indentations to 2sp indentation. Addresses issue #37 2018-05-17 21:02:30 -07:00
Neil Fraser 7bb89f53a5 Don’t throw error for unlinked nodes in Chrome
evt.target in Chrome is the abandoned shape, not connected to the DOM.  evt.target in Firefox is the svgroot.

Add checks to ensure that no matter what node is presented by the event, there are no property calls to null or undefined.

Fixes issue #232.
2018-05-17 12:04:58 -07:00
Neil Fraser f9fb7f47ae Residual linting
{object} -> {Object}
Remove extra semicolons.
Use jQuery’s .empty().
Make nodelist loops O(n) rather than O(n^2).
Specify radix in parseInt to prevent guessing octal.
2018-05-17 11:57:28 -07:00
Brett Zamir fb329e4977
Merge pull request #229 from NeilFraser/deps
Add missing dependency
2018-05-17 15:32:20 +08:00
Brett Zamir 25b1e9be01 - Linting (ESLint): Fix other indents besides main (though continue to disable check) 2018-05-17 13:15:20 +08:00
Brett Zamir a3b3525789 - Linting (ESLint): Finish
- Fix: Globals (x, y) in `mouseMove`
- Fix: Global (element, d_attr->dAttr) in `mouseDown`
- Fix: Avoid `drawnPath` not defined error
- Docs: sp.
2018-05-17 11:34:21 +08:00
Brett Zamir 340915be4e - Linting (ESLint): Finish extensions and most files in editor/; unfinished: `editor/svg-editor.js`, `editor/svgcanvas.js`
- Linting (ESLint): Fix ignore file paths
- History `elem` fix
2018-05-16 12:08:41 +08:00
Neil Fraser 6aced017ea Add missing dependency
HistoryRecordingService is required at line 400.
2018-05-10 12:07:44 -07:00
Igin edb8a75402 fix #222 Browsers block data URI (#224)
* fix #222 Browsers block data URI

* add spaces and blank lines
2018-04-12 11:00:52 -07:00
Jeff Schiller 396cce40eb
Merge pull request #208 from iuyiuy/setSvgString_without_undo
Add ability to set the svg drawing without adding to the undo stack.
2018-02-27 07:04:09 -08:00
KB Jørgensen 64759a8cab Added documentation for the preventUndo parameter in the svgcanvas.setSvgString() function. 2018-02-27 11:21:07 +01:00
KB Jørgensen d3ed6cbb8c Changed code style as requested in svgedit pull request #208. 2018-01-26 15:11:41 +01:00
KB Jørgensen 07803fd1db Add ability to set the svg drawing without adding to the undo stack. 2018-01-22 11:40:00 +01:00
KB Jørgensen 42bcd5bcf8 Fixed typo in comment. 2018-01-22 10:15:59 +01:00
KB Jørgensen 02c8721c2d Implemented a clipboard that works across tabs and windows. 2018-01-18 14:02:03 +01:00
Jeff Schiller 97f5127e81 Merge pull request #130 from iuyiuy/addSvgElementFromJson_expansion
Add svg element from json expansion
2016-11-15 05:57:26 -08:00
KB Jørgensen b92024eca2 Adjusted requested code styling changes. 2016-11-15 09:27:31 +01:00
Jeff Schiller f7a1d2eb81 Merge pull request #148 from iuyiuy/optimized_loading
Optimized loading by removing unnecessary code
2016-11-14 08:17:10 -08:00
KB Jørgensen c65f98b0ba Split code for added clarity. 2016-11-14 10:08:06 +01:00
KB Jørgensen 4994deb6ec Removed redundant function name. 2016-11-14 10:06:05 +01:00
KB Jørgensen 0bf50b0b42 Added description of the new children option to the addSvgElementFromJson() function. 2016-11-14 09:54:53 +01:00
Jeff Schiller 627d038e33 Merge pull request #142 from iuyiuy/null_stroke_fix
Fixed an issue where resizing an element would set stroke="null" on it.
2016-11-11 10:09:06 -08:00
Jeff Schiller 8f73ae16bb Update svgcanvas.js 2016-11-11 10:08:38 -08:00
KB Jørgensen 6f2822fac8 Removed code which went through all nodes and recalculated dimensions,
which was a lot of work for large svg drawings. There's no need to do
that when loading. It will happen gradually when you use it and on
manageable parts. This changed the loading time for a page with svg-edit
and a large drawing from ~50 secs to ~5 secs.
2016-11-11 15:46:51 +01:00
KB Jørgensen b2469d27d5 Fixed an issue where resizing an element would set stroke="null" on it. 2016-10-12 10:37:50 +02:00
Simon Brown b9549e1d43 fixed call to createSVGRect in getIntersectionList
createSVGRect() does not have parameters, they must be set on the object after

https://developer.mozilla.org/en/docs/Web/API/SVGSVGElement
2016-09-14 18:44:09 +01:00
KB Jørgensen e79db0f2a6 Added ability to create a text node with just a string in addSvgElementFromJson(). 2016-08-08 16:32:59 +02:00
KB Jørgensen b301acf716 Added ability to include children in the json to addSvgElementFromJson(). 2016-08-05 14:29:58 +02:00