Commit Graph

789 Commits (2fa2bfac1e2e37f65e49731777a3164aa5c8128f)

Author SHA1 Message Date
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 b573a85fba - Fix: Save broken on Firefox (since FF version?)
- Docs: Mention potentially more frequent release schedule
- 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`
- npm: Add newly renamed `jsdoc-check-overly-generic-types.js` to ignore
- npm: Bump to 3.1.1
2018-10-25 10:45:57 +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 25f02d99f2 - Refactoring: Display inline styles within a template for readability
(until we may refactor as class swapping)
- Refactoring: Line breaks
2018-10-24 09:44:43 +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 d13f99bb5e - Breaking change: Remove `storagePromptClosed` state boolean in favor of
`storagePromptState`; used by `ext-storage.js`
- Fix (regression): Ensure storage dialog will not be blocked because of
    canvas updating done for sake of centering background
- 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"
2018-10-21 18:38:53 +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 fb9eb80798 - Fix (regression): Extension locale loading for non-English locales
- Fix: Allow language to be properly set back to a different locale and
  retaining preference (and ensure language changes are available before
  dialog closed)
- Refactoring: array extra/spread operator
- npm: Update devDep (sinon-test)
2018-10-20 22:21:58 +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 3909d2fd97 - Fix: Only clear selection by escape key if not within a dialog (as the escape key should only close the dialog)
- Fix: Ensure escape key will work from within input text boxes (as was already added for textareas)
- Refactoring: Share code for dialog selectors
2018-10-02 14:02:15 +08:00
Brett Zamir 2a943cd1fa - 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
2018-10-02 13:21:04 +08:00
Brett Zamir fa37778ec0 - Fix: Ensure repeated selection of same file overwrites with that
file's contents (fix #289)
2018-09-25 11:19:13 +08:00
Brett Zamir 7ff2721ba9 - Enhancement: Auto-detect `allowedImageLibOrigins` based on locale rather than requiring user to supply 2018-09-25 02:35:15 +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 c0ea00d36b - Fix (image export) Export in Chrome; fixes #282 2018-09-13 18:23:53 +08:00
Brett Zamir 0688b9af60 - Fix (image import): Put src after onload to avoid missing event;
check other width/height properties in case offset is 0; fixes #278
2018-09-13 17:54:40 +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 acb57c1609 - Fix: Add images (and references) for fallback (#135)
- Fix (canvg): blur export fix
- i18n (Chinese): A few fixes (#135)
- Optimize: Further image optimizing
- Refactoring: Avoid custom JS substitution syntax
- Refactoring: Reorder default extension list
2018-07-31 00:18:39 -07: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 3008696314 - Allow template to have text node for readability 2018-07-25 17:44:37 -07:00
Brett Zamir aa2c3f142e - Fix (regression in last commit): Avoid empty text node in SVG template 2018-07-25 17:42:06 -07:00
Brett Zamir a68696ee34 - Refactoring (minor): Array destructuring
- Refactoring (minor): ES6 templates
- i18n: picking stroke/fill paint and opacity
2018-07-25 16:43:29 -07:00
Brett Zamir d71ca48654 - Docs: A couple JSDoc fixes 2018-07-20 20:45:46 -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 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
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 96e089f930 - 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
- npm: Add `prepare` script to ensure building/testing before publish
2018-05-31 09:53:47 +08:00
Brett Zamir a5c25a2113 - Code comments: Coding standards within
- Refactoring (minor): Use single quotes in PHP
2018-05-31 07:52:13 +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 2ddc78d525 - Fix (regression): Favicon setting 2018-05-30 08:54:56 +08:00
Brett Zamir a353d6fc89 - npm: Update devDeps
- Fix: Enforce stylesheet ordering sequence
- Fix: Ensure SVG-edit hidden until stylesheets loaded
- Fix: Avoid abandoning stylesheet loading if one load fails
2018-05-29 13:48:42 +08:00
Brett Zamir c2e06534ff - Enhancement: Delete the imge upon cancel if it is a new image (fixes #177) 2018-05-28 19:19:00 +08:00
Brett Zamir 5ad83b9b87 - Refactoring: Clean-up
- Fix: Race condition with svgicons and seticonsize
- Embedded editor: Use module form for now; drop unused inline attribute
- Embedded editor: Fix PNG export; work toward restoring PDF (add `getUIStrings` method to editor for assisting)
- canvg and importScript fixes
2018-05-25 22:43:01 +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 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 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 eba9dee54c - Linting (ESLint): Finish `editor/svg-editor.js`; unfinished: `editor/svgcanvas.js`
- Fix: Restore save alert
2018-05-16 16:03:43 +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
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
KB Jørgensen 02c8721c2d Implemented a clipboard that works across tabs and windows. 2018-01-18 14:02:03 +01:00
Teemu Koivisto 6ee97e0d3f Fix broken saving of svg in Chrome >=60 2017-11-27 19:49:34 +02:00
KB Jørgensen aafcbb694e Log errors from extensions to the browser console. 2016-11-21 15:45:43 +01:00
KB Jørgensen f9b7ae97e5 Also trigger the svgEditorReady event when opened through an iframe. 2016-08-01 09:48:00 +02:00
Flint O'Brien 53cfe68afa Merge pull request #107 from gec/createLayerFix
Fixed Layers in svgcanvas. Moved Layer class. HistoryRecordingservice
2016-05-02 12:02:42 -04:00
Jeff Schiller fb5e2c78ec Merge pull request #85 from magnebra/text_input_update
Change the text input bindings to catch more input events
2016-05-02 07:53:41 -07:00
Jeff Schiller 1120d61544 Merge pull request #96 from iuyiuy/patch-1
Trigger the svgEditorReady after the canvas is ready.
2016-05-02 07:49:42 -07:00
Flint O'Brien 899853c963 Fixed Layers in svgcanvas. Moved Layer class. New HistoryRecordingservice.
Canvas was referencing drawing.all_layers and drawing.current_layer.
Both variables now represent Layer instead of group element and should
be considered private.
Moved Layer class to layer.js
New HistoryRecordingService added to help with moving Layer code out of
Canvas. Started using it in Canvas.mergLayer
2016-05-01 22:58:41 -04:00
Flint O'Brien ebcf3d9c47 Update layers panel on programatic call to createLayer.
Add class=“layer” to each layer element. This happens when calling
createLayer() or any call to identifyLayers(). This happens with new
drawings and when opening legacy drawings, so it’s fully backwards
compatible.
svg-editor.js elementChanged() looks for g.layer as an addition test
for calling populateLayers() which updates the layers panel.
Addition tests for class=“layer” added to draw_test.html.
Fixed Firefox exception in draw_test.html.
2016-04-29 16:13:35 -04:00
iuyiuy 2fe15e4d3f Trigger the svgEditorReady after the canvas is ready. 2016-03-23 11:40:42 +01:00
Magne Bratseth 1f57536546 Add config options for text 2016-03-15 08:43:24 +01:00
Jeff Schiller 2a062f6b01 Merge pull request #86 from Saurbaum/return
Images drawn using an extension always spawn the URL dialog
2016-03-14 09:19:31 -07:00
Ian Newborn 0c035f8aa2 Removed debugger; 2016-03-14 09:12:47 +00:00
Ian Newborn 8f904c05dd Prevented Editor opening image browser if not in image mode 2016-03-14 09:12:23 +00:00
Magne Bratseth d03d50dc3b Remove binding of change - 'input' is sufficient 2016-03-14 08:01:42 +01:00
Magne Bratseth 9fdb305fb5 Change the text input bindings to catch more input events 2016-03-11 12:06:10 +01:00
Magne Bratseth fc269cf045 Make sure font size is set to display when text is selected 2016-03-11 11:04:11 +01:00
Magne Bratseth 1c77772740 Sizing the font-size elements leave them disabled and not shown later on 2016-03-11 10:34:05 +01:00
Jeff Schiller 6715e62146 Merge pull request #7 from ibrierley/master
Fix for import svg image leading to unattached dragtool
2016-01-31 23:27:01 -08:00
Jordan cac6202e58 #59 Remove double-bind of keypresses Z and Y
Patch for Issue #59. https://github.com/SVG-Edit/svgedit/issues/59
2016-01-19 17:00:59 -08:00
Francesco Strappini ce009a4581 Spacing like the code around 2015-09-27 09:01:04 +02:00
Francesco Strappini 1f11691c60 Added class support 2015-09-24 16:15:34 +02:00
ibrierley ea129f009e formatting 2015-07-16 19:28:20 +02:00
ibrierley 4d745dc05b Fix for importing svg files where grabber just selects nothing as it doesnt know the svg to select 2015-07-16 15:45:48 +02:00
portablejim a62f7c1c5a Make context menu group option work. 2015-06-16 18:17:52 +10:00
Brett Zamir 6f7651299c Some additional JSLint; update jsPDF and SVG plugin; handle canvg for image export within svgcanvas and provide new "datauri" to "exported" event.
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2875 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-06-01 21:29:54 +00:00
Brett Zamir 8bda8fe16d Ensure loading... message closes upon completion or error
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2865 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-05-22 23:20:43 +00:00
Brett Zamir d792d60808 Update JSLint global declarations
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2862 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-05-22 11:01:11 +00:00
Brett Zamir abc9cd6ffb Move embedapi.html code which is not part of the API into embedapi-dom.js; demo export PDF in embedded editor; add new exportPDF method to canvas (and exposed to embedded editor) which can support JSON-able data URI string response, removing PDF exporting from rasterExport; JSLint; move dependency checking code for canvg and jsPDF to utilities; simplify Utils calls; allow for custom PDF export handler (but not yet implemented in server-based extensions); import PDF todo
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2860 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-05-22 10:21:29 +00:00
Brett Zamir 3fdb8f4377 Avoid window.name security errors and make export window name configurable through config.exportWindowType (new|same) based on configurable canvas name
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2855 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-05-22 07:22:57 +00:00
Brett Zamir 5bddabcec3 Switch to minified and complete distribution version of jsPDF; allow data URL to work in Firefox as well as Chrome instead of blob URL; rmv global saveAs requirement
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2854 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-05-22 06:43:37 +00:00
Brett Zamir 25a8d9a851 Fix callEnsure all dependencies available for canvg-using extensions (server_moinsave, server_opensave)
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2853 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-05-22 03:47:10 +00:00
Brett Zamir 18c9fd0932 Ensure all dependencies available for canvg-using extensions (server_moinsave, server_opensave)
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2852 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-05-22 03:45:31 +00:00
Brett Zamir 9bda441c77 Abstract conditional script loading and allow jsPDF to load as needed (as with canvg); update jsPDF
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2847 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-05-22 02:34:37 +00:00
Brett Zamir 4ffd994c49 Spacing
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2846 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-05-22 01:30:42 +00:00
Brett Zamir bf8c5308f2 Fix exportImage behavior if multiple setCustomHandlers calls are made
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2843 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-05-15 05:16:39 +00:00
Brett Zamir 978315f944 Allow override of jsPDF saveAs function (jsPDF work not complete however); apply fix for issue #1209 on push buttons; fix comment
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2839 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-05-08 03:47:14 +00:00
Brett Zamir df057b9736 Quick fix for small icon view and top toolbar
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2826 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-17 00:25:02 +00:00
Brett Zamir 582e71cb1b Minor: Spacing
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2825 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-09 22:47:39 +00:00
Brett Zamir 936d7d3aa4 Support external (embedded) export invocation; utilize export in embedded demo
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2822 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-09 06:53:08 +00:00
Brett Zamir 856d1971c2 Remove paramurl parameter as it encouraged improper encoding of a URL within the SVG Edit URL
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2815 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-09 04:26:34 +00:00
Brett Zamir d84a4465d2 Minor clean-up
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2813 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-09 03:44:19 +00:00
Brett Zamir 04d522b43b Properly allow for ext-grid showGrid default setting
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2805 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-09 02:25:25 +00:00
Brett Zamir 297f10489f explain colorPickerCSS default behavior in comments
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2802 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-09 01:33:11 +00:00
Brett Zamir 35ab5a9862 Fix spacing
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2800 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-08 13:49:58 +00:00
Brett Zamir 75928e9b63 Revert to using point regardless of base unit (with comment)
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2798 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-08 11:27:05 +00:00
Brett Zamir b1ea39db46 Provide values for px, pc, em, ex and utilize switch for divisor determination in jsPDF in order to utilize the user's current base unit type in PDF exports. Accurate conversion formulas?
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2797 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-08 11:01:46 +00:00
Brett Zamir 667de19147 Set document title as PDF property
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2796 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-08 08:18:47 +00:00
Brett Zamir 1f95988b29 Make PDF export orientation dependent on width vs. height, based on "pt", and using the dimensions of the canvas (Todo: provide alternative of predefined jsPDF options like a4, legal, etc.)
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2795 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-08 08:10:26 +00:00
Brett Zamir 50d0b1fb67 Add jsPDF(with SVG plugin)-based PDF export (courtesy of https://github.com/brettz9/jsPDF forked from https://github.com/MrRio/jsPDF => https://github.com/ahwolf/jsPDF ); provides data: URL where blob conversion is supported, and a blob URL otherwise.
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2792 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-08 05:13:54 +00:00
Brett Zamir 0d34fcfa7d Properly-formed URLs will not have spaces, so no need to replace; no need for "/" escaping unless within HTML doc; properly encode loadingImage window text; support loading of (properly URL encoded) non-base64 "data:image/svg+xml;utf8,"-style data URIs
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2782 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-08 01:31:22 +00:00
Brett Zamir 91a627d53d Remove 2.7-deprecated pngsave option
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2780 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-07 23:31:00 +00:00
Brett Zamir 614895baf0 Uniform spelling for "Todo" throughout code
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2760 eee81c28-f429-11dd-99c0-75d572ba1ddd
2014-04-07 04:13:01 +00:00