- 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-22 10:03:16 +00:00
|
|
|
/* globals jQuery */
|
2018-05-18 07:39:36 +00:00
|
|
|
/*
|
|
|
|
* ext-imagelib.js
|
|
|
|
*
|
|
|
|
* Licensed under the MIT License
|
|
|
|
*
|
|
|
|
* Copyright(c) 2010 Alexis Deveria
|
|
|
|
*
|
|
|
|
*/
|
- 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-22 10:03:16 +00:00
|
|
|
import svgEditor from '../svg-editor.js';
|
2018-05-18 07:39:36 +00:00
|
|
|
|
- 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-22 10:03:16 +00:00
|
|
|
svgEditor.addExtension('imagelib', function ({decode64}) {
|
2018-05-18 03:25:45 +00:00
|
|
|
const $ = jQuery;
|
- 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-22 10:03:16 +00:00
|
|
|
const {uiStrings, canvas: svgCanvas} = svgEditor;
|
2018-05-18 07:39:36 +00:00
|
|
|
|
|
|
|
$.extend(uiStrings, {
|
|
|
|
imagelib: {
|
|
|
|
select_lib: 'Select an image library',
|
|
|
|
show_list: 'Show library list',
|
|
|
|
import_single: 'Import single',
|
|
|
|
import_multi: 'Import multiple',
|
|
|
|
open: 'Open as new document'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
- 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-22 10:03:16 +00:00
|
|
|
const modularVersion = !('svgEditor' in window) ||
|
|
|
|
!window.svgEditor ||
|
|
|
|
window.svgEditor.modules !== false;
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const imgLibs = [
|
2018-05-18 07:39:36 +00:00
|
|
|
{
|
|
|
|
name: 'Demo library (local)',
|
- 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-22 10:03:16 +00:00
|
|
|
url: svgEditor.curConfig.extPath +
|
|
|
|
'imagelib/index' + (modularVersion ? '-es' : '') + '.html',
|
2018-05-18 07:39:36 +00:00
|
|
|
description: 'Demonstration library for SVG-edit on this server'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'IAN Symbol Libraries',
|
|
|
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
|
|
|
description: 'Free library of illustrations'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Openclipart',
|
|
|
|
url: 'https://openclipart.org/svgedit',
|
|
|
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
function closeBrowser () {
|
|
|
|
$('#imgbrowse_holder').hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
function importImage (url) {
|
2018-05-18 03:25:45 +00:00
|
|
|
const newImage = svgCanvas.addSvgElementFromJson({
|
- 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-22 10:03:16 +00:00
|
|
|
element: 'image',
|
|
|
|
attr: {
|
|
|
|
x: 0,
|
|
|
|
y: 0,
|
|
|
|
width: 0,
|
|
|
|
height: 0,
|
|
|
|
id: svgCanvas.getNextId(),
|
|
|
|
style: 'pointer-events:inherit'
|
2018-05-18 07:39:36 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
svgCanvas.clearSelection();
|
|
|
|
svgCanvas.addToSelection([newImage]);
|
|
|
|
svgCanvas.setImageURL(url);
|
|
|
|
}
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const pending = {};
|
|
|
|
|
|
|
|
let mode = 's';
|
|
|
|
let multiArr = [];
|
|
|
|
let transferStopped = false;
|
|
|
|
let preview, submit;
|
2018-05-18 07:39:36 +00:00
|
|
|
|
|
|
|
window.addEventListener('message', function (evt) {
|
2018-05-18 03:25:45 +00:00
|
|
|
// Receive `postMessage` data
|
|
|
|
let response = evt.data;
|
2018-05-18 07:39:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
if (!response || typeof response !== 'string') {
|
2018-05-18 07:39:36 +00:00
|
|
|
// Do nothing
|
|
|
|
return;
|
|
|
|
}
|
2018-05-18 03:25:45 +00:00
|
|
|
try {
|
|
|
|
// Todo: This block can be removed (and the above check changed to
|
|
|
|
// insist on an object) if embedAPI moves away from a string to
|
|
|
|
// an object (if IE9 support not needed)
|
|
|
|
response = JSON.parse(response);
|
|
|
|
if (response.namespace !== 'imagelib') {
|
2018-05-18 07:39:36 +00:00
|
|
|
return;
|
|
|
|
}
|
2018-05-18 03:25:45 +00:00
|
|
|
} catch (e) {
|
|
|
|
return;
|
|
|
|
}
|
2018-05-18 07:39:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const hasName = 'name' in response;
|
|
|
|
const hasHref = 'href' in response;
|
2018-05-18 07:39:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
if (!hasName && transferStopped) {
|
2018-05-18 07:39:36 +00:00
|
|
|
transferStopped = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
let id;
|
|
|
|
if (hasHref) {
|
|
|
|
id = response.href;
|
|
|
|
response = response.data;
|
2018-05-18 07:39:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Hide possible transfer dialog box
|
|
|
|
$('#dialog_box').hide();
|
2018-05-18 03:25:45 +00:00
|
|
|
let entry, curMeta, svgStr, imgStr;
|
|
|
|
const type = hasName
|
|
|
|
? 'meta'
|
|
|
|
: response.charAt(0);
|
|
|
|
switch (type) {
|
|
|
|
case 'meta': {
|
2018-05-18 07:39:36 +00:00
|
|
|
// Metadata
|
|
|
|
transferStopped = false;
|
2018-05-18 03:25:45 +00:00
|
|
|
curMeta = response;
|
2018-05-18 07:39:36 +00:00
|
|
|
|
|
|
|
pending[curMeta.id] = curMeta;
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const name = (curMeta.name || 'file');
|
2018-05-18 07:39:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const message = uiStrings.notification.retrieving.replace('%s', name);
|
2018-05-18 07:39:36 +00:00
|
|
|
|
|
|
|
if (mode !== 'm') {
|
|
|
|
$.process_cancel(message, function () {
|
|
|
|
transferStopped = true;
|
|
|
|
// Should a message be sent back to the frame?
|
|
|
|
|
|
|
|
$('#dialog_box').hide();
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
entry = $('<div>' + message + '</div>').data('id', curMeta.id);
|
|
|
|
preview.append(entry);
|
|
|
|
curMeta.entry = entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
2018-05-18 03:25:45 +00:00
|
|
|
}
|
2018-05-18 07:39:36 +00:00
|
|
|
case '<':
|
|
|
|
svgStr = true;
|
|
|
|
break;
|
2018-05-18 03:25:45 +00:00
|
|
|
case 'd': {
|
|
|
|
if (response.startsWith('data:image/svg+xml')) {
|
|
|
|
const pre = 'data:image/svg+xml;base64,';
|
|
|
|
const src = response.substring(pre.length);
|
- 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-22 10:03:16 +00:00
|
|
|
response = decode64(src);
|
2018-05-18 07:39:36 +00:00
|
|
|
svgStr = true;
|
|
|
|
break;
|
2018-05-18 03:25:45 +00:00
|
|
|
} else if (response.startsWith('data:image/')) {
|
2018-05-18 07:39:36 +00:00
|
|
|
imgStr = true;
|
|
|
|
break;
|
|
|
|
}
|
2018-05-18 03:25:45 +00:00
|
|
|
}
|
|
|
|
// Else fall through
|
2018-05-18 07:39:36 +00:00
|
|
|
default:
|
|
|
|
// TODO: See if there's a way to base64 encode the binary data stream
|
2018-05-18 03:25:45 +00:00
|
|
|
// const str = 'data:;base64,' + svgedit.utilities.encode64(response, true);
|
2018-05-18 07:39:36 +00:00
|
|
|
|
|
|
|
// Assume it's raw image data
|
|
|
|
// importImage(str);
|
|
|
|
|
|
|
|
// Don't give warning as postMessage may have been used by something else
|
|
|
|
if (mode !== 'm') {
|
|
|
|
closeBrowser();
|
|
|
|
} else {
|
|
|
|
pending[id].entry.remove();
|
|
|
|
}
|
|
|
|
// $.alert('Unexpected data was returned: ' + response, function() {
|
|
|
|
// if (mode !== 'm') {
|
|
|
|
// closeBrowser();
|
|
|
|
// } else {
|
|
|
|
// pending[id].entry.remove();
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (mode) {
|
|
|
|
case 's':
|
|
|
|
// Import one
|
|
|
|
if (svgStr) {
|
|
|
|
svgCanvas.importSvgString(response);
|
|
|
|
} else if (imgStr) {
|
|
|
|
importImage(response);
|
|
|
|
}
|
|
|
|
closeBrowser();
|
|
|
|
break;
|
|
|
|
case 'm':
|
|
|
|
// Import multiple
|
|
|
|
multiArr.push([(svgStr ? 'svg' : 'img'), response]);
|
|
|
|
curMeta = pending[id];
|
2018-05-18 03:25:45 +00:00
|
|
|
let title;
|
2018-05-18 07:39:36 +00:00
|
|
|
if (svgStr) {
|
|
|
|
if (curMeta && curMeta.name) {
|
|
|
|
title = curMeta.name;
|
|
|
|
} else {
|
|
|
|
// Try to find a title
|
2018-05-18 03:25:45 +00:00
|
|
|
const xml = new DOMParser().parseFromString(response, 'text/xml').documentElement;
|
2018-05-18 07:39:36 +00:00
|
|
|
title = $(xml).children('title').first().text() || '(SVG #' + response.length + ')';
|
|
|
|
}
|
|
|
|
if (curMeta) {
|
|
|
|
preview.children().each(function () {
|
|
|
|
if ($(this).data('id') === id) {
|
|
|
|
if (curMeta.preview_url) {
|
|
|
|
$(this).html('<img src="' + curMeta.preview_url + '">' + title);
|
|
|
|
} else {
|
|
|
|
$(this).text(title);
|
|
|
|
}
|
|
|
|
submit.removeAttr('disabled');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
preview.append('<div>' + title + '</div>');
|
|
|
|
submit.removeAttr('disabled');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (curMeta && curMeta.preview_url) {
|
|
|
|
title = curMeta.name || '';
|
|
|
|
}
|
|
|
|
if (curMeta && curMeta.preview_url) {
|
|
|
|
entry = '<img src="' + curMeta.preview_url + '">' + title;
|
|
|
|
} else {
|
|
|
|
entry = '<img src="' + response + '">';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (curMeta) {
|
|
|
|
preview.children().each(function () {
|
|
|
|
if ($(this).data('id') === id) {
|
|
|
|
$(this).html(entry);
|
|
|
|
submit.removeAttr('disabled');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
preview.append($('<div>').append(entry));
|
|
|
|
submit.removeAttr('disabled');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'o':
|
|
|
|
// Open
|
|
|
|
if (!svgStr) { break; }
|
|
|
|
svgEditor.openPrep(function (ok) {
|
|
|
|
if (!ok) { return; }
|
|
|
|
svgCanvas.clear();
|
|
|
|
svgCanvas.setSvgString(response);
|
|
|
|
// updateCanvas();
|
|
|
|
});
|
|
|
|
closeBrowser();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}, true);
|
|
|
|
|
|
|
|
function toggleMulti (show) {
|
|
|
|
$('#lib_framewrap, #imglib_opts').css({right: (show ? 200 : 10)});
|
|
|
|
if (!preview) {
|
|
|
|
preview = $('<div id=imglib_preview>').css({
|
|
|
|
position: 'absolute',
|
|
|
|
top: 45,
|
|
|
|
right: 10,
|
|
|
|
width: 180,
|
|
|
|
bottom: 45,
|
|
|
|
background: '#fff',
|
|
|
|
overflow: 'auto'
|
|
|
|
}).insertAfter('#lib_framewrap');
|
|
|
|
|
|
|
|
submit = $('<button disabled>Import selected</button>')
|
|
|
|
.appendTo('#imgbrowse')
|
|
|
|
.on('click touchend', function () {
|
|
|
|
$.each(multiArr, function (i) {
|
2018-05-18 03:25:45 +00:00
|
|
|
const type = this[0];
|
|
|
|
const data = this[1];
|
2018-05-18 07:39:36 +00:00
|
|
|
if (type === 'svg') {
|
|
|
|
svgCanvas.importSvgString(data);
|
|
|
|
} else {
|
|
|
|
importImage(data);
|
|
|
|
}
|
|
|
|
svgCanvas.moveSelectedElements(i * 20, i * 20, false);
|
|
|
|
});
|
|
|
|
preview.empty();
|
|
|
|
multiArr = [];
|
|
|
|
$('#imgbrowse_holder').hide();
|
|
|
|
}).css({
|
|
|
|
position: 'absolute',
|
|
|
|
bottom: 10,
|
|
|
|
right: -10
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
preview.toggle(show);
|
|
|
|
submit.toggle(show);
|
|
|
|
}
|
|
|
|
|
|
|
|
function showBrowser () {
|
2018-05-18 03:25:45 +00:00
|
|
|
let browser = $('#imgbrowse');
|
2018-05-18 07:39:36 +00:00
|
|
|
if (!browser.length) {
|
|
|
|
$('<div id=imgbrowse_holder><div id=imgbrowse class=toolbar_button>' +
|
|
|
|
'</div></div>').insertAfter('#svg_docprops');
|
|
|
|
browser = $('#imgbrowse');
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const allLibs = uiStrings.imagelib.select_lib;
|
2018-05-18 07:39:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const libOpts = $('<ul id=imglib_opts>').appendTo(browser);
|
|
|
|
const frame = $('<iframe/>').prependTo(browser).hide().wrap('<div id=lib_framewrap>');
|
2018-05-18 07:39:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const header = $('<h1>').prependTo(browser).text(allLibs).css({
|
2018-05-18 07:39:36 +00:00
|
|
|
position: 'absolute',
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
width: '100%'
|
|
|
|
});
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const cancel = $('<button>' + uiStrings.common.cancel + '</button>')
|
2018-05-18 07:39:36 +00:00
|
|
|
.appendTo(browser)
|
|
|
|
.on('click touchend', function () {
|
|
|
|
$('#imgbrowse_holder').hide();
|
|
|
|
}).css({
|
|
|
|
position: 'absolute',
|
|
|
|
top: 5,
|
|
|
|
right: -10
|
|
|
|
});
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const leftBlock = $('<span>').css({position: 'absolute', top: 5, left: 10}).appendTo(browser);
|
2018-05-18 07:39:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const back = $('<button hidden>' + uiStrings.imagelib.show_list + '</button>')
|
2018-05-18 07:39:36 +00:00
|
|
|
.appendTo(leftBlock)
|
|
|
|
.on('click touchend', function () {
|
|
|
|
frame.attr('src', 'about:blank').hide();
|
|
|
|
libOpts.show();
|
|
|
|
header.text(allLibs);
|
|
|
|
back.hide();
|
|
|
|
}).css({
|
|
|
|
'margin-right': 5
|
|
|
|
}).hide();
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
/* const type = */ $('<select><option value=s>' +
|
2018-05-18 07:39:36 +00:00
|
|
|
uiStrings.imagelib.import_single + '</option><option value=m>' +
|
|
|
|
uiStrings.imagelib.import_multi + '</option><option value=o>' +
|
|
|
|
uiStrings.imagelib.open + '</option></select>').appendTo(leftBlock).change(function () {
|
|
|
|
mode = $(this).val();
|
|
|
|
switch (mode) {
|
|
|
|
case 's':
|
|
|
|
case 'o':
|
|
|
|
toggleMulti(false);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'm':
|
|
|
|
// Import multiple
|
|
|
|
toggleMulti(true);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}).css({
|
|
|
|
'margin-top': 10
|
|
|
|
});
|
|
|
|
|
|
|
|
cancel.prepend($.getSvgIcon('cancel', true));
|
|
|
|
back.prepend($.getSvgIcon('tool_imagelib', true));
|
|
|
|
|
- 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-22 10:03:16 +00:00
|
|
|
$.each(imgLibs, function (i, {name, url, description}) {
|
2018-05-18 07:39:36 +00:00
|
|
|
$('<li>')
|
|
|
|
.appendTo(libOpts)
|
- 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-22 10:03:16 +00:00
|
|
|
.text(name)
|
2018-05-18 07:39:36 +00:00
|
|
|
.on('click touchend', function () {
|
- 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-22 10:03:16 +00:00
|
|
|
frame.attr('src', url).show();
|
|
|
|
header.text(name);
|
2018-05-18 07:39:36 +00:00
|
|
|
libOpts.hide();
|
|
|
|
back.show();
|
- 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-22 10:03:16 +00:00
|
|
|
}).append(`<span>${description}</span>`);
|
2018-05-18 07:39:36 +00:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
$('#imgbrowse_holder').show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
- 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-22 10:03:16 +00:00
|
|
|
svgicons: svgEditor.curConfig.extIconsPath + 'ext-imagelib.xml',
|
2018-05-18 07:39:36 +00:00
|
|
|
buttons: [{
|
|
|
|
id: 'tool_imagelib',
|
|
|
|
type: 'app_menu', // _flyout
|
|
|
|
position: 4,
|
|
|
|
title: 'Image library',
|
|
|
|
events: {
|
2018-05-18 03:25:45 +00:00
|
|
|
mouseup: showBrowser
|
2018-05-18 07:39:36 +00:00
|
|
|
}
|
|
|
|
}],
|
2018-05-18 03:25:45 +00:00
|
|
|
callback () {
|
2018-05-18 07:39:36 +00:00
|
|
|
$('<style>').text(
|
|
|
|
'#imgbrowse_holder {' +
|
|
|
|
'position: absolute;' +
|
|
|
|
'top: 0;' +
|
|
|
|
'left: 0;' +
|
|
|
|
'width: 100%;' +
|
|
|
|
'height: 100%;' +
|
|
|
|
'background-color: rgba(0, 0, 0, .5);' +
|
|
|
|
'z-index: 5;' +
|
|
|
|
'}' +
|
|
|
|
'#imgbrowse {' +
|
|
|
|
'position: absolute;' +
|
|
|
|
'top: 25px;' +
|
|
|
|
'left: 25px;' +
|
|
|
|
'right: 25px;' +
|
|
|
|
'bottom: 25px;' +
|
|
|
|
'min-width: 300px;' +
|
|
|
|
'min-height: 200px;' +
|
|
|
|
'background: #B0B0B0;' +
|
|
|
|
'border: 1px outset #777;' +
|
|
|
|
'}' +
|
|
|
|
'#imgbrowse h1 {' +
|
|
|
|
'font-size: 20px;' +
|
|
|
|
'margin: .4em;' +
|
|
|
|
'text-align: center;' +
|
|
|
|
'}' +
|
|
|
|
'#lib_framewrap,' +
|
|
|
|
'#imgbrowse > ul {' +
|
|
|
|
'position: absolute;' +
|
|
|
|
'top: 45px;' +
|
|
|
|
'left: 10px;' +
|
|
|
|
'right: 10px;' +
|
|
|
|
'bottom: 10px;' +
|
|
|
|
'background: white;' +
|
|
|
|
'margin: 0;' +
|
|
|
|
'padding: 0;' +
|
|
|
|
'}' +
|
|
|
|
'#imgbrowse > ul {' +
|
|
|
|
'overflow: auto;' +
|
|
|
|
'}' +
|
|
|
|
'#imgbrowse > div {' +
|
|
|
|
'border: 1px solid #666;' +
|
|
|
|
'}' +
|
|
|
|
'#imglib_preview > div {' +
|
|
|
|
'padding: 5px;' +
|
|
|
|
'font-size: 12px;' +
|
|
|
|
'}' +
|
|
|
|
'#imglib_preview img {' +
|
|
|
|
'display: block;' +
|
|
|
|
'margin: 0 auto;' +
|
|
|
|
'max-height: 100px;' +
|
|
|
|
'}' +
|
|
|
|
'#imgbrowse li {' +
|
|
|
|
'list-style: none;' +
|
|
|
|
'padding: .5em;' +
|
|
|
|
'background: #E8E8E8;' +
|
|
|
|
'border-bottom: 1px solid #B0B0B0;' +
|
|
|
|
'line-height: 1.2em;' +
|
|
|
|
'font-style: sans-serif;' +
|
|
|
|
'}' +
|
|
|
|
'#imgbrowse li > span {' +
|
|
|
|
'color: #666;' +
|
|
|
|
'font-size: 15px;' +
|
|
|
|
'display: block;' +
|
|
|
|
'}' +
|
|
|
|
'#imgbrowse li:hover {' +
|
|
|
|
'background: #FFC;' +
|
|
|
|
'cursor: pointer;' +
|
|
|
|
'}' +
|
|
|
|
'#imgbrowse iframe {' +
|
|
|
|
'width: 100%;' +
|
|
|
|
'height: 100%;' +
|
|
|
|
'border: 0;' +
|
|
|
|
'}'
|
|
|
|
).appendTo('head');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|