- 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

@@ -65,11 +65,14 @@ export default {
function getLinked (elem, attr) {
const str = elem.getAttribute(attr);
if (!str) { return null; }
const m = str.match(/\(#(?<id>.+)\)/);
if (!m || !m.groups.id) {
const m = str.match(/\(#(.*)\)/);
// const m = str.match(/\(#(?<id>.+)\)/);
// if (!m || !m.groups.id) {
if (!m || m.length !== 2) {
return null;
}
return svgCanvas.getElem(m.groups.id);
return svgCanvas.getElem(m[1]);
// return svgCanvas.getElem(m.groups.id);
}
/**

View File

@@ -86,11 +86,14 @@ export default {
function getLinked (elem, attr) {
const str = elem.getAttribute(attr);
if (!str) { return null; }
const m = str.match(/\(#(?<id>.+)\)/);
if (!m || !m.groups.id) {
const m = str.match(/\(#(.*)\)/);
// const m = str.match(/\(#(?<id>.+)\)/);
// if (!m || !m.groups.id) {
if (!m || m.length !== 2) {
return null;
}
return svgCanvas.getElem(m.groups.id);
return svgCanvas.getElem(m[1]);
// return svgCanvas.getElem(m.groups.id);
}
/**

View File

@@ -70,11 +70,15 @@ export default {
if (!elem) { return null; }
const str = elem.getAttribute(attr);
if (!str) { return null; }
const m = str.match(/\(#(?<id>.+)\)/);
if (!m || !m.groups.id) {
// const m = str.match(/\(#(?<id>.+)\)/);
// if (!m || !m.groups.id) {
const m = str.match(/\(#(.*)\)/);
if (!m || m.length !== 2) {
return null;
}
return svgCanvas.getElem(m.groups.id);
return svgCanvas.getElem(m[1]);
// return svgCanvas.getElem(m.groups.id);
}
/**

View File

@@ -56,9 +56,14 @@ export default {
val = val ? 'storagePrompt=' + val : '';
const loc = top.location; // Allow this to work with the embedded editor as well
if (loc.href.includes('storagePrompt=')) {
/*
loc.href = loc.href.replace(/(?<sep>[&?])storagePrompt=[^&]*(?<amp>&?)/, function (n0, sep, amp) {
return (val ? sep : '') + val + (!val && amp ? sep : (amp || ''));
});
*/
loc.href = loc.href.replace(/([&?])storagePrompt=[^&]*(&?)/, function (n0, n1, amp) {
return (val ? n1 : '') + val + (!val && amp ? n1 : (amp || ''));
});
} else {
loc.href += (loc.href.includes('?') ? '&' : '?') + val;
}