- Fix (regression): Imagelib (ensure non-URL relative paths are treated as current origin); variable order (#274)
This commit is contained in:
15
dist/extensions/ext-imagelib.js
vendored
15
dist/extensions/ext-imagelib.js
vendored
@@ -52,7 +52,7 @@ var svgEditorExtension_imagelib = (function () {
|
|||||||
var decode64 = _ref.decode64,
|
var decode64 = _ref.decode64,
|
||||||
importLocale = _ref.importLocale,
|
importLocale = _ref.importLocale,
|
||||||
dropXMLInternalSubset = _ref.dropXMLInternalSubset;
|
dropXMLInternalSubset = _ref.dropXMLInternalSubset;
|
||||||
var imagelibStrings, modularVersion, allowedImageLibOrigins, svgEditor, $, uiStrings, svgCanvas, extIconsPath, closeBrowser, importImage, pending, mode, multiArr, transferStopped, preview, submit, toggleMulti, showBrowser, buttons;
|
var imagelibStrings, modularVersion, svgEditor, $, uiStrings, svgCanvas, extIconsPath, allowedImageLibOrigins, closeBrowser, importImage, pending, mode, multiArr, transferStopped, preview, submit, toggleMulti, showBrowser, buttons;
|
||||||
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) {
|
||||||
@@ -198,6 +198,10 @@ var svgEditorExtension_imagelib = (function () {
|
|||||||
case 6:
|
case 6:
|
||||||
imagelibStrings = _context.sent;
|
imagelibStrings = _context.sent;
|
||||||
modularVersion = !('svgEditor' in window) || !window.svgEditor || window.svgEditor.modules !== false;
|
modularVersion = !('svgEditor' in window) || !window.svgEditor || window.svgEditor.modules !== false;
|
||||||
|
svgEditor = this;
|
||||||
|
$ = jQuery;
|
||||||
|
uiStrings = svgEditor.uiStrings, svgCanvas = svgEditor.canvas, extIconsPath = svgEditor.curConfig.extIconsPath;
|
||||||
|
|
||||||
|
|
||||||
imagelibStrings.imgLibs = imagelibStrings.imgLibs.map(function (_ref3) {
|
imagelibStrings.imgLibs = imagelibStrings.imgLibs.map(function (_ref3) {
|
||||||
var name = _ref3.name,
|
var name = _ref3.name,
|
||||||
@@ -210,11 +214,12 @@ var svgEditorExtension_imagelib = (function () {
|
|||||||
allowedImageLibOrigins = imagelibStrings.imgLibs.map(function (_ref4) {
|
allowedImageLibOrigins = imagelibStrings.imgLibs.map(function (_ref4) {
|
||||||
var url = _ref4.url;
|
var url = _ref4.url;
|
||||||
|
|
||||||
return new URL(url).origin;
|
try {
|
||||||
|
return new URL(url).origin;
|
||||||
|
} catch (err) {
|
||||||
|
return location.origin;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
svgEditor = this;
|
|
||||||
$ = jQuery;
|
|
||||||
uiStrings = svgEditor.uiStrings, svgCanvas = svgEditor.canvas, extIconsPath = svgEditor.curConfig.extIconsPath;
|
|
||||||
pending = {};
|
pending = {};
|
||||||
mode = 's';
|
mode = 's';
|
||||||
multiArr = [];
|
multiArr = [];
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ export default {
|
|||||||
const modularVersion = !('svgEditor' in window) ||
|
const modularVersion = !('svgEditor' in window) ||
|
||||||
!window.svgEditor ||
|
!window.svgEditor ||
|
||||||
window.svgEditor.modules !== false;
|
window.svgEditor.modules !== false;
|
||||||
|
|
||||||
|
const svgEditor = this;
|
||||||
|
|
||||||
|
const $ = jQuery;
|
||||||
|
const {uiStrings, canvas: svgCanvas, curConfig: {extIconsPath}} = svgEditor;
|
||||||
|
|
||||||
imagelibStrings.imgLibs = imagelibStrings.imgLibs.map(({name, url, description}) => {
|
imagelibStrings.imgLibs = imagelibStrings.imgLibs.map(({name, url, description}) => {
|
||||||
url = url
|
url = url
|
||||||
.replace(/\{path\}/g, extIconsPath)
|
.replace(/\{path\}/g, extIconsPath)
|
||||||
@@ -25,14 +31,13 @@ export default {
|
|||||||
return {name, url, description};
|
return {name, url, description};
|
||||||
});
|
});
|
||||||
const allowedImageLibOrigins = imagelibStrings.imgLibs.map(({url}) => {
|
const allowedImageLibOrigins = imagelibStrings.imgLibs.map(({url}) => {
|
||||||
return new URL(url).origin;
|
try {
|
||||||
|
return new URL(url).origin;
|
||||||
|
} catch (err) {
|
||||||
|
return location.origin;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const svgEditor = this;
|
|
||||||
|
|
||||||
const $ = jQuery;
|
|
||||||
const {uiStrings, canvas: svgCanvas, curConfig: {extIconsPath}} = svgEditor;
|
|
||||||
|
|
||||||
function closeBrowser () {
|
function closeBrowser () {
|
||||||
$('#imgbrowse_holder').hide();
|
$('#imgbrowse_holder').hide();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user