- Fix (regression): Imagelib (ensure non-URL relative paths are treated as current origin); variable order (#274)

This commit is contained in:
Brett Zamir
2018-09-25 03:32:01 +08:00
parent 459a6b8f89
commit 83aa156353
2 changed files with 21 additions and 11 deletions

View File

@@ -15,6 +15,12 @@ export default {
const modularVersion = !('svgEditor' in window) ||
!window.svgEditor ||
window.svgEditor.modules !== false;
const svgEditor = this;
const $ = jQuery;
const {uiStrings, canvas: svgCanvas, curConfig: {extIconsPath}} = svgEditor;
imagelibStrings.imgLibs = imagelibStrings.imgLibs.map(({name, url, description}) => {
url = url
.replace(/\{path\}/g, extIconsPath)
@@ -25,14 +31,13 @@ export default {
return {name, url, description};
});
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 () {
$('#imgbrowse_holder').hide();
}