- Refactoring: Reduce BBQ dependency (not yet removable as used still in svgeditor)

master
Brett Zamir 2020-01-05 10:32:31 +08:00
parent 56197a493c
commit d0d7efabc4
12 changed files with 606 additions and 613 deletions

View File

@ -4909,15 +4909,15 @@ var svgEditorExtension_server_moinsave = (function () {
var _save = _asyncToGenerator( var _save = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee(win, data) { regeneratorRuntime.mark(function _callee(win, data) {
var svg, qstr, _qstr$substr$split, _qstr$substr$split2, name, svgData, c, datauri, pngData; var svg, _ref2, pathname, name, svgData, c, datauri, pngData;
return regeneratorRuntime.wrap(function _callee$(_context) { return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) { while (1) {
switch (_context.prev = _context.next) { switch (_context.prev = _context.next) {
case 0: case 0:
svg = '<?xml version="1.0"?>\n' + data; svg = '<?xml version="1.0"?>\n' + data;
qstr = $.param.querystring(); _ref2 = new URL(location), pathname = _ref2.pathname;
_qstr$substr$split = qstr.substr(9).split('/+get/'), _qstr$substr$split2 = _slicedToArray(_qstr$substr$split, 2), name = _qstr$substr$split2[1]; name = pathname.replace(/\/+get\//, '');
svgData = encode64(svg); svgData = encode64(svg);
if (!$('#export_canvas').length) { if (!$('#export_canvas').length) {

View File

@ -89,15 +89,13 @@ var svgEditorExtension_storage = (function () {
* The functionality was originally part of the SVG Editor, but moved to a * The functionality was originally part of the SVG Editor, but moved to a
* separate extension to make the setting behavior optional, and adapted * separate extension to make the setting behavior optional, and adapted
* to inform the user of its setting of local data. * to inform the user of its setting of local data.
* Dependencies:
* *
* 1. jQuery BBQ (for deparam)
* @license MIT * @license MIT
* *
* @copyright 2010 Brett Zamir * @copyright 2010 Brett Zamir
* @todo Revisit on whether to use $.pref over directly setting curConfig in all * @todo Revisit on whether to use `svgEditor.pref` over directly setting
* extensions for a more public API (not only for extPath and imagePath, * `curConfig` in all extensions for a more public API (not only for `extPath`
* but other currently used config in the extensions) * and `imagePath`, but other currently used config in the extensions)
* @todo We might provide control of storage settings through the UI besides the * @todo We might provide control of storage settings through the UI besides the
* initial (or URL-forced) dialog. * * initial (or URL-forced) dialog. *
*/ */
@ -122,6 +120,7 @@ var svgEditorExtension_storage = (function () {
* Replace `storagePrompt` parameter within URL. * Replace `storagePrompt` parameter within URL.
* @param {string} val * @param {string} val
* @returns {void} * @returns {void}
* @todo Replace the string manipulation with `searchParams.set`
*/ */
function replaceStoragePrompt(val) { function replaceStoragePrompt(val) {
@ -257,14 +256,14 @@ var svgEditorExtension_storage = (function () {
var _langReady = _asyncToGenerator( var _langReady = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee(_ref4) { regeneratorRuntime.mark(function _callee(_ref4) {
var importLocale, _$$deparam$querystrin, storagePrompt, confirmSetStorage, message, storagePrefsAndContent, storagePrefsOnly, storagePrefs, storageNoPrefsOrContent, storageNoPrefs, rememberLabel, rememberTooltip, options, oldContainerWidth, oldContainerMarginLeft, oldContentHeight, oldContainerHeight, _ref5, pref, checked; var importLocale, storagePrompt, confirmSetStorage, message, storagePrefsAndContent, storagePrefsOnly, storagePrefs, storageNoPrefsOrContent, storageNoPrefs, rememberLabel, rememberTooltip, options, oldContainerWidth, oldContainerMarginLeft, oldContentHeight, oldContainerHeight, _ref5, pref, checked;
return regeneratorRuntime.wrap(function _callee$(_context) { return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) { while (1) {
switch (_context.prev = _context.next) { switch (_context.prev = _context.next) {
case 0: case 0:
importLocale = _ref4.importLocale; importLocale = _ref4.importLocale;
_$$deparam$querystrin = $.deparam.querystring(true), storagePrompt = _$$deparam$querystrin.storagePrompt; storagePrompt = new URL(top.location).searchParams.get('storagePrompt');
_context.next = 4; _context.next = 4;
return importLocale(); return importLocale();
@ -289,11 +288,11 @@ var svgEditorExtension_storage = (function () {
if (!(!forceStorage && ( // If the URL has been explicitly set to always prompt the if (!(!forceStorage && ( // If the URL has been explicitly set to always prompt the
// user (e.g., so one can be pointed to a URL where one // user (e.g., so one can be pointed to a URL where one
// can alter one's settings, say to prevent future storage)... // can alter one's settings, say to prevent future storage)...
storagePrompt === true || // ...or...if the URL at least doesn't explicitly prevent a storagePrompt === 'true' || // ...or...if the URL at least doesn't explicitly prevent a
// storage prompt (as we use for users who // storage prompt (as we use for users who
// don't want to set cookies at all but who don't want // don't want to set cookies at all but who don't want
// continual prompts about it)... // continual prompts about it)...
storagePrompt !== false && // ...and this user hasn't previously indicated a desire for storage storagePrompt !== 'false' && // ...and this user hasn't previously indicated a desire for storage
!document.cookie.match(/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/) // ...then show the storage prompt. !document.cookie.match(/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/) // ...then show the storage prompt.
))) { ))) {
_context.next = 44; _context.next = 44;
@ -361,7 +360,7 @@ var svgEditorExtension_storage = (function () {
// don't want ask them again upon page refresh so move // don't want ask them again upon page refresh so move
// them instead to a URL which does not always prompt // them instead to a URL which does not always prompt
if (!(storagePrompt === true && checked)) { if (!(storagePrompt === 'true' && checked)) {
_context.next = 28; _context.next = 28;
break; break;
} }

259
dist/index-es.js vendored
View File

@ -28615,44 +28615,33 @@ function () {
case 0: case 0:
if (givenParam) { if (givenParam) {
langParam = givenParam; langParam = givenParam;
} else { } else if (navigator.userLanguage) {
langParam = $$a.pref('lang');
if (!langParam) {
if (navigator.userLanguage) {
// Explorer // Explorer
langParam = navigator.userLanguage; langParam = navigator.userLanguage;
} else if (navigator.language) { } else if (navigator.language) {
// FF, Opera, ... // FF, Opera, ...
langParam = navigator.language; langParam = navigator.language;
} }
}
console.log('Lang: ' + langParam); // eslint-disable-line no-console console.log('Lang: ' + langParam); // eslint-disable-line no-console
// Set to English if language is not in list of good langs // Set to English if language is not in list of good langs
if (!goodLangs.includes(langParam) && langParam !== 'test') { if (!goodLangs.includes(langParam) && langParam !== 'test') {
langParam = 'en'; langParam = 'en';
} // don't bother on first run if language is English
// The following line prevents setLang from running
// extensions which depend on updated uiStrings,
// so commenting it out.
// if (langParam.startsWith('en')) {return;}
} }
url = conf.langPath + 'lang.' + langParam + '.js'; url = conf.langPath + 'lang.' + langParam + '.js';
_context2.t0 = readLang; _context2.t0 = readLang;
_context2.next = 5; _context2.next = 7;
return importSetGlobalDefault(url, { return importSetGlobalDefault(url, {
global: 'svgEditorLang_' + langParam.replace(/-/g, '_') global: 'svgEditorLang_' + langParam.replace(/-/g, '_')
}); });
case 5: case 7:
_context2.t1 = _context2.sent; _context2.t1 = _context2.sent;
return _context2.abrupt("return", (0, _context2.t0)(_context2.t1)); return _context2.abrupt("return", (0, _context2.t0)(_context2.t1));
case 7: case 9:
case "end": case "end":
return _context2.stop(); return _context2.stop();
} }
@ -29152,7 +29141,7 @@ function _loadSvgString() {
_loadSvgString = _asyncToGenerator( _loadSvgString = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee23(str) { regeneratorRuntime.mark(function _callee23(str) {
var _ref46, var _ref47,
noAlert, noAlert,
success, success,
_args23 = arguments; _args23 = arguments;
@ -29161,7 +29150,7 @@ function _loadSvgString() {
while (1) { while (1) {
switch (_context23.prev = _context23.next) { switch (_context23.prev = _context23.next) {
case 0: case 0:
_ref46 = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {}, noAlert = _ref46.noAlert; _ref47 = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {}, noAlert = _ref47.noAlert;
success = svgCanvas.setSvgString(str) !== false; success = svgCanvas.setSvgString(str) !== false;
if (!success) { if (!success) {
@ -29273,16 +29262,16 @@ function getImportLocale(_ref) {
* @param {boolean} [mayBeEmpty] If value may be falsey. * @param {boolean} [mayBeEmpty] If value may be falsey.
* @returns {string|void} If val is missing or falsey and `mayBeEmpty` is not set, the * @returns {string|void} If val is missing or falsey and `mayBeEmpty` is not set, the
* value of the previously stored preference will be returned. * value of the previously stored preference will be returned.
* @todo Can we change setting on the jQuery namespace (onto editor) to avoid conflicts?
* @todo Review whether any remaining existing direct references to * @todo Review whether any remaining existing direct references to
* getting `curPrefs` can be changed to use `$.pref()` getting to ensure * getting `curPrefs` can be changed to use `svgEditor.pref()` getting to ensure
* `defaultPrefs` fallback (also for sake of `allowInitialUserOverride`); specifically, `bkgd_color` could be changed so that * `defaultPrefs` fallback (also for sake of `allowInitialUserOverride`);
* the pref dialog has a button to auto-calculate background, but otherwise uses `$.pref()` to be able to get default prefs * specifically, `bkgd_color` could be changed so that the pref dialog has a
* or overridable settings * button to auto-calculate background, but otherwise uses `svgEditor.pref()` to
* be able to get default prefs or overridable settings
*/ */
$$b.pref = function (key, val, mayBeEmpty) { editor.pref = function (key, val, mayBeEmpty) {
if (mayBeEmpty || val) { if (mayBeEmpty || val) {
curPrefs[key] = val; curPrefs[key] = val;
/** /**
@ -29411,7 +29400,7 @@ editor.setConfig = function (opts, cfgCfg) {
if (cfgCfg.allowInitialUserOverride === true) { if (cfgCfg.allowInitialUserOverride === true) {
defaultPrefs[key] = val; defaultPrefs[key] = val;
} else { } else {
$$b.pref(key, val); editor.pref(key, val);
} }
} else if (['extensions', 'stylesheets', 'allowedOrigins'].includes(key)) { } else if (['extensions', 'stylesheets', 'allowedOrigins'].includes(key)) {
if (cfgCfg.overwrite === false && (curConfig.preventAllURLConfig || ['allowedOrigins', 'stylesheets'].includes(key) || key === 'extensions' && curConfig.lockExtensions)) { if (cfgCfg.overwrite === false && (curConfig.preventAllURLConfig || ['allowedOrigins', 'stylesheets'].includes(key) || key === 'extensions' && curConfig.lockExtensions)) {
@ -29623,7 +29612,6 @@ editor.init = function () {
(function () { (function () {
// Load config/data from URL if given // Load config/data from URL if given
var src, qstr;
urldata = $$b.deparam.querystring(true); urldata = $$b.deparam.querystring(true);
if (!$$b.isEmptyObject(urldata)) { if (!$$b.isEmptyObject(urldata)) {
@ -29656,21 +29644,26 @@ editor.init = function () {
setupCurConfig(); setupCurConfig();
if (!curConfig.preventURLContentLoading) { if (!curConfig.preventURLContentLoading) {
src = urldata.source; var _urldata = urldata,
qstr = $$b.param.querystring(); source = _urldata.source;
if (!src) { if (!source) {
// urldata.source may have been null if it ended with '=' // urldata.source may have been null if it ended with '='
if (qstr.includes('source=data:')) { var _ref4 = new URL(location),
src = qstr.match(/source=(data:[^&]*)/)[1]; // ({src} = qstr.match(/source=(?<src>data:[^&]*)/).groups); searchParams = _ref4.searchParams;
var src = searchParams.get('source');
if (src.startsWith('data:')) {
source = src;
} }
} }
if (src) { if (source) {
if (src.startsWith('data:')) { if (source.startsWith('data:')) {
editor.loadFromDataURI(src); editor.loadFromDataURI(source);
} else { } else {
editor.loadFromString(src); editor.loadFromString(source);
} }
return; return;
@ -29725,22 +29718,22 @@ editor.init = function () {
var extAndLocaleFunc = var extAndLocaleFunc =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref4 = _asyncToGenerator( var _ref5 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee3() { regeneratorRuntime.mark(function _callee3() {
var _ref5, langParam, langData, _uiStrings$common, ok, cancel; var _ref6, langParam, langData, _uiStrings$common, ok, cancel;
return regeneratorRuntime.wrap(function _callee3$(_context3) { return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) { while (1) {
switch (_context3.prev = _context3.next) { switch (_context3.prev = _context3.next) {
case 0: case 0:
_context3.next = 2; _context3.next = 2;
return editor.putLocale(null, goodLangs, curConfig); return editor.putLocale(editor.pref('lang'), goodLangs, curConfig);
case 2: case 2:
_ref5 = _context3.sent; _ref6 = _context3.sent;
langParam = _ref5.langParam; langParam = _ref6.langParam;
langData = _ref5.langData; langData = _ref6.langData;
_context3.next = 7; _context3.next = 7;
return setLang(langParam, langData); return setLang(langParam, langData);
@ -29757,7 +29750,7 @@ editor.init = function () {
return Promise.all(curConfig.extensions.map( return Promise.all(curConfig.extensions.map(
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref6 = _asyncToGenerator( var _ref7 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee2(extname) { regeneratorRuntime.mark(function _callee2(extname) {
var extName, url, imported, _imported$name, _name2, init, importLocale; var extName, url, imported, _imported$name, _name2, init, importLocale;
@ -29825,7 +29818,7 @@ editor.init = function () {
})); }));
return function (_x2) { return function (_x2) {
return _ref6.apply(this, arguments); return _ref7.apply(this, arguments);
}; };
}())); }()));
@ -29877,7 +29870,7 @@ editor.init = function () {
})); }));
return function extAndLocaleFunc() { return function extAndLocaleFunc() {
return _ref4.apply(this, arguments); return _ref5.apply(this, arguments);
}; };
}(); }();
@ -30011,7 +30004,7 @@ editor.init = function () {
scaleElements(elems, scale); scaleElements(elems, scale);
hiddenPs.css('visibility', 'visible').hide(); // return; hiddenPs.css('visibility', 'visible').hide(); // return;
$$b.pref('iconsize', size); editor.pref('iconsize', size);
$$b('#iconsize').val(size); // Change icon size $$b('#iconsize').val(size); // Change icon size
// $('.tool_button, .push_button, .tool_button_current, .disabled, .icon_label, #url_notice, #tool_open') // $('.tool_button, .push_button, .tool_button_current, .disabled, .icon_label, #url_notice, #tool_open')
// .find('> svg, > img').each(function () { // .find('> svg, > img').each(function () {
@ -30371,7 +30364,7 @@ editor.init = function () {
while (1) { while (1) {
switch (_context4.prev = _context4.next) { switch (_context4.prev = _context4.next) {
case 0: case 0:
getStylesheetPriority = function _ref8(stylesheetFile) { getStylesheetPriority = function _ref9(stylesheetFile) {
switch (stylesheetFile) { switch (stylesheetFile) {
case 'jgraduate/css/jPicker.css': case 'jgraduate/css/jPicker.css':
return 1; return 1;
@ -30399,7 +30392,7 @@ editor.init = function () {
minHeight = tleft.offset().top + tleft.outerHeight(); minHeight = tleft.offset().top + tleft.outerHeight();
} }
size = $$b.pref('iconsize'); size = editor.pref('iconsize');
editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins
$$b('.tools_flyout').each(function () { $$b('.tools_flyout').each(function () {
@ -30446,10 +30439,10 @@ editor.init = function () {
_context4.next = 11; _context4.next = 11;
return loadStylesheets(stylesheets, { return loadStylesheets(stylesheets, {
acceptErrors: function acceptErrors(_ref7) { acceptErrors: function acceptErrors(_ref8) {
var stylesheetURL = _ref7.stylesheetURL, var stylesheetURL = _ref8.stylesheetURL,
reject = _ref7.reject, reject = _ref8.reject,
resolve = _ref7.resolve; resolve = _ref8.resolve;
if ($$b.loadingStylesheets.includes(stylesheetURL)) { if ($$b.loadingStylesheets.includes(stylesheetURL)) {
reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL))); reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL)));
@ -30736,7 +30729,7 @@ editor.init = function () {
a.click(); // Alert will only appear the first time saved OR the a.click(); // Alert will only appear the first time saved OR the
// first time the bug is encountered // first time the bug is encountered
var done = $$b.pref('save_notice_done'); var done = editor.pref('save_notice_done');
if (done !== 'all') { if (done !== 'all') {
var note = uiStrings$1.notification.saveFromBrowser.replace('%s', 'SVG'); // Check if FF and has <defs/> var note = uiStrings$1.notification.saveFromBrowser.replace('%s', 'SVG'); // Check if FF and has <defs/>
@ -30745,13 +30738,13 @@ editor.init = function () {
if (svg.includes('<defs')) { if (svg.includes('<defs')) {
// warning about Mozilla bug #308590 when applicable (seems to be fixed now in Feb 2013) // warning about Mozilla bug #308590 when applicable (seems to be fixed now in Feb 2013)
note += '\n\n' + uiStrings$1.notification.defsFailOnSave; note += '\n\n' + uiStrings$1.notification.defsFailOnSave;
$$b.pref('save_notice_done', 'all'); editor.pref('save_notice_done', 'all');
done = 'all'; done = 'all';
} else { } else {
$$b.pref('save_notice_done', 'part'); editor.pref('save_notice_done', 'part');
} }
} else { } else {
$$b.pref('save_notice_done', 'all'); editor.pref('save_notice_done', 'all');
} }
if (done !== 'part') { if (done !== 'part') {
@ -30779,7 +30772,7 @@ editor.init = function () {
} }
exportWindow.location.href = data.bloburl || data.datauri; exportWindow.location.href = data.bloburl || data.datauri;
var done = $$b.pref('export_notice_done'); var done = editor.pref('export_notice_done');
if (done !== 'all') { if (done !== 'all') {
var note = uiStrings$1.notification.saveFromBrowser.replace('%s', data.type); // Check if there are issues var note = uiStrings$1.notification.saveFromBrowser.replace('%s', data.type); // Check if there are issues
@ -30791,7 +30784,7 @@ editor.init = function () {
// May want to find a way to deal with that without annoying the user // May want to find a way to deal with that without annoying the user
$$b.pref('export_notice_done', 'all'); editor.pref('export_notice_done', 'all');
exportWindow.alert(note); exportWindow.alert(note);
} }
}; };
@ -30921,9 +30914,9 @@ editor.init = function () {
function setBackground(color, url) { function setBackground(color, url) {
// if (color == $.pref('bkgd_color') && url == $.pref('bkgd_url')) { return; } // if (color == editor.pref('bkgd_color') && url == editor.pref('bkgd_url')) { return; }
$$b.pref('bkgd_color', color); editor.pref('bkgd_color', color);
$$b.pref('bkgd_url', url, true); // This should be done in svgcanvas.js for the borderRect fill editor.pref('bkgd_url', url, true); // This should be done in svgcanvas.js for the borderRect fill
svgCanvas.setBackground(color, url); svgCanvas.setBackground(color, url);
} }
@ -30947,8 +30940,8 @@ editor.init = function () {
_promptImgURL = _asyncToGenerator( _promptImgURL = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee18() { regeneratorRuntime.mark(function _callee18() {
var _ref32, var _ref33,
_ref32$cancelDeletes, _ref33$cancelDeletes,
cancelDeletes, cancelDeletes,
curhref, curhref,
url, url,
@ -30958,7 +30951,7 @@ editor.init = function () {
while (1) { while (1) {
switch (_context18.prev = _context18.next) { switch (_context18.prev = _context18.next) {
case 0: case 0:
_ref32 = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {}, _ref32$cancelDeletes = _ref32.cancelDeletes, cancelDeletes = _ref32$cancelDeletes === void 0 ? false : _ref32$cancelDeletes; _ref33 = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {}, _ref33$cancelDeletes = _ref33.cancelDeletes, cancelDeletes = _ref33$cancelDeletes === void 0 ? false : _ref33$cancelDeletes;
curhref = svgCanvas.getHref(selectedElement); curhref = svgCanvas.getHref(selectedElement);
curhref = curhref.startsWith('data:') ? '' : curhref; curhref = curhref.startsWith('data:') ? '' : curhref;
_context18.next = 5; _context18.next = 5;
@ -31966,10 +31959,10 @@ editor.init = function () {
// Get this button's options // Get this button's options
var idSel = '#' + this.getAttribute('id'); var idSel = '#' + this.getAttribute('id');
var _Object$entries$find = Object.entries(btnOpts).find(function (_ref9) { var _Object$entries$find = Object.entries(btnOpts).find(function (_ref10) {
var _ref10 = _slicedToArray(_ref9, 2), var _ref11 = _slicedToArray(_ref10, 2),
_ = _ref10[0], _ = _ref11[0],
sel = _ref10[1].sel; sel = _ref11[1].sel;
return sel === idSel; return sel === idSel;
}), }),
@ -31996,10 +31989,10 @@ editor.init = function () {
if (ev.type === 'keydown') { if (ev.type === 'keydown') {
var flyoutIsSelected = $$b(options.parent + '_show').hasClass('tool_button_current'); var flyoutIsSelected = $$b(options.parent + '_show').hasClass('tool_button_current');
var currentOperation = $$b(options.parent + '_show').attr('data-curopt'); var currentOperation = $$b(options.parent + '_show').attr('data-curopt');
Object.entries(holders[opts.parent]).some(function (_ref11) { Object.entries(holders[opts.parent]).some(function (_ref12) {
var _ref12 = _slicedToArray(_ref11, 2), var _ref13 = _slicedToArray(_ref12, 2),
j = _ref12[0], j = _ref13[0],
tool = _ref12[1]; tool = _ref13[1];
if (tool.sel !== currentOperation) { if (tool.sel !== currentOperation) {
return false; return false;
@ -32212,7 +32205,7 @@ editor.init = function () {
var extAdded = var extAdded =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref13 = _asyncToGenerator( var _ref14 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee5(win, ext) { regeneratorRuntime.mark(function _callee5(win, ext) {
var cbCalled, resizeDone, lang, prepResize, runCallback, btnSelects, svgicons, fallbackObj, altsObj, placementObj, holders; var cbCalled, resizeDone, lang, prepResize, runCallback, btnSelects, svgicons, fallbackObj, altsObj, placementObj, holders;
@ -32220,7 +32213,7 @@ editor.init = function () {
while (1) { while (1) {
switch (_context5.prev = _context5.next) { switch (_context5.prev = _context5.next) {
case 0: case 0:
prepResize = function _ref14() { prepResize = function _ref15() {
if (resizeTimer) { if (resizeTimer) {
clearTimeout(resizeTimer); clearTimeout(resizeTimer);
resizeTimer = null; resizeTimer = null;
@ -32229,7 +32222,7 @@ editor.init = function () {
if (!resizeDone) { if (!resizeDone) {
resizeTimer = setTimeout(function () { resizeTimer = setTimeout(function () {
resizeDone = true; resizeDone = true;
setIconSize($$b.pref('iconsize')); setIconSize(editor.pref('iconsize'));
}, 50); }, 50);
} }
}; };
@ -32256,7 +32249,7 @@ editor.init = function () {
} }
// We check for this since the "lang" pref could have been set by storage // We check for this since the "lang" pref could have been set by storage
lang = $$b.pref('lang'); lang = editor.pref('lang');
_context5.next = 10; _context5.next = 10;
return ext.langReady({ return ext.langReady({
lang: lang, lang: lang,
@ -32673,7 +32666,7 @@ editor.init = function () {
callback: function callback(icons) { callback: function callback(icons) {
// Non-ideal hack to make the icon match the current size // Non-ideal hack to make the icon match the current size
// if (curPrefs.iconsize && curPrefs.iconsize !== 'm') { // if (curPrefs.iconsize && curPrefs.iconsize !== 'm') {
if ($$b.pref('iconsize') !== 'm') { if (editor.pref('iconsize') !== 'm') {
prepResize(); prepResize();
} }
@ -32695,7 +32688,7 @@ editor.init = function () {
})); }));
return function extAdded(_x4, _x5) { return function extAdded(_x4, _x5) {
return _ref13.apply(this, arguments); return _ref14.apply(this, arguments);
}; };
}(); }();
/** /**
@ -32770,9 +32763,9 @@ editor.init = function () {
* @listens module:svgcanvas.SvgCanvas#event:updateCanvas * @listens module:svgcanvas.SvgCanvas#event:updateCanvas
* @returns {void} * @returns {void}
*/ */
function (win, _ref15) { function (win, _ref16) {
var center = _ref15.center, var center = _ref16.center,
newCtr = _ref15.newCtr; newCtr = _ref16.newCtr;
updateCanvas(center, newCtr); updateCanvas(center, newCtr);
}); });
svgCanvas.bind('contextset', contextChanged); svgCanvas.bind('contextset', contextChanged);
@ -32801,8 +32794,8 @@ editor.init = function () {
$$b(this).addClass(curBg); $$b(this).addClass(curBg);
}); });
}); });
setBackground($$b.pref('bkgd_color'), $$b.pref('bkgd_url')); setBackground(editor.pref('bkgd_color'), editor.pref('bkgd_url'));
$$b('#image_save_opts input').val([$$b.pref('img_save')]); $$b('#image_save_opts input').val([editor.pref('img_save')]);
/** /**
* @type {module:jQuerySpinButton.ValueCallback} * @type {module:jQuerySpinButton.ValueCallback}
*/ */
@ -33653,7 +33646,7 @@ editor.init = function () {
var makeHyperlink = var makeHyperlink =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref17 = _asyncToGenerator( var _ref18 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee7() { regeneratorRuntime.mark(function _callee7() {
var url; var url;
@ -33685,7 +33678,7 @@ editor.init = function () {
})); }));
return function makeHyperlink() { return function makeHyperlink() {
return _ref17.apply(this, arguments); return _ref18.apply(this, arguments);
}; };
}(); }();
/** /**
@ -33808,7 +33801,7 @@ editor.init = function () {
var clickClear = var clickClear =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref18 = _asyncToGenerator( var _ref19 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee8() { regeneratorRuntime.mark(function _callee8() {
var _curConfig$dimensions, x, y, ok; var _curConfig$dimensions, x, y, ok;
@ -33851,7 +33844,7 @@ editor.init = function () {
})); }));
return function clickClear() { return function clickClear() {
return _ref18.apply(this, arguments); return _ref19.apply(this, arguments);
}; };
}(); }();
/** /**
@ -33885,7 +33878,7 @@ editor.init = function () {
var clickSave = function clickSave() { var clickSave = function clickSave() {
// In the future, more options can be provided here // In the future, more options can be provided here
var saveOpts = { var saveOpts = {
images: $$b.pref('img_save'), images: editor.pref('img_save'),
round_digits: 6 round_digits: 6
}; };
svgCanvas.save(saveOpts); svgCanvas.save(saveOpts);
@ -33900,7 +33893,7 @@ editor.init = function () {
var clickExport = var clickExport =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref19 = _asyncToGenerator( var _ref20 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee9() { regeneratorRuntime.mark(function _callee9() {
var imgType, exportWindowName, openExportWindow, chrome, quality; var imgType, exportWindowName, openExportWindow, chrome, quality;
@ -33908,7 +33901,7 @@ editor.init = function () {
while (1) { while (1) {
switch (_context9.prev = _context9.next) { switch (_context9.prev = _context9.next) {
case 0: case 0:
openExportWindow = function _ref20() { openExportWindow = function _ref21() {
var loadingImage = uiStrings$1.notification.loadingImage; var loadingImage = uiStrings$1.notification.loadingImage;
if (curConfig.exportWindowType === 'new') { if (curConfig.exportWindowType === 'new') {
@ -33999,7 +33992,7 @@ editor.init = function () {
})); }));
return function clickExport() { return function clickExport() {
return _ref19.apply(this, arguments); return _ref20.apply(this, arguments);
}; };
}(); }();
/** /**
@ -34123,7 +34116,7 @@ editor.init = function () {
docprops = true; // This selects the correct radio button by using the array notation docprops = true; // This selects the correct radio button by using the array notation
$$b('#image_save_opts input').val([$$b.pref('img_save')]); // update resolution option with actual resolution $$b('#image_save_opts input').val([editor.pref('img_save')]); // update resolution option with actual resolution
var res = svgCanvas.getResolution(); var res = svgCanvas.getResolution();
@ -34152,7 +34145,7 @@ editor.init = function () {
$$b('#main_menu').hide(); // Update background color with current one $$b('#main_menu').hide(); // Update background color with current one
var canvasBg = curPrefs.bkgd_color; var canvasBg = curPrefs.bkgd_color;
var url = $$b.pref('bkgd_url'); var url = editor.pref('bkgd_url');
blocks.each(function () { blocks.each(function () {
var blk = $$b(this); var blk = $$b(this);
var isBg = blk.css('background-color') === canvasBg; var isBg = blk.css('background-color') === canvasBg;
@ -34205,7 +34198,7 @@ editor.init = function () {
var saveSourceEditor = var saveSourceEditor =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref21 = _asyncToGenerator( var _ref22 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee10() { regeneratorRuntime.mark(function _callee10() {
var saveChanges, ok; var saveChanges, ok;
@ -34265,7 +34258,7 @@ editor.init = function () {
})); }));
return function saveSourceEditor() { return function saveSourceEditor() {
return _ref21.apply(this, arguments); return _ref22.apply(this, arguments);
}; };
}(); }();
/** /**
@ -34278,7 +34271,7 @@ editor.init = function () {
$$b('#svg_docprops').hide(); $$b('#svg_docprops').hide();
$$b('#canvas_width,#canvas_height').removeAttr('disabled'); $$b('#canvas_width,#canvas_height').removeAttr('disabled');
$$b('#resolution')[0].selectedIndex = 0; $$b('#resolution')[0].selectedIndex = 0;
$$b('#image_save_opts input').val([$$b.pref('img_save')]); $$b('#image_save_opts input').val([editor.pref('img_save')]);
docprops = false; docprops = false;
}; };
/** /**
@ -34335,7 +34328,7 @@ editor.init = function () {
} // Set image save option } // Set image save option
$$b.pref('img_save', $$b('#image_save_opts :checked').val()); editor.pref('img_save', $$b('#image_save_opts :checked').val());
updateCanvas(); updateCanvas();
hideDocProperties(); hideDocProperties();
return true; return true;
@ -34352,7 +34345,7 @@ editor.init = function () {
_asyncToGenerator( _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee11() { regeneratorRuntime.mark(function _callee11() {
var color, lang, _ref23, langParam, langData; var color, lang, _ref24, langParam, langData;
return regeneratorRuntime.wrap(function _callee11$(_context11) { return regeneratorRuntime.wrap(function _callee11$(_context11) {
while (1) { while (1) {
@ -34364,7 +34357,7 @@ editor.init = function () {
lang = $$b('#lang_select').val(); lang = $$b('#lang_select').val();
if (!(lang !== $$b.pref('lang'))) { if (!(lang && lang !== editor.pref('lang'))) {
_context11.next = 11; _context11.next = 11;
break; break;
} }
@ -34373,9 +34366,9 @@ editor.init = function () {
return editor.putLocale(lang, goodLangs, curConfig); return editor.putLocale(lang, goodLangs, curConfig);
case 6: case 6:
_ref23 = _context11.sent; _ref24 = _context11.sent;
langParam = _ref23.langParam; langParam = _ref24.langParam;
langData = _ref23.langData; langData = _ref24.langData;
_context11.next = 11; _context11.next = 11;
return setLang(langParam, langData); return setLang(langParam, langData);
@ -34415,7 +34408,7 @@ editor.init = function () {
var cancelOverlays = var cancelOverlays =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref24 = _asyncToGenerator( var _ref25 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee12() { regeneratorRuntime.mark(function _callee12() {
var ok; var ok;
@ -34486,7 +34479,7 @@ editor.init = function () {
})); }));
return function cancelOverlays() { return function cancelOverlays() {
return _ref24.apply(this, arguments); return _ref25.apply(this, arguments);
}; };
}(); }();
@ -34814,7 +34807,7 @@ editor.init = function () {
// Disable option // Disable option
$$b('#image_save_opts [value=embed]').attr('disabled', 'disabled'); $$b('#image_save_opts [value=embed]').attr('disabled', 'disabled');
$$b('#image_save_opts input').val(['ref']); $$b('#image_save_opts input').val(['ref']);
$$b.pref('img_save', 'ref'); editor.pref('img_save', 'ref');
$$b('#image_opt_embed').css('color', '#666').attr('title', uiStrings$1.notification.featNotSupported); $$b('#image_opt_embed').css('color', '#666').attr('title', uiStrings$1.notification.featNotSupported);
} }
}); });
@ -36228,8 +36221,8 @@ editor.init = function () {
// bitmap handling // bitmap handling
reader = new FileReader(); reader = new FileReader();
reader.onloadend = function (_ref27) { reader.onloadend = function (_ref28) {
var result = _ref27.target.result; var result = _ref28.target.result;
/** /**
* Insert the new image until we know its dimensions. * Insert the new image until we know its dimensions.
@ -36281,7 +36274,7 @@ editor.init = function () {
var open = $$b('<input type="file">').change( var open = $$b('<input type="file">').change(
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref28 = _asyncToGenerator( var _ref29 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee16(e) { regeneratorRuntime.mark(function _callee16(e) {
var ok, reader; var ok, reader;
@ -36312,15 +36305,15 @@ editor.init = function () {
reader.onloadend = reader.onloadend =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref30 = _asyncToGenerator( var _ref31 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee15(_ref29) { regeneratorRuntime.mark(function _callee15(_ref30) {
var target; var target;
return regeneratorRuntime.wrap(function _callee15$(_context15) { return regeneratorRuntime.wrap(function _callee15$(_context15) {
while (1) { while (1) {
switch (_context15.prev = _context15.next) { switch (_context15.prev = _context15.next) {
case 0: case 0:
target = _ref29.target; target = _ref30.target;
_context15.next = 3; _context15.next = 3;
return loadSvgString(target.result); return loadSvgString(target.result);
@ -36336,7 +36329,7 @@ editor.init = function () {
})); }));
return function (_x7) { return function (_x7) {
return _ref30.apply(this, arguments); return _ref31.apply(this, arguments);
}; };
}(); }();
@ -36352,7 +36345,7 @@ editor.init = function () {
})); }));
return function (_x6) { return function (_x6) {
return _ref28.apply(this, arguments); return _ref29.apply(this, arguments);
}; };
}()); }());
$$b('#tool_open').show(); $$b('#tool_open').show();
@ -36383,7 +36376,7 @@ editor.init = function () {
var setLang = editor.setLang = var setLang = editor.setLang =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref31 = _asyncToGenerator( var _ref32 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee17(lang, allStrings) { regeneratorRuntime.mark(function _callee17(lang, allStrings) {
var oldLayerName, renameLayer, elems; var oldLayerName, renameLayer, elems;
@ -36392,7 +36385,7 @@ editor.init = function () {
switch (_context17.prev = _context17.next) { switch (_context17.prev = _context17.next) {
case 0: case 0:
editor.langChanged = true; editor.langChanged = true;
$$b.pref('lang', lang); editor.pref('lang', lang);
$$b('#lang_select').val(lang); $$b('#lang_select').val(lang);
if (allStrings) { if (allStrings) {
@ -36491,7 +36484,7 @@ editor.init = function () {
})); }));
return function (_x8, _x9) { return function (_x8, _x9) {
return _ref31.apply(this, arguments); return _ref32.apply(this, arguments);
}; };
}(); }();
@ -36585,9 +36578,9 @@ regeneratorRuntime.mark(function _callee20() {
case 0: case 0:
_context20.prev = 0; _context20.prev = 0;
_context20.next = 3; _context20.next = 3;
return Promise.all(callbacks.map(function (_ref34) { return Promise.all(callbacks.map(function (_ref35) {
var _ref35 = _slicedToArray(_ref34, 1), var _ref36 = _slicedToArray(_ref35, 1),
cb = _ref35[0]; cb = _ref36[0];
return cb(); // eslint-disable-line promise/prefer-await-to-callbacks return cb(); // eslint-disable-line promise/prefer-await-to-callbacks
})); }));
@ -36599,18 +36592,18 @@ regeneratorRuntime.mark(function _callee20() {
case 5: case 5:
_context20.prev = 5; _context20.prev = 5;
_context20.t0 = _context20["catch"](0); _context20.t0 = _context20["catch"](0);
callbacks.forEach(function (_ref36) { callbacks.forEach(function (_ref37) {
var _ref37 = _slicedToArray(_ref36, 3), var _ref38 = _slicedToArray(_ref37, 3),
reject = _ref37[2]; reject = _ref38[2];
reject(); reject();
}); });
throw _context20.t0; throw _context20.t0;
case 9: case 9:
callbacks.forEach(function (_ref38) { callbacks.forEach(function (_ref39) {
var _ref39 = _slicedToArray(_ref38, 2), var _ref40 = _slicedToArray(_ref39, 2),
resolve = _ref39[1]; resolve = _ref40[1];
resolve(); resolve();
}); });
@ -36631,8 +36624,8 @@ regeneratorRuntime.mark(function _callee20() {
*/ */
editor.loadFromString = function (str) { editor.loadFromString = function (str) {
var _ref40 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, var _ref41 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref40.noAlert; noAlert = _ref41.noAlert;
return editor.ready( return editor.ready(
/*#__PURE__*/ /*#__PURE__*/
@ -36702,9 +36695,9 @@ editor.disableUI = function (featList) {// $(function () {
editor.loadFromURL = function (url) { editor.loadFromURL = function (url) {
var _ref42 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, var _ref43 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
cache = _ref42.cache, cache = _ref43.cache,
noAlert = _ref42.noAlert; noAlert = _ref43.noAlert;
return editor.ready(function () { return editor.ready(function () {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
@ -36753,8 +36746,8 @@ editor.loadFromURL = function (url) {
editor.loadFromDataURI = function (str) { editor.loadFromDataURI = function (str) {
var _ref43 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, var _ref44 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref43.noAlert; noAlert = _ref44.noAlert;
return editor.ready(function () { return editor.ready(function () {
var base64 = false; var base64 = false;
@ -36811,9 +36804,9 @@ var messageQueue = [];
* @returns {void} * @returns {void}
*/ */
var messageListener = function messageListener(_ref44) { var messageListener = function messageListener(_ref45) {
var data = _ref44.data, var data = _ref45.data,
origin = _ref44.origin; origin = _ref45.origin;
// eslint-disable-line no-shadow // eslint-disable-line no-shadow
// console.log('data, origin, extensionsAdded', data, origin, extensionsAdded); // console.log('data, origin, extensionsAdded', data, origin, extensionsAdded);
var messageObj = { var messageObj = {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

259
dist/index-umd.js vendored
View File

@ -28621,44 +28621,33 @@
case 0: case 0:
if (givenParam) { if (givenParam) {
langParam = givenParam; langParam = givenParam;
} else { } else if (navigator.userLanguage) {
langParam = $$a.pref('lang');
if (!langParam) {
if (navigator.userLanguage) {
// Explorer // Explorer
langParam = navigator.userLanguage; langParam = navigator.userLanguage;
} else if (navigator.language) { } else if (navigator.language) {
// FF, Opera, ... // FF, Opera, ...
langParam = navigator.language; langParam = navigator.language;
} }
}
console.log('Lang: ' + langParam); // eslint-disable-line no-console console.log('Lang: ' + langParam); // eslint-disable-line no-console
// Set to English if language is not in list of good langs // Set to English if language is not in list of good langs
if (!goodLangs.includes(langParam) && langParam !== 'test') { if (!goodLangs.includes(langParam) && langParam !== 'test') {
langParam = 'en'; langParam = 'en';
} // don't bother on first run if language is English
// The following line prevents setLang from running
// extensions which depend on updated uiStrings,
// so commenting it out.
// if (langParam.startsWith('en')) {return;}
} }
url = conf.langPath + 'lang.' + langParam + '.js'; url = conf.langPath + 'lang.' + langParam + '.js';
_context2.t0 = readLang; _context2.t0 = readLang;
_context2.next = 5; _context2.next = 7;
return importSetGlobalDefault(url, { return importSetGlobalDefault(url, {
global: 'svgEditorLang_' + langParam.replace(/-/g, '_') global: 'svgEditorLang_' + langParam.replace(/-/g, '_')
}); });
case 5: case 7:
_context2.t1 = _context2.sent; _context2.t1 = _context2.sent;
return _context2.abrupt("return", (0, _context2.t0)(_context2.t1)); return _context2.abrupt("return", (0, _context2.t0)(_context2.t1));
case 7: case 9:
case "end": case "end":
return _context2.stop(); return _context2.stop();
} }
@ -29158,7 +29147,7 @@
_loadSvgString = _asyncToGenerator( _loadSvgString = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee23(str) { regeneratorRuntime.mark(function _callee23(str) {
var _ref46, var _ref47,
noAlert, noAlert,
success, success,
_args23 = arguments; _args23 = arguments;
@ -29167,7 +29156,7 @@
while (1) { while (1) {
switch (_context23.prev = _context23.next) { switch (_context23.prev = _context23.next) {
case 0: case 0:
_ref46 = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {}, noAlert = _ref46.noAlert; _ref47 = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {}, noAlert = _ref47.noAlert;
success = svgCanvas.setSvgString(str) !== false; success = svgCanvas.setSvgString(str) !== false;
if (!success) { if (!success) {
@ -29279,16 +29268,16 @@
* @param {boolean} [mayBeEmpty] If value may be falsey. * @param {boolean} [mayBeEmpty] If value may be falsey.
* @returns {string|void} If val is missing or falsey and `mayBeEmpty` is not set, the * @returns {string|void} If val is missing or falsey and `mayBeEmpty` is not set, the
* value of the previously stored preference will be returned. * value of the previously stored preference will be returned.
* @todo Can we change setting on the jQuery namespace (onto editor) to avoid conflicts?
* @todo Review whether any remaining existing direct references to * @todo Review whether any remaining existing direct references to
* getting `curPrefs` can be changed to use `$.pref()` getting to ensure * getting `curPrefs` can be changed to use `svgEditor.pref()` getting to ensure
* `defaultPrefs` fallback (also for sake of `allowInitialUserOverride`); specifically, `bkgd_color` could be changed so that * `defaultPrefs` fallback (also for sake of `allowInitialUserOverride`);
* the pref dialog has a button to auto-calculate background, but otherwise uses `$.pref()` to be able to get default prefs * specifically, `bkgd_color` could be changed so that the pref dialog has a
* or overridable settings * button to auto-calculate background, but otherwise uses `svgEditor.pref()` to
* be able to get default prefs or overridable settings
*/ */
$$b.pref = function (key, val, mayBeEmpty) { editor.pref = function (key, val, mayBeEmpty) {
if (mayBeEmpty || val) { if (mayBeEmpty || val) {
curPrefs[key] = val; curPrefs[key] = val;
/** /**
@ -29417,7 +29406,7 @@
if (cfgCfg.allowInitialUserOverride === true) { if (cfgCfg.allowInitialUserOverride === true) {
defaultPrefs[key] = val; defaultPrefs[key] = val;
} else { } else {
$$b.pref(key, val); editor.pref(key, val);
} }
} else if (['extensions', 'stylesheets', 'allowedOrigins'].includes(key)) { } else if (['extensions', 'stylesheets', 'allowedOrigins'].includes(key)) {
if (cfgCfg.overwrite === false && (curConfig.preventAllURLConfig || ['allowedOrigins', 'stylesheets'].includes(key) || key === 'extensions' && curConfig.lockExtensions)) { if (cfgCfg.overwrite === false && (curConfig.preventAllURLConfig || ['allowedOrigins', 'stylesheets'].includes(key) || key === 'extensions' && curConfig.lockExtensions)) {
@ -29629,7 +29618,6 @@
(function () { (function () {
// Load config/data from URL if given // Load config/data from URL if given
var src, qstr;
urldata = $$b.deparam.querystring(true); urldata = $$b.deparam.querystring(true);
if (!$$b.isEmptyObject(urldata)) { if (!$$b.isEmptyObject(urldata)) {
@ -29662,21 +29650,26 @@
setupCurConfig(); setupCurConfig();
if (!curConfig.preventURLContentLoading) { if (!curConfig.preventURLContentLoading) {
src = urldata.source; var _urldata = urldata,
qstr = $$b.param.querystring(); source = _urldata.source;
if (!src) { if (!source) {
// urldata.source may have been null if it ended with '=' // urldata.source may have been null if it ended with '='
if (qstr.includes('source=data:')) { var _ref4 = new URL(location),
src = qstr.match(/source=(data:[^&]*)/)[1]; // ({src} = qstr.match(/source=(?<src>data:[^&]*)/).groups); searchParams = _ref4.searchParams;
var src = searchParams.get('source');
if (src.startsWith('data:')) {
source = src;
} }
} }
if (src) { if (source) {
if (src.startsWith('data:')) { if (source.startsWith('data:')) {
editor.loadFromDataURI(src); editor.loadFromDataURI(source);
} else { } else {
editor.loadFromString(src); editor.loadFromString(source);
} }
return; return;
@ -29731,22 +29724,22 @@
var extAndLocaleFunc = var extAndLocaleFunc =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref4 = _asyncToGenerator( var _ref5 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee3() { regeneratorRuntime.mark(function _callee3() {
var _ref5, langParam, langData, _uiStrings$common, ok, cancel; var _ref6, langParam, langData, _uiStrings$common, ok, cancel;
return regeneratorRuntime.wrap(function _callee3$(_context3) { return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) { while (1) {
switch (_context3.prev = _context3.next) { switch (_context3.prev = _context3.next) {
case 0: case 0:
_context3.next = 2; _context3.next = 2;
return editor.putLocale(null, goodLangs, curConfig); return editor.putLocale(editor.pref('lang'), goodLangs, curConfig);
case 2: case 2:
_ref5 = _context3.sent; _ref6 = _context3.sent;
langParam = _ref5.langParam; langParam = _ref6.langParam;
langData = _ref5.langData; langData = _ref6.langData;
_context3.next = 7; _context3.next = 7;
return setLang(langParam, langData); return setLang(langParam, langData);
@ -29763,7 +29756,7 @@
return Promise.all(curConfig.extensions.map( return Promise.all(curConfig.extensions.map(
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref6 = _asyncToGenerator( var _ref7 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee2(extname) { regeneratorRuntime.mark(function _callee2(extname) {
var extName, url, imported, _imported$name, _name2, init, importLocale; var extName, url, imported, _imported$name, _name2, init, importLocale;
@ -29831,7 +29824,7 @@
})); }));
return function (_x2) { return function (_x2) {
return _ref6.apply(this, arguments); return _ref7.apply(this, arguments);
}; };
}())); }()));
@ -29883,7 +29876,7 @@
})); }));
return function extAndLocaleFunc() { return function extAndLocaleFunc() {
return _ref4.apply(this, arguments); return _ref5.apply(this, arguments);
}; };
}(); }();
@ -30017,7 +30010,7 @@
scaleElements(elems, scale); scaleElements(elems, scale);
hiddenPs.css('visibility', 'visible').hide(); // return; hiddenPs.css('visibility', 'visible').hide(); // return;
$$b.pref('iconsize', size); editor.pref('iconsize', size);
$$b('#iconsize').val(size); // Change icon size $$b('#iconsize').val(size); // Change icon size
// $('.tool_button, .push_button, .tool_button_current, .disabled, .icon_label, #url_notice, #tool_open') // $('.tool_button, .push_button, .tool_button_current, .disabled, .icon_label, #url_notice, #tool_open')
// .find('> svg, > img').each(function () { // .find('> svg, > img').each(function () {
@ -30377,7 +30370,7 @@
while (1) { while (1) {
switch (_context4.prev = _context4.next) { switch (_context4.prev = _context4.next) {
case 0: case 0:
getStylesheetPriority = function _ref8(stylesheetFile) { getStylesheetPriority = function _ref9(stylesheetFile) {
switch (stylesheetFile) { switch (stylesheetFile) {
case 'jgraduate/css/jPicker.css': case 'jgraduate/css/jPicker.css':
return 1; return 1;
@ -30405,7 +30398,7 @@
minHeight = tleft.offset().top + tleft.outerHeight(); minHeight = tleft.offset().top + tleft.outerHeight();
} }
size = $$b.pref('iconsize'); size = editor.pref('iconsize');
editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins
$$b('.tools_flyout').each(function () { $$b('.tools_flyout').each(function () {
@ -30452,10 +30445,10 @@
_context4.next = 11; _context4.next = 11;
return loadStylesheets(stylesheets, { return loadStylesheets(stylesheets, {
acceptErrors: function acceptErrors(_ref7) { acceptErrors: function acceptErrors(_ref8) {
var stylesheetURL = _ref7.stylesheetURL, var stylesheetURL = _ref8.stylesheetURL,
reject = _ref7.reject, reject = _ref8.reject,
resolve = _ref7.resolve; resolve = _ref8.resolve;
if ($$b.loadingStylesheets.includes(stylesheetURL)) { if ($$b.loadingStylesheets.includes(stylesheetURL)) {
reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL))); reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL)));
@ -30742,7 +30735,7 @@
a.click(); // Alert will only appear the first time saved OR the a.click(); // Alert will only appear the first time saved OR the
// first time the bug is encountered // first time the bug is encountered
var done = $$b.pref('save_notice_done'); var done = editor.pref('save_notice_done');
if (done !== 'all') { if (done !== 'all') {
var note = uiStrings$1.notification.saveFromBrowser.replace('%s', 'SVG'); // Check if FF and has <defs/> var note = uiStrings$1.notification.saveFromBrowser.replace('%s', 'SVG'); // Check if FF and has <defs/>
@ -30751,13 +30744,13 @@
if (svg.includes('<defs')) { if (svg.includes('<defs')) {
// warning about Mozilla bug #308590 when applicable (seems to be fixed now in Feb 2013) // warning about Mozilla bug #308590 when applicable (seems to be fixed now in Feb 2013)
note += '\n\n' + uiStrings$1.notification.defsFailOnSave; note += '\n\n' + uiStrings$1.notification.defsFailOnSave;
$$b.pref('save_notice_done', 'all'); editor.pref('save_notice_done', 'all');
done = 'all'; done = 'all';
} else { } else {
$$b.pref('save_notice_done', 'part'); editor.pref('save_notice_done', 'part');
} }
} else { } else {
$$b.pref('save_notice_done', 'all'); editor.pref('save_notice_done', 'all');
} }
if (done !== 'part') { if (done !== 'part') {
@ -30785,7 +30778,7 @@
} }
exportWindow.location.href = data.bloburl || data.datauri; exportWindow.location.href = data.bloburl || data.datauri;
var done = $$b.pref('export_notice_done'); var done = editor.pref('export_notice_done');
if (done !== 'all') { if (done !== 'all') {
var note = uiStrings$1.notification.saveFromBrowser.replace('%s', data.type); // Check if there are issues var note = uiStrings$1.notification.saveFromBrowser.replace('%s', data.type); // Check if there are issues
@ -30797,7 +30790,7 @@
// May want to find a way to deal with that without annoying the user // May want to find a way to deal with that without annoying the user
$$b.pref('export_notice_done', 'all'); editor.pref('export_notice_done', 'all');
exportWindow.alert(note); exportWindow.alert(note);
} }
}; };
@ -30927,9 +30920,9 @@
function setBackground(color, url) { function setBackground(color, url) {
// if (color == $.pref('bkgd_color') && url == $.pref('bkgd_url')) { return; } // if (color == editor.pref('bkgd_color') && url == editor.pref('bkgd_url')) { return; }
$$b.pref('bkgd_color', color); editor.pref('bkgd_color', color);
$$b.pref('bkgd_url', url, true); // This should be done in svgcanvas.js for the borderRect fill editor.pref('bkgd_url', url, true); // This should be done in svgcanvas.js for the borderRect fill
svgCanvas.setBackground(color, url); svgCanvas.setBackground(color, url);
} }
@ -30953,8 +30946,8 @@
_promptImgURL = _asyncToGenerator( _promptImgURL = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee18() { regeneratorRuntime.mark(function _callee18() {
var _ref32, var _ref33,
_ref32$cancelDeletes, _ref33$cancelDeletes,
cancelDeletes, cancelDeletes,
curhref, curhref,
url, url,
@ -30964,7 +30957,7 @@
while (1) { while (1) {
switch (_context18.prev = _context18.next) { switch (_context18.prev = _context18.next) {
case 0: case 0:
_ref32 = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {}, _ref32$cancelDeletes = _ref32.cancelDeletes, cancelDeletes = _ref32$cancelDeletes === void 0 ? false : _ref32$cancelDeletes; _ref33 = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {}, _ref33$cancelDeletes = _ref33.cancelDeletes, cancelDeletes = _ref33$cancelDeletes === void 0 ? false : _ref33$cancelDeletes;
curhref = svgCanvas.getHref(selectedElement); curhref = svgCanvas.getHref(selectedElement);
curhref = curhref.startsWith('data:') ? '' : curhref; curhref = curhref.startsWith('data:') ? '' : curhref;
_context18.next = 5; _context18.next = 5;
@ -31972,10 +31965,10 @@
// Get this button's options // Get this button's options
var idSel = '#' + this.getAttribute('id'); var idSel = '#' + this.getAttribute('id');
var _Object$entries$find = Object.entries(btnOpts).find(function (_ref9) { var _Object$entries$find = Object.entries(btnOpts).find(function (_ref10) {
var _ref10 = _slicedToArray(_ref9, 2), var _ref11 = _slicedToArray(_ref10, 2),
_ = _ref10[0], _ = _ref11[0],
sel = _ref10[1].sel; sel = _ref11[1].sel;
return sel === idSel; return sel === idSel;
}), }),
@ -32002,10 +31995,10 @@
if (ev.type === 'keydown') { if (ev.type === 'keydown') {
var flyoutIsSelected = $$b(options.parent + '_show').hasClass('tool_button_current'); var flyoutIsSelected = $$b(options.parent + '_show').hasClass('tool_button_current');
var currentOperation = $$b(options.parent + '_show').attr('data-curopt'); var currentOperation = $$b(options.parent + '_show').attr('data-curopt');
Object.entries(holders[opts.parent]).some(function (_ref11) { Object.entries(holders[opts.parent]).some(function (_ref12) {
var _ref12 = _slicedToArray(_ref11, 2), var _ref13 = _slicedToArray(_ref12, 2),
j = _ref12[0], j = _ref13[0],
tool = _ref12[1]; tool = _ref13[1];
if (tool.sel !== currentOperation) { if (tool.sel !== currentOperation) {
return false; return false;
@ -32218,7 +32211,7 @@
var extAdded = var extAdded =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref13 = _asyncToGenerator( var _ref14 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee5(win, ext) { regeneratorRuntime.mark(function _callee5(win, ext) {
var cbCalled, resizeDone, lang, prepResize, runCallback, btnSelects, svgicons, fallbackObj, altsObj, placementObj, holders; var cbCalled, resizeDone, lang, prepResize, runCallback, btnSelects, svgicons, fallbackObj, altsObj, placementObj, holders;
@ -32226,7 +32219,7 @@
while (1) { while (1) {
switch (_context5.prev = _context5.next) { switch (_context5.prev = _context5.next) {
case 0: case 0:
prepResize = function _ref14() { prepResize = function _ref15() {
if (resizeTimer) { if (resizeTimer) {
clearTimeout(resizeTimer); clearTimeout(resizeTimer);
resizeTimer = null; resizeTimer = null;
@ -32235,7 +32228,7 @@
if (!resizeDone) { if (!resizeDone) {
resizeTimer = setTimeout(function () { resizeTimer = setTimeout(function () {
resizeDone = true; resizeDone = true;
setIconSize($$b.pref('iconsize')); setIconSize(editor.pref('iconsize'));
}, 50); }, 50);
} }
}; };
@ -32262,7 +32255,7 @@
} }
// We check for this since the "lang" pref could have been set by storage // We check for this since the "lang" pref could have been set by storage
lang = $$b.pref('lang'); lang = editor.pref('lang');
_context5.next = 10; _context5.next = 10;
return ext.langReady({ return ext.langReady({
lang: lang, lang: lang,
@ -32679,7 +32672,7 @@
callback: function callback(icons) { callback: function callback(icons) {
// Non-ideal hack to make the icon match the current size // Non-ideal hack to make the icon match the current size
// if (curPrefs.iconsize && curPrefs.iconsize !== 'm') { // if (curPrefs.iconsize && curPrefs.iconsize !== 'm') {
if ($$b.pref('iconsize') !== 'm') { if (editor.pref('iconsize') !== 'm') {
prepResize(); prepResize();
} }
@ -32701,7 +32694,7 @@
})); }));
return function extAdded(_x4, _x5) { return function extAdded(_x4, _x5) {
return _ref13.apply(this, arguments); return _ref14.apply(this, arguments);
}; };
}(); }();
/** /**
@ -32776,9 +32769,9 @@
* @listens module:svgcanvas.SvgCanvas#event:updateCanvas * @listens module:svgcanvas.SvgCanvas#event:updateCanvas
* @returns {void} * @returns {void}
*/ */
function (win, _ref15) { function (win, _ref16) {
var center = _ref15.center, var center = _ref16.center,
newCtr = _ref15.newCtr; newCtr = _ref16.newCtr;
updateCanvas(center, newCtr); updateCanvas(center, newCtr);
}); });
svgCanvas.bind('contextset', contextChanged); svgCanvas.bind('contextset', contextChanged);
@ -32807,8 +32800,8 @@
$$b(this).addClass(curBg); $$b(this).addClass(curBg);
}); });
}); });
setBackground($$b.pref('bkgd_color'), $$b.pref('bkgd_url')); setBackground(editor.pref('bkgd_color'), editor.pref('bkgd_url'));
$$b('#image_save_opts input').val([$$b.pref('img_save')]); $$b('#image_save_opts input').val([editor.pref('img_save')]);
/** /**
* @type {module:jQuerySpinButton.ValueCallback} * @type {module:jQuerySpinButton.ValueCallback}
*/ */
@ -33659,7 +33652,7 @@
var makeHyperlink = var makeHyperlink =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref17 = _asyncToGenerator( var _ref18 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee7() { regeneratorRuntime.mark(function _callee7() {
var url; var url;
@ -33691,7 +33684,7 @@
})); }));
return function makeHyperlink() { return function makeHyperlink() {
return _ref17.apply(this, arguments); return _ref18.apply(this, arguments);
}; };
}(); }();
/** /**
@ -33814,7 +33807,7 @@
var clickClear = var clickClear =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref18 = _asyncToGenerator( var _ref19 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee8() { regeneratorRuntime.mark(function _callee8() {
var _curConfig$dimensions, x, y, ok; var _curConfig$dimensions, x, y, ok;
@ -33857,7 +33850,7 @@
})); }));
return function clickClear() { return function clickClear() {
return _ref18.apply(this, arguments); return _ref19.apply(this, arguments);
}; };
}(); }();
/** /**
@ -33891,7 +33884,7 @@
var clickSave = function clickSave() { var clickSave = function clickSave() {
// In the future, more options can be provided here // In the future, more options can be provided here
var saveOpts = { var saveOpts = {
images: $$b.pref('img_save'), images: editor.pref('img_save'),
round_digits: 6 round_digits: 6
}; };
svgCanvas.save(saveOpts); svgCanvas.save(saveOpts);
@ -33906,7 +33899,7 @@
var clickExport = var clickExport =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref19 = _asyncToGenerator( var _ref20 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee9() { regeneratorRuntime.mark(function _callee9() {
var imgType, exportWindowName, openExportWindow, chrome, quality; var imgType, exportWindowName, openExportWindow, chrome, quality;
@ -33914,7 +33907,7 @@
while (1) { while (1) {
switch (_context9.prev = _context9.next) { switch (_context9.prev = _context9.next) {
case 0: case 0:
openExportWindow = function _ref20() { openExportWindow = function _ref21() {
var loadingImage = uiStrings$1.notification.loadingImage; var loadingImage = uiStrings$1.notification.loadingImage;
if (curConfig.exportWindowType === 'new') { if (curConfig.exportWindowType === 'new') {
@ -34005,7 +33998,7 @@
})); }));
return function clickExport() { return function clickExport() {
return _ref19.apply(this, arguments); return _ref20.apply(this, arguments);
}; };
}(); }();
/** /**
@ -34129,7 +34122,7 @@
docprops = true; // This selects the correct radio button by using the array notation docprops = true; // This selects the correct radio button by using the array notation
$$b('#image_save_opts input').val([$$b.pref('img_save')]); // update resolution option with actual resolution $$b('#image_save_opts input').val([editor.pref('img_save')]); // update resolution option with actual resolution
var res = svgCanvas.getResolution(); var res = svgCanvas.getResolution();
@ -34158,7 +34151,7 @@
$$b('#main_menu').hide(); // Update background color with current one $$b('#main_menu').hide(); // Update background color with current one
var canvasBg = curPrefs.bkgd_color; var canvasBg = curPrefs.bkgd_color;
var url = $$b.pref('bkgd_url'); var url = editor.pref('bkgd_url');
blocks.each(function () { blocks.each(function () {
var blk = $$b(this); var blk = $$b(this);
var isBg = blk.css('background-color') === canvasBg; var isBg = blk.css('background-color') === canvasBg;
@ -34211,7 +34204,7 @@
var saveSourceEditor = var saveSourceEditor =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref21 = _asyncToGenerator( var _ref22 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee10() { regeneratorRuntime.mark(function _callee10() {
var saveChanges, ok; var saveChanges, ok;
@ -34271,7 +34264,7 @@
})); }));
return function saveSourceEditor() { return function saveSourceEditor() {
return _ref21.apply(this, arguments); return _ref22.apply(this, arguments);
}; };
}(); }();
/** /**
@ -34284,7 +34277,7 @@
$$b('#svg_docprops').hide(); $$b('#svg_docprops').hide();
$$b('#canvas_width,#canvas_height').removeAttr('disabled'); $$b('#canvas_width,#canvas_height').removeAttr('disabled');
$$b('#resolution')[0].selectedIndex = 0; $$b('#resolution')[0].selectedIndex = 0;
$$b('#image_save_opts input').val([$$b.pref('img_save')]); $$b('#image_save_opts input').val([editor.pref('img_save')]);
docprops = false; docprops = false;
}; };
/** /**
@ -34341,7 +34334,7 @@
} // Set image save option } // Set image save option
$$b.pref('img_save', $$b('#image_save_opts :checked').val()); editor.pref('img_save', $$b('#image_save_opts :checked').val());
updateCanvas(); updateCanvas();
hideDocProperties(); hideDocProperties();
return true; return true;
@ -34358,7 +34351,7 @@
_asyncToGenerator( _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee11() { regeneratorRuntime.mark(function _callee11() {
var color, lang, _ref23, langParam, langData; var color, lang, _ref24, langParam, langData;
return regeneratorRuntime.wrap(function _callee11$(_context11) { return regeneratorRuntime.wrap(function _callee11$(_context11) {
while (1) { while (1) {
@ -34370,7 +34363,7 @@
lang = $$b('#lang_select').val(); lang = $$b('#lang_select').val();
if (!(lang !== $$b.pref('lang'))) { if (!(lang && lang !== editor.pref('lang'))) {
_context11.next = 11; _context11.next = 11;
break; break;
} }
@ -34379,9 +34372,9 @@
return editor.putLocale(lang, goodLangs, curConfig); return editor.putLocale(lang, goodLangs, curConfig);
case 6: case 6:
_ref23 = _context11.sent; _ref24 = _context11.sent;
langParam = _ref23.langParam; langParam = _ref24.langParam;
langData = _ref23.langData; langData = _ref24.langData;
_context11.next = 11; _context11.next = 11;
return setLang(langParam, langData); return setLang(langParam, langData);
@ -34421,7 +34414,7 @@
var cancelOverlays = var cancelOverlays =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref24 = _asyncToGenerator( var _ref25 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee12() { regeneratorRuntime.mark(function _callee12() {
var ok; var ok;
@ -34492,7 +34485,7 @@
})); }));
return function cancelOverlays() { return function cancelOverlays() {
return _ref24.apply(this, arguments); return _ref25.apply(this, arguments);
}; };
}(); }();
@ -34820,7 +34813,7 @@
// Disable option // Disable option
$$b('#image_save_opts [value=embed]').attr('disabled', 'disabled'); $$b('#image_save_opts [value=embed]').attr('disabled', 'disabled');
$$b('#image_save_opts input').val(['ref']); $$b('#image_save_opts input').val(['ref']);
$$b.pref('img_save', 'ref'); editor.pref('img_save', 'ref');
$$b('#image_opt_embed').css('color', '#666').attr('title', uiStrings$1.notification.featNotSupported); $$b('#image_opt_embed').css('color', '#666').attr('title', uiStrings$1.notification.featNotSupported);
} }
}); });
@ -36234,8 +36227,8 @@
// bitmap handling // bitmap handling
reader = new FileReader(); reader = new FileReader();
reader.onloadend = function (_ref27) { reader.onloadend = function (_ref28) {
var result = _ref27.target.result; var result = _ref28.target.result;
/** /**
* Insert the new image until we know its dimensions. * Insert the new image until we know its dimensions.
@ -36287,7 +36280,7 @@
var open = $$b('<input type="file">').change( var open = $$b('<input type="file">').change(
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref28 = _asyncToGenerator( var _ref29 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee16(e) { regeneratorRuntime.mark(function _callee16(e) {
var ok, reader; var ok, reader;
@ -36318,15 +36311,15 @@
reader.onloadend = reader.onloadend =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref30 = _asyncToGenerator( var _ref31 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee15(_ref29) { regeneratorRuntime.mark(function _callee15(_ref30) {
var target; var target;
return regeneratorRuntime.wrap(function _callee15$(_context15) { return regeneratorRuntime.wrap(function _callee15$(_context15) {
while (1) { while (1) {
switch (_context15.prev = _context15.next) { switch (_context15.prev = _context15.next) {
case 0: case 0:
target = _ref29.target; target = _ref30.target;
_context15.next = 3; _context15.next = 3;
return loadSvgString(target.result); return loadSvgString(target.result);
@ -36342,7 +36335,7 @@
})); }));
return function (_x7) { return function (_x7) {
return _ref30.apply(this, arguments); return _ref31.apply(this, arguments);
}; };
}(); }();
@ -36358,7 +36351,7 @@
})); }));
return function (_x6) { return function (_x6) {
return _ref28.apply(this, arguments); return _ref29.apply(this, arguments);
}; };
}()); }());
$$b('#tool_open').show(); $$b('#tool_open').show();
@ -36389,7 +36382,7 @@
var setLang = editor.setLang = var setLang = editor.setLang =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref31 = _asyncToGenerator( var _ref32 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee17(lang, allStrings) { regeneratorRuntime.mark(function _callee17(lang, allStrings) {
var oldLayerName, renameLayer, elems; var oldLayerName, renameLayer, elems;
@ -36398,7 +36391,7 @@
switch (_context17.prev = _context17.next) { switch (_context17.prev = _context17.next) {
case 0: case 0:
editor.langChanged = true; editor.langChanged = true;
$$b.pref('lang', lang); editor.pref('lang', lang);
$$b('#lang_select').val(lang); $$b('#lang_select').val(lang);
if (allStrings) { if (allStrings) {
@ -36497,7 +36490,7 @@
})); }));
return function (_x8, _x9) { return function (_x8, _x9) {
return _ref31.apply(this, arguments); return _ref32.apply(this, arguments);
}; };
}(); }();
@ -36591,9 +36584,9 @@
case 0: case 0:
_context20.prev = 0; _context20.prev = 0;
_context20.next = 3; _context20.next = 3;
return Promise.all(callbacks.map(function (_ref34) { return Promise.all(callbacks.map(function (_ref35) {
var _ref35 = _slicedToArray(_ref34, 1), var _ref36 = _slicedToArray(_ref35, 1),
cb = _ref35[0]; cb = _ref36[0];
return cb(); // eslint-disable-line promise/prefer-await-to-callbacks return cb(); // eslint-disable-line promise/prefer-await-to-callbacks
})); }));
@ -36605,18 +36598,18 @@
case 5: case 5:
_context20.prev = 5; _context20.prev = 5;
_context20.t0 = _context20["catch"](0); _context20.t0 = _context20["catch"](0);
callbacks.forEach(function (_ref36) { callbacks.forEach(function (_ref37) {
var _ref37 = _slicedToArray(_ref36, 3), var _ref38 = _slicedToArray(_ref37, 3),
reject = _ref37[2]; reject = _ref38[2];
reject(); reject();
}); });
throw _context20.t0; throw _context20.t0;
case 9: case 9:
callbacks.forEach(function (_ref38) { callbacks.forEach(function (_ref39) {
var _ref39 = _slicedToArray(_ref38, 2), var _ref40 = _slicedToArray(_ref39, 2),
resolve = _ref39[1]; resolve = _ref40[1];
resolve(); resolve();
}); });
@ -36637,8 +36630,8 @@
*/ */
editor.loadFromString = function (str) { editor.loadFromString = function (str) {
var _ref40 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, var _ref41 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref40.noAlert; noAlert = _ref41.noAlert;
return editor.ready( return editor.ready(
/*#__PURE__*/ /*#__PURE__*/
@ -36708,9 +36701,9 @@
editor.loadFromURL = function (url) { editor.loadFromURL = function (url) {
var _ref42 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, var _ref43 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
cache = _ref42.cache, cache = _ref43.cache,
noAlert = _ref42.noAlert; noAlert = _ref43.noAlert;
return editor.ready(function () { return editor.ready(function () {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
@ -36759,8 +36752,8 @@
editor.loadFromDataURI = function (str) { editor.loadFromDataURI = function (str) {
var _ref43 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, var _ref44 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref43.noAlert; noAlert = _ref44.noAlert;
return editor.ready(function () { return editor.ready(function () {
var base64 = false; var base64 = false;
@ -36817,9 +36810,9 @@
* @returns {void} * @returns {void}
*/ */
var messageListener = function messageListener(_ref44) { var messageListener = function messageListener(_ref45) {
var data = _ref44.data, var data = _ref45.data,
origin = _ref44.origin; origin = _ref45.origin;
// eslint-disable-line no-shadow // eslint-disable-line no-shadow
// console.log('data, origin, extensionsAdded', data, origin, extensionsAdded); // console.log('data, origin, extensionsAdded', data, origin, extensionsAdded);
var messageObj = { var messageObj = {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,9 +8,7 @@
* The functionality was originally part of the SVG Editor, but moved to a * The functionality was originally part of the SVG Editor, but moved to a
* separate extension to make the setting behavior optional, and adapted * separate extension to make the setting behavior optional, and adapted
* to inform the user of its setting of local data. * to inform the user of its setting of local data.
* Dependencies:
* *
* 1. jQuery BBQ (for deparam)
* @license MIT * @license MIT
* *
* @copyright 2010 Brett Zamir * @copyright 2010 Brett Zamir
@ -20,6 +18,7 @@
* @todo We might provide control of storage settings through the UI besides the * @todo We might provide control of storage settings through the UI besides the
* initial (or URL-forced) dialog. * * initial (or URL-forced) dialog. *
*/ */
export default { export default {
name: 'storage', name: 'storage',
init ({$}) { init ({$}) {
@ -51,6 +50,7 @@ export default {
* Replace `storagePrompt` parameter within URL. * Replace `storagePrompt` parameter within URL.
* @param {string} val * @param {string} val
* @returns {void} * @returns {void}
* @todo Replace the string manipulation with `searchParams.set`
*/ */
function replaceStoragePrompt (val) { function replaceStoragePrompt (val) {
val = val ? 'storagePrompt=' + val : ''; val = val ? 'storagePrompt=' + val : '';
@ -166,7 +166,7 @@ export default {
return { return {
name: 'storage', name: 'storage',
async langReady ({importLocale}) { async langReady ({importLocale}) {
const {storagePrompt} = $.deparam.querystring(true); const storagePrompt = new URL(top.location).searchParams.get('storagePrompt');
const confirmSetStorage = await importLocale(); const confirmSetStorage = await importLocale();
const { const {
@ -190,13 +190,13 @@ export default {
// If the URL has been explicitly set to always prompt the // If the URL has been explicitly set to always prompt the
// user (e.g., so one can be pointed to a URL where one // user (e.g., so one can be pointed to a URL where one
// can alter one's settings, say to prevent future storage)... // can alter one's settings, say to prevent future storage)...
storagePrompt === true || storagePrompt === 'true' ||
( (
// ...or...if the URL at least doesn't explicitly prevent a // ...or...if the URL at least doesn't explicitly prevent a
// storage prompt (as we use for users who // storage prompt (as we use for users who
// don't want to set cookies at all but who don't want // don't want to set cookies at all but who don't want
// continual prompts about it)... // continual prompts about it)...
storagePrompt !== false && storagePrompt !== 'false' &&
// ...and this user hasn't previously indicated a desire for storage // ...and this user hasn't previously indicated a desire for storage
!document.cookie.match(/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/) !document.cookie.match(/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/)
) )
@ -252,7 +252,7 @@ export default {
// the user does indicate a wish to store their info, we // the user does indicate a wish to store their info, we
// don't want ask them again upon page refresh so move // don't want ask them again upon page refresh so move
// them instead to a URL which does not always prompt // them instead to a URL which does not always prompt
if (storagePrompt === true && checked) { if (storagePrompt === 'true' && checked) {
replaceStoragePrompt(); replaceStoragePrompt();
return; return;
} }

View File

@ -15,6 +15,12 @@
* @borrows module:locale.setStrings as setStrings * @borrows module:locale.setStrings as setStrings
*/ */
/*
* Dependencies to remove:
*
* 1. jQuery BBQ (for deparam)
*/
import './touch.js'; import './touch.js';
import {NS} from './namespaces.js'; import {NS} from './namespaces.js';
import {isWebkit, isChrome, isGecko, isIE, isMac, isTouch} from './browser.js'; import {isWebkit, isChrome, isGecko, isIE, isMac, isTouch} from './browser.js';

View File

@ -28618,44 +28618,33 @@
case 0: case 0:
if (givenParam) { if (givenParam) {
langParam = givenParam; langParam = givenParam;
} else { } else if (navigator.userLanguage) {
langParam = $$a.pref('lang');
if (!langParam) {
if (navigator.userLanguage) {
// Explorer // Explorer
langParam = navigator.userLanguage; langParam = navigator.userLanguage;
} else if (navigator.language) { } else if (navigator.language) {
// FF, Opera, ... // FF, Opera, ...
langParam = navigator.language; langParam = navigator.language;
} }
}
console.log('Lang: ' + langParam); // eslint-disable-line no-console console.log('Lang: ' + langParam); // eslint-disable-line no-console
// Set to English if language is not in list of good langs // Set to English if language is not in list of good langs
if (!goodLangs.includes(langParam) && langParam !== 'test') { if (!goodLangs.includes(langParam) && langParam !== 'test') {
langParam = 'en'; langParam = 'en';
} // don't bother on first run if language is English
// The following line prevents setLang from running
// extensions which depend on updated uiStrings,
// so commenting it out.
// if (langParam.startsWith('en')) {return;}
} }
url = conf.langPath + 'lang.' + langParam + '.js'; url = conf.langPath + 'lang.' + langParam + '.js';
_context2.t0 = readLang; _context2.t0 = readLang;
_context2.next = 5; _context2.next = 7;
return importSetGlobalDefault(url, { return importSetGlobalDefault(url, {
global: 'svgEditorLang_' + langParam.replace(/-/g, '_') global: 'svgEditorLang_' + langParam.replace(/-/g, '_')
}); });
case 5: case 7:
_context2.t1 = _context2.sent; _context2.t1 = _context2.sent;
return _context2.abrupt("return", (0, _context2.t0)(_context2.t1)); return _context2.abrupt("return", (0, _context2.t0)(_context2.t1));
case 7: case 9:
case "end": case "end":
return _context2.stop(); return _context2.stop();
} }
@ -29155,7 +29144,7 @@
_loadSvgString = _asyncToGenerator( _loadSvgString = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee23(str) { regeneratorRuntime.mark(function _callee23(str) {
var _ref46, var _ref47,
noAlert, noAlert,
success, success,
_args23 = arguments; _args23 = arguments;
@ -29164,7 +29153,7 @@
while (1) { while (1) {
switch (_context23.prev = _context23.next) { switch (_context23.prev = _context23.next) {
case 0: case 0:
_ref46 = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {}, noAlert = _ref46.noAlert; _ref47 = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {}, noAlert = _ref47.noAlert;
success = svgCanvas.setSvgString(str) !== false; success = svgCanvas.setSvgString(str) !== false;
if (!success) { if (!success) {
@ -29276,16 +29265,16 @@
* @param {boolean} [mayBeEmpty] If value may be falsey. * @param {boolean} [mayBeEmpty] If value may be falsey.
* @returns {string|void} If val is missing or falsey and `mayBeEmpty` is not set, the * @returns {string|void} If val is missing or falsey and `mayBeEmpty` is not set, the
* value of the previously stored preference will be returned. * value of the previously stored preference will be returned.
* @todo Can we change setting on the jQuery namespace (onto editor) to avoid conflicts?
* @todo Review whether any remaining existing direct references to * @todo Review whether any remaining existing direct references to
* getting `curPrefs` can be changed to use `$.pref()` getting to ensure * getting `curPrefs` can be changed to use `svgEditor.pref()` getting to ensure
* `defaultPrefs` fallback (also for sake of `allowInitialUserOverride`); specifically, `bkgd_color` could be changed so that * `defaultPrefs` fallback (also for sake of `allowInitialUserOverride`);
* the pref dialog has a button to auto-calculate background, but otherwise uses `$.pref()` to be able to get default prefs * specifically, `bkgd_color` could be changed so that the pref dialog has a
* or overridable settings * button to auto-calculate background, but otherwise uses `svgEditor.pref()` to
* be able to get default prefs or overridable settings
*/ */
$$b.pref = function (key, val, mayBeEmpty) { editor.pref = function (key, val, mayBeEmpty) {
if (mayBeEmpty || val) { if (mayBeEmpty || val) {
curPrefs[key] = val; curPrefs[key] = val;
/** /**
@ -29414,7 +29403,7 @@
if (cfgCfg.allowInitialUserOverride === true) { if (cfgCfg.allowInitialUserOverride === true) {
defaultPrefs[key] = val; defaultPrefs[key] = val;
} else { } else {
$$b.pref(key, val); editor.pref(key, val);
} }
} else if (['extensions', 'stylesheets', 'allowedOrigins'].includes(key)) { } else if (['extensions', 'stylesheets', 'allowedOrigins'].includes(key)) {
if (cfgCfg.overwrite === false && (curConfig.preventAllURLConfig || ['allowedOrigins', 'stylesheets'].includes(key) || key === 'extensions' && curConfig.lockExtensions)) { if (cfgCfg.overwrite === false && (curConfig.preventAllURLConfig || ['allowedOrigins', 'stylesheets'].includes(key) || key === 'extensions' && curConfig.lockExtensions)) {
@ -29626,7 +29615,6 @@
(function () { (function () {
// Load config/data from URL if given // Load config/data from URL if given
var src, qstr;
urldata = $$b.deparam.querystring(true); urldata = $$b.deparam.querystring(true);
if (!$$b.isEmptyObject(urldata)) { if (!$$b.isEmptyObject(urldata)) {
@ -29659,21 +29647,26 @@
setupCurConfig(); setupCurConfig();
if (!curConfig.preventURLContentLoading) { if (!curConfig.preventURLContentLoading) {
src = urldata.source; var _urldata = urldata,
qstr = $$b.param.querystring(); source = _urldata.source;
if (!src) { if (!source) {
// urldata.source may have been null if it ended with '=' // urldata.source may have been null if it ended with '='
if (qstr.includes('source=data:')) { var _ref4 = new URL(location),
src = qstr.match(/source=(data:[^&]*)/)[1]; // ({src} = qstr.match(/source=(?<src>data:[^&]*)/).groups); searchParams = _ref4.searchParams;
var src = searchParams.get('source');
if (src.startsWith('data:')) {
source = src;
} }
} }
if (src) { if (source) {
if (src.startsWith('data:')) { if (source.startsWith('data:')) {
editor.loadFromDataURI(src); editor.loadFromDataURI(source);
} else { } else {
editor.loadFromString(src); editor.loadFromString(source);
} }
return; return;
@ -29728,22 +29721,22 @@
var extAndLocaleFunc = var extAndLocaleFunc =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref4 = _asyncToGenerator( var _ref5 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee3() { regeneratorRuntime.mark(function _callee3() {
var _ref5, langParam, langData, _uiStrings$common, ok, cancel; var _ref6, langParam, langData, _uiStrings$common, ok, cancel;
return regeneratorRuntime.wrap(function _callee3$(_context3) { return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) { while (1) {
switch (_context3.prev = _context3.next) { switch (_context3.prev = _context3.next) {
case 0: case 0:
_context3.next = 2; _context3.next = 2;
return editor.putLocale(null, goodLangs, curConfig); return editor.putLocale(editor.pref('lang'), goodLangs, curConfig);
case 2: case 2:
_ref5 = _context3.sent; _ref6 = _context3.sent;
langParam = _ref5.langParam; langParam = _ref6.langParam;
langData = _ref5.langData; langData = _ref6.langData;
_context3.next = 7; _context3.next = 7;
return setLang(langParam, langData); return setLang(langParam, langData);
@ -29760,7 +29753,7 @@
return Promise.all(curConfig.extensions.map( return Promise.all(curConfig.extensions.map(
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref6 = _asyncToGenerator( var _ref7 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee2(extname) { regeneratorRuntime.mark(function _callee2(extname) {
var extName, url, imported, _imported$name, _name2, init, importLocale; var extName, url, imported, _imported$name, _name2, init, importLocale;
@ -29828,7 +29821,7 @@
})); }));
return function (_x2) { return function (_x2) {
return _ref6.apply(this, arguments); return _ref7.apply(this, arguments);
}; };
}())); }()));
@ -29880,7 +29873,7 @@
})); }));
return function extAndLocaleFunc() { return function extAndLocaleFunc() {
return _ref4.apply(this, arguments); return _ref5.apply(this, arguments);
}; };
}(); }();
@ -30014,7 +30007,7 @@
scaleElements(elems, scale); scaleElements(elems, scale);
hiddenPs.css('visibility', 'visible').hide(); // return; hiddenPs.css('visibility', 'visible').hide(); // return;
$$b.pref('iconsize', size); editor.pref('iconsize', size);
$$b('#iconsize').val(size); // Change icon size $$b('#iconsize').val(size); // Change icon size
// $('.tool_button, .push_button, .tool_button_current, .disabled, .icon_label, #url_notice, #tool_open') // $('.tool_button, .push_button, .tool_button_current, .disabled, .icon_label, #url_notice, #tool_open')
// .find('> svg, > img').each(function () { // .find('> svg, > img').each(function () {
@ -30374,7 +30367,7 @@
while (1) { while (1) {
switch (_context4.prev = _context4.next) { switch (_context4.prev = _context4.next) {
case 0: case 0:
getStylesheetPriority = function _ref8(stylesheetFile) { getStylesheetPriority = function _ref9(stylesheetFile) {
switch (stylesheetFile) { switch (stylesheetFile) {
case 'jgraduate/css/jPicker.css': case 'jgraduate/css/jPicker.css':
return 1; return 1;
@ -30402,7 +30395,7 @@
minHeight = tleft.offset().top + tleft.outerHeight(); minHeight = tleft.offset().top + tleft.outerHeight();
} }
size = $$b.pref('iconsize'); size = editor.pref('iconsize');
editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins
$$b('.tools_flyout').each(function () { $$b('.tools_flyout').each(function () {
@ -30449,10 +30442,10 @@
_context4.next = 11; _context4.next = 11;
return loadStylesheets(stylesheets, { return loadStylesheets(stylesheets, {
acceptErrors: function acceptErrors(_ref7) { acceptErrors: function acceptErrors(_ref8) {
var stylesheetURL = _ref7.stylesheetURL, var stylesheetURL = _ref8.stylesheetURL,
reject = _ref7.reject, reject = _ref8.reject,
resolve = _ref7.resolve; resolve = _ref8.resolve;
if ($$b.loadingStylesheets.includes(stylesheetURL)) { if ($$b.loadingStylesheets.includes(stylesheetURL)) {
reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL))); reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL)));
@ -30739,7 +30732,7 @@
a.click(); // Alert will only appear the first time saved OR the a.click(); // Alert will only appear the first time saved OR the
// first time the bug is encountered // first time the bug is encountered
var done = $$b.pref('save_notice_done'); var done = editor.pref('save_notice_done');
if (done !== 'all') { if (done !== 'all') {
var note = uiStrings$1.notification.saveFromBrowser.replace('%s', 'SVG'); // Check if FF and has <defs/> var note = uiStrings$1.notification.saveFromBrowser.replace('%s', 'SVG'); // Check if FF and has <defs/>
@ -30748,13 +30741,13 @@
if (svg.includes('<defs')) { if (svg.includes('<defs')) {
// warning about Mozilla bug #308590 when applicable (seems to be fixed now in Feb 2013) // warning about Mozilla bug #308590 when applicable (seems to be fixed now in Feb 2013)
note += '\n\n' + uiStrings$1.notification.defsFailOnSave; note += '\n\n' + uiStrings$1.notification.defsFailOnSave;
$$b.pref('save_notice_done', 'all'); editor.pref('save_notice_done', 'all');
done = 'all'; done = 'all';
} else { } else {
$$b.pref('save_notice_done', 'part'); editor.pref('save_notice_done', 'part');
} }
} else { } else {
$$b.pref('save_notice_done', 'all'); editor.pref('save_notice_done', 'all');
} }
if (done !== 'part') { if (done !== 'part') {
@ -30782,7 +30775,7 @@
} }
exportWindow.location.href = data.bloburl || data.datauri; exportWindow.location.href = data.bloburl || data.datauri;
var done = $$b.pref('export_notice_done'); var done = editor.pref('export_notice_done');
if (done !== 'all') { if (done !== 'all') {
var note = uiStrings$1.notification.saveFromBrowser.replace('%s', data.type); // Check if there are issues var note = uiStrings$1.notification.saveFromBrowser.replace('%s', data.type); // Check if there are issues
@ -30794,7 +30787,7 @@
// May want to find a way to deal with that without annoying the user // May want to find a way to deal with that without annoying the user
$$b.pref('export_notice_done', 'all'); editor.pref('export_notice_done', 'all');
exportWindow.alert(note); exportWindow.alert(note);
} }
}; };
@ -30924,9 +30917,9 @@
function setBackground(color, url) { function setBackground(color, url) {
// if (color == $.pref('bkgd_color') && url == $.pref('bkgd_url')) { return; } // if (color == editor.pref('bkgd_color') && url == editor.pref('bkgd_url')) { return; }
$$b.pref('bkgd_color', color); editor.pref('bkgd_color', color);
$$b.pref('bkgd_url', url, true); // This should be done in svgcanvas.js for the borderRect fill editor.pref('bkgd_url', url, true); // This should be done in svgcanvas.js for the borderRect fill
svgCanvas.setBackground(color, url); svgCanvas.setBackground(color, url);
} }
@ -30950,8 +30943,8 @@
_promptImgURL = _asyncToGenerator( _promptImgURL = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee18() { regeneratorRuntime.mark(function _callee18() {
var _ref32, var _ref33,
_ref32$cancelDeletes, _ref33$cancelDeletes,
cancelDeletes, cancelDeletes,
curhref, curhref,
url, url,
@ -30961,7 +30954,7 @@
while (1) { while (1) {
switch (_context18.prev = _context18.next) { switch (_context18.prev = _context18.next) {
case 0: case 0:
_ref32 = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {}, _ref32$cancelDeletes = _ref32.cancelDeletes, cancelDeletes = _ref32$cancelDeletes === void 0 ? false : _ref32$cancelDeletes; _ref33 = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {}, _ref33$cancelDeletes = _ref33.cancelDeletes, cancelDeletes = _ref33$cancelDeletes === void 0 ? false : _ref33$cancelDeletes;
curhref = svgCanvas.getHref(selectedElement); curhref = svgCanvas.getHref(selectedElement);
curhref = curhref.startsWith('data:') ? '' : curhref; curhref = curhref.startsWith('data:') ? '' : curhref;
_context18.next = 5; _context18.next = 5;
@ -31969,10 +31962,10 @@
// Get this button's options // Get this button's options
var idSel = '#' + this.getAttribute('id'); var idSel = '#' + this.getAttribute('id');
var _Object$entries$find = Object.entries(btnOpts).find(function (_ref9) { var _Object$entries$find = Object.entries(btnOpts).find(function (_ref10) {
var _ref10 = _slicedToArray(_ref9, 2), var _ref11 = _slicedToArray(_ref10, 2),
_ = _ref10[0], _ = _ref11[0],
sel = _ref10[1].sel; sel = _ref11[1].sel;
return sel === idSel; return sel === idSel;
}), }),
@ -31999,10 +31992,10 @@
if (ev.type === 'keydown') { if (ev.type === 'keydown') {
var flyoutIsSelected = $$b(options.parent + '_show').hasClass('tool_button_current'); var flyoutIsSelected = $$b(options.parent + '_show').hasClass('tool_button_current');
var currentOperation = $$b(options.parent + '_show').attr('data-curopt'); var currentOperation = $$b(options.parent + '_show').attr('data-curopt');
Object.entries(holders[opts.parent]).some(function (_ref11) { Object.entries(holders[opts.parent]).some(function (_ref12) {
var _ref12 = _slicedToArray(_ref11, 2), var _ref13 = _slicedToArray(_ref12, 2),
j = _ref12[0], j = _ref13[0],
tool = _ref12[1]; tool = _ref13[1];
if (tool.sel !== currentOperation) { if (tool.sel !== currentOperation) {
return false; return false;
@ -32215,7 +32208,7 @@
var extAdded = var extAdded =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref13 = _asyncToGenerator( var _ref14 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee5(win, ext) { regeneratorRuntime.mark(function _callee5(win, ext) {
var cbCalled, resizeDone, lang, prepResize, runCallback, btnSelects, svgicons, fallbackObj, altsObj, placementObj, holders; var cbCalled, resizeDone, lang, prepResize, runCallback, btnSelects, svgicons, fallbackObj, altsObj, placementObj, holders;
@ -32223,7 +32216,7 @@
while (1) { while (1) {
switch (_context5.prev = _context5.next) { switch (_context5.prev = _context5.next) {
case 0: case 0:
prepResize = function _ref14() { prepResize = function _ref15() {
if (resizeTimer) { if (resizeTimer) {
clearTimeout(resizeTimer); clearTimeout(resizeTimer);
resizeTimer = null; resizeTimer = null;
@ -32232,7 +32225,7 @@
if (!resizeDone) { if (!resizeDone) {
resizeTimer = setTimeout(function () { resizeTimer = setTimeout(function () {
resizeDone = true; resizeDone = true;
setIconSize($$b.pref('iconsize')); setIconSize(editor.pref('iconsize'));
}, 50); }, 50);
} }
}; };
@ -32259,7 +32252,7 @@
} }
// We check for this since the "lang" pref could have been set by storage // We check for this since the "lang" pref could have been set by storage
lang = $$b.pref('lang'); lang = editor.pref('lang');
_context5.next = 10; _context5.next = 10;
return ext.langReady({ return ext.langReady({
lang: lang, lang: lang,
@ -32676,7 +32669,7 @@
callback: function callback(icons) { callback: function callback(icons) {
// Non-ideal hack to make the icon match the current size // Non-ideal hack to make the icon match the current size
// if (curPrefs.iconsize && curPrefs.iconsize !== 'm') { // if (curPrefs.iconsize && curPrefs.iconsize !== 'm') {
if ($$b.pref('iconsize') !== 'm') { if (editor.pref('iconsize') !== 'm') {
prepResize(); prepResize();
} }
@ -32698,7 +32691,7 @@
})); }));
return function extAdded(_x4, _x5) { return function extAdded(_x4, _x5) {
return _ref13.apply(this, arguments); return _ref14.apply(this, arguments);
}; };
}(); }();
/** /**
@ -32773,9 +32766,9 @@
* @listens module:svgcanvas.SvgCanvas#event:updateCanvas * @listens module:svgcanvas.SvgCanvas#event:updateCanvas
* @returns {void} * @returns {void}
*/ */
function (win, _ref15) { function (win, _ref16) {
var center = _ref15.center, var center = _ref16.center,
newCtr = _ref15.newCtr; newCtr = _ref16.newCtr;
updateCanvas(center, newCtr); updateCanvas(center, newCtr);
}); });
svgCanvas.bind('contextset', contextChanged); svgCanvas.bind('contextset', contextChanged);
@ -32804,8 +32797,8 @@
$$b(this).addClass(curBg); $$b(this).addClass(curBg);
}); });
}); });
setBackground($$b.pref('bkgd_color'), $$b.pref('bkgd_url')); setBackground(editor.pref('bkgd_color'), editor.pref('bkgd_url'));
$$b('#image_save_opts input').val([$$b.pref('img_save')]); $$b('#image_save_opts input').val([editor.pref('img_save')]);
/** /**
* @type {module:jQuerySpinButton.ValueCallback} * @type {module:jQuerySpinButton.ValueCallback}
*/ */
@ -33656,7 +33649,7 @@
var makeHyperlink = var makeHyperlink =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref17 = _asyncToGenerator( var _ref18 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee7() { regeneratorRuntime.mark(function _callee7() {
var url; var url;
@ -33688,7 +33681,7 @@
})); }));
return function makeHyperlink() { return function makeHyperlink() {
return _ref17.apply(this, arguments); return _ref18.apply(this, arguments);
}; };
}(); }();
/** /**
@ -33811,7 +33804,7 @@
var clickClear = var clickClear =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref18 = _asyncToGenerator( var _ref19 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee8() { regeneratorRuntime.mark(function _callee8() {
var _curConfig$dimensions, x, y, ok; var _curConfig$dimensions, x, y, ok;
@ -33854,7 +33847,7 @@
})); }));
return function clickClear() { return function clickClear() {
return _ref18.apply(this, arguments); return _ref19.apply(this, arguments);
}; };
}(); }();
/** /**
@ -33888,7 +33881,7 @@
var clickSave = function clickSave() { var clickSave = function clickSave() {
// In the future, more options can be provided here // In the future, more options can be provided here
var saveOpts = { var saveOpts = {
images: $$b.pref('img_save'), images: editor.pref('img_save'),
round_digits: 6 round_digits: 6
}; };
svgCanvas.save(saveOpts); svgCanvas.save(saveOpts);
@ -33903,7 +33896,7 @@
var clickExport = var clickExport =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref19 = _asyncToGenerator( var _ref20 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee9() { regeneratorRuntime.mark(function _callee9() {
var imgType, exportWindowName, openExportWindow, chrome, quality; var imgType, exportWindowName, openExportWindow, chrome, quality;
@ -33911,7 +33904,7 @@
while (1) { while (1) {
switch (_context9.prev = _context9.next) { switch (_context9.prev = _context9.next) {
case 0: case 0:
openExportWindow = function _ref20() { openExportWindow = function _ref21() {
var loadingImage = uiStrings$1.notification.loadingImage; var loadingImage = uiStrings$1.notification.loadingImage;
if (curConfig.exportWindowType === 'new') { if (curConfig.exportWindowType === 'new') {
@ -34002,7 +33995,7 @@
})); }));
return function clickExport() { return function clickExport() {
return _ref19.apply(this, arguments); return _ref20.apply(this, arguments);
}; };
}(); }();
/** /**
@ -34126,7 +34119,7 @@
docprops = true; // This selects the correct radio button by using the array notation docprops = true; // This selects the correct radio button by using the array notation
$$b('#image_save_opts input').val([$$b.pref('img_save')]); // update resolution option with actual resolution $$b('#image_save_opts input').val([editor.pref('img_save')]); // update resolution option with actual resolution
var res = svgCanvas.getResolution(); var res = svgCanvas.getResolution();
@ -34155,7 +34148,7 @@
$$b('#main_menu').hide(); // Update background color with current one $$b('#main_menu').hide(); // Update background color with current one
var canvasBg = curPrefs.bkgd_color; var canvasBg = curPrefs.bkgd_color;
var url = $$b.pref('bkgd_url'); var url = editor.pref('bkgd_url');
blocks.each(function () { blocks.each(function () {
var blk = $$b(this); var blk = $$b(this);
var isBg = blk.css('background-color') === canvasBg; var isBg = blk.css('background-color') === canvasBg;
@ -34208,7 +34201,7 @@
var saveSourceEditor = var saveSourceEditor =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref21 = _asyncToGenerator( var _ref22 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee10() { regeneratorRuntime.mark(function _callee10() {
var saveChanges, ok; var saveChanges, ok;
@ -34268,7 +34261,7 @@
})); }));
return function saveSourceEditor() { return function saveSourceEditor() {
return _ref21.apply(this, arguments); return _ref22.apply(this, arguments);
}; };
}(); }();
/** /**
@ -34281,7 +34274,7 @@
$$b('#svg_docprops').hide(); $$b('#svg_docprops').hide();
$$b('#canvas_width,#canvas_height').removeAttr('disabled'); $$b('#canvas_width,#canvas_height').removeAttr('disabled');
$$b('#resolution')[0].selectedIndex = 0; $$b('#resolution')[0].selectedIndex = 0;
$$b('#image_save_opts input').val([$$b.pref('img_save')]); $$b('#image_save_opts input').val([editor.pref('img_save')]);
docprops = false; docprops = false;
}; };
/** /**
@ -34338,7 +34331,7 @@
} // Set image save option } // Set image save option
$$b.pref('img_save', $$b('#image_save_opts :checked').val()); editor.pref('img_save', $$b('#image_save_opts :checked').val());
updateCanvas(); updateCanvas();
hideDocProperties(); hideDocProperties();
return true; return true;
@ -34355,7 +34348,7 @@
_asyncToGenerator( _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee11() { regeneratorRuntime.mark(function _callee11() {
var color, lang, _ref23, langParam, langData; var color, lang, _ref24, langParam, langData;
return regeneratorRuntime.wrap(function _callee11$(_context11) { return regeneratorRuntime.wrap(function _callee11$(_context11) {
while (1) { while (1) {
@ -34367,7 +34360,7 @@
lang = $$b('#lang_select').val(); lang = $$b('#lang_select').val();
if (!(lang !== $$b.pref('lang'))) { if (!(lang && lang !== editor.pref('lang'))) {
_context11.next = 11; _context11.next = 11;
break; break;
} }
@ -34376,9 +34369,9 @@
return editor.putLocale(lang, goodLangs, curConfig); return editor.putLocale(lang, goodLangs, curConfig);
case 6: case 6:
_ref23 = _context11.sent; _ref24 = _context11.sent;
langParam = _ref23.langParam; langParam = _ref24.langParam;
langData = _ref23.langData; langData = _ref24.langData;
_context11.next = 11; _context11.next = 11;
return setLang(langParam, langData); return setLang(langParam, langData);
@ -34418,7 +34411,7 @@
var cancelOverlays = var cancelOverlays =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref24 = _asyncToGenerator( var _ref25 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee12() { regeneratorRuntime.mark(function _callee12() {
var ok; var ok;
@ -34489,7 +34482,7 @@
})); }));
return function cancelOverlays() { return function cancelOverlays() {
return _ref24.apply(this, arguments); return _ref25.apply(this, arguments);
}; };
}(); }();
@ -34817,7 +34810,7 @@
// Disable option // Disable option
$$b('#image_save_opts [value=embed]').attr('disabled', 'disabled'); $$b('#image_save_opts [value=embed]').attr('disabled', 'disabled');
$$b('#image_save_opts input').val(['ref']); $$b('#image_save_opts input').val(['ref']);
$$b.pref('img_save', 'ref'); editor.pref('img_save', 'ref');
$$b('#image_opt_embed').css('color', '#666').attr('title', uiStrings$1.notification.featNotSupported); $$b('#image_opt_embed').css('color', '#666').attr('title', uiStrings$1.notification.featNotSupported);
} }
}); });
@ -36231,8 +36224,8 @@
// bitmap handling // bitmap handling
reader = new FileReader(); reader = new FileReader();
reader.onloadend = function (_ref27) { reader.onloadend = function (_ref28) {
var result = _ref27.target.result; var result = _ref28.target.result;
/** /**
* Insert the new image until we know its dimensions. * Insert the new image until we know its dimensions.
@ -36284,7 +36277,7 @@
var open = $$b('<input type="file">').change( var open = $$b('<input type="file">').change(
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref28 = _asyncToGenerator( var _ref29 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee16(e) { regeneratorRuntime.mark(function _callee16(e) {
var ok, reader; var ok, reader;
@ -36315,15 +36308,15 @@
reader.onloadend = reader.onloadend =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref30 = _asyncToGenerator( var _ref31 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee15(_ref29) { regeneratorRuntime.mark(function _callee15(_ref30) {
var target; var target;
return regeneratorRuntime.wrap(function _callee15$(_context15) { return regeneratorRuntime.wrap(function _callee15$(_context15) {
while (1) { while (1) {
switch (_context15.prev = _context15.next) { switch (_context15.prev = _context15.next) {
case 0: case 0:
target = _ref29.target; target = _ref30.target;
_context15.next = 3; _context15.next = 3;
return loadSvgString(target.result); return loadSvgString(target.result);
@ -36339,7 +36332,7 @@
})); }));
return function (_x7) { return function (_x7) {
return _ref30.apply(this, arguments); return _ref31.apply(this, arguments);
}; };
}(); }();
@ -36355,7 +36348,7 @@
})); }));
return function (_x6) { return function (_x6) {
return _ref28.apply(this, arguments); return _ref29.apply(this, arguments);
}; };
}()); }());
$$b('#tool_open').show(); $$b('#tool_open').show();
@ -36386,7 +36379,7 @@
var setLang = editor.setLang = var setLang = editor.setLang =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref31 = _asyncToGenerator( var _ref32 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee17(lang, allStrings) { regeneratorRuntime.mark(function _callee17(lang, allStrings) {
var oldLayerName, renameLayer, elems; var oldLayerName, renameLayer, elems;
@ -36395,7 +36388,7 @@
switch (_context17.prev = _context17.next) { switch (_context17.prev = _context17.next) {
case 0: case 0:
editor.langChanged = true; editor.langChanged = true;
$$b.pref('lang', lang); editor.pref('lang', lang);
$$b('#lang_select').val(lang); $$b('#lang_select').val(lang);
if (allStrings) { if (allStrings) {
@ -36494,7 +36487,7 @@
})); }));
return function (_x8, _x9) { return function (_x8, _x9) {
return _ref31.apply(this, arguments); return _ref32.apply(this, arguments);
}; };
}(); }();
@ -36588,9 +36581,9 @@
case 0: case 0:
_context20.prev = 0; _context20.prev = 0;
_context20.next = 3; _context20.next = 3;
return Promise.all(callbacks.map(function (_ref34) { return Promise.all(callbacks.map(function (_ref35) {
var _ref35 = _slicedToArray(_ref34, 1), var _ref36 = _slicedToArray(_ref35, 1),
cb = _ref35[0]; cb = _ref36[0];
return cb(); // eslint-disable-line promise/prefer-await-to-callbacks return cb(); // eslint-disable-line promise/prefer-await-to-callbacks
})); }));
@ -36602,18 +36595,18 @@
case 5: case 5:
_context20.prev = 5; _context20.prev = 5;
_context20.t0 = _context20["catch"](0); _context20.t0 = _context20["catch"](0);
callbacks.forEach(function (_ref36) { callbacks.forEach(function (_ref37) {
var _ref37 = _slicedToArray(_ref36, 3), var _ref38 = _slicedToArray(_ref37, 3),
reject = _ref37[2]; reject = _ref38[2];
reject(); reject();
}); });
throw _context20.t0; throw _context20.t0;
case 9: case 9:
callbacks.forEach(function (_ref38) { callbacks.forEach(function (_ref39) {
var _ref39 = _slicedToArray(_ref38, 2), var _ref40 = _slicedToArray(_ref39, 2),
resolve = _ref39[1]; resolve = _ref40[1];
resolve(); resolve();
}); });
@ -36634,8 +36627,8 @@
*/ */
editor.loadFromString = function (str) { editor.loadFromString = function (str) {
var _ref40 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, var _ref41 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref40.noAlert; noAlert = _ref41.noAlert;
return editor.ready( return editor.ready(
/*#__PURE__*/ /*#__PURE__*/
@ -36705,9 +36698,9 @@
editor.loadFromURL = function (url) { editor.loadFromURL = function (url) {
var _ref42 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, var _ref43 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
cache = _ref42.cache, cache = _ref43.cache,
noAlert = _ref42.noAlert; noAlert = _ref43.noAlert;
return editor.ready(function () { return editor.ready(function () {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
@ -36756,8 +36749,8 @@
editor.loadFromDataURI = function (str) { editor.loadFromDataURI = function (str) {
var _ref43 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, var _ref44 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref43.noAlert; noAlert = _ref44.noAlert;
return editor.ready(function () { return editor.ready(function () {
var base64 = false; var base64 = false;
@ -36814,9 +36807,9 @@
* @returns {void} * @returns {void}
*/ */
var messageListener = function messageListener(_ref44) { var messageListener = function messageListener(_ref45) {
var data = _ref44.data, var data = _ref45.data,
origin = _ref44.origin; origin = _ref45.origin;
// eslint-disable-line no-shadow // eslint-disable-line no-shadow
// console.log('data, origin, extensionsAdded', data, origin, extensionsAdded); // console.log('data, origin, extensionsAdded', data, origin, extensionsAdded);
var messageObj = { var messageObj = {

View File

@ -28618,44 +28618,33 @@
case 0: case 0:
if (givenParam) { if (givenParam) {
langParam = givenParam; langParam = givenParam;
} else { } else if (navigator.userLanguage) {
langParam = $$a.pref('lang');
if (!langParam) {
if (navigator.userLanguage) {
// Explorer // Explorer
langParam = navigator.userLanguage; langParam = navigator.userLanguage;
} else if (navigator.language) { } else if (navigator.language) {
// FF, Opera, ... // FF, Opera, ...
langParam = navigator.language; langParam = navigator.language;
} }
}
console.log('Lang: ' + langParam); // eslint-disable-line no-console console.log('Lang: ' + langParam); // eslint-disable-line no-console
// Set to English if language is not in list of good langs // Set to English if language is not in list of good langs
if (!goodLangs.includes(langParam) && langParam !== 'test') { if (!goodLangs.includes(langParam) && langParam !== 'test') {
langParam = 'en'; langParam = 'en';
} // don't bother on first run if language is English
// The following line prevents setLang from running
// extensions which depend on updated uiStrings,
// so commenting it out.
// if (langParam.startsWith('en')) {return;}
} }
url = conf.langPath + 'lang.' + langParam + '.js'; url = conf.langPath + 'lang.' + langParam + '.js';
_context2.t0 = readLang; _context2.t0 = readLang;
_context2.next = 5; _context2.next = 7;
return importSetGlobalDefault(url, { return importSetGlobalDefault(url, {
global: 'svgEditorLang_' + langParam.replace(/-/g, '_') global: 'svgEditorLang_' + langParam.replace(/-/g, '_')
}); });
case 5: case 7:
_context2.t1 = _context2.sent; _context2.t1 = _context2.sent;
return _context2.abrupt("return", (0, _context2.t0)(_context2.t1)); return _context2.abrupt("return", (0, _context2.t0)(_context2.t1));
case 7: case 9:
case "end": case "end":
return _context2.stop(); return _context2.stop();
} }
@ -29155,7 +29144,7 @@
_loadSvgString = _asyncToGenerator( _loadSvgString = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee23(str) { regeneratorRuntime.mark(function _callee23(str) {
var _ref46, var _ref47,
noAlert, noAlert,
success, success,
_args23 = arguments; _args23 = arguments;
@ -29164,7 +29153,7 @@
while (1) { while (1) {
switch (_context23.prev = _context23.next) { switch (_context23.prev = _context23.next) {
case 0: case 0:
_ref46 = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {}, noAlert = _ref46.noAlert; _ref47 = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {}, noAlert = _ref47.noAlert;
success = svgCanvas.setSvgString(str) !== false; success = svgCanvas.setSvgString(str) !== false;
if (!success) { if (!success) {
@ -29276,16 +29265,16 @@
* @param {boolean} [mayBeEmpty] If value may be falsey. * @param {boolean} [mayBeEmpty] If value may be falsey.
* @returns {string|void} If val is missing or falsey and `mayBeEmpty` is not set, the * @returns {string|void} If val is missing or falsey and `mayBeEmpty` is not set, the
* value of the previously stored preference will be returned. * value of the previously stored preference will be returned.
* @todo Can we change setting on the jQuery namespace (onto editor) to avoid conflicts?
* @todo Review whether any remaining existing direct references to * @todo Review whether any remaining existing direct references to
* getting `curPrefs` can be changed to use `$.pref()` getting to ensure * getting `curPrefs` can be changed to use `svgEditor.pref()` getting to ensure
* `defaultPrefs` fallback (also for sake of `allowInitialUserOverride`); specifically, `bkgd_color` could be changed so that * `defaultPrefs` fallback (also for sake of `allowInitialUserOverride`);
* the pref dialog has a button to auto-calculate background, but otherwise uses `$.pref()` to be able to get default prefs * specifically, `bkgd_color` could be changed so that the pref dialog has a
* or overridable settings * button to auto-calculate background, but otherwise uses `svgEditor.pref()` to
* be able to get default prefs or overridable settings
*/ */
$$b.pref = function (key, val, mayBeEmpty) { editor.pref = function (key, val, mayBeEmpty) {
if (mayBeEmpty || val) { if (mayBeEmpty || val) {
curPrefs[key] = val; curPrefs[key] = val;
/** /**
@ -29414,7 +29403,7 @@
if (cfgCfg.allowInitialUserOverride === true) { if (cfgCfg.allowInitialUserOverride === true) {
defaultPrefs[key] = val; defaultPrefs[key] = val;
} else { } else {
$$b.pref(key, val); editor.pref(key, val);
} }
} else if (['extensions', 'stylesheets', 'allowedOrigins'].includes(key)) { } else if (['extensions', 'stylesheets', 'allowedOrigins'].includes(key)) {
if (cfgCfg.overwrite === false && (curConfig.preventAllURLConfig || ['allowedOrigins', 'stylesheets'].includes(key) || key === 'extensions' && curConfig.lockExtensions)) { if (cfgCfg.overwrite === false && (curConfig.preventAllURLConfig || ['allowedOrigins', 'stylesheets'].includes(key) || key === 'extensions' && curConfig.lockExtensions)) {
@ -29626,7 +29615,6 @@
(function () { (function () {
// Load config/data from URL if given // Load config/data from URL if given
var src, qstr;
urldata = $$b.deparam.querystring(true); urldata = $$b.deparam.querystring(true);
if (!$$b.isEmptyObject(urldata)) { if (!$$b.isEmptyObject(urldata)) {
@ -29659,21 +29647,26 @@
setupCurConfig(); setupCurConfig();
if (!curConfig.preventURLContentLoading) { if (!curConfig.preventURLContentLoading) {
src = urldata.source; var _urldata = urldata,
qstr = $$b.param.querystring(); source = _urldata.source;
if (!src) { if (!source) {
// urldata.source may have been null if it ended with '=' // urldata.source may have been null if it ended with '='
if (qstr.includes('source=data:')) { var _ref4 = new URL(location),
src = qstr.match(/source=(data:[^&]*)/)[1]; // ({src} = qstr.match(/source=(?<src>data:[^&]*)/).groups); searchParams = _ref4.searchParams;
var src = searchParams.get('source');
if (src.startsWith('data:')) {
source = src;
} }
} }
if (src) { if (source) {
if (src.startsWith('data:')) { if (source.startsWith('data:')) {
editor.loadFromDataURI(src); editor.loadFromDataURI(source);
} else { } else {
editor.loadFromString(src); editor.loadFromString(source);
} }
return; return;
@ -29728,22 +29721,22 @@
var extAndLocaleFunc = var extAndLocaleFunc =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref4 = _asyncToGenerator( var _ref5 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee3() { regeneratorRuntime.mark(function _callee3() {
var _ref5, langParam, langData, _uiStrings$common, ok, cancel; var _ref6, langParam, langData, _uiStrings$common, ok, cancel;
return regeneratorRuntime.wrap(function _callee3$(_context3) { return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) { while (1) {
switch (_context3.prev = _context3.next) { switch (_context3.prev = _context3.next) {
case 0: case 0:
_context3.next = 2; _context3.next = 2;
return editor.putLocale(null, goodLangs, curConfig); return editor.putLocale(editor.pref('lang'), goodLangs, curConfig);
case 2: case 2:
_ref5 = _context3.sent; _ref6 = _context3.sent;
langParam = _ref5.langParam; langParam = _ref6.langParam;
langData = _ref5.langData; langData = _ref6.langData;
_context3.next = 7; _context3.next = 7;
return setLang(langParam, langData); return setLang(langParam, langData);
@ -29760,7 +29753,7 @@
return Promise.all(curConfig.extensions.map( return Promise.all(curConfig.extensions.map(
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref6 = _asyncToGenerator( var _ref7 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee2(extname) { regeneratorRuntime.mark(function _callee2(extname) {
var extName, url, imported, _imported$name, _name2, init, importLocale; var extName, url, imported, _imported$name, _name2, init, importLocale;
@ -29828,7 +29821,7 @@
})); }));
return function (_x2) { return function (_x2) {
return _ref6.apply(this, arguments); return _ref7.apply(this, arguments);
}; };
}())); }()));
@ -29880,7 +29873,7 @@
})); }));
return function extAndLocaleFunc() { return function extAndLocaleFunc() {
return _ref4.apply(this, arguments); return _ref5.apply(this, arguments);
}; };
}(); }();
@ -30014,7 +30007,7 @@
scaleElements(elems, scale); scaleElements(elems, scale);
hiddenPs.css('visibility', 'visible').hide(); // return; hiddenPs.css('visibility', 'visible').hide(); // return;
$$b.pref('iconsize', size); editor.pref('iconsize', size);
$$b('#iconsize').val(size); // Change icon size $$b('#iconsize').val(size); // Change icon size
// $('.tool_button, .push_button, .tool_button_current, .disabled, .icon_label, #url_notice, #tool_open') // $('.tool_button, .push_button, .tool_button_current, .disabled, .icon_label, #url_notice, #tool_open')
// .find('> svg, > img').each(function () { // .find('> svg, > img').each(function () {
@ -30374,7 +30367,7 @@
while (1) { while (1) {
switch (_context4.prev = _context4.next) { switch (_context4.prev = _context4.next) {
case 0: case 0:
getStylesheetPriority = function _ref8(stylesheetFile) { getStylesheetPriority = function _ref9(stylesheetFile) {
switch (stylesheetFile) { switch (stylesheetFile) {
case 'jgraduate/css/jPicker.css': case 'jgraduate/css/jPicker.css':
return 1; return 1;
@ -30402,7 +30395,7 @@
minHeight = tleft.offset().top + tleft.outerHeight(); minHeight = tleft.offset().top + tleft.outerHeight();
} }
size = $$b.pref('iconsize'); size = editor.pref('iconsize');
editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins
$$b('.tools_flyout').each(function () { $$b('.tools_flyout').each(function () {
@ -30449,10 +30442,10 @@
_context4.next = 11; _context4.next = 11;
return loadStylesheets(stylesheets, { return loadStylesheets(stylesheets, {
acceptErrors: function acceptErrors(_ref7) { acceptErrors: function acceptErrors(_ref8) {
var stylesheetURL = _ref7.stylesheetURL, var stylesheetURL = _ref8.stylesheetURL,
reject = _ref7.reject, reject = _ref8.reject,
resolve = _ref7.resolve; resolve = _ref8.resolve;
if ($$b.loadingStylesheets.includes(stylesheetURL)) { if ($$b.loadingStylesheets.includes(stylesheetURL)) {
reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL))); reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL)));
@ -30739,7 +30732,7 @@
a.click(); // Alert will only appear the first time saved OR the a.click(); // Alert will only appear the first time saved OR the
// first time the bug is encountered // first time the bug is encountered
var done = $$b.pref('save_notice_done'); var done = editor.pref('save_notice_done');
if (done !== 'all') { if (done !== 'all') {
var note = uiStrings$1.notification.saveFromBrowser.replace('%s', 'SVG'); // Check if FF and has <defs/> var note = uiStrings$1.notification.saveFromBrowser.replace('%s', 'SVG'); // Check if FF and has <defs/>
@ -30748,13 +30741,13 @@
if (svg.includes('<defs')) { if (svg.includes('<defs')) {
// warning about Mozilla bug #308590 when applicable (seems to be fixed now in Feb 2013) // warning about Mozilla bug #308590 when applicable (seems to be fixed now in Feb 2013)
note += '\n\n' + uiStrings$1.notification.defsFailOnSave; note += '\n\n' + uiStrings$1.notification.defsFailOnSave;
$$b.pref('save_notice_done', 'all'); editor.pref('save_notice_done', 'all');
done = 'all'; done = 'all';
} else { } else {
$$b.pref('save_notice_done', 'part'); editor.pref('save_notice_done', 'part');
} }
} else { } else {
$$b.pref('save_notice_done', 'all'); editor.pref('save_notice_done', 'all');
} }
if (done !== 'part') { if (done !== 'part') {
@ -30782,7 +30775,7 @@
} }
exportWindow.location.href = data.bloburl || data.datauri; exportWindow.location.href = data.bloburl || data.datauri;
var done = $$b.pref('export_notice_done'); var done = editor.pref('export_notice_done');
if (done !== 'all') { if (done !== 'all') {
var note = uiStrings$1.notification.saveFromBrowser.replace('%s', data.type); // Check if there are issues var note = uiStrings$1.notification.saveFromBrowser.replace('%s', data.type); // Check if there are issues
@ -30794,7 +30787,7 @@
// May want to find a way to deal with that without annoying the user // May want to find a way to deal with that without annoying the user
$$b.pref('export_notice_done', 'all'); editor.pref('export_notice_done', 'all');
exportWindow.alert(note); exportWindow.alert(note);
} }
}; };
@ -30924,9 +30917,9 @@
function setBackground(color, url) { function setBackground(color, url) {
// if (color == $.pref('bkgd_color') && url == $.pref('bkgd_url')) { return; } // if (color == editor.pref('bkgd_color') && url == editor.pref('bkgd_url')) { return; }
$$b.pref('bkgd_color', color); editor.pref('bkgd_color', color);
$$b.pref('bkgd_url', url, true); // This should be done in svgcanvas.js for the borderRect fill editor.pref('bkgd_url', url, true); // This should be done in svgcanvas.js for the borderRect fill
svgCanvas.setBackground(color, url); svgCanvas.setBackground(color, url);
} }
@ -30950,8 +30943,8 @@
_promptImgURL = _asyncToGenerator( _promptImgURL = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee18() { regeneratorRuntime.mark(function _callee18() {
var _ref32, var _ref33,
_ref32$cancelDeletes, _ref33$cancelDeletes,
cancelDeletes, cancelDeletes,
curhref, curhref,
url, url,
@ -30961,7 +30954,7 @@
while (1) { while (1) {
switch (_context18.prev = _context18.next) { switch (_context18.prev = _context18.next) {
case 0: case 0:
_ref32 = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {}, _ref32$cancelDeletes = _ref32.cancelDeletes, cancelDeletes = _ref32$cancelDeletes === void 0 ? false : _ref32$cancelDeletes; _ref33 = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {}, _ref33$cancelDeletes = _ref33.cancelDeletes, cancelDeletes = _ref33$cancelDeletes === void 0 ? false : _ref33$cancelDeletes;
curhref = svgCanvas.getHref(selectedElement); curhref = svgCanvas.getHref(selectedElement);
curhref = curhref.startsWith('data:') ? '' : curhref; curhref = curhref.startsWith('data:') ? '' : curhref;
_context18.next = 5; _context18.next = 5;
@ -31969,10 +31962,10 @@
// Get this button's options // Get this button's options
var idSel = '#' + this.getAttribute('id'); var idSel = '#' + this.getAttribute('id');
var _Object$entries$find = Object.entries(btnOpts).find(function (_ref9) { var _Object$entries$find = Object.entries(btnOpts).find(function (_ref10) {
var _ref10 = _slicedToArray(_ref9, 2), var _ref11 = _slicedToArray(_ref10, 2),
_ = _ref10[0], _ = _ref11[0],
sel = _ref10[1].sel; sel = _ref11[1].sel;
return sel === idSel; return sel === idSel;
}), }),
@ -31999,10 +31992,10 @@
if (ev.type === 'keydown') { if (ev.type === 'keydown') {
var flyoutIsSelected = $$b(options.parent + '_show').hasClass('tool_button_current'); var flyoutIsSelected = $$b(options.parent + '_show').hasClass('tool_button_current');
var currentOperation = $$b(options.parent + '_show').attr('data-curopt'); var currentOperation = $$b(options.parent + '_show').attr('data-curopt');
Object.entries(holders[opts.parent]).some(function (_ref11) { Object.entries(holders[opts.parent]).some(function (_ref12) {
var _ref12 = _slicedToArray(_ref11, 2), var _ref13 = _slicedToArray(_ref12, 2),
j = _ref12[0], j = _ref13[0],
tool = _ref12[1]; tool = _ref13[1];
if (tool.sel !== currentOperation) { if (tool.sel !== currentOperation) {
return false; return false;
@ -32215,7 +32208,7 @@
var extAdded = var extAdded =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref13 = _asyncToGenerator( var _ref14 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee5(win, ext) { regeneratorRuntime.mark(function _callee5(win, ext) {
var cbCalled, resizeDone, lang, prepResize, runCallback, btnSelects, svgicons, fallbackObj, altsObj, placementObj, holders; var cbCalled, resizeDone, lang, prepResize, runCallback, btnSelects, svgicons, fallbackObj, altsObj, placementObj, holders;
@ -32223,7 +32216,7 @@
while (1) { while (1) {
switch (_context5.prev = _context5.next) { switch (_context5.prev = _context5.next) {
case 0: case 0:
prepResize = function _ref14() { prepResize = function _ref15() {
if (resizeTimer) { if (resizeTimer) {
clearTimeout(resizeTimer); clearTimeout(resizeTimer);
resizeTimer = null; resizeTimer = null;
@ -32232,7 +32225,7 @@
if (!resizeDone) { if (!resizeDone) {
resizeTimer = setTimeout(function () { resizeTimer = setTimeout(function () {
resizeDone = true; resizeDone = true;
setIconSize($$b.pref('iconsize')); setIconSize(editor.pref('iconsize'));
}, 50); }, 50);
} }
}; };
@ -32259,7 +32252,7 @@
} }
// We check for this since the "lang" pref could have been set by storage // We check for this since the "lang" pref could have been set by storage
lang = $$b.pref('lang'); lang = editor.pref('lang');
_context5.next = 10; _context5.next = 10;
return ext.langReady({ return ext.langReady({
lang: lang, lang: lang,
@ -32676,7 +32669,7 @@
callback: function callback(icons) { callback: function callback(icons) {
// Non-ideal hack to make the icon match the current size // Non-ideal hack to make the icon match the current size
// if (curPrefs.iconsize && curPrefs.iconsize !== 'm') { // if (curPrefs.iconsize && curPrefs.iconsize !== 'm') {
if ($$b.pref('iconsize') !== 'm') { if (editor.pref('iconsize') !== 'm') {
prepResize(); prepResize();
} }
@ -32698,7 +32691,7 @@
})); }));
return function extAdded(_x4, _x5) { return function extAdded(_x4, _x5) {
return _ref13.apply(this, arguments); return _ref14.apply(this, arguments);
}; };
}(); }();
/** /**
@ -32773,9 +32766,9 @@
* @listens module:svgcanvas.SvgCanvas#event:updateCanvas * @listens module:svgcanvas.SvgCanvas#event:updateCanvas
* @returns {void} * @returns {void}
*/ */
function (win, _ref15) { function (win, _ref16) {
var center = _ref15.center, var center = _ref16.center,
newCtr = _ref15.newCtr; newCtr = _ref16.newCtr;
updateCanvas(center, newCtr); updateCanvas(center, newCtr);
}); });
svgCanvas.bind('contextset', contextChanged); svgCanvas.bind('contextset', contextChanged);
@ -32804,8 +32797,8 @@
$$b(this).addClass(curBg); $$b(this).addClass(curBg);
}); });
}); });
setBackground($$b.pref('bkgd_color'), $$b.pref('bkgd_url')); setBackground(editor.pref('bkgd_color'), editor.pref('bkgd_url'));
$$b('#image_save_opts input').val([$$b.pref('img_save')]); $$b('#image_save_opts input').val([editor.pref('img_save')]);
/** /**
* @type {module:jQuerySpinButton.ValueCallback} * @type {module:jQuerySpinButton.ValueCallback}
*/ */
@ -33656,7 +33649,7 @@
var makeHyperlink = var makeHyperlink =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref17 = _asyncToGenerator( var _ref18 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee7() { regeneratorRuntime.mark(function _callee7() {
var url; var url;
@ -33688,7 +33681,7 @@
})); }));
return function makeHyperlink() { return function makeHyperlink() {
return _ref17.apply(this, arguments); return _ref18.apply(this, arguments);
}; };
}(); }();
/** /**
@ -33811,7 +33804,7 @@
var clickClear = var clickClear =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref18 = _asyncToGenerator( var _ref19 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee8() { regeneratorRuntime.mark(function _callee8() {
var _curConfig$dimensions, x, y, ok; var _curConfig$dimensions, x, y, ok;
@ -33854,7 +33847,7 @@
})); }));
return function clickClear() { return function clickClear() {
return _ref18.apply(this, arguments); return _ref19.apply(this, arguments);
}; };
}(); }();
/** /**
@ -33888,7 +33881,7 @@
var clickSave = function clickSave() { var clickSave = function clickSave() {
// In the future, more options can be provided here // In the future, more options can be provided here
var saveOpts = { var saveOpts = {
images: $$b.pref('img_save'), images: editor.pref('img_save'),
round_digits: 6 round_digits: 6
}; };
svgCanvas.save(saveOpts); svgCanvas.save(saveOpts);
@ -33903,7 +33896,7 @@
var clickExport = var clickExport =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref19 = _asyncToGenerator( var _ref20 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee9() { regeneratorRuntime.mark(function _callee9() {
var imgType, exportWindowName, openExportWindow, chrome, quality; var imgType, exportWindowName, openExportWindow, chrome, quality;
@ -33911,7 +33904,7 @@
while (1) { while (1) {
switch (_context9.prev = _context9.next) { switch (_context9.prev = _context9.next) {
case 0: case 0:
openExportWindow = function _ref20() { openExportWindow = function _ref21() {
var loadingImage = uiStrings$1.notification.loadingImage; var loadingImage = uiStrings$1.notification.loadingImage;
if (curConfig.exportWindowType === 'new') { if (curConfig.exportWindowType === 'new') {
@ -34002,7 +33995,7 @@
})); }));
return function clickExport() { return function clickExport() {
return _ref19.apply(this, arguments); return _ref20.apply(this, arguments);
}; };
}(); }();
/** /**
@ -34126,7 +34119,7 @@
docprops = true; // This selects the correct radio button by using the array notation docprops = true; // This selects the correct radio button by using the array notation
$$b('#image_save_opts input').val([$$b.pref('img_save')]); // update resolution option with actual resolution $$b('#image_save_opts input').val([editor.pref('img_save')]); // update resolution option with actual resolution
var res = svgCanvas.getResolution(); var res = svgCanvas.getResolution();
@ -34155,7 +34148,7 @@
$$b('#main_menu').hide(); // Update background color with current one $$b('#main_menu').hide(); // Update background color with current one
var canvasBg = curPrefs.bkgd_color; var canvasBg = curPrefs.bkgd_color;
var url = $$b.pref('bkgd_url'); var url = editor.pref('bkgd_url');
blocks.each(function () { blocks.each(function () {
var blk = $$b(this); var blk = $$b(this);
var isBg = blk.css('background-color') === canvasBg; var isBg = blk.css('background-color') === canvasBg;
@ -34208,7 +34201,7 @@
var saveSourceEditor = var saveSourceEditor =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref21 = _asyncToGenerator( var _ref22 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee10() { regeneratorRuntime.mark(function _callee10() {
var saveChanges, ok; var saveChanges, ok;
@ -34268,7 +34261,7 @@
})); }));
return function saveSourceEditor() { return function saveSourceEditor() {
return _ref21.apply(this, arguments); return _ref22.apply(this, arguments);
}; };
}(); }();
/** /**
@ -34281,7 +34274,7 @@
$$b('#svg_docprops').hide(); $$b('#svg_docprops').hide();
$$b('#canvas_width,#canvas_height').removeAttr('disabled'); $$b('#canvas_width,#canvas_height').removeAttr('disabled');
$$b('#resolution')[0].selectedIndex = 0; $$b('#resolution')[0].selectedIndex = 0;
$$b('#image_save_opts input').val([$$b.pref('img_save')]); $$b('#image_save_opts input').val([editor.pref('img_save')]);
docprops = false; docprops = false;
}; };
/** /**
@ -34338,7 +34331,7 @@
} // Set image save option } // Set image save option
$$b.pref('img_save', $$b('#image_save_opts :checked').val()); editor.pref('img_save', $$b('#image_save_opts :checked').val());
updateCanvas(); updateCanvas();
hideDocProperties(); hideDocProperties();
return true; return true;
@ -34355,7 +34348,7 @@
_asyncToGenerator( _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee11() { regeneratorRuntime.mark(function _callee11() {
var color, lang, _ref23, langParam, langData; var color, lang, _ref24, langParam, langData;
return regeneratorRuntime.wrap(function _callee11$(_context11) { return regeneratorRuntime.wrap(function _callee11$(_context11) {
while (1) { while (1) {
@ -34367,7 +34360,7 @@
lang = $$b('#lang_select').val(); lang = $$b('#lang_select').val();
if (!(lang !== $$b.pref('lang'))) { if (!(lang && lang !== editor.pref('lang'))) {
_context11.next = 11; _context11.next = 11;
break; break;
} }
@ -34376,9 +34369,9 @@
return editor.putLocale(lang, goodLangs, curConfig); return editor.putLocale(lang, goodLangs, curConfig);
case 6: case 6:
_ref23 = _context11.sent; _ref24 = _context11.sent;
langParam = _ref23.langParam; langParam = _ref24.langParam;
langData = _ref23.langData; langData = _ref24.langData;
_context11.next = 11; _context11.next = 11;
return setLang(langParam, langData); return setLang(langParam, langData);
@ -34418,7 +34411,7 @@
var cancelOverlays = var cancelOverlays =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref24 = _asyncToGenerator( var _ref25 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee12() { regeneratorRuntime.mark(function _callee12() {
var ok; var ok;
@ -34489,7 +34482,7 @@
})); }));
return function cancelOverlays() { return function cancelOverlays() {
return _ref24.apply(this, arguments); return _ref25.apply(this, arguments);
}; };
}(); }();
@ -34817,7 +34810,7 @@
// Disable option // Disable option
$$b('#image_save_opts [value=embed]').attr('disabled', 'disabled'); $$b('#image_save_opts [value=embed]').attr('disabled', 'disabled');
$$b('#image_save_opts input').val(['ref']); $$b('#image_save_opts input').val(['ref']);
$$b.pref('img_save', 'ref'); editor.pref('img_save', 'ref');
$$b('#image_opt_embed').css('color', '#666').attr('title', uiStrings$1.notification.featNotSupported); $$b('#image_opt_embed').css('color', '#666').attr('title', uiStrings$1.notification.featNotSupported);
} }
}); });
@ -36231,8 +36224,8 @@
// bitmap handling // bitmap handling
reader = new FileReader(); reader = new FileReader();
reader.onloadend = function (_ref27) { reader.onloadend = function (_ref28) {
var result = _ref27.target.result; var result = _ref28.target.result;
/** /**
* Insert the new image until we know its dimensions. * Insert the new image until we know its dimensions.
@ -36284,7 +36277,7 @@
var open = $$b('<input type="file">').change( var open = $$b('<input type="file">').change(
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref28 = _asyncToGenerator( var _ref29 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee16(e) { regeneratorRuntime.mark(function _callee16(e) {
var ok, reader; var ok, reader;
@ -36315,15 +36308,15 @@
reader.onloadend = reader.onloadend =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref30 = _asyncToGenerator( var _ref31 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee15(_ref29) { regeneratorRuntime.mark(function _callee15(_ref30) {
var target; var target;
return regeneratorRuntime.wrap(function _callee15$(_context15) { return regeneratorRuntime.wrap(function _callee15$(_context15) {
while (1) { while (1) {
switch (_context15.prev = _context15.next) { switch (_context15.prev = _context15.next) {
case 0: case 0:
target = _ref29.target; target = _ref30.target;
_context15.next = 3; _context15.next = 3;
return loadSvgString(target.result); return loadSvgString(target.result);
@ -36339,7 +36332,7 @@
})); }));
return function (_x7) { return function (_x7) {
return _ref30.apply(this, arguments); return _ref31.apply(this, arguments);
}; };
}(); }();
@ -36355,7 +36348,7 @@
})); }));
return function (_x6) { return function (_x6) {
return _ref28.apply(this, arguments); return _ref29.apply(this, arguments);
}; };
}()); }());
$$b('#tool_open').show(); $$b('#tool_open').show();
@ -36386,7 +36379,7 @@
var setLang = editor.setLang = var setLang = editor.setLang =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
var _ref31 = _asyncToGenerator( var _ref32 = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
regeneratorRuntime.mark(function _callee17(lang, allStrings) { regeneratorRuntime.mark(function _callee17(lang, allStrings) {
var oldLayerName, renameLayer, elems; var oldLayerName, renameLayer, elems;
@ -36395,7 +36388,7 @@
switch (_context17.prev = _context17.next) { switch (_context17.prev = _context17.next) {
case 0: case 0:
editor.langChanged = true; editor.langChanged = true;
$$b.pref('lang', lang); editor.pref('lang', lang);
$$b('#lang_select').val(lang); $$b('#lang_select').val(lang);
if (allStrings) { if (allStrings) {
@ -36494,7 +36487,7 @@
})); }));
return function (_x8, _x9) { return function (_x8, _x9) {
return _ref31.apply(this, arguments); return _ref32.apply(this, arguments);
}; };
}(); }();
@ -36588,9 +36581,9 @@
case 0: case 0:
_context20.prev = 0; _context20.prev = 0;
_context20.next = 3; _context20.next = 3;
return Promise.all(callbacks.map(function (_ref34) { return Promise.all(callbacks.map(function (_ref35) {
var _ref35 = _slicedToArray(_ref34, 1), var _ref36 = _slicedToArray(_ref35, 1),
cb = _ref35[0]; cb = _ref36[0];
return cb(); // eslint-disable-line promise/prefer-await-to-callbacks return cb(); // eslint-disable-line promise/prefer-await-to-callbacks
})); }));
@ -36602,18 +36595,18 @@
case 5: case 5:
_context20.prev = 5; _context20.prev = 5;
_context20.t0 = _context20["catch"](0); _context20.t0 = _context20["catch"](0);
callbacks.forEach(function (_ref36) { callbacks.forEach(function (_ref37) {
var _ref37 = _slicedToArray(_ref36, 3), var _ref38 = _slicedToArray(_ref37, 3),
reject = _ref37[2]; reject = _ref38[2];
reject(); reject();
}); });
throw _context20.t0; throw _context20.t0;
case 9: case 9:
callbacks.forEach(function (_ref38) { callbacks.forEach(function (_ref39) {
var _ref39 = _slicedToArray(_ref38, 2), var _ref40 = _slicedToArray(_ref39, 2),
resolve = _ref39[1]; resolve = _ref40[1];
resolve(); resolve();
}); });
@ -36634,8 +36627,8 @@
*/ */
editor.loadFromString = function (str) { editor.loadFromString = function (str) {
var _ref40 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, var _ref41 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref40.noAlert; noAlert = _ref41.noAlert;
return editor.ready( return editor.ready(
/*#__PURE__*/ /*#__PURE__*/
@ -36705,9 +36698,9 @@
editor.loadFromURL = function (url) { editor.loadFromURL = function (url) {
var _ref42 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, var _ref43 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
cache = _ref42.cache, cache = _ref43.cache,
noAlert = _ref42.noAlert; noAlert = _ref43.noAlert;
return editor.ready(function () { return editor.ready(function () {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
@ -36756,8 +36749,8 @@
editor.loadFromDataURI = function (str) { editor.loadFromDataURI = function (str) {
var _ref43 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, var _ref44 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref43.noAlert; noAlert = _ref44.noAlert;
return editor.ready(function () { return editor.ready(function () {
var base64 = false; var base64 = false;
@ -36814,9 +36807,9 @@
* @returns {void} * @returns {void}
*/ */
var messageListener = function messageListener(_ref44) { var messageListener = function messageListener(_ref45) {
var data = _ref44.data, var data = _ref45.data,
origin = _ref44.origin; origin = _ref45.origin;
// eslint-disable-line no-shadow // eslint-disable-line no-shadow
// console.log('data, origin, extensionsAdded', data, origin, extensionsAdded); // console.log('data, origin, extensionsAdded', data, origin, extensionsAdded);
var messageObj = { var messageObj = {
@ -36900,10 +36893,14 @@
}); // EXTENSION CONFIG }); // EXTENSION CONFIG
editor.setConfig({ editor.setConfig({
extensions: [// 'ext-overview_window.js', 'ext-markers.js', 'ext-connector.js', 'ext-eyedropper.js', 'ext-shapes.js', 'ext-imagelib.js', 'ext-grid.js', 'ext-polygon.js', 'ext-star.js', 'ext-panning.js', 'ext-storage.js' extensions: [// 'ext-overview_window.js', 'ext-markers.js', 'ext-connector.js',
// 'ext-eyedropper.js', 'ext-shapes.js', 'ext-imagelib.js',
// 'ext-grid.js', 'ext-polygon.js', 'ext-star.js', 'ext-panning.js',
// 'ext-storage.js'
], ],
noDefaultExtensions: false // noDefaultExtensions can only be meaningfully used in svgedit-config-iife.js or in the URL // noDefaultExtensions can only be meaningfully used in
// `svgedit-config-iife.js` or in the URL
noDefaultExtensions: false
}); // STYLESHEET CONFIG }); // STYLESHEET CONFIG
editor.setConfig({ editor.setConfig({
@ -36940,7 +36937,8 @@
Setting as `['*']` would allow any domain to access but would be unsafe to Setting as `['*']` would allow any domain to access but would be unsafe to
data privacy and integrity. data privacy and integrity.
*/ */
// allowedOrigins: [location.origin || 'null'], // May be 'null' (as a string) when used as a `file:///` URL // May be 'null' (as a string) when used as a `file:///` URL
// allowedOrigins: [location.origin || 'null'],
// DOCUMENT PROPERTIES // DOCUMENT PROPERTIES
// dimensions: [640, 480], // dimensions: [640, 480],
// EDITOR OPTIONS // EDITOR OPTIONS
@ -36952,9 +36950,16 @@
// EXTENSION-RELATED (GRID) // EXTENSION-RELATED (GRID)
// showGrid: false, // Set by ext-grid.js // showGrid: false, // Set by ext-grid.js
// EXTENSION-RELATED (STORAGE) // EXTENSION-RELATED (STORAGE)
// noStorageOnLoad: false, // Some interaction with ext-storage.js; prevent even the loading of previously saved local storage // Some interaction with `ext-storage.js`; prevent even the loading of
// forceStorage: false, // Some interaction with ext-storage.js; strongly discouraged from modification as it bypasses user privacy by preventing them from choosing whether to keep local storage or not // previously saved local storage
// emptyStorageOnDecline: true, // Used by ext-storage.js; empty any prior storage if the user declines to store // noStorageOnLoad: false,
// Some interaction with `ext-storage.js`; strongly discouraged from
// modification as it bypasses user privacy by preventing them from
// choosing whether to keep local storage or not
// forceStorage: false,
// Used by `ext-storage.js`; empty any prior storage if the user
// declines to store
// emptyStorageOnDecline: true,
}); // PREF CHANGES }); // PREF CHANGES
/** /**
@ -36971,15 +36976,18 @@
are hard-coded here regardless of URL or prior user storage setting. are hard-coded here regardless of URL or prior user storage setting.
*/ */
editor.setConfig({// lang: '', // Set dynamically within locale.js if not previously set editor.setConfig({// Set dynamically within locale.js if not previously set
// iconsize: '', // Will default to 's' if the window height is smaller than the minimum height and 'm' otherwise // lang: '',
// Will default to 's' if the window height is smaller than the minimum
// height and 'm' otherwise
// iconsize: '',
/** /**
* When showing the preferences dialog, svg-editor.js currently relies * When showing the preferences dialog, svg-editor.js currently relies
* on curPrefs instead of $.pref, so allowing an override for bkgd_color * on `curPrefs` instead of `svgEditor.pref`, so allowing an override for
* means that this value won't have priority over block auto-detection as * `bkgd_color` means that this value won't have priority over block
* far as determining which color shows initially in the preferences * auto-detection as far as determining which color shows initially
* dialog (though it can be changed and saved). * in the preferences dialog (though it can be changed and saved).
*/ */
// bkgd_color: '#FFF', // bkgd_color: '#FFF',
// bkgd_url: '', // bkgd_url: '',
@ -36988,9 +36996,10 @@
// save_notice_done: false, // save_notice_done: false,
// export_notice_done: false // export_notice_done: false
}); });
editor.setConfig({// Indicate pref settings here if you wish to allow user storage or URL settings editor.setConfig({// Indicate pref settings here if you wish to allow user storage or URL
// to be able to override your default preferences (unless other config options // settings to be able to override your default preferences (unless
// have already explicitly prevented one or the other) // other config options have already explicitly prevented one or the
// other)
}, { }, {
allowInitialUserOverride: true allowInitialUserOverride: true
}); });