Skip to content

Commit

Permalink
- Fix (regression): Fix storage namespace; update build files to get …
Browse files Browse the repository at this point in the history
…regression fix applied
  • Loading branch information
brettz9 committed Nov 16, 2018
1 parent c42791b commit b0fad3d
Show file tree
Hide file tree
Showing 9 changed files with 149 additions and 117 deletions.
64 changes: 36 additions & 28 deletions dist/index-es.js
Original file line number Diff line number Diff line change
Expand Up @@ -14602,12 +14602,18 @@ function SvgCanvas(container, config) {
* @returns {Promise} Resolves to [ExtensionInitResponse]{@link module:svgcanvas.ExtensionInitResponse} or `undefined`
*/

/**
* @typedef {PlainObject} module:svgcanvas.ExtensionInitArgs
* @param {external:jQuery} initArgs.$
* @param {module:SVGEditor~ImportLocale} initArgs.importLocale
*/

/**
* Add an extension to the editor.
* @function module:svgcanvas.SvgCanvas#addExtension
* @param {string} name - String with the ID of the extension. Used internally; no need for i18n.
* @param {module:svgcanvas.ExtensionInitCallback} [extInitFunc] - Function supplied by the extension with its data
* @param {module:SVGEditor~ImportLocale} importLocale
* @param {module:svgcanvas.ExtensionInitArgs} initArgs
* @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
Expand All @@ -14618,30 +14624,32 @@ function SvgCanvas(container, config) {
this.addExtension =
/*#__PURE__*/
function () {
var _ref3 = _asyncToGenerator(
var _ref4 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(name, extInitFunc, importLocale) {
var argObj, extObj;
regeneratorRuntime.mark(function _callee(name, extInitFunc, _ref3) {
var jq, importLocale, argObj, extObj;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
jq = _ref3.$, importLocale = _ref3.importLocale;

if (!(typeof extInitFunc !== 'function')) {
_context.next = 2;
_context.next = 3;
break;
}

throw new TypeError('Function argument expected for `svgcanvas.addExtension`');

case 2:
case 3:
if (!(name in extensions)) {
_context.next = 4;
_context.next = 5;
break;
}

throw new Error('Cannot add extension "' + name + '", an extension by that name already exists.');

case 4:
case 5:
// Provide private vars/funcs here. Is there a better way to do this?

/**
Expand All @@ -14658,17 +14666,17 @@ function SvgCanvas(container, config) {
* @see {@link module:svgcanvas.PrivateMethods} source for the other methods/properties
*/
argObj = $$9.extend(canvas.getPrivateMethods(), {
$: $$9,
$: jq,
importLocale: importLocale,
svgroot: svgroot,
svgcontent: svgcontent,
nonce: getCurrentDrawing().getNonce(),
selectorManager: selectorManager
});
_context.next = 7;
_context.next = 8;
return extInitFunc(argObj);

case 7:
case 8:
extObj = _context.sent;

if (extObj) {
Expand All @@ -14678,7 +14686,7 @@ function SvgCanvas(container, config) {
extensions[name] = extObj;
return _context.abrupt("return", call('extension_added', extObj));

case 11:
case 12:
case "end":
return _context.stop();
}
Expand All @@ -14687,7 +14695,7 @@ function SvgCanvas(container, config) {
}));

return function (_x, _x2, _x3) {
return _ref3.apply(this, arguments);
return _ref4.apply(this, arguments);
};
}();
/**
Expand Down Expand Up @@ -17802,7 +17810,7 @@ function SvgCanvas(container, config) {
this.rasterExport =
/*#__PURE__*/
function () {
var _ref4 = _asyncToGenerator(
var _ref5 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee2(imgType, quality, exportWindowName) {
var opts,
Expand All @@ -17812,7 +17820,7 @@ function SvgCanvas(container, config) {
issues,
issueCodes,
svg,
_ref5,
_ref6,
c,
_args2 = arguments;

Expand All @@ -17837,8 +17845,8 @@ function SvgCanvas(container, config) {
});

case 8:
_ref5 = _context2.sent;
canvg = _ref5.canvg;
_ref6 = _context2.sent;
canvg = _ref6.canvg;

case 10:
if (!$$9('#export_canvas').length) {
Expand Down Expand Up @@ -17905,7 +17913,7 @@ function SvgCanvas(container, config) {
}));

return function (_x4, _x5, _x6) {
return _ref4.apply(this, arguments);
return _ref5.apply(this, arguments);
};
}();
/**
Expand Down Expand Up @@ -17950,7 +17958,7 @@ function SvgCanvas(container, config) {
this.exportPDF =
/*#__PURE__*/
function () {
var _ref6 = _asyncToGenerator(
var _ref7 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee3(exportWindowName) {
var outputType,
Expand Down Expand Up @@ -18041,7 +18049,7 @@ function SvgCanvas(container, config) {
}));

return function (_x7) {
return _ref6.apply(this, arguments);
return _ref7.apply(this, arguments);
};
}();
/**
Expand Down Expand Up @@ -18750,10 +18758,10 @@ function SvgCanvas(container, config) {
leaveContext: leaveContext,
setContext: setContext
};
Object.entries(dr).forEach(function (_ref7) {
var _ref8 = _slicedToArray(_ref7, 2),
prop = _ref8[0],
propVal = _ref8[1];
Object.entries(dr).forEach(function (_ref8) {
var _ref9 = _slicedToArray(_ref8, 2),
prop = _ref9[0],
propVal = _ref9[1];

canvas[prop] = propVal;
});
Expand Down Expand Up @@ -28959,7 +28967,7 @@ editor.loadContentAndPrefs = function () {


if (editor.storage && ( // Cookies do not have enough available memory to hold large documents
curConfig.forceStorage || !curConfig.noStorageOnLoad && document.cookie.match(/(?:^|;\s*)svgeditstorestore=prefsAndContent/))) {
curConfig.forceStorage || !curConfig.noStorageOnLoad && document.cookie.match(/(?:^|;\s*)svgeditstore=prefsAndContent/))) {
var name = 'svgedit-' + curConfig.canvasName;
var cached = editor.storage.getItem(name);

Expand Down Expand Up @@ -36341,21 +36349,21 @@ editor.loadFromDataURI = function (str) {
/**
* @param {string} name Used internally; no need for i18n.
* @param {module:svgcanvas.ExtensionInitCallback} init Config to be invoked on this module
* @param {module:SVGEditor~ImportLocale} importLocale Importer defaulting to pth with current extension name and locale
* @param {module:svgcanvas.ExtensionInitArgs} initArgs
* @throws {Error} If called too early
* @returns {Promise} Resolves to `undefined`
*/


editor.addExtension = function (name, init$$1, importLocale) {
editor.addExtension = function (name, init$$1, initArgs) {
// Note that we don't want this on editor.ready since some extensions
// may want to run before then (like server_opensave).
// $(function () {
if (!svgCanvas) {
throw new Error('Extension added too early');
}

return svgCanvas.addExtension.call(this, name, init$$1, importLocale); // });
return svgCanvas.addExtension.call(this, name, init$$1, initArgs); // });
}; // Defer injection to wait out initial menu processing. This probably goes
// away once all context menu behavior is brought to context menu.

Expand Down
2 changes: 1 addition & 1 deletion dist/index-es.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index-es.min.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit b0fad3d

Please sign in to comment.