storagedialog

master
JFH 2020-12-30 17:56:17 +01:00
parent d574e73ecb
commit 0dc636ef62
3 changed files with 18 additions and 24 deletions

View File

@ -1,3 +1,4 @@
/* eslint-disable max-len */
/* eslint-disable node/no-unpublished-import */
import 'elix/define/Dialog.js';

View File

@ -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) {

View File

@ -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();