- 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 directly
This commit is contained in:
@@ -8,6 +8,8 @@
|
|||||||
global available to use (e.g., if using the modular editor)
|
global available to use (e.g., if using the modular editor)
|
||||||
- Fix (Embedded editor): Add events only after load is complete and
|
- Fix (Embedded editor): Add events only after load is complete and
|
||||||
svgCanvas is available; also log blocked error objects
|
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`
|
- Enhancement: For PDF export, switch Chrome by default to "save" `outputType`
|
||||||
- Refactoring (canvg): Better type-checking on `canvasRGBA_` (but set
|
- Refactoring (canvg): Better type-checking on `canvasRGBA_` (but set
|
||||||
correctly by default anyways)
|
correctly by default anyways)
|
||||||
@@ -19,6 +21,7 @@
|
|||||||
- Docs: CHANGES clarifications
|
- Docs: CHANGES clarifications
|
||||||
- Docs (JSdoc): Denote optional arguments
|
- Docs (JSdoc): Denote optional arguments
|
||||||
- Docs: More info on `importLocale` for extensions
|
- Docs: More info on `importLocale` for extensions
|
||||||
|
- Build: Add comment not to edit xdomain editor directly
|
||||||
- Build: Remove unused `Makefile`
|
- Build: Remove unused `Makefile`
|
||||||
|
|
||||||
# 3.0.1
|
# 3.0.1
|
||||||
|
|||||||
@@ -32,6 +32,22 @@ const filesAndReplacements = [
|
|||||||
[
|
[
|
||||||
'<script src="external/dom-polyfill/dom-polyfill.js"></script>',
|
'<script src="external/dom-polyfill/dom-polyfill.js"></script>',
|
||||||
'<script src="../dist/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="external/dom-polyfill/dom-polyfill.js"></script>',
|
||||||
'<script src="../dist/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 type="module" src="openclipart.js"></script>',
|
||||||
'<script defer="defer" src="../../../dist/extensions/imagelib/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 type="module" src="index.js"></script>',
|
||||||
'<script defer="defer" src="../../../dist/extensions/imagelib/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}) => {
|
filesAndReplacements.reduce(async (p, {input, output, replacements}) => {
|
||||||
return p.then(async () => {
|
await p;
|
||||||
let data;
|
let data;
|
||||||
try {
|
try {
|
||||||
data = await fs.readFile(input, 'utf8');
|
data = await fs.readFile(input, 'utf8');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(`Error reading ${input} file`, err);
|
console.log(`Error reading ${input} file`, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
data = replacements.reduce((s, [find, replacement]) => {
|
data = replacements.reduce((s, [find, replacement]) => {
|
||||||
return s.replace(find, replacement);
|
return s.replace(find, replacement);
|
||||||
}, data);
|
}, data);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fs.writeFile(output, data);
|
await fs.writeFile(output, data);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(`Error writing file: ${err}`, err);
|
console.log(`Error writing file: ${err}`, err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(`Completed file ${input} rewriting!`);
|
console.log(`Completed file ${input} rewriting!`);
|
||||||
});
|
|
||||||
}, Promise.resolve()).then(() => {
|
}, Promise.resolve()).then(() => {
|
||||||
console.log('Finished!');
|
console.log('Finished!');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>-</title>
|
<title>-</title>
|
||||||
<link rel="icon" type="image/png" href="../../images/logo.png"/>
|
<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="../../jquery.min.js"></script>
|
||||||
<script src="../../external/@babel/polyfill/polyfill.min.js"></script>
|
<script src="../../external/@babel/polyfill/polyfill.min.js"></script>
|
||||||
<script type="module" src="index.js"></script>
|
<script type="module" src="index.js"></script>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>-</title>
|
<title>-</title>
|
||||||
<link rel="icon" type="image/png" href="../../images/logo.png"/>
|
<link rel="icon" type="image/png" href="../../images/logo.png"/>
|
||||||
|
|
||||||
<script src="../../jquery.min.js"></script>
|
<script src="../../jquery.min.js"></script>
|
||||||
<script src="../../external/@babel/polyfill/polyfill.min.js"></script>
|
<script src="../../external/@babel/polyfill/polyfill.min.js"></script>
|
||||||
<script defer="defer" src="../../../dist/extensions/imagelib/index.js"></script>
|
<script defer="defer" src="../../../dist/extensions/imagelib/index.js"></script>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>-</title>
|
<title>-</title>
|
||||||
<link rel="icon" type="image/png" href="../../images/logo.png"/>
|
<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/dom-polyfill/dom-polyfill.js"></script>
|
||||||
<script src="../../external/@babel/polyfill/polyfill.min.js"></script>
|
<script src="../../external/@babel/polyfill/polyfill.min.js"></script>
|
||||||
<script type="module" src="openclipart.js"></script>
|
<script type="module" src="openclipart.js"></script>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>-</title>
|
<title>-</title>
|
||||||
<link rel="icon" type="image/png" href="../../images/logo.png"/>
|
<link rel="icon" type="image/png" href="../../images/logo.png"/>
|
||||||
|
|
||||||
<script src="../../../dist/dom-polyfill.js"></script>
|
<script src="../../../dist/dom-polyfill.js"></script>
|
||||||
<script src="../../external/@babel/polyfill/polyfill.min.js"></script>
|
<script src="../../external/@babel/polyfill/polyfill.min.js"></script>
|
||||||
<script defer="defer" src="../../../dist/extensions/imagelib/openclipart.js"></script>
|
<script defer="defer" src="../../../dist/extensions/imagelib/openclipart.js"></script>
|
||||||
|
|||||||
8
editor/no-module-support-redirect.js
Normal file
8
editor/no-module-support-redirect.js
Normal file
@@ -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}-->
|
<!{else}-->
|
||||||
<script src="jquery.min.js"></script>
|
<script src="jquery.min.js"></script>
|
||||||
<!--{endif}-->
|
<!--{endif}-->
|
||||||
|
<script nomodule="" src="no-module-support-redirect.js"></script>
|
||||||
<!-- We keep this next module external to avoid the need to
|
<!-- We keep this next module external to avoid the need to
|
||||||
load further scripts if not supported -->
|
load further scripts if not supported -->
|
||||||
<script type="module" src="redirect-on-lacking-support.js"></script>
|
<script type="module" src="redirect-on-lacking-support.js"></script>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<!{else}-->
|
<!{else}-->
|
||||||
<script src="jquery.min.js"></script>
|
<script src="jquery.min.js"></script>
|
||||||
<!--{endif}-->
|
<!--{endif}-->
|
||||||
|
|
||||||
<!-- We keep this next module external to avoid the need to
|
<!-- We keep this next module external to avoid the need to
|
||||||
load further scripts if not supported -->
|
load further scripts if not supported -->
|
||||||
<script defer="defer" src="../dist/redirect-on-lacking-support.js"></script>
|
<script defer="defer" src="../dist/redirect-on-lacking-support.js"></script>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
<!-- AUTO-GENERATED FROM svg-editor-es.html; DO NOT EDIT; use build-html.js to build -->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
<!{else}-->
|
<!{else}-->
|
||||||
<script src="jquery.min.js"></script>
|
<script src="jquery.min.js"></script>
|
||||||
<!--{endif}-->
|
<!--{endif}-->
|
||||||
|
<script nomodule="" src="no-module-support-redirect.js"></script>
|
||||||
<!-- We keep this next module external to avoid the need to
|
<!-- We keep this next module external to avoid the need to
|
||||||
load further scripts if not supported -->
|
load further scripts if not supported -->
|
||||||
<script type="module" src="redirect-on-lacking-support.js"></script>
|
<script type="module" src="redirect-on-lacking-support.js"></script>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<!{else}-->
|
<!{else}-->
|
||||||
<script src="jquery.min.js"></script>
|
<script src="jquery.min.js"></script>
|
||||||
<!--{endif}-->
|
<!--{endif}-->
|
||||||
|
|
||||||
<!-- We keep this next module external to avoid the need to
|
<!-- We keep this next module external to avoid the need to
|
||||||
load further scripts if not supported -->
|
load further scripts if not supported -->
|
||||||
<script defer="defer" src="../dist/redirect-on-lacking-support.js"></script>
|
<script defer="defer" src="../dist/redirect-on-lacking-support.js"></script>
|
||||||
|
|||||||
1
lgtm.yml
1
lgtm.yml
@@ -3,5 +3,6 @@ extraction:
|
|||||||
index:
|
index:
|
||||||
filters:
|
filters:
|
||||||
- exclude: "editor/xdomain-svgedit-config-iife.js"
|
- exclude: "editor/xdomain-svgedit-config-iife.js"
|
||||||
|
- exclude: "editor/no-module-support-redirect.js"
|
||||||
- exclude: "svgedit-config-iife.js"
|
- exclude: "svgedit-config-iife.js"
|
||||||
- exclude: "dist"
|
- exclude: "dist"
|
||||||
|
|||||||
Reference in New Issue
Block a user