- Enhancement: For anyone visiting the ES6 modules entrance file without ESM
support, redirect to non-modular vesion - Build: Add comment not to edit xdomain editor directlymaster
parent
25f02d99f2
commit
4a0889c7e5
|
@ -8,6 +8,8 @@
|
|||
global available to use (e.g., if using the modular editor)
|
||||
- Fix (Embedded editor): Add events only after load is complete and
|
||||
svgCanvas is available; also log blocked error objects
|
||||
- Enhancement: For anyone visiting the ES6 modules entrance file without ESM
|
||||
support, redirect to non-modular vesion
|
||||
- Enhancement: For PDF export, switch Chrome by default to "save" `outputType`
|
||||
- Refactoring (canvg): Better type-checking on `canvasRGBA_` (but set
|
||||
correctly by default anyways)
|
||||
|
@ -19,6 +21,7 @@
|
|||
- Docs: CHANGES clarifications
|
||||
- Docs (JSdoc): Denote optional arguments
|
||||
- Docs: More info on `importLocale` for extensions
|
||||
- Build: Add comment not to edit xdomain editor directly
|
||||
- Build: Remove unused `Makefile`
|
||||
|
||||
# 3.0.1
|
||||
|
|
|
@ -32,6 +32,22 @@ const filesAndReplacements = [
|
|||
[
|
||||
'<script src="external/dom-polyfill/dom-polyfill.js"></script>',
|
||||
'<script src="../dist/dom-polyfill.js"></script>'
|
||||
],
|
||||
[
|
||||
'<script nomodule="" src="no-module-support-redirect.js"></script>',
|
||||
''
|
||||
]
|
||||
]
|
||||
},
|
||||
// Now that file has copied, we can replace the DOCTYPE in xdomain
|
||||
{
|
||||
input: 'editor/xdomain-svg-editor-es.html',
|
||||
output: 'editor/xdomain-svg-editor-es.html',
|
||||
replacements: [
|
||||
[
|
||||
'<!DOCTYPE html>',
|
||||
`<!DOCTYPE html>
|
||||
<!-- AUTO-GENERATED FROM svg-editor-es.html; DO NOT EDIT; use build-html.js to build -->`
|
||||
]
|
||||
]
|
||||
},
|
||||
|
@ -55,6 +71,10 @@ const filesAndReplacements = [
|
|||
[
|
||||
'<script src="external/dom-polyfill/dom-polyfill.js"></script>',
|
||||
'<script src="../dist/dom-polyfill.js"></script>'
|
||||
],
|
||||
[
|
||||
'<script nomodule="" src="no-module-support-redirect.js"></script>',
|
||||
''
|
||||
]
|
||||
]
|
||||
},
|
||||
|
@ -74,6 +94,10 @@ const filesAndReplacements = [
|
|||
[
|
||||
'<script type="module" src="openclipart.js"></script>',
|
||||
'<script defer="defer" src="../../../dist/extensions/imagelib/openclipart.js"></script>'
|
||||
],
|
||||
[
|
||||
'<script nomodule="" src="no-module-support-redirect.js"></script>',
|
||||
''
|
||||
]
|
||||
]
|
||||
},
|
||||
|
@ -89,32 +113,35 @@ const filesAndReplacements = [
|
|||
[
|
||||
'<script type="module" src="index.js"></script>',
|
||||
'<script defer="defer" src="../../../dist/extensions/imagelib/index.js"></script>'
|
||||
],
|
||||
[
|
||||
'<script nomodule="" src="no-module-support-redirect.js"></script>',
|
||||
''
|
||||
]
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
filesAndReplacements.reduce((p, {input, output, replacements}) => {
|
||||
return p.then(async () => {
|
||||
let data;
|
||||
try {
|
||||
data = await fs.readFile(input, 'utf8');
|
||||
} catch (err) {
|
||||
console.log(`Error reading ${input} file`, err);
|
||||
}
|
||||
filesAndReplacements.reduce(async (p, {input, output, replacements}) => {
|
||||
await p;
|
||||
let data;
|
||||
try {
|
||||
data = await fs.readFile(input, 'utf8');
|
||||
} catch (err) {
|
||||
console.log(`Error reading ${input} file`, err);
|
||||
}
|
||||
|
||||
data = replacements.reduce((s, [find, replacement]) => {
|
||||
return s.replace(find, replacement);
|
||||
}, data);
|
||||
data = replacements.reduce((s, [find, replacement]) => {
|
||||
return s.replace(find, replacement);
|
||||
}, data);
|
||||
|
||||
try {
|
||||
await fs.writeFile(output, data);
|
||||
} catch (err) {
|
||||
console.log(`Error writing file: ${err}`, err);
|
||||
return;
|
||||
}
|
||||
console.log(`Completed file ${input} rewriting!`);
|
||||
});
|
||||
try {
|
||||
await fs.writeFile(output, data);
|
||||
} catch (err) {
|
||||
console.log(`Error writing file: ${err}`, err);
|
||||
return;
|
||||
}
|
||||
console.log(`Completed file ${input} rewriting!`);
|
||||
}, Promise.resolve()).then(() => {
|
||||
console.log('Finished!');
|
||||
});
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<title>-</title>
|
||||
<link rel="icon" type="image/png" href="../../images/logo.png"/>
|
||||
<script nomodule="" src="no-module-support-redirect.js"></script>
|
||||
<script src="../../jquery.min.js"></script>
|
||||
<script src="../../external/@babel/polyfill/polyfill.min.js"></script>
|
||||
<script type="module" src="index.js"></script>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<title>-</title>
|
||||
<link rel="icon" type="image/png" href="../../images/logo.png"/>
|
||||
|
||||
<script src="../../jquery.min.js"></script>
|
||||
<script src="../../external/@babel/polyfill/polyfill.min.js"></script>
|
||||
<script defer="defer" src="../../../dist/extensions/imagelib/index.js"></script>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<title>-</title>
|
||||
<link rel="icon" type="image/png" href="../../images/logo.png"/>
|
||||
<script nomodule="" src="no-module-support-redirect.js"></script>
|
||||
<script src="../../external/dom-polyfill/dom-polyfill.js"></script>
|
||||
<script src="../../external/@babel/polyfill/polyfill.min.js"></script>
|
||||
<script type="module" src="openclipart.js"></script>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<meta charset="utf-8">
|
||||
<title>-</title>
|
||||
<link rel="icon" type="image/png" href="../../images/logo.png"/>
|
||||
|
||||
<script src="../../../dist/dom-polyfill.js"></script>
|
||||
<script src="../../external/@babel/polyfill/polyfill.min.js"></script>
|
||||
<script defer="defer" src="../../../dist/extensions/imagelib/openclipart.js"></script>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// This file should only load if the user's browser doesn't support ESM
|
||||
// This file will be stripped from the non-modular versions
|
||||
|
||||
// We only need to replace the first instance
|
||||
location.href = location.href
|
||||
.replace(/(xdomain-)?svg-editor-es\.html/, 'svg-editor.html')
|
||||
.replace('openclipart-es.html', 'openclipart.html')
|
||||
.replace('imagelib/index-es.html', 'imagelib/index.html');
|
|
@ -15,6 +15,7 @@
|
|||
<!{else}-->
|
||||
<script src="jquery.min.js"></script>
|
||||
<!--{endif}-->
|
||||
<script nomodule="" src="no-module-support-redirect.js"></script>
|
||||
<!-- We keep this next module external to avoid the need to
|
||||
load further scripts if not supported -->
|
||||
<script type="module" src="redirect-on-lacking-support.js"></script>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<!{else}-->
|
||||
<script src="jquery.min.js"></script>
|
||||
<!--{endif}-->
|
||||
|
||||
<!-- We keep this next module external to avoid the need to
|
||||
load further scripts if not supported -->
|
||||
<script defer="defer" src="../dist/redirect-on-lacking-support.js"></script>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- AUTO-GENERATED FROM svg-editor-es.html; DO NOT EDIT; use build-html.js to build -->
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
|
@ -15,6 +16,7 @@
|
|||
<!{else}-->
|
||||
<script src="jquery.min.js"></script>
|
||||
<!--{endif}-->
|
||||
<script nomodule="" src="no-module-support-redirect.js"></script>
|
||||
<!-- We keep this next module external to avoid the need to
|
||||
load further scripts if not supported -->
|
||||
<script type="module" src="redirect-on-lacking-support.js"></script>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<!{else}-->
|
||||
<script src="jquery.min.js"></script>
|
||||
<!--{endif}-->
|
||||
|
||||
<!-- We keep this next module external to avoid the need to
|
||||
load further scripts if not supported -->
|
||||
<script defer="defer" src="../dist/redirect-on-lacking-support.js"></script>
|
||||
|
|
Loading…
Reference in New Issue