fix issue with storage

master
jfh 2020-09-09 01:35:47 +02:00
parent ff71d836f8
commit 029ed1a1e1
76 changed files with 780 additions and 948 deletions

View File

@ -3,7 +3,7 @@
[ [
"@babel/env", "@babel/env",
{ {
"useBuiltIns": "entry", "useBuiltIns": "usage",
"corejs": "3.6.5" "corejs": "3.6.5"
} }
] ]

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="428" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="orange" stroke="#000" d="M0 0h120v20H0zM120 0h109v20H120zM229 0h87v20h-87zM316 0h112v20H316z"/><path fill="url(#smooth)" d="M0 0h428v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Statements 36.76%</text><text class="high" x="5" y="14">Statements 36.76%</text><text class="shadow" x="125.5" y="15">Branches 25.98%</text><text class="high" x="125" y="14">Branches 25.98%</text><text class="shadow" x="234.5" y="15">Lines 37.65%</text><text class="high" x="234" y="14">Lines 37.65%</text><text class="shadow" x="321.5" y="15">Functions 38.42%</text><text class="high" x="321" y="14">Functions 38.42%</text></g></svg> <svg xmlns="http://www.w3.org/2000/svg" width="428" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="green" stroke="#000" d="M0 0h120v20H0zM120 0h109v20H120zM229 0h87v20h-87zM316 0h112v20H316z"/><path fill="url(#smooth)" d="M0 0h428v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Statements 49.92%</text><text class="high" x="5" y="14">Statements 49.92%</text><text class="shadow" x="125.5" y="15">Branches 39.84%</text><text class="high" x="125" y="14">Branches 39.84%</text><text class="shadow" x="234.5" y="15">Lines 51.01%</text><text class="high" x="234" y="14">Lines 51.01%</text><text class="shadow" x="321.5" y="15">Functions 54.06%</text><text class="high" x="321" y="14">Functions 54.06%</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="97" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="#696969" d="M0 0h41v20H0z"/><path fill="#e05d44" d="M41 0h56v20H41z"/><path fill="url(#smooth)" d="M0 0h97v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Tests</text><text class="high" x="5" y="14">Tests</text><text class="shadow" x="46.5" y="15">121/131</text><text class="high" x="46" y="14">121/131</text></g></svg> <svg xmlns="http://www.w3.org/2000/svg" width="97" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="#696969" d="M0 0h41v20H0z"/><path fill="#4c1" d="M41 0h56v20H41z"/><path fill="url(#smooth)" d="M0 0h97v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Tests</text><text class="high" x="5" y="14">Tests</text><text class="shadow" x="46.5" y="15">132/132</text><text class="high" x="46" y="14">132/132</text></g></svg>

Before

Width:  |  Height:  |  Size: 823 B

After

Width:  |  Height:  |  Size: 820 B

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

137
dist/editor/index.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -19,6 +19,9 @@
"build:watch": "rollup -c --watch", "build:watch": "rollup -c --watch",
"start": "echo \"Open file, e.g., to http://localhost:8000/src/editor\" && es-dev-server", "start": "echo \"Open file, e.g., to http://localhost:8000/src/editor\" && es-dev-server",
"start:watch": "es-dev-server --watch", "start:watch": "es-dev-server --watch",
"cypress:open": "run-p start cypress:open-no-start",
"cypress:open-no-start": "cypress open",
"cypress:instrument": "rimraf instrumented && cp-cli src instrumented && nyc instrument --compact=false src instrumented",
"add-release": "git submodule add --depth=1 -b \"release-v$npm_config_release\" -- https://github.com/SVG-Edit/svgedit.git \"releases/svg-edit-$npm_config_release\"", "add-release": "git submodule add --depth=1 -b \"release-v$npm_config_release\" -- https://github.com/SVG-Edit/svgedit.git \"releases/svg-edit-$npm_config_release\"",
"add-new-release": "cross-var npm run add-release --release=$npm_package_version && cross-var git config --file=.gitmodules submodule.releases/latest.branch \"release-v$npm_package_version\"", "add-new-release": "cross-var npm run add-release --release=$npm_package_version && cross-var git config --file=.gitmodules submodule.releases/latest.branch \"release-v$npm_package_version\"",
"remove-release": "git submodule deinit -f \"releases/svg-edit-$npm_config_release\" && rm -rf .git/modules/releases/svg-edit-$npm_config_release && git rm -f releases/svg-edit-$npm_config_release", "remove-release": "git submodule deinit -f \"releases/svg-edit-$npm_config_release\" && rm -rf .git/modules/releases/svg-edit-$npm_config_release && git rm -f releases/svg-edit-$npm_config_release",
@ -55,9 +58,7 @@
"remark": "remark -q -f .", "remark": "remark -q -f .",
"install-offline": "npm install --prefer-offline --no-audit", "install-offline": "npm install --prefer-offline --no-audit",
"prepublishOnly": "run-s license-badges copy prep build-docs", "prepublishOnly": "run-s license-badges copy prep build-docs",
"cypress:open-no-start": "cypress open",
"cypress:instrument": "rimraf instrumented && cp-cli src instrumented && nyc instrument --compact=false src instrumented",
"cypress:open": "run-p start cypress:open-no-start",
"open-tests": "run-s cypress:instrument cypress:open", "open-tests": "run-s cypress:instrument cypress:open",
"cypress:merge": "mochawesome-merge \"cypress/results/mochaw*.json\" > mochawesome.json && marge mochawesome.json && mbg --file ./mochawesome.json --badge_output badges/tests-badge.svg", "cypress:merge": "mochawesome-merge \"cypress/results/mochaw*.json\" > mochawesome.json && marge mochawesome.json && mbg --file ./mochawesome.json --badge_output badges/tests-badge.svg",
"cypress:run-only": "rimraf \"cypress/results/mochaw*.json\" && rimraf \".nyc_output/*\" && cypress run", "cypress:run-only": "rimraf \"cypress/results/mochaw*.json\" && rimraf \".nyc_output/*\" && cypress run",

View File

@ -92,7 +92,7 @@ const config = [{
}), }),
commonjs(), commonjs(),
dynamicImportVars({include: './src/editor/locale.js'}), dynamicImportVars({include: './src/editor/locale.js'}),
babel({babelHelpers: 'bundled'}), babel({babelHelpers: 'bundled', exclude: [/\/core-js\//]}),
nodePolyfills(), nodePolyfills(),
terser({keep_fnames: true}) terser({keep_fnames: true})
] ]
@ -128,7 +128,7 @@ extensionDirs.forEach((extensionDir) => {
}), }),
commonjs(), commonjs(),
dynamicImportVars({include: `dist/editor/system/extensions/${extensionName}${extensionName}.js`}), dynamicImportVars({include: `dist/editor/system/extensions/${extensionName}${extensionName}.js`}),
babel({babelHelpers: 'bundled'}), babel({babelHelpers: 'bundled', exclude: [/\/core-js\//]}),
nodePolyfills(), nodePolyfills(),
terser({keep_fnames: true}) terser({keep_fnames: true})
] ]

View File

@ -165,10 +165,10 @@ export default {
let loaded = false; let loaded = false;
return { return {
name: 'storage', name: 'storage',
async langReady ({importLocale}) { async langReady ({lang}) {
const storagePrompt = new URL(top.location).searchParams.get('storagePrompt'); const storagePrompt = new URL(top.location).searchParams.get('storagePrompt');
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const confirmSetStorage = await importLocale(); const {default: confirmSetStorage} = await import(`./locale/${lang}.js`);
const { const {
message, storagePrefsAndContent, storagePrefsOnly, message, storagePrefsAndContent, storagePrefsOnly,
storagePrefs, storageNoPrefsOrContent, storageNoPrefs, storagePrefs, storageNoPrefsOrContent, storageNoPrefs,

View File

@ -18,8 +18,8 @@ For default config and extensions (and available options) available to
`setConfig()`, see the file `docs/tutorials/ConfigOptions.md` `setConfig()`, see the file `docs/tutorials/ConfigOptions.md`
*/ */
import 'core-js/stable/index.js'; // import 'core-js/stable/index.js';
import 'regenerator-runtime/runtime.js'; // import 'regenerator-runtime/runtime.js';
import svgEditor from './svgedit.js'; import svgEditor from './svgedit.js';
// URL OVERRIDE CONFIG // URL OVERRIDE CONFIG

View File

@ -2834,13 +2834,19 @@ editor.init = function () {
* @listens module:svgcanvas.SvgCanvas#event:extension_added * @listens module:svgcanvas.SvgCanvas#event:extension_added
* @returns {Promise<void>|void} Resolves to `undefined` * @returns {Promise<void>|void} Resolves to `undefined`
*/ */
const extAdded = function (win, ext) { const extAdded = async (win, ext) => {
if (!ext) { if (!ext) {
return undefined; return undefined;
} }
let cbCalled = false; let cbCalled = false;
let resizeDone = false; let resizeDone = false;
if (ext.langReady) {
if (editor.langChanged) { // We check for this since the "lang" pref could have been set by storage
const lang = editor.pref('lang');
await ext.langReady({lang});
}
}
/** /**
* Clear resize timer if present and if not previously performed, * Clear resize timer if present and if not previously performed,
* perform an icon resize. * perform an icon resize.