add ability to add extensions not located in the extensions folder
This commit is contained in:
@@ -36,7 +36,10 @@ svgEditor.setConfig(
|
|||||||
svgEditor.setConfig({
|
svgEditor.setConfig({
|
||||||
extensions: [],
|
extensions: [],
|
||||||
noDefaultExtensions: false,
|
noDefaultExtensions: false,
|
||||||
userExtensions: []
|
// in addition to standard extensions, it is possible to add user extensions.
|
||||||
|
// they behave exactly like all extensions but they can be anywhere
|
||||||
|
// so the full relative path needs to specified for each user extensions.
|
||||||
|
userExtensions: [/* '../ext-helloworld/ext-helloworld.js' */]
|
||||||
});
|
});
|
||||||
|
|
||||||
// OTHER CONFIG
|
// OTHER CONFIG
|
||||||
|
|||||||
@@ -277,6 +277,7 @@ let svgCanvas, urldata = {},
|
|||||||
// We do not put on defaultConfig to simplify object copying
|
// We do not put on defaultConfig to simplify object copying
|
||||||
// procedures (we obtain instead from defaultExtensions)
|
// procedures (we obtain instead from defaultExtensions)
|
||||||
extensions: [],
|
extensions: [],
|
||||||
|
userExtensions: [],
|
||||||
/**
|
/**
|
||||||
* Can use `location.origin` to indicate the current
|
* Can use `location.origin` to indicate the current
|
||||||
* origin. Can contain a '*' to allow all domains or 'null' (as
|
* origin. Can contain a '*' to allow all domains or 'null' (as
|
||||||
@@ -469,7 +470,7 @@ editor.setConfig = function (opts, cfgCfg) {
|
|||||||
} else {
|
} else {
|
||||||
editor.pref(key, val);
|
editor.pref(key, val);
|
||||||
}
|
}
|
||||||
} else if (['extensions', 'allowedOrigins'].includes(key)) {
|
} else if (['extensions', 'userExtensions', 'allowedOrigins'].includes(key)) {
|
||||||
if (cfgCfg.overwrite === false &&
|
if (cfgCfg.overwrite === false &&
|
||||||
(
|
(
|
||||||
curConfig.preventAllURLConfig ||
|
curConfig.preventAllURLConfig ||
|
||||||
@@ -4387,7 +4388,7 @@ editor.init = function () {
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
const clickImport = function () {
|
const clickImport = function () {
|
||||||
/* */
|
/* empty fn */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user