- Refactoring: Destructuring, templates, label Unicode code point

- npm: Rename `build-doc` to `build-docs`; add `open-docs` script
master
Brett Zamir 2019-04-08 10:50:50 +08:00
parent 91c0dc549b
commit 0c1ddd44fa
18 changed files with 290 additions and 243 deletions

View File

@ -4,9 +4,11 @@
- Enhancement: Return a Promise for Editor's `setCustomHandlers`,
`loadFromString`, `loadFromDataURI` so known when ready and set
- Refactoring: Destructuring, templates, label Unicode code point
- Docs (Refactoring): Formally specify `Promise` resolve type;
add `typedef` for dialog result object; add an
`ArbitraryCallbackResult` type
- npm: Rename `build-doc` to `build-docs`; add `open-docs` script
## 4.3.0

View File

@ -8,7 +8,8 @@ var svgEditorExtension_php_savefile = (function () {
init: function init(_ref) {
var $ = _ref.$;
var svgEditor = this;
var svgCanvas = svgEditor.canvas;
var extPath = svgEditor.curConfig.extPath,
svgCanvas = svgEditor.canvas;
/**
* Get file name out of SVGEdit document title.
* @returns {string}
@ -19,7 +20,7 @@ var svgEditorExtension_php_savefile = (function () {
return title.trim();
}
var saveSvgAction = svgEditor.curConfig.extPath + 'savefile.php';
var saveSvgAction = extPath + 'savefile.php';
svgEditor.setCustomHandlers({
save: function save(win, data) {
var svg = '<?xml version="1.0" encoding="UTF-8"?>\n' + data,

View File

@ -4893,14 +4893,15 @@ var svgEditorExtension_server_moinsave = (function () {
var _save = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(win, data) {
var svg, qstr, name, svgData, c, datauri, pngData;
var svg, qstr, _qstr$substr$split, _qstr$substr$split2, name, svgData, c, datauri, pngData;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
svg = '<?xml version="1.0"?>\n' + data;
qstr = $.param.querystring();
name = qstr.substr(9).split('/+get/')[1];
_qstr$substr$split = qstr.substr(9).split('/+get/'), _qstr$substr$split2 = _slicedToArray(_qstr$substr$split, 2), name = _qstr$substr$split2[1];
svgData = encode64(svg);
if (!$('#export_canvas').length) {
@ -4926,7 +4927,7 @@ var svgEditorExtension_server_moinsave = (function () {
method: 'post',
action: saveSvgAction + '/' + name,
target: 'output_frame'
}).append('<input type="hidden" name="png_data" value="' + pngData + '">').append('<input type="hidden" name="filepath" value="' + svgData + '">').append('<input type="hidden" name="filename" value="' + 'drawing.svg">').append('<input type="hidden" name="contenttype" value="application/x-svgdraw">').appendTo('body').submit().remove();
}).append("\n <input type=\"hidden\" name=\"png_data\" value=\"".concat(pngData, "\">\n <input type=\"hidden\" name=\"filepath\" value=\"").concat(svgData, "\">\n <input type=\"hidden\" name=\"filename\" value=\"drawing.svg\">\n <input type=\"hidden\" name=\"contenttype\" value=\"application/x-svgdraw\">\n ")).appendTo('body').submit().remove();
$.alert(strings.saved);
top.window.location = '/' + name;

View File

@ -4868,7 +4868,7 @@ var svgEditorExtension_server_opensave = (function () {
var _init = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee5(_ref) {
var $, decode64, encode64, importLocale, strings, svgEditor, svgCanvas, getFileNameFromTitle, xhtmlEscape, clientDownloadSupport, saveSvgAction, saveImgAction, cancelled, openSvgAction, importSvgAction, importImgAction, openSvgForm, importSvgForm, importImgForm, rebuildInput;
var $, decode64, encode64, importLocale, strings, svgEditor, extPath, svgCanvas, getFileNameFromTitle, xhtmlEscape, clientDownloadSupport, saveSvgAction, saveImgAction, cancelled, openSvgAction, importSvgAction, importImgAction, openSvgForm, importSvgForm, importImgForm, rebuildInput;
return regeneratorRuntime.wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
@ -5006,13 +5006,13 @@ var svgEditorExtension_server_opensave = (function () {
case 7:
strings = _context5.sent;
svgEditor = this;
svgCanvas = svgEditor.canvas;
extPath = svgEditor.curConfig, svgCanvas = svgEditor.canvas;
/**
*
* @returns {string}
*/
saveSvgAction = svgEditor.curConfig.extPath + 'filesave.php', saveImgAction = svgEditor.curConfig.extPath + 'filesave.php'; // Create upload target (hidden iframe)
saveSvgAction = extPath + 'filesave.php', saveImgAction = extPath + 'filesave.php'; // Create upload target (hidden iframe)
cancelled = false; // Hiding by size instead of display to avoid FF console errors
// with `getBBox` in browser.js `supportsPathBBox_`)
@ -5032,7 +5032,7 @@ var svgEditorExtension_server_opensave = (function () {
method: 'post',
action: saveSvgAction,
target: 'output_frame'
}).append('<input type="hidden" name="output_svg" value="' + xhtmlEscape(svg) + '">').append('<input type="hidden" name="filename" value="' + xhtmlEscape(filename) + '">').appendTo('body').submit().remove();
}).append("\n <input type=\"hidden\" name=\"output_svg\" value=\"".concat(xhtmlEscape(svg), "\">\n <input type=\"hidden\" name=\"filename\" value=\"").concat(xhtmlEscape(filename), "\">\n ")).appendTo('body').submit().remove();
},
exportPDF: function exportPDF(win, data) {
var filename = getFileNameFromTitle(),
@ -5046,7 +5046,7 @@ var svgEditorExtension_server_opensave = (function () {
method: 'post',
action: saveImgAction,
target: 'output_frame'
}).append('<input type="hidden" name="output_img" value="' + datauri + '">').append('<input type="hidden" name="mime" value="application/pdf">').append('<input type="hidden" name="filename" value="' + xhtmlEscape(filename) + '">').appendTo('body').submit().remove();
}).append("\n <input type=\"hidden\" name=\"output_img\" value=\"".concat(datauri, "\">\n <input type=\"hidden\" name=\"mime\" value=\"application/pdf\">\n <input type=\"hidden\" name=\"filename\" value=\"").concat(xhtmlEscape(filename), "\">\n ")).appendTo('body').submit().remove();
},
// Todo: Integrate this extension with a new built-in exportWindowType, "download"
exportImage: function () {
@ -5079,7 +5079,8 @@ var svgEditorExtension_server_opensave = (function () {
note = '';
if (issues.length) {
pre = "\n \u2022 ";
pre = "\n \u2022 "; // Bullet
note += '\n\n' + pre + issues.join(pre);
}
@ -5107,7 +5108,7 @@ var svgEditorExtension_server_opensave = (function () {
method: 'post',
action: saveImgAction,
target: 'output_frame'
}).append('<input type="hidden" name="output_img" value="' + datauri + '">').append('<input type="hidden" name="mime" value="' + mimeType + '">').append('<input type="hidden" name="filename" value="' + xhtmlEscape(filename) + '">').appendTo('body').submit().remove();
}).append("\n <input type=\"hidden\" name=\"output_img\" value=\"".concat(datauri, "\">\n <input type=\"hidden\" name=\"mime\" value=\"").concat(mimeType, "\">\n <input type=\"hidden\" name=\"filename\" value=\"").concat(xhtmlEscape(filename), "\">\n ")).appendTo('body').submit().remove();
case 18:
case "end":
@ -5134,9 +5135,9 @@ var svgEditorExtension_server_opensave = (function () {
case 16:
// Change these to appropriate script file
openSvgAction = svgEditor.curConfig.extPath + 'fileopen.php?type=load_svg';
importSvgAction = svgEditor.curConfig.extPath + 'fileopen.php?type=import_svg';
importImgAction = svgEditor.curConfig.extPath + 'fileopen.php?type=import_img'; // Set up function for PHP uploader to use
openSvgAction = extPath + 'fileopen.php?type=load_svg';
importSvgAction = extPath + 'fileopen.php?type=import_svg';
importImgAction = extPath + 'fileopen.php?type=import_img'; // Set up function for PHP uploader to use
svgEditor.processFile = function (str64, type) {
var xmlstr;

94
dist/index-es.js vendored
View File

@ -9377,7 +9377,7 @@ function addScriptAtts(script, atts) {
* @function module:importModule.importSetGlobalDefault
* @param {string|string[]} url
* @param {module:importModule.ImportConfig} config
* @returns {Promise} The value to which it resolves depends on the export of the targeted module.
* @returns {Promise<*>} The value to which it resolves depends on the export of the targeted module.
*/
@ -9390,7 +9390,7 @@ function importSetGlobalDefault(url, config) {
* @function module:importModule.importSetGlobal
* @param {string|string[]} url
* @param {module:importModule.ImportConfig} config
* @returns {Promise} The promise resolves to either an `ArbitraryModule` or
* @returns {Promise<ArbitraryModule>} The promise resolves to either an `ArbitraryModule` or
* any other value depends on the export of the targeted module.
*/
@ -9402,7 +9402,7 @@ function importSetGlobal(_x, _x2) {
* @author Brett Zamir (other items are from `dynamic-import-polyfill`)
* @param {string|string[]} url
* @param {PlainObject} [atts={}]
* @returns {Promise} Resolves to `undefined` or rejects with an `Error` upon a
* @returns {Promise<void|Error>} Resolves to `undefined` or rejects with an `Error` upon a
* script loading error
*/
@ -9493,14 +9493,14 @@ function importScript(url) {
});
}
/**
*
* @param {string|string[]} url
* @param {PlainObject} [atts={}]
* @param {PlainObject} opts
* @param {boolean} [opts.returnDefault=false} = {}]
* @returns {Promise} Resolves to value of loading module or rejects with
* `Error` upon a script loading error.
*/
*
* @param {string|string[]} url
* @param {PlainObject} [atts={}]
* @param {PlainObject} opts
* @param {boolean} [opts.returnDefault=false} = {}]
* @returns {Promise<*>} Resolves to value of loading module or rejects with
* `Error` upon a script loading error.
*/
function importModule(url) {
var atts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@ -9592,13 +9592,19 @@ function jQueryPluginDBox($) {
var box = $('#dialog_box'),
btnHolder = $('#dialog_buttons'),
dialogContent = $('#dialog_content');
/**
* @typedef {PlainObject} module:jQueryPluginDBox.PromiseResultObject
* @property {string|true} response
* @property {boolean} checked
*/
/**
* Resolves to `false` (if cancelled), for prompts and selects
* without checkboxes, it resolves to the value of the form control. For other
* types without checkboxes, it resolves to `true`. For checkboxes, it resolves
* to an object with the `response` key containing the same value as the previous
* mentioned (string or `true`) and a `checked` (boolean) property.
* @typedef {Promise} module:jQueryPluginDBox.PromiseResult
* @typedef {Promise<boolean|string|module:jQueryPluginDBox.PromiseResultObject>} module:jQueryPluginDBox.PromiseResult
*/
/**
@ -14608,7 +14614,7 @@ function SvgCanvas(container, config) {
/**
* @function module:svgcanvas.ExtensionInitResponse#addLangData
* @param {module:svgcanvas.SvgCanvas#event:ext-addLangData} arg
* @returns {Promise} Resolves to {@link module:locale.ExtensionLocaleData}
* @returns {Promise<module:locale.ExtensionLocaleData>} Resolves to {@link module:locale.ExtensionLocaleData}
*/
/**
@ -14634,7 +14640,7 @@ function SvgCanvas(container, config) {
* @callback module:svgcanvas.ExtensionInitCallback
* @this module:SVGEditor
* @param {module:svgcanvas.ExtensionArgumentObject} arg
* @returns {Promise} Resolves to [ExtensionInitResponse]{@link module:svgcanvas.ExtensionInitResponse} or `undefined`
* @returns {Promise<module:svgcanvas.ExtensionInitResponse|void>} Resolves to [ExtensionInitResponse]{@link module:svgcanvas.ExtensionInitResponse} or `undefined`
*/
/**
@ -14652,7 +14658,7 @@ function SvgCanvas(container, config) {
* @fires module:svgcanvas.SvgCanvas#event:extension_added
* @throws {TypeError|Error} `TypeError` if `extInitFunc` is not a function, `Error`
* if extension of supplied name already exists
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -14985,7 +14991,7 @@ function SvgCanvas(container, config) {
/**
* The promise return, if present, resolves to `undefined`
* (`extension_added`, `exported`, `saved`)
* @typedef {Promise|undefined} module:svgcanvas.EventHandlerReturn
* @typedef {Promise<void>|void} module:svgcanvas.EventHandlerReturn
*/
/**
@ -17688,7 +17694,7 @@ function SvgCanvas(container, config) {
* Converts a given image file to a data URL when possible, then runs a given callback.
* @function module:svgcanvas.SvgCanvas#embedImage
* @param {string} src - The path/URL of the image
* @returns {Promise} Resolves to Data URL (string|false)
* @returns {Promise<string|false>} Resolves to a Data URL (string|false)
*/
@ -17840,7 +17846,7 @@ function SvgCanvas(container, config) {
* @param {boolean} [opts.avoidEvent]
* @fires module:svgcanvas.SvgCanvas#event:exported
* @todo Confirm/fix ICO type
* @returns {Promise} Resolves to {@link module:svgcanvas.ImageExportedResults}
* @returns {Promise<module:svgcanvas.ImageExportedResults>} Resolves to {@link module:svgcanvas.ImageExportedResults}
*/
this.rasterExport =
@ -17987,7 +17993,7 @@ function SvgCanvas(container, config) {
* @param {string} [exportWindowName] Will also be used for the download file name here
* @param {external:jsPDF.OutputType} [outputType="dataurlstring"]
* @fires module:svgcanvas.SvgCanvas#event:exportedPDF
* @returns {Promise} Resolves to {@link module:svgcanvas.PDFExportedResults}
* @returns {Promise<module:svgcanvas.PDFExportedResults>} Resolves to {@link module:svgcanvas.PDFExportedResults}
*/
@ -28172,7 +28178,7 @@ var init$7 = function init(editor) {
* @function module:locale.readLang
* @param {module:locale.LocaleStrings} langData See {@tutorial LocaleDocs}
* @fires module:svgcanvas.SvgCanvas#event:ext-addLangData
* @returns {Promise} Resolves to [`LangAndData`]{@link module:locale.LangAndData}
* @returns {Promise<module:locale.LangAndData>} Resolves to [`LangAndData`]{@link module:locale.LangAndData}
*/
var readLang =
@ -28425,7 +28431,7 @@ function () {
* @fires module:svgcanvas.SvgCanvas#event:ext-addLangData
* @fires module:svgcanvas.SvgCanvas#event:ext-langReady
* @fires module:svgcanvas.SvgCanvas#event:ext-langChanged
* @returns {Promise} Resolves to result of {@link module:locale.readLang}
* @returns {Promise<module:locale.LangAndData>} Resolves to result of {@link module:locale.readLang}
*/
var putLocale =
@ -28918,7 +28924,7 @@ curConfig = {
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.noAlert]
* @throws {Error} Upon failure to load SVG
* @returns {Promise} Resolves to undefined upon success (or if `noAlert` is
* @returns {Promise<void>} Resolves to undefined upon success (or if `noAlert` is
* falsey, though only until after the `alert` is closed); rejects if SVG
* loading fails and `noAlert` is truthy.
*/
@ -28992,7 +28998,7 @@ function getImportLocale(_ref) {
* @param {PlainObject} localeInfo
* @param {string} [localeInfo.name] Defaults to `defaultName` of {@link module:SVGEditor~getImportLocale}
* @param {string} [localeInfo.lang=defaultLang] Defaults to `defaultLang` of {@link module:SVGEditor~getImportLocale}
* @returns {Promise} Resolves to {@link module:locale.LocaleStrings}
* @returns {Promise<module:locale.LocaleStrings>} Resolves to {@link module:locale.LocaleStrings}
*/
return (
/*#__PURE__*/
@ -29285,12 +29291,12 @@ editor.setConfig = function (opts, cfgCfg) {
* Allows one to override default SVGEdit `open`, `save`, and
* `export` editor behaviors.
* @param {module:SVGEditor.CustomHandler} opts Extension mechanisms may call `setCustomHandlers` with three functions: `opts.open`, `opts.save`, and `opts.exportImage`
* @returns {undefined}
* @returns {Promise<void>}
*/
editor.setCustomHandlers = function (opts) {
editor.ready(function () {
return editor.ready(function () {
if (opts.open) {
$$b('#tool_open > input[type="file"]').remove();
$$b('#tool_open').show();
@ -29499,7 +29505,7 @@ editor.init = function () {
* @fires module:svgcanvas.SvgCanvas#event:ext-langReady
* @fires module:svgcanvas.SvgCanvas#event:ext-langChanged
* @fires module:svgcanvas.SvgCanvas#event:extensions_added
* @returns {Promise} Resolves to result of {@link module:locale.readLang}
* @returns {Promise<module:locale.LangAndData>} Resolves to result of {@link module:locale.readLang}
*/
@ -30704,7 +30710,7 @@ editor.init = function () {
/**
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.cancelDeletes=false}]
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -31980,7 +31986,7 @@ editor.init = function () {
* @param {external:Window} win
* @param {module:svgcanvas.SvgCanvas#event:extension_added} ext
* @listens module:svgcanvas.SvgCanvas#event:extension_added
* @returns {Promise|undefined} Resolves to `undefined`
* @returns {Promise<void>|undefined} Resolves to `undefined`
*/
var extAdded =
@ -33423,7 +33429,7 @@ editor.init = function () {
};
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -33578,7 +33584,7 @@ editor.init = function () {
};
/**
* @fires module:svgcanvas.SvgCanvas#event:ext-onNewDocument
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -33671,7 +33677,7 @@ editor.init = function () {
var loadingURL;
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
var clickExport =
@ -33966,7 +33972,7 @@ editor.init = function () {
};
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -34177,7 +34183,7 @@ editor.init = function () {
var resetScrollPos = $$b.noop;
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
var cancelOverlays =
@ -35876,7 +35882,7 @@ editor.init = function () {
return uiStrings$1;
};
/**
* @returns {Promise} Resolves to boolean indicating `true` if there were no changes
* @returns {Promise<boolean>} Resolves to boolean indicating `true` if there were no changes
* and `false` after the user confirms.
*/
@ -36113,7 +36119,7 @@ editor.init = function () {
* @param {module:locale.LocaleStrings} allStrings See {@tutorial LocaleDocs}
* @fires module:svgcanvas.SvgCanvas#event:ext-langReady
* @fires module:svgcanvas.SvgCanvas#event:ext-langChanged
* @returns {Promise} A Promise which resolves to `undefined`
* @returns {Promise<void>} A Promise which resolves to `undefined`
*/
var setLang = editor.setLang =
@ -36279,7 +36285,7 @@ editor.init = function () {
};
/**
* @callback module:SVGEditor.ReadyCallback
* @returns {Promise|undefined}
* @returns {Promise<void>|undefined}
*/
/**
@ -36287,7 +36293,7 @@ editor.init = function () {
* to be invoked immediately if it is already ready--i.e.,
* if `runCallbacks` has been run).
* @param {module:SVGEditor.ReadyCallback} cb Callback to be queued to invoke
* @returns {Promise} Resolves when all callbacks, including the supplied have resolved
* @returns {Promise<ArbitraryCallbackResult>} Resolves when all callbacks, including the supplied have resolved
*/
@ -36306,7 +36312,7 @@ editor.ready = function (cb) {
};
/**
* Invokes the callbacks previous set by `svgEditor.ready`
* @returns {Promise} Resolves to `undefined` if all callbacks succeeded and rejects otherwise
* @returns {Promise<void>} Resolves to `undefined` if all callbacks succeeded and rejects otherwise
*/
@ -36363,14 +36369,14 @@ regeneratorRuntime.mark(function _callee20() {
* @param {string} str The SVG string to load
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.noAlert=false] Option to avoid alert to user and instead get rejected promise
* @returns {Promise}
* @returns {Promise<void>}
*/
editor.loadFromString = function (str) {
var _ref39 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref39.noAlert;
editor.ready(
return editor.ready(
/*#__PURE__*/
_asyncToGenerator(
/*#__PURE__*/
@ -36431,7 +36437,7 @@ editor.disableUI = function (featList) {// $(function () {
* @param {PlainObject} [opts={}] May contain properties: `cache`, `callback`
* @param {boolean} [opts.cache]
* @param {boolean} [opts.noAlert]
* @returns {Promise} Resolves to `undefined` or rejects upon bad loading of
* @returns {Promise<void>} Resolves to `undefined` or rejects upon bad loading of
* the SVG (or upon failure to parse the loaded string) when `noAlert` is
* enabled
*/
@ -36484,7 +36490,7 @@ editor.loadFromURL = function (url) {
* @param {string} str The Data URI to base64-decode (if relevant) and load
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.noAlert]
* @returns {Promise} Resolves to `undefined` and rejects if loading SVG string fails and `noAlert` is enabled
* @returns {Promise<void>} Resolves to `undefined` and rejects if loading SVG string fails and `noAlert` is enabled
*/
@ -36492,7 +36498,7 @@ editor.loadFromDataURI = function (str) {
var _ref42 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref42.noAlert;
editor.ready(function () {
return editor.ready(function () {
var base64 = false;
var pre = str.match(/^data:image\/svg\+xml;base64,/);
@ -36517,7 +36523,7 @@ editor.loadFromDataURI = function (str) {
* @param {module:svgcanvas.ExtensionInitCallback} init Config to be invoked on this module
* @param {module:svgcanvas.ExtensionInitArgs} initArgs
* @throws {Error} If called too early
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

80
dist/index-umd.js vendored
View File

@ -9383,7 +9383,7 @@
* @function module:importModule.importSetGlobalDefault
* @param {string|string[]} url
* @param {module:importModule.ImportConfig} config
* @returns {Promise} The value to which it resolves depends on the export of the targeted module.
* @returns {Promise<*>} The value to which it resolves depends on the export of the targeted module.
*/
@ -9396,7 +9396,7 @@
* @function module:importModule.importSetGlobal
* @param {string|string[]} url
* @param {module:importModule.ImportConfig} config
* @returns {Promise} The promise resolves to either an `ArbitraryModule` or
* @returns {Promise<ArbitraryModule>} The promise resolves to either an `ArbitraryModule` or
* any other value depends on the export of the targeted module.
*/
@ -9408,7 +9408,7 @@
* @author Brett Zamir (other items are from `dynamic-import-polyfill`)
* @param {string|string[]} url
* @param {PlainObject} [atts={}]
* @returns {Promise} Resolves to `undefined` or rejects with an `Error` upon a
* @returns {Promise<void|Error>} Resolves to `undefined` or rejects with an `Error` upon a
* script loading error
*/
@ -9504,7 +9504,7 @@
* @param {PlainObject} [atts={}]
* @param {PlainObject} opts
* @param {boolean} [opts.returnDefault=false} = {}]
* @returns {Promise} Resolves to value of loading module or rejects with
* @returns {Promise<*>} Resolves to value of loading module or rejects with
* `Error` upon a script loading error.
*/
@ -9598,13 +9598,19 @@
var box = $('#dialog_box'),
btnHolder = $('#dialog_buttons'),
dialogContent = $('#dialog_content');
/**
* @typedef {PlainObject} module:jQueryPluginDBox.PromiseResultObject
* @property {string|true} response
* @property {boolean} checked
*/
/**
* Resolves to `false` (if cancelled), for prompts and selects
* without checkboxes, it resolves to the value of the form control. For other
* types without checkboxes, it resolves to `true`. For checkboxes, it resolves
* to an object with the `response` key containing the same value as the previous
* mentioned (string or `true`) and a `checked` (boolean) property.
* @typedef {Promise} module:jQueryPluginDBox.PromiseResult
* @typedef {Promise<boolean|string|module:jQueryPluginDBox.PromiseResultObject>} module:jQueryPluginDBox.PromiseResult
*/
/**
@ -14614,7 +14620,7 @@
/**
* @function module:svgcanvas.ExtensionInitResponse#addLangData
* @param {module:svgcanvas.SvgCanvas#event:ext-addLangData} arg
* @returns {Promise} Resolves to {@link module:locale.ExtensionLocaleData}
* @returns {Promise<module:locale.ExtensionLocaleData>} Resolves to {@link module:locale.ExtensionLocaleData}
*/
/**
@ -14640,7 +14646,7 @@
* @callback module:svgcanvas.ExtensionInitCallback
* @this module:SVGEditor
* @param {module:svgcanvas.ExtensionArgumentObject} arg
* @returns {Promise} Resolves to [ExtensionInitResponse]{@link module:svgcanvas.ExtensionInitResponse} or `undefined`
* @returns {Promise<module:svgcanvas.ExtensionInitResponse|void>} Resolves to [ExtensionInitResponse]{@link module:svgcanvas.ExtensionInitResponse} or `undefined`
*/
/**
@ -14658,7 +14664,7 @@
* @fires module:svgcanvas.SvgCanvas#event:extension_added
* @throws {TypeError|Error} `TypeError` if `extInitFunc` is not a function, `Error`
* if extension of supplied name already exists
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -14991,7 +14997,7 @@
/**
* The promise return, if present, resolves to `undefined`
* (`extension_added`, `exported`, `saved`)
* @typedef {Promise|undefined} module:svgcanvas.EventHandlerReturn
* @typedef {Promise<void>|void} module:svgcanvas.EventHandlerReturn
*/
/**
@ -17694,7 +17700,7 @@
* Converts a given image file to a data URL when possible, then runs a given callback.
* @function module:svgcanvas.SvgCanvas#embedImage
* @param {string} src - The path/URL of the image
* @returns {Promise} Resolves to Data URL (string|false)
* @returns {Promise<string|false>} Resolves to a Data URL (string|false)
*/
@ -17846,7 +17852,7 @@
* @param {boolean} [opts.avoidEvent]
* @fires module:svgcanvas.SvgCanvas#event:exported
* @todo Confirm/fix ICO type
* @returns {Promise} Resolves to {@link module:svgcanvas.ImageExportedResults}
* @returns {Promise<module:svgcanvas.ImageExportedResults>} Resolves to {@link module:svgcanvas.ImageExportedResults}
*/
this.rasterExport =
@ -17993,7 +17999,7 @@
* @param {string} [exportWindowName] Will also be used for the download file name here
* @param {external:jsPDF.OutputType} [outputType="dataurlstring"]
* @fires module:svgcanvas.SvgCanvas#event:exportedPDF
* @returns {Promise} Resolves to {@link module:svgcanvas.PDFExportedResults}
* @returns {Promise<module:svgcanvas.PDFExportedResults>} Resolves to {@link module:svgcanvas.PDFExportedResults}
*/
@ -28178,7 +28184,7 @@
* @function module:locale.readLang
* @param {module:locale.LocaleStrings} langData See {@tutorial LocaleDocs}
* @fires module:svgcanvas.SvgCanvas#event:ext-addLangData
* @returns {Promise} Resolves to [`LangAndData`]{@link module:locale.LangAndData}
* @returns {Promise<module:locale.LangAndData>} Resolves to [`LangAndData`]{@link module:locale.LangAndData}
*/
var readLang =
@ -28431,7 +28437,7 @@
* @fires module:svgcanvas.SvgCanvas#event:ext-addLangData
* @fires module:svgcanvas.SvgCanvas#event:ext-langReady
* @fires module:svgcanvas.SvgCanvas#event:ext-langChanged
* @returns {Promise} Resolves to result of {@link module:locale.readLang}
* @returns {Promise<module:locale.LangAndData>} Resolves to result of {@link module:locale.readLang}
*/
var putLocale =
@ -28924,7 +28930,7 @@
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.noAlert]
* @throws {Error} Upon failure to load SVG
* @returns {Promise} Resolves to undefined upon success (or if `noAlert` is
* @returns {Promise<void>} Resolves to undefined upon success (or if `noAlert` is
* falsey, though only until after the `alert` is closed); rejects if SVG
* loading fails and `noAlert` is truthy.
*/
@ -28998,7 +29004,7 @@
* @param {PlainObject} localeInfo
* @param {string} [localeInfo.name] Defaults to `defaultName` of {@link module:SVGEditor~getImportLocale}
* @param {string} [localeInfo.lang=defaultLang] Defaults to `defaultLang` of {@link module:SVGEditor~getImportLocale}
* @returns {Promise} Resolves to {@link module:locale.LocaleStrings}
* @returns {Promise<module:locale.LocaleStrings>} Resolves to {@link module:locale.LocaleStrings}
*/
return (
/*#__PURE__*/
@ -29291,12 +29297,12 @@
* Allows one to override default SVGEdit `open`, `save`, and
* `export` editor behaviors.
* @param {module:SVGEditor.CustomHandler} opts Extension mechanisms may call `setCustomHandlers` with three functions: `opts.open`, `opts.save`, and `opts.exportImage`
* @returns {undefined}
* @returns {Promise<void>}
*/
editor.setCustomHandlers = function (opts) {
editor.ready(function () {
return editor.ready(function () {
if (opts.open) {
$$b('#tool_open > input[type="file"]').remove();
$$b('#tool_open').show();
@ -29505,7 +29511,7 @@
* @fires module:svgcanvas.SvgCanvas#event:ext-langReady
* @fires module:svgcanvas.SvgCanvas#event:ext-langChanged
* @fires module:svgcanvas.SvgCanvas#event:extensions_added
* @returns {Promise} Resolves to result of {@link module:locale.readLang}
* @returns {Promise<module:locale.LangAndData>} Resolves to result of {@link module:locale.readLang}
*/
@ -30710,7 +30716,7 @@
/**
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.cancelDeletes=false}]
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -31986,7 +31992,7 @@
* @param {external:Window} win
* @param {module:svgcanvas.SvgCanvas#event:extension_added} ext
* @listens module:svgcanvas.SvgCanvas#event:extension_added
* @returns {Promise|undefined} Resolves to `undefined`
* @returns {Promise<void>|undefined} Resolves to `undefined`
*/
var extAdded =
@ -33429,7 +33435,7 @@
};
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -33584,7 +33590,7 @@
};
/**
* @fires module:svgcanvas.SvgCanvas#event:ext-onNewDocument
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -33677,7 +33683,7 @@
var loadingURL;
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
var clickExport =
@ -33972,7 +33978,7 @@
};
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -34183,7 +34189,7 @@
var resetScrollPos = $$b.noop;
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
var cancelOverlays =
@ -35882,7 +35888,7 @@
return uiStrings$1;
};
/**
* @returns {Promise} Resolves to boolean indicating `true` if there were no changes
* @returns {Promise<boolean>} Resolves to boolean indicating `true` if there were no changes
* and `false` after the user confirms.
*/
@ -36119,7 +36125,7 @@
* @param {module:locale.LocaleStrings} allStrings See {@tutorial LocaleDocs}
* @fires module:svgcanvas.SvgCanvas#event:ext-langReady
* @fires module:svgcanvas.SvgCanvas#event:ext-langChanged
* @returns {Promise} A Promise which resolves to `undefined`
* @returns {Promise<void>} A Promise which resolves to `undefined`
*/
var setLang = editor.setLang =
@ -36285,7 +36291,7 @@
};
/**
* @callback module:SVGEditor.ReadyCallback
* @returns {Promise|undefined}
* @returns {Promise<void>|undefined}
*/
/**
@ -36293,7 +36299,7 @@
* to be invoked immediately if it is already ready--i.e.,
* if `runCallbacks` has been run).
* @param {module:SVGEditor.ReadyCallback} cb Callback to be queued to invoke
* @returns {Promise} Resolves when all callbacks, including the supplied have resolved
* @returns {Promise<ArbitraryCallbackResult>} Resolves when all callbacks, including the supplied have resolved
*/
@ -36312,7 +36318,7 @@
};
/**
* Invokes the callbacks previous set by `svgEditor.ready`
* @returns {Promise} Resolves to `undefined` if all callbacks succeeded and rejects otherwise
* @returns {Promise<void>} Resolves to `undefined` if all callbacks succeeded and rejects otherwise
*/
@ -36369,14 +36375,14 @@
* @param {string} str The SVG string to load
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.noAlert=false] Option to avoid alert to user and instead get rejected promise
* @returns {Promise}
* @returns {Promise<void>}
*/
editor.loadFromString = function (str) {
var _ref39 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref39.noAlert;
editor.ready(
return editor.ready(
/*#__PURE__*/
_asyncToGenerator(
/*#__PURE__*/
@ -36437,7 +36443,7 @@
* @param {PlainObject} [opts={}] May contain properties: `cache`, `callback`
* @param {boolean} [opts.cache]
* @param {boolean} [opts.noAlert]
* @returns {Promise} Resolves to `undefined` or rejects upon bad loading of
* @returns {Promise<void>} Resolves to `undefined` or rejects upon bad loading of
* the SVG (or upon failure to parse the loaded string) when `noAlert` is
* enabled
*/
@ -36490,7 +36496,7 @@
* @param {string} str The Data URI to base64-decode (if relevant) and load
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.noAlert]
* @returns {Promise} Resolves to `undefined` and rejects if loading SVG string fails and `noAlert` is enabled
* @returns {Promise<void>} Resolves to `undefined` and rejects if loading SVG string fails and `noAlert` is enabled
*/
@ -36498,7 +36504,7 @@
var _ref42 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref42.noAlert;
editor.ready(function () {
return editor.ready(function () {
var base64 = false;
var pre = str.match(/^data:image\/svg\+xml;base64,/);
@ -36523,7 +36529,7 @@
* @param {module:svgcanvas.ExtensionInitCallback} init Config to be invoked on this module
* @param {module:svgcanvas.ExtensionInitArgs} initArgs
* @throws {Error} If called too early
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2629,13 +2629,19 @@ var SvgCanvas = (function () {
var box = $('#dialog_box'),
btnHolder = $('#dialog_buttons'),
dialogContent = $('#dialog_content');
/**
* @typedef {PlainObject} module:jQueryPluginDBox.PromiseResultObject
* @property {string|true} response
* @property {boolean} checked
*/
/**
* Resolves to `false` (if cancelled), for prompts and selects
* without checkboxes, it resolves to the value of the form control. For other
* types without checkboxes, it resolves to `true`. For checkboxes, it resolves
* to an object with the `response` key containing the same value as the previous
* mentioned (string or `true`) and a `checked` (boolean) property.
* @typedef {Promise} module:jQueryPluginDBox.PromiseResult
* @typedef {Promise<boolean|string|module:jQueryPluginDBox.PromiseResultObject>} module:jQueryPluginDBox.PromiseResult
*/
/**
@ -11248,7 +11254,7 @@ var SvgCanvas = (function () {
* @function module:importModule.importSetGlobal
* @param {string|string[]} url
* @param {module:importModule.ImportConfig} config
* @returns {Promise} The promise resolves to either an `ArbitraryModule` or
* @returns {Promise<ArbitraryModule>} The promise resolves to either an `ArbitraryModule` or
* any other value depends on the export of the targeted module.
*/
@ -11260,7 +11266,7 @@ var SvgCanvas = (function () {
* @author Brett Zamir (other items are from `dynamic-import-polyfill`)
* @param {string|string[]} url
* @param {PlainObject} [atts={}]
* @returns {Promise} Resolves to `undefined` or rejects with an `Error` upon a
* @returns {Promise<void|Error>} Resolves to `undefined` or rejects with an `Error` upon a
* script loading error
*/
@ -11356,7 +11362,7 @@ var SvgCanvas = (function () {
* @param {PlainObject} [atts={}]
* @param {PlainObject} opts
* @param {boolean} [opts.returnDefault=false} = {}]
* @returns {Promise} Resolves to value of loading module or rejects with
* @returns {Promise<*>} Resolves to value of loading module or rejects with
* `Error` upon a script loading error.
*/
@ -14386,7 +14392,7 @@ var SvgCanvas = (function () {
/**
* @function module:svgcanvas.ExtensionInitResponse#addLangData
* @param {module:svgcanvas.SvgCanvas#event:ext-addLangData} arg
* @returns {Promise} Resolves to {@link module:locale.ExtensionLocaleData}
* @returns {Promise<module:locale.ExtensionLocaleData>} Resolves to {@link module:locale.ExtensionLocaleData}
*/
/**
@ -14412,7 +14418,7 @@ var SvgCanvas = (function () {
* @callback module:svgcanvas.ExtensionInitCallback
* @this module:SVGEditor
* @param {module:svgcanvas.ExtensionArgumentObject} arg
* @returns {Promise} Resolves to [ExtensionInitResponse]{@link module:svgcanvas.ExtensionInitResponse} or `undefined`
* @returns {Promise<module:svgcanvas.ExtensionInitResponse|void>} Resolves to [ExtensionInitResponse]{@link module:svgcanvas.ExtensionInitResponse} or `undefined`
*/
/**
@ -14430,7 +14436,7 @@ var SvgCanvas = (function () {
* @fires module:svgcanvas.SvgCanvas#event:extension_added
* @throws {TypeError|Error} `TypeError` if `extInitFunc` is not a function, `Error`
* if extension of supplied name already exists
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -14763,7 +14769,7 @@ var SvgCanvas = (function () {
/**
* The promise return, if present, resolves to `undefined`
* (`extension_added`, `exported`, `saved`)
* @typedef {Promise|undefined} module:svgcanvas.EventHandlerReturn
* @typedef {Promise<void>|void} module:svgcanvas.EventHandlerReturn
*/
/**
@ -17466,7 +17472,7 @@ var SvgCanvas = (function () {
* Converts a given image file to a data URL when possible, then runs a given callback.
* @function module:svgcanvas.SvgCanvas#embedImage
* @param {string} src - The path/URL of the image
* @returns {Promise} Resolves to Data URL (string|false)
* @returns {Promise<string|false>} Resolves to a Data URL (string|false)
*/
@ -17618,7 +17624,7 @@ var SvgCanvas = (function () {
* @param {boolean} [opts.avoidEvent]
* @fires module:svgcanvas.SvgCanvas#event:exported
* @todo Confirm/fix ICO type
* @returns {Promise} Resolves to {@link module:svgcanvas.ImageExportedResults}
* @returns {Promise<module:svgcanvas.ImageExportedResults>} Resolves to {@link module:svgcanvas.ImageExportedResults}
*/
this.rasterExport =
@ -17765,7 +17771,7 @@ var SvgCanvas = (function () {
* @param {string} [exportWindowName] Will also be used for the download file name here
* @param {external:jsPDF.OutputType} [outputType="dataurlstring"]
* @fires module:svgcanvas.SvgCanvas#event:exportedPDF
* @returns {Promise} Resolves to {@link module:svgcanvas.PDFExportedResults}
* @returns {Promise<module:svgcanvas.PDFExportedResults>} Resolves to {@link module:svgcanvas.PDFExportedResults}
*/

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,10 @@ export default {
name: 'php_savefile',
init ({$}) {
const svgEditor = this;
const svgCanvas = svgEditor.canvas;
const {
curConfig: {extPath},
canvas: svgCanvas
} = svgEditor;
/**
* Get file name out of SVGEdit document title.
* @returns {string}
@ -14,7 +17,7 @@ export default {
const title = svgCanvas.getDocumentTitle();
return title.trim();
}
const saveSvgAction = svgEditor.curConfig.extPath + 'savefile.php';
const saveSvgAction = extPath + 'savefile.php';
svgEditor.setCustomHandlers({
save (win, data) {
const svg = '<?xml version="1.0" encoding="UTF-8"?>\n' + data,

View File

@ -29,7 +29,7 @@ export default {
async save (win, data) {
const svg = '<?xml version="1.0"?>\n' + data;
const qstr = $.param.querystring();
const name = qstr.substr(9).split('/+get/')[1];
const [, name] = qstr.substr(9).split('/+get/');
const svgData = encode64(svg);
if (!$('#export_canvas').length) {
$('<canvas>', {id: 'export_canvas'}).hide().appendTo('body');
@ -45,11 +45,12 @@ export default {
method: 'post',
action: saveSvgAction + '/' + name,
target: 'output_frame'
}).append('<input type="hidden" name="png_data" value="' + pngData + '">')
.append('<input type="hidden" name="filepath" value="' + svgData + '">')
.append('<input type="hidden" name="filename" value="' + 'drawing.svg">')
.append('<input type="hidden" name="contenttype" value="application/x-svgdraw">')
.appendTo('body')
}).append(`
<input type="hidden" name="png_data" value="${pngData}">
<input type="hidden" name="filepath" value="${svgData}">
<input type="hidden" name="filename" value="drawing.svg">
<input type="hidden" name="contenttype" value="application/x-svgdraw">
`).appendTo('body')
.submit().remove();
$.alert(strings.saved);
top.window.location = '/' + name;

View File

@ -13,7 +13,11 @@ export default {
async init ({$, decode64, encode64, importLocale}) {
const strings = await importLocale();
const svgEditor = this;
const svgCanvas = svgEditor.canvas;
const {
curConfig: extPath,
canvas: svgCanvas
} = svgEditor;
/**
*
* @returns {string}
@ -53,8 +57,8 @@ export default {
return false;
}
const
saveSvgAction = svgEditor.curConfig.extPath + 'filesave.php',
saveImgAction = svgEditor.curConfig.extPath + 'filesave.php';
saveSvgAction = extPath + 'filesave.php',
saveImgAction = extPath + 'filesave.php';
// Create upload target (hidden iframe)
let cancelled = false;
@ -78,9 +82,10 @@ export default {
method: 'post',
action: saveSvgAction,
target: 'output_frame'
}).append('<input type="hidden" name="output_svg" value="' + xhtmlEscape(svg) + '">')
.append('<input type="hidden" name="filename" value="' + xhtmlEscape(filename) + '">')
.appendTo('body')
}).append(`
<input type="hidden" name="output_svg" value="${xhtmlEscape(svg)}">
<input type="hidden" name="filename" value="${xhtmlEscape(filename)}">
`).appendTo('body')
.submit().remove();
},
exportPDF (win, data) {
@ -93,10 +98,11 @@ export default {
method: 'post',
action: saveImgAction,
target: 'output_frame'
}).append('<input type="hidden" name="output_img" value="' + datauri + '">')
.append('<input type="hidden" name="mime" value="application/pdf">')
.append('<input type="hidden" name="filename" value="' + xhtmlEscape(filename) + '">')
.appendTo('body')
}).append(`
<input type="hidden" name="output_img" value="${datauri}">
<input type="hidden" name="mime" value="application/pdf">
<input type="hidden" name="filename" value="${xhtmlEscape(filename)}">
`).appendTo('body')
.submit().remove();
},
// Todo: Integrate this extension with a new built-in exportWindowType, "download"
@ -117,7 +123,7 @@ export default {
// Check if there are issues
let pre, note = '';
if (issues.length) {
pre = '\n \u2022 ';
pre = '\n \u2022 '; // Bullet
note += ('\n\n' + pre + issues.join(pre));
}
@ -136,10 +142,11 @@ export default {
method: 'post',
action: saveImgAction,
target: 'output_frame'
}).append('<input type="hidden" name="output_img" value="' + datauri + '">')
.append('<input type="hidden" name="mime" value="' + mimeType + '">')
.append('<input type="hidden" name="filename" value="' + xhtmlEscape(filename) + '">')
.appendTo('body')
}).append(`
<input type="hidden" name="output_img" value="${datauri}">
<input type="hidden" name="mime" value="${mimeType}">
<input type="hidden" name="filename" value="${xhtmlEscape(filename)}">
`).appendTo('body')
.submit().remove();
}
});
@ -148,9 +155,9 @@ export default {
if (window.FileReader) { return; }
// Change these to appropriate script file
const openSvgAction = svgEditor.curConfig.extPath + 'fileopen.php?type=load_svg';
const importSvgAction = svgEditor.curConfig.extPath + 'fileopen.php?type=import_svg';
const importImgAction = svgEditor.curConfig.extPath + 'fileopen.php?type=import_img';
const openSvgAction = extPath + 'fileopen.php?type=load_svg';
const importSvgAction = extPath + 'fileopen.php?type=import_svg';
const importImgAction = extPath + 'fileopen.php?type=import_img';
// Set up function for PHP uploader to use
svgEditor.processFile = function (str64, type) {

View File

@ -9380,7 +9380,7 @@
* @function module:importModule.importSetGlobalDefault
* @param {string|string[]} url
* @param {module:importModule.ImportConfig} config
* @returns {Promise} The value to which it resolves depends on the export of the targeted module.
* @returns {Promise<*>} The value to which it resolves depends on the export of the targeted module.
*/
@ -9393,7 +9393,7 @@
* @function module:importModule.importSetGlobal
* @param {string|string[]} url
* @param {module:importModule.ImportConfig} config
* @returns {Promise} The promise resolves to either an `ArbitraryModule` or
* @returns {Promise<ArbitraryModule>} The promise resolves to either an `ArbitraryModule` or
* any other value depends on the export of the targeted module.
*/
@ -9405,7 +9405,7 @@
* @author Brett Zamir (other items are from `dynamic-import-polyfill`)
* @param {string|string[]} url
* @param {PlainObject} [atts={}]
* @returns {Promise} Resolves to `undefined` or rejects with an `Error` upon a
* @returns {Promise<void|Error>} Resolves to `undefined` or rejects with an `Error` upon a
* script loading error
*/
@ -9501,7 +9501,7 @@
* @param {PlainObject} [atts={}]
* @param {PlainObject} opts
* @param {boolean} [opts.returnDefault=false} = {}]
* @returns {Promise} Resolves to value of loading module or rejects with
* @returns {Promise<*>} Resolves to value of loading module or rejects with
* `Error` upon a script loading error.
*/
@ -9595,13 +9595,19 @@
var box = $('#dialog_box'),
btnHolder = $('#dialog_buttons'),
dialogContent = $('#dialog_content');
/**
* @typedef {PlainObject} module:jQueryPluginDBox.PromiseResultObject
* @property {string|true} response
* @property {boolean} checked
*/
/**
* Resolves to `false` (if cancelled), for prompts and selects
* without checkboxes, it resolves to the value of the form control. For other
* types without checkboxes, it resolves to `true`. For checkboxes, it resolves
* to an object with the `response` key containing the same value as the previous
* mentioned (string or `true`) and a `checked` (boolean) property.
* @typedef {Promise} module:jQueryPluginDBox.PromiseResult
* @typedef {Promise<boolean|string|module:jQueryPluginDBox.PromiseResultObject>} module:jQueryPluginDBox.PromiseResult
*/
/**
@ -14611,7 +14617,7 @@
/**
* @function module:svgcanvas.ExtensionInitResponse#addLangData
* @param {module:svgcanvas.SvgCanvas#event:ext-addLangData} arg
* @returns {Promise} Resolves to {@link module:locale.ExtensionLocaleData}
* @returns {Promise<module:locale.ExtensionLocaleData>} Resolves to {@link module:locale.ExtensionLocaleData}
*/
/**
@ -14637,7 +14643,7 @@
* @callback module:svgcanvas.ExtensionInitCallback
* @this module:SVGEditor
* @param {module:svgcanvas.ExtensionArgumentObject} arg
* @returns {Promise} Resolves to [ExtensionInitResponse]{@link module:svgcanvas.ExtensionInitResponse} or `undefined`
* @returns {Promise<module:svgcanvas.ExtensionInitResponse|void>} Resolves to [ExtensionInitResponse]{@link module:svgcanvas.ExtensionInitResponse} or `undefined`
*/
/**
@ -14655,7 +14661,7 @@
* @fires module:svgcanvas.SvgCanvas#event:extension_added
* @throws {TypeError|Error} `TypeError` if `extInitFunc` is not a function, `Error`
* if extension of supplied name already exists
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -14988,7 +14994,7 @@
/**
* The promise return, if present, resolves to `undefined`
* (`extension_added`, `exported`, `saved`)
* @typedef {Promise|undefined} module:svgcanvas.EventHandlerReturn
* @typedef {Promise<void>|void} module:svgcanvas.EventHandlerReturn
*/
/**
@ -17691,7 +17697,7 @@
* Converts a given image file to a data URL when possible, then runs a given callback.
* @function module:svgcanvas.SvgCanvas#embedImage
* @param {string} src - The path/URL of the image
* @returns {Promise} Resolves to Data URL (string|false)
* @returns {Promise<string|false>} Resolves to a Data URL (string|false)
*/
@ -17843,7 +17849,7 @@
* @param {boolean} [opts.avoidEvent]
* @fires module:svgcanvas.SvgCanvas#event:exported
* @todo Confirm/fix ICO type
* @returns {Promise} Resolves to {@link module:svgcanvas.ImageExportedResults}
* @returns {Promise<module:svgcanvas.ImageExportedResults>} Resolves to {@link module:svgcanvas.ImageExportedResults}
*/
this.rasterExport =
@ -17990,7 +17996,7 @@
* @param {string} [exportWindowName] Will also be used for the download file name here
* @param {external:jsPDF.OutputType} [outputType="dataurlstring"]
* @fires module:svgcanvas.SvgCanvas#event:exportedPDF
* @returns {Promise} Resolves to {@link module:svgcanvas.PDFExportedResults}
* @returns {Promise<module:svgcanvas.PDFExportedResults>} Resolves to {@link module:svgcanvas.PDFExportedResults}
*/
@ -28175,7 +28181,7 @@
* @function module:locale.readLang
* @param {module:locale.LocaleStrings} langData See {@tutorial LocaleDocs}
* @fires module:svgcanvas.SvgCanvas#event:ext-addLangData
* @returns {Promise} Resolves to [`LangAndData`]{@link module:locale.LangAndData}
* @returns {Promise<module:locale.LangAndData>} Resolves to [`LangAndData`]{@link module:locale.LangAndData}
*/
var readLang =
@ -28428,7 +28434,7 @@
* @fires module:svgcanvas.SvgCanvas#event:ext-addLangData
* @fires module:svgcanvas.SvgCanvas#event:ext-langReady
* @fires module:svgcanvas.SvgCanvas#event:ext-langChanged
* @returns {Promise} Resolves to result of {@link module:locale.readLang}
* @returns {Promise<module:locale.LangAndData>} Resolves to result of {@link module:locale.readLang}
*/
var putLocale =
@ -28921,7 +28927,7 @@
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.noAlert]
* @throws {Error} Upon failure to load SVG
* @returns {Promise} Resolves to undefined upon success (or if `noAlert` is
* @returns {Promise<void>} Resolves to undefined upon success (or if `noAlert` is
* falsey, though only until after the `alert` is closed); rejects if SVG
* loading fails and `noAlert` is truthy.
*/
@ -28995,7 +29001,7 @@
* @param {PlainObject} localeInfo
* @param {string} [localeInfo.name] Defaults to `defaultName` of {@link module:SVGEditor~getImportLocale}
* @param {string} [localeInfo.lang=defaultLang] Defaults to `defaultLang` of {@link module:SVGEditor~getImportLocale}
* @returns {Promise} Resolves to {@link module:locale.LocaleStrings}
* @returns {Promise<module:locale.LocaleStrings>} Resolves to {@link module:locale.LocaleStrings}
*/
return (
/*#__PURE__*/
@ -29288,12 +29294,12 @@
* Allows one to override default SVGEdit `open`, `save`, and
* `export` editor behaviors.
* @param {module:SVGEditor.CustomHandler} opts Extension mechanisms may call `setCustomHandlers` with three functions: `opts.open`, `opts.save`, and `opts.exportImage`
* @returns {undefined}
* @returns {Promise<void>}
*/
editor.setCustomHandlers = function (opts) {
editor.ready(function () {
return editor.ready(function () {
if (opts.open) {
$$b('#tool_open > input[type="file"]').remove();
$$b('#tool_open').show();
@ -29502,7 +29508,7 @@
* @fires module:svgcanvas.SvgCanvas#event:ext-langReady
* @fires module:svgcanvas.SvgCanvas#event:ext-langChanged
* @fires module:svgcanvas.SvgCanvas#event:extensions_added
* @returns {Promise} Resolves to result of {@link module:locale.readLang}
* @returns {Promise<module:locale.LangAndData>} Resolves to result of {@link module:locale.readLang}
*/
@ -30707,7 +30713,7 @@
/**
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.cancelDeletes=false}]
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -31983,7 +31989,7 @@
* @param {external:Window} win
* @param {module:svgcanvas.SvgCanvas#event:extension_added} ext
* @listens module:svgcanvas.SvgCanvas#event:extension_added
* @returns {Promise|undefined} Resolves to `undefined`
* @returns {Promise<void>|undefined} Resolves to `undefined`
*/
var extAdded =
@ -33426,7 +33432,7 @@
};
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -33581,7 +33587,7 @@
};
/**
* @fires module:svgcanvas.SvgCanvas#event:ext-onNewDocument
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -33674,7 +33680,7 @@
var loadingURL;
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
var clickExport =
@ -33969,7 +33975,7 @@
};
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -34180,7 +34186,7 @@
var resetScrollPos = $$b.noop;
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
var cancelOverlays =
@ -35879,7 +35885,7 @@
return uiStrings$1;
};
/**
* @returns {Promise} Resolves to boolean indicating `true` if there were no changes
* @returns {Promise<boolean>} Resolves to boolean indicating `true` if there were no changes
* and `false` after the user confirms.
*/
@ -36116,7 +36122,7 @@
* @param {module:locale.LocaleStrings} allStrings See {@tutorial LocaleDocs}
* @fires module:svgcanvas.SvgCanvas#event:ext-langReady
* @fires module:svgcanvas.SvgCanvas#event:ext-langChanged
* @returns {Promise} A Promise which resolves to `undefined`
* @returns {Promise<void>} A Promise which resolves to `undefined`
*/
var setLang = editor.setLang =
@ -36282,7 +36288,7 @@
};
/**
* @callback module:SVGEditor.ReadyCallback
* @returns {Promise|undefined}
* @returns {Promise<void>|undefined}
*/
/**
@ -36290,7 +36296,7 @@
* to be invoked immediately if it is already ready--i.e.,
* if `runCallbacks` has been run).
* @param {module:SVGEditor.ReadyCallback} cb Callback to be queued to invoke
* @returns {Promise} Resolves when all callbacks, including the supplied have resolved
* @returns {Promise<ArbitraryCallbackResult>} Resolves when all callbacks, including the supplied have resolved
*/
@ -36309,7 +36315,7 @@
};
/**
* Invokes the callbacks previous set by `svgEditor.ready`
* @returns {Promise} Resolves to `undefined` if all callbacks succeeded and rejects otherwise
* @returns {Promise<void>} Resolves to `undefined` if all callbacks succeeded and rejects otherwise
*/
@ -36366,14 +36372,14 @@
* @param {string} str The SVG string to load
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.noAlert=false] Option to avoid alert to user and instead get rejected promise
* @returns {Promise}
* @returns {Promise<void>}
*/
editor.loadFromString = function (str) {
var _ref39 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref39.noAlert;
editor.ready(
return editor.ready(
/*#__PURE__*/
_asyncToGenerator(
/*#__PURE__*/
@ -36434,7 +36440,7 @@
* @param {PlainObject} [opts={}] May contain properties: `cache`, `callback`
* @param {boolean} [opts.cache]
* @param {boolean} [opts.noAlert]
* @returns {Promise} Resolves to `undefined` or rejects upon bad loading of
* @returns {Promise<void>} Resolves to `undefined` or rejects upon bad loading of
* the SVG (or upon failure to parse the loaded string) when `noAlert` is
* enabled
*/
@ -36487,7 +36493,7 @@
* @param {string} str The Data URI to base64-decode (if relevant) and load
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.noAlert]
* @returns {Promise} Resolves to `undefined` and rejects if loading SVG string fails and `noAlert` is enabled
* @returns {Promise<void>} Resolves to `undefined` and rejects if loading SVG string fails and `noAlert` is enabled
*/
@ -36495,7 +36501,7 @@
var _ref42 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref42.noAlert;
editor.ready(function () {
return editor.ready(function () {
var base64 = false;
var pre = str.match(/^data:image\/svg\+xml;base64,/);
@ -36520,7 +36526,7 @@
* @param {module:svgcanvas.ExtensionInitCallback} init Config to be invoked on this module
* @param {module:svgcanvas.ExtensionInitArgs} initArgs
* @throws {Error} If called too early
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/

View File

@ -17,7 +17,8 @@
"build-config": "rollup -c rollup-config.config.js",
"types-doc": "npx babel-node --plugins @babel/plugin-transform-modules-commonjs jsdoc-check-overly-generic-types.js",
"open-es-allext": "opn http://localhost:8000/editor/svg-editor-es.html?extensions=ext-arrows.js,ext-closepath.js,ext-foreignobject.js,ext-helloworld.js,ext-mathjax.js,ext-php_savefile.js,ext-server_moinsave.js,ext-server_opensave.js,ext-webappfind.js,ext-xdomain-messaging.js",
"build-doc": "rm -rf docs/jsdoc/*;jsdoc --pedantic -c docs/jsdoc-config.js editor",
"build-docs": "rm -rf docs/jsdoc/*;jsdoc --pedantic -c docs/jsdoc-config.js editor",
"open-docs": "opn http://localhost:8000/docs/jsdoc/ && npm start",
"build-html": "npx babel-node --plugins @babel/plugin-transform-modules-commonjs build-html.js",
"compress-images": "imageoptim 'chrome-app/*.png' && imageoptim 'editor/extensions/*.png' && imageoptim 'editor/spinbtn/*.png' && imageoptim 'editor/jgraduate/images/*.{png,gif}' && imageoptim 'editor/images/*.png'",
"copy": "cp node_modules/load-stylesheets/dist/index-es.js editor/external/load-stylesheets/index-es.js && cp node_modules/@babel/polyfill/dist/polyfill.min.js editor/external/@babel/polyfill/polyfill.min.js && cp node_modules/@babel/polyfill/dist/polyfill.js editor/external/@babel/polyfill/polyfill.js && cp node_modules/jamilih/dist/jml-es.js editor/external/jamilih/jml-es.js && cp node_modules/query-result/esm/index.js editor/external/query-result/esm/index.js && cp node_modules/qr-manipulation/dist/index-es.js editor/external/qr-manipulation/dist/index-es.js && cp node_modules/stackblur-canvas/dist/stackblur-es.js editor/external/stackblur-canvas/dist/stackblur-es.js",

View File

@ -9380,7 +9380,7 @@
* @function module:importModule.importSetGlobalDefault
* @param {string|string[]} url
* @param {module:importModule.ImportConfig} config
* @returns {Promise} The value to which it resolves depends on the export of the targeted module.
* @returns {Promise<*>} The value to which it resolves depends on the export of the targeted module.
*/
@ -9393,7 +9393,7 @@
* @function module:importModule.importSetGlobal
* @param {string|string[]} url
* @param {module:importModule.ImportConfig} config
* @returns {Promise} The promise resolves to either an `ArbitraryModule` or
* @returns {Promise<ArbitraryModule>} The promise resolves to either an `ArbitraryModule` or
* any other value depends on the export of the targeted module.
*/
@ -9405,7 +9405,7 @@
* @author Brett Zamir (other items are from `dynamic-import-polyfill`)
* @param {string|string[]} url
* @param {PlainObject} [atts={}]
* @returns {Promise} Resolves to `undefined` or rejects with an `Error` upon a
* @returns {Promise<void|Error>} Resolves to `undefined` or rejects with an `Error` upon a
* script loading error
*/
@ -9501,7 +9501,7 @@
* @param {PlainObject} [atts={}]
* @param {PlainObject} opts
* @param {boolean} [opts.returnDefault=false} = {}]
* @returns {Promise} Resolves to value of loading module or rejects with
* @returns {Promise<*>} Resolves to value of loading module or rejects with
* `Error` upon a script loading error.
*/
@ -9595,13 +9595,19 @@
var box = $('#dialog_box'),
btnHolder = $('#dialog_buttons'),
dialogContent = $('#dialog_content');
/**
* @typedef {PlainObject} module:jQueryPluginDBox.PromiseResultObject
* @property {string|true} response
* @property {boolean} checked
*/
/**
* Resolves to `false` (if cancelled), for prompts and selects
* without checkboxes, it resolves to the value of the form control. For other
* types without checkboxes, it resolves to `true`. For checkboxes, it resolves
* to an object with the `response` key containing the same value as the previous
* mentioned (string or `true`) and a `checked` (boolean) property.
* @typedef {Promise} module:jQueryPluginDBox.PromiseResult
* @typedef {Promise<boolean|string|module:jQueryPluginDBox.PromiseResultObject>} module:jQueryPluginDBox.PromiseResult
*/
/**
@ -14611,7 +14617,7 @@
/**
* @function module:svgcanvas.ExtensionInitResponse#addLangData
* @param {module:svgcanvas.SvgCanvas#event:ext-addLangData} arg
* @returns {Promise} Resolves to {@link module:locale.ExtensionLocaleData}
* @returns {Promise<module:locale.ExtensionLocaleData>} Resolves to {@link module:locale.ExtensionLocaleData}
*/
/**
@ -14637,7 +14643,7 @@
* @callback module:svgcanvas.ExtensionInitCallback
* @this module:SVGEditor
* @param {module:svgcanvas.ExtensionArgumentObject} arg
* @returns {Promise} Resolves to [ExtensionInitResponse]{@link module:svgcanvas.ExtensionInitResponse} or `undefined`
* @returns {Promise<module:svgcanvas.ExtensionInitResponse|void>} Resolves to [ExtensionInitResponse]{@link module:svgcanvas.ExtensionInitResponse} or `undefined`
*/
/**
@ -14655,7 +14661,7 @@
* @fires module:svgcanvas.SvgCanvas#event:extension_added
* @throws {TypeError|Error} `TypeError` if `extInitFunc` is not a function, `Error`
* if extension of supplied name already exists
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -14988,7 +14994,7 @@
/**
* The promise return, if present, resolves to `undefined`
* (`extension_added`, `exported`, `saved`)
* @typedef {Promise|undefined} module:svgcanvas.EventHandlerReturn
* @typedef {Promise<void>|void} module:svgcanvas.EventHandlerReturn
*/
/**
@ -17691,7 +17697,7 @@
* Converts a given image file to a data URL when possible, then runs a given callback.
* @function module:svgcanvas.SvgCanvas#embedImage
* @param {string} src - The path/URL of the image
* @returns {Promise} Resolves to Data URL (string|false)
* @returns {Promise<string|false>} Resolves to a Data URL (string|false)
*/
@ -17843,7 +17849,7 @@
* @param {boolean} [opts.avoidEvent]
* @fires module:svgcanvas.SvgCanvas#event:exported
* @todo Confirm/fix ICO type
* @returns {Promise} Resolves to {@link module:svgcanvas.ImageExportedResults}
* @returns {Promise<module:svgcanvas.ImageExportedResults>} Resolves to {@link module:svgcanvas.ImageExportedResults}
*/
this.rasterExport =
@ -17990,7 +17996,7 @@
* @param {string} [exportWindowName] Will also be used for the download file name here
* @param {external:jsPDF.OutputType} [outputType="dataurlstring"]
* @fires module:svgcanvas.SvgCanvas#event:exportedPDF
* @returns {Promise} Resolves to {@link module:svgcanvas.PDFExportedResults}
* @returns {Promise<module:svgcanvas.PDFExportedResults>} Resolves to {@link module:svgcanvas.PDFExportedResults}
*/
@ -28175,7 +28181,7 @@
* @function module:locale.readLang
* @param {module:locale.LocaleStrings} langData See {@tutorial LocaleDocs}
* @fires module:svgcanvas.SvgCanvas#event:ext-addLangData
* @returns {Promise} Resolves to [`LangAndData`]{@link module:locale.LangAndData}
* @returns {Promise<module:locale.LangAndData>} Resolves to [`LangAndData`]{@link module:locale.LangAndData}
*/
var readLang =
@ -28428,7 +28434,7 @@
* @fires module:svgcanvas.SvgCanvas#event:ext-addLangData
* @fires module:svgcanvas.SvgCanvas#event:ext-langReady
* @fires module:svgcanvas.SvgCanvas#event:ext-langChanged
* @returns {Promise} Resolves to result of {@link module:locale.readLang}
* @returns {Promise<module:locale.LangAndData>} Resolves to result of {@link module:locale.readLang}
*/
var putLocale =
@ -28921,7 +28927,7 @@
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.noAlert]
* @throws {Error} Upon failure to load SVG
* @returns {Promise} Resolves to undefined upon success (or if `noAlert` is
* @returns {Promise<void>} Resolves to undefined upon success (or if `noAlert` is
* falsey, though only until after the `alert` is closed); rejects if SVG
* loading fails and `noAlert` is truthy.
*/
@ -28995,7 +29001,7 @@
* @param {PlainObject} localeInfo
* @param {string} [localeInfo.name] Defaults to `defaultName` of {@link module:SVGEditor~getImportLocale}
* @param {string} [localeInfo.lang=defaultLang] Defaults to `defaultLang` of {@link module:SVGEditor~getImportLocale}
* @returns {Promise} Resolves to {@link module:locale.LocaleStrings}
* @returns {Promise<module:locale.LocaleStrings>} Resolves to {@link module:locale.LocaleStrings}
*/
return (
/*#__PURE__*/
@ -29288,12 +29294,12 @@
* Allows one to override default SVGEdit `open`, `save`, and
* `export` editor behaviors.
* @param {module:SVGEditor.CustomHandler} opts Extension mechanisms may call `setCustomHandlers` with three functions: `opts.open`, `opts.save`, and `opts.exportImage`
* @returns {undefined}
* @returns {Promise<void>}
*/
editor.setCustomHandlers = function (opts) {
editor.ready(function () {
return editor.ready(function () {
if (opts.open) {
$$b('#tool_open > input[type="file"]').remove();
$$b('#tool_open').show();
@ -29502,7 +29508,7 @@
* @fires module:svgcanvas.SvgCanvas#event:ext-langReady
* @fires module:svgcanvas.SvgCanvas#event:ext-langChanged
* @fires module:svgcanvas.SvgCanvas#event:extensions_added
* @returns {Promise} Resolves to result of {@link module:locale.readLang}
* @returns {Promise<module:locale.LangAndData>} Resolves to result of {@link module:locale.readLang}
*/
@ -30707,7 +30713,7 @@
/**
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.cancelDeletes=false}]
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -31983,7 +31989,7 @@
* @param {external:Window} win
* @param {module:svgcanvas.SvgCanvas#event:extension_added} ext
* @listens module:svgcanvas.SvgCanvas#event:extension_added
* @returns {Promise|undefined} Resolves to `undefined`
* @returns {Promise<void>|undefined} Resolves to `undefined`
*/
var extAdded =
@ -33426,7 +33432,7 @@
};
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -33581,7 +33587,7 @@
};
/**
* @fires module:svgcanvas.SvgCanvas#event:ext-onNewDocument
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -33674,7 +33680,7 @@
var loadingURL;
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
var clickExport =
@ -33969,7 +33975,7 @@
};
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@ -34180,7 +34186,7 @@
var resetScrollPos = $$b.noop;
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
var cancelOverlays =
@ -35879,7 +35885,7 @@
return uiStrings$1;
};
/**
* @returns {Promise} Resolves to boolean indicating `true` if there were no changes
* @returns {Promise<boolean>} Resolves to boolean indicating `true` if there were no changes
* and `false` after the user confirms.
*/
@ -36116,7 +36122,7 @@
* @param {module:locale.LocaleStrings} allStrings See {@tutorial LocaleDocs}
* @fires module:svgcanvas.SvgCanvas#event:ext-langReady
* @fires module:svgcanvas.SvgCanvas#event:ext-langChanged
* @returns {Promise} A Promise which resolves to `undefined`
* @returns {Promise<void>} A Promise which resolves to `undefined`
*/
var setLang = editor.setLang =
@ -36282,7 +36288,7 @@
};
/**
* @callback module:SVGEditor.ReadyCallback
* @returns {Promise|undefined}
* @returns {Promise<void>|undefined}
*/
/**
@ -36290,7 +36296,7 @@
* to be invoked immediately if it is already ready--i.e.,
* if `runCallbacks` has been run).
* @param {module:SVGEditor.ReadyCallback} cb Callback to be queued to invoke
* @returns {Promise} Resolves when all callbacks, including the supplied have resolved
* @returns {Promise<ArbitraryCallbackResult>} Resolves when all callbacks, including the supplied have resolved
*/
@ -36309,7 +36315,7 @@
};
/**
* Invokes the callbacks previous set by `svgEditor.ready`
* @returns {Promise} Resolves to `undefined` if all callbacks succeeded and rejects otherwise
* @returns {Promise<void>} Resolves to `undefined` if all callbacks succeeded and rejects otherwise
*/
@ -36366,14 +36372,14 @@
* @param {string} str The SVG string to load
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.noAlert=false] Option to avoid alert to user and instead get rejected promise
* @returns {Promise}
* @returns {Promise<void>}
*/
editor.loadFromString = function (str) {
var _ref39 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref39.noAlert;
editor.ready(
return editor.ready(
/*#__PURE__*/
_asyncToGenerator(
/*#__PURE__*/
@ -36434,7 +36440,7 @@
* @param {PlainObject} [opts={}] May contain properties: `cache`, `callback`
* @param {boolean} [opts.cache]
* @param {boolean} [opts.noAlert]
* @returns {Promise} Resolves to `undefined` or rejects upon bad loading of
* @returns {Promise<void>} Resolves to `undefined` or rejects upon bad loading of
* the SVG (or upon failure to parse the loaded string) when `noAlert` is
* enabled
*/
@ -36487,7 +36493,7 @@
* @param {string} str The Data URI to base64-decode (if relevant) and load
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.noAlert]
* @returns {Promise} Resolves to `undefined` and rejects if loading SVG string fails and `noAlert` is enabled
* @returns {Promise<void>} Resolves to `undefined` and rejects if loading SVG string fails and `noAlert` is enabled
*/
@ -36495,7 +36501,7 @@
var _ref42 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref42.noAlert;
editor.ready(function () {
return editor.ready(function () {
var base64 = false;
var pre = str.match(/^data:image\/svg\+xml;base64,/);
@ -36520,7 +36526,7 @@
* @param {module:svgcanvas.ExtensionInitCallback} init Config to be invoked on this module
* @param {module:svgcanvas.ExtensionInitArgs} initArgs
* @throws {Error} If called too early
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/