From 0dc636ef6225f385eed775cab3635554fb47fb29 Mon Sep 17 00:00:00 2001 From: JFH <20402845+jfhenon@users.noreply.github.com> Date: Wed, 30 Dec 2020 17:56:17 +0100 Subject: [PATCH] storagedialog --- src/editor/dialogs/storageDialog.js | 1 + .../extensions/ext-storage/ext-storage.js | 24 +------------------ src/editor/svgedit.js | 17 ++++++++++++- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/src/editor/dialogs/storageDialog.js b/src/editor/dialogs/storageDialog.js index 32ee919e..4797be7f 100644 --- a/src/editor/dialogs/storageDialog.js +++ b/src/editor/dialogs/storageDialog.js @@ -1,3 +1,4 @@ +/* eslint-disable max-len */ /* eslint-disable node/no-unpublished-import */ import 'elix/define/Dialog.js'; diff --git a/src/editor/extensions/ext-storage/ext-storage.js b/src/editor/extensions/ext-storage/ext-storage.js index a41836cc..8435ed72 100644 --- a/src/editor/extensions/ext-storage/ext-storage.js +++ b/src/editor/extensions/ext-storage/ext-storage.js @@ -19,18 +19,6 @@ * initial (or URL-forced) dialog. * */ -const loadExtensionTranslation = async function (lang) { - let translationModule; - try { - translationModule = await import(`./locale/${encodeURIComponent(lang)}.js`); - } catch (_error) { - // eslint-disable-next-line no-console - console.error(`Missing translation (${lang}) - using 'en'`); - translationModule = await import(`./locale/en.js`); - } - return translationModule.default; -}; - export default { name: 'storage', init ({$}) { @@ -119,18 +107,8 @@ export default { let loaded = false; return { name: 'storage', - async langReady ({lang}) { + langReady ({lang}) { const storagePrompt = new URL(top.location).searchParams.get('storagePrompt'); - // eslint-disable-next-line no-unused-vars - const strings = await loadExtensionTranslation(svgEditor.pref('lang')); - /* - const { - message, storagePrefsAndContent, storagePrefsOnly, - storagePrefs, storageNoPrefsOrContent, storageNoPrefs, - rememberLabel, rememberTooltip - } = strings; - */ - // No need to run this one-time dialog again just because the user // changes the language if (loaded) { diff --git a/src/editor/svgedit.js b/src/editor/svgedit.js index d6d6d935..5bcef500 100644 --- a/src/editor/svgedit.js +++ b/src/editor/svgedit.js @@ -504,7 +504,22 @@ class Editor { const dialogBox = document.createElement('se-cmenu_canvas-dialog'); dialogBox.setAttribute('id', 'se-cmenu_canvas'); document.body.append(dialogBox); - } catch (err) {} + // alertDialog added to DOM + const alertBox = document.createElement('se-alert-dialog'); + alertBox.setAttribute('id', 'se-alert-dialog'); + document.body.append(alertBox); + // storageDialog added to DOM + const storageBox = document.createElement('se-storage-dialog'); + storageBox.setAttribute('id', 'se-storage-dialog'); + document.body.append(storageBox); + // promptDialog added to DOM + const promptBox = document.createElement('se-prompt-dialog'); + promptBox.setAttribute('id', 'se-prompt-dialog'); + document.body.append(promptBox); + } catch (err) { + // eslint-disable-next-line no-console + console.error(err); + } this.configObj.load();