- Revert prefer-named-capture-group due to apparently problematic Babel plugin

This commit is contained in:
Brett Zamir
2019-11-16 10:08:38 +08:00
parent cd0bdd9cce
commit 19f7962c4a
33 changed files with 315 additions and 2146 deletions

View File

@@ -757,7 +757,8 @@ editor.init = function () {
qstr = $.param.querystring();
if (!src) { // urldata.source may have been null if it ended with '='
if (qstr.includes('source=data:')) {
({src} = qstr.match(/source=(?<src>data:[^&]*)/).groups);
src = qstr.match(/source=(data:[^&]*)/)[1];
// ({src} = qstr.match(/source=(?<src>data:[^&]*)/).groups);
}
}
if (src) {
@@ -820,7 +821,8 @@ editor.init = function () {
try {
await Promise.all(
curConfig.extensions.map(async (extname) => {
const {extName} = extname.match(/^ext-(?<extName>.+)\.js/).groups;
const extName = extname.match(/^ext-(.+)\.js/);
// const {extName} = extname.match(/^ext-(?<extName>.+)\.js/).groups;
if (!extName) { // Ensure URL cannot specify some other unintended file in the extPath
return undefined;
}
@@ -838,9 +840,11 @@ editor.init = function () {
* @type {module:SVGEditor.ExtensionObject}
*/
const imported = await importSetGlobalDefault(url, {
global: 'svgEditorExtension_' + extName.replace(/-/g, '_')
global: 'svgEditorExtension_' + extName[1].replace(/-/g, '_')
// global: 'svgEditorExtension_' + extName.replace(/-/g, '_')
});
const {name = extName, init} = imported;
const {name = extName[1], init} = imported;
// const {name = extName, init} = imported;
const importLocale = getImportLocale({defaultLang: langParam, defaultName: name});
return editor.addExtension(name, (init && init.bind(editor)), {$, importLocale});
} catch (err) {