From 522860ef6adf20445ccc3366751e292fa6d0ae91 Mon Sep 17 00:00:00 2001 From: Agriya Dev5 Date: Fri, 21 May 2021 11:47:17 +0530 Subject: [PATCH 1/9] #101 pass the strings as attributes and update i18n string in template --- src/editor/EditorStartup.js | 1 + src/editor/dialogs/cmenuDialog.js | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/editor/EditorStartup.js b/src/editor/EditorStartup.js index 588173a6..8e8976af 100644 --- a/src/editor/EditorStartup.js +++ b/src/editor/EditorStartup.js @@ -88,6 +88,7 @@ class EditorStartup { // canvas menu added to DOM const dialogBox = document.createElement('se-cmenu_canvas-dialog'); dialogBox.setAttribute('id', 'se-cmenu_canvas'); + dialogBox.setAttribute('i18next-tools-cut', this.i18next.t('tools.cut')); document.body.append(dialogBox); // alertDialog added to DOM const alertBox = document.createElement('se-alert-dialog'); diff --git a/src/editor/dialogs/cmenuDialog.js b/src/editor/dialogs/cmenuDialog.js index 5f1a68c2..3117a7b6 100644 --- a/src/editor/dialogs/cmenuDialog.js +++ b/src/editor/dialogs/cmenuDialog.js @@ -68,7 +68,7 @@ template.innerHTML = ` @@ -146,15 +146,24 @@ export class SeCMenuDialog extends HTMLElement { this.$moveBackLink = this._shadowRoot.querySelector('#se-move-back'); } init (i18next) { - console.log(i18next); - this.setAttribute('toolscut', 'a test'); + this.setAttribute('tools-cut', i18next.t('tools.cut')); + this.setAttribute('tools-copy', i18next.t('tools.copy')); + this.setAttribute('tools-paste', i18next.t('tools.paste')); + this.setAttribute('tools-paste_in_place', i18next.t('tools.paste_in_place')); + this.setAttribute('tools-delete', i18next.t('tools.delete')); + this.setAttribute('tools-group', i18next.t('tools.group')); + this.setAttribute('tools-ungroup', i18next.t('tools.ungroup')); + this.setAttribute('tools-move_front', i18next.t('tools.move_front')); + this.setAttribute('tools-move_up', i18next.t('tools.move_up')); + this.setAttribute('tools-move_down', i18next.t('tools.move_down')); + this.setAttribute('tools-move_back', i18next.t('tools.move_back')); } /** * @function observedAttributes * @returns {any} observed */ static get observedAttributes () { - return [ 'disableallmenu', 'enablemenuitems', 'disablemenuitems', 'toolscut' ]; + return [ 'disableallmenu', 'enablemenuitems', 'disablemenuitems', 'tools-cut', 'tools-copy', 'tools-paste', 'tools-paste_in_place', 'tools-delete', 'tools-group', 'tools-ungroup', 'tools-move_front', 'tools-move_up', 'tools-move_down', 'tools-move_back' ]; } /** * @function attributeChangedCallback @@ -165,6 +174,7 @@ export class SeCMenuDialog extends HTMLElement { */ attributeChangedCallback (name, oldValue, newValue) { let eles = []; + let textnode; const sdowRoot = this._shadowRoot; switch (name) { case 'disableallmenu': @@ -189,9 +199,47 @@ export class SeCMenuDialog extends HTMLElement { selEle.parentElement.classList.add('disabled'); }); break; - case 'toolscut': - var textnode = document.createTextNode(newValue); - this._shadowRoot.querySelector('#se-cut').prepend(textnode); + case 'tools-cut': + textnode = document.createTextNode(newValue); + this.$cutLink.prepend(textnode); + break; + case 'tools-copy': + textnode = document.createTextNode(newValue); + this.$copyLink.prepend(textnode); + break; + case 'tools-paste': + this.$pasteLink.textContent = newValue; + break; + case 'tools-paste_in_place': + this.$pasteInPlaceLink.textContent = newValue; + break; + case 'tools-delete': + textnode = document.createTextNode(newValue); + this.$deleteLink.prepend(textnode); + break; + case 'tools-group': + textnode = document.createTextNode(newValue); + this.$groupLink.prepend(textnode); + break; + case 'tools-ungroup': + textnode = document.createTextNode(newValue); + this.$ungroupLink.prepend(textnode); + break; + case 'tools-move_front': + textnode = document.createTextNode(newValue); + this.$moveFrontLink.prepend(textnode); + break; + case 'tools-move_up': + textnode = document.createTextNode(newValue); + this.$moveUpLink.prepend(textnode); + break; + case 'tools-move_down': + textnode = document.createTextNode(newValue); + this.$moveDownLink.prepend(textnode); + break; + case 'tools-move_back': + textnode = document.createTextNode(newValue); + this.$moveBackLink.prepend(textnode); break; default: // super.attributeChangedCallback(name, oldValue, newValue); From c60d1bf645824ca157a7f8ce912d4347a9c0194b Mon Sep 17 00:00:00 2001 From: Agriya Dev5 Date: Fri, 21 May 2021 18:03:19 +0530 Subject: [PATCH 5/9] #101 dialogs i18n new approach implement --- src/editor/EditorStartup.js | 3 + src/editor/dialogs/cmenuDialog.js | 5 + src/editor/dialogs/editorPreferencesDialog.js | 145 +++++++++++++++--- src/editor/dialogs/exportDialog.js | 42 +++-- src/editor/dialogs/imagePropertiesDialog.js | 93 +++++++++-- 5 files changed, 240 insertions(+), 48 deletions(-) diff --git a/src/editor/EditorStartup.js b/src/editor/EditorStartup.js index 34872fd2..d923ef51 100644 --- a/src/editor/EditorStartup.js +++ b/src/editor/EditorStartup.js @@ -81,10 +81,12 @@ class EditorStartup { const newSeImgPropDialog = document.createElement('se-img-prop-dialog'); newSeImgPropDialog.setAttribute('id', 'se-img-prop'); document.body.append(newSeImgPropDialog); + newSeImgPropDialog.init(this.i18next); // editor prefences dialoag added to DOM const newSeEditPrefsDialog = document.createElement('se-edit-prefs-dialog'); newSeEditPrefsDialog.setAttribute('id', 'se-edit-prefs'); document.body.append(newSeEditPrefsDialog); + newSeEditPrefsDialog.init(this.i18next); // canvas menu added to DOM const dialogBox = document.createElement('se-cmenu_canvas-dialog'); dialogBox.setAttribute('id', 'se-cmenu_canvas'); @@ -102,6 +104,7 @@ class EditorStartup { const exportDialog = document.createElement('se-export-dialog'); exportDialog.setAttribute('id', 'se-export-dialog'); document.body.append(exportDialog); + exportDialog.init(this.i18next); } catch (err) { console.error(err); } diff --git a/src/editor/dialogs/cmenuDialog.js b/src/editor/dialogs/cmenuDialog.js index 08affc07..b3eeb25d 100644 --- a/src/editor/dialogs/cmenuDialog.js +++ b/src/editor/dialogs/cmenuDialog.js @@ -145,6 +145,11 @@ export class SeCMenuDialog extends HTMLElement { this.$moveDownLink = this._shadowRoot.querySelector('#se-move-down'); this.$moveBackLink = this._shadowRoot.querySelector('#se-move-back'); } + /** + * @function init + * @param {any} name + * @returns {void} + */ init (i18next) { this.setAttribute('tools-cut', i18next.t('tools.cut')); this.setAttribute('tools-copy', i18next.t('tools.copy')); diff --git a/src/editor/dialogs/editorPreferencesDialog.js b/src/editor/dialogs/editorPreferencesDialog.js index a286282a..868be581 100644 --- a/src/editor/dialogs/editorPreferencesDialog.js +++ b/src/editor/dialogs/editorPreferencesDialog.js @@ -149,17 +149,13 @@ template.innerHTML = `
- - + +
- #{svgEditor.i18next.t('config.editor_prefs')} +
- #{svgEditor.i18next.t('config.background')} +
-

#{svgEditor.i18next.t('config.editor_bg_note')}

+

- #{svgEditor.i18next.t('config.grid')} +
- #{svgEditor.i18next.t('config.units_and_rulers')} +
- - + +
@@ -103,12 +97,23 @@ export class SeExportDialog extends HTMLElement { this.$input = this._shadowRoot.querySelector('elix-number-spin-box'); this.value = 1; } + /** + * @function init + * @param {any} name + * @returns {void} + */ + init (i18next) { + this.setAttribute('common-ok', i18next.t('common.ok')); + this.setAttribute('common-cancel', i18next.t('common.cancel')); + this.setAttribute('ui-quality', i18next.t('ui.quality')); + this.setAttribute('ui-export_type_label', i18next.t('ui.export_type_label')); + } /** * @function observedAttributes * @returns {any} observed */ static get observedAttributes () { - return [ 'dialog' ]; + return [ 'dialog', 'common-ok', 'common-cancel', 'ui-quality', 'ui-export_type_label' ]; } /** * @function attributeChangedCallback @@ -119,6 +124,7 @@ export class SeExportDialog extends HTMLElement { */ attributeChangedCallback (name, oldValue, newValue) { // eslint-disable-next-line sonarjs/no-small-switch + let node; switch (name) { case 'dialog': if (newValue === 'open') { @@ -127,6 +133,20 @@ export class SeExportDialog extends HTMLElement { this.$dialog.close(); } break; + case 'common-ok': + this.$okBtn.textContent = newValue; + break; + case 'common-cancel': + this.$cancelBtn.textContent = newValue; + break; + case 'ui-quality': + node = this._shadowRoot.querySelector('#se-quality'); + node.prepend(newValue); + break; + case 'ui-export_type_label': + node = this._shadowRoot.querySelector('#export_select'); + node.textContent = newValue; + break; default: // super.attributeChangedCallback(name, oldValue, newValue); break; diff --git a/src/editor/dialogs/imagePropertiesDialog.js b/src/editor/dialogs/imagePropertiesDialog.js index 9a9d675a..197e15ed 100644 --- a/src/editor/dialogs/imagePropertiesDialog.js +++ b/src/editor/dialogs/imagePropertiesDialog.js @@ -71,46 +71,46 @@ template.innerHTML = `
- - + +
- #{svgEditor.i18next.t('config.image_props')} +
- #{svgEditor.i18next.t('config.doc_dims')} +
- #{svgEditor.i18next.t('config.included_images')} +
@@ -141,12 +141,32 @@ export class SeImgPropDialog extends HTMLElement { this.$imageOptRef = this._shadowRoot.querySelector('#image_ref'); this.$dialog = this._shadowRoot.querySelector('#svg_docprops'); } + /** + * @function init + * @param {any} name + * @returns {void} + */ + init (i18next) { + this.setAttribute('common-ok', i18next.t('common.ok')); + this.setAttribute('common-cancel', i18next.t('common.cancel')); + this.setAttribute('config-image_props', i18next.t('config.image_props')); + this.setAttribute('config-doc_title', i18next.t('config.doc_title')); + this.setAttribute('config-doc_dims', i18next.t('config.doc_dims')); + this.setAttribute('common-width', i18next.t('common.width')); + this.setAttribute('common-height', i18next.t('common.height')); + this.setAttribute('config-select_predefined', i18next.t('config.select_predefined')); + this.setAttribute('tools-fit-to-content', i18next.t('tools.fitToContent')); + this.setAttribute('config-included_images', i18next.t('config.included_images')); + this.setAttribute('config-image_opt_embed', i18next.t('config.image_opt_embed')); + this.setAttribute('config-image_opt_ref', i18next.t('config.image_opt_ref')); + } + /** * @function observedAttributes * @returns {any} observed */ static get observedAttributes () { - return [ 'title', 'width', 'height', 'save', 'dialog', 'embed' ]; + return [ 'title', 'width', 'height', 'save', 'dialog', 'embed', 'common-ok', 'common-cancel', 'config-image_props', 'config-doc_title', 'config-doc_dims', 'common-width', 'common-height', 'config-select_predefined', 'tools-fit-to-content', 'config-included_images', 'config-image_opt_embed', 'config-image_opt_ref' ]; } /** * @function attributeChangedCallback @@ -157,6 +177,7 @@ export class SeImgPropDialog extends HTMLElement { */ attributeChangedCallback (name, oldValue, newValue) { if (oldValue === newValue) return; + let node ; switch (name) { case 'title': this.$canvasTitle.value = newValue; @@ -209,6 +230,52 @@ export class SeImgPropDialog extends HTMLElement { } } break; + case 'common-ok': + this.$saveBtn.textContent = newValue; + break; + case 'common-cancel': + this.$cancelBtn.textContent = newValue; + break; + case 'config-image_props': + node = this._shadowRoot.querySelector('#svginfo_image_props'); + node.textContent = newValue; + break; + case 'config-doc_title': + node = this._shadowRoot.querySelector('#svginfo_title'); + node.textContent = newValue; + break; + case 'config-doc_dims': + node = this._shadowRoot.querySelector('#svginfo_dim'); + node.textContent = newValue; + break; + case 'common-width': + node = this._shadowRoot.querySelector('#svginfo_width'); + node.textContent = newValue; + break; + case 'common-height': + node = this._shadowRoot.querySelector('#svginfo_height'); + node.textContent = newValue; + break; + case 'config-select_predefined': + node = this._shadowRoot.querySelector('#selectedPredefined'); + node.textContent = newValue; + break; + case 'tools-fit-to-content': + node = this._shadowRoot.querySelector('#fitToContent'); + node.textContent = newValue; + break; + case 'config-included_images': + node = this._shadowRoot.querySelector('#includedImages'); + node.textContent = newValue; + break; + case 'config-image_opt_embed': + node = this._shadowRoot.querySelector('#image_opt_embed'); + node.textContent = newValue; + break; + case 'config-image_opt_ref': + node = this._shadowRoot.querySelector('#image_opt_ref'); + node.textContent = newValue; + break; default: super.attributeChangedCallback(name, oldValue, newValue); break; From 88512f208819238967eb7a0e67306c560f07eae0 Mon Sep 17 00:00:00 2001 From: Agriya Dev5 Date: Fri, 21 May 2021 18:15:09 +0530 Subject: [PATCH 6/9] #101 dialog i18n are change to new approach --- src/editor/dialogs/cmenuLayersDialog.js | 25 ++++++++++++++++++++++++- src/editor/panels/LayersPanel.js | 2 ++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/editor/dialogs/cmenuLayersDialog.js b/src/editor/dialogs/cmenuLayersDialog.js index 7c6e3096..93e91da8 100644 --- a/src/editor/dialogs/cmenuLayersDialog.js +++ b/src/editor/dialogs/cmenuLayersDialog.js @@ -93,12 +93,23 @@ export class SeCMenuLayerDialog extends HTMLElement { this.$mergeDownLink = this._shadowRoot.querySelector('#se-merge-down'); this.$mergeAllLink = this._shadowRoot.querySelector('#se-merge-all'); } + /** + * @function init + * @param {any} name + * @returns {void} + */ + init (i18next) { + this.setAttribute('layers-dupe', i18next.t('layers.dupe')); + this.setAttribute('layers-del', i18next.t('layers.del')); + this.setAttribute('layers-merge_down', i18next.t('layers.merge_down')); + this.setAttribute('layers-merge_all', i18next.t('layers.merge_all')); + } /** * @function observedAttributes * @returns {any} observed */ static get observedAttributes () { - return [ 'value', 'leftclick' ]; + return [ 'value', 'leftclick', 'layers-dupe', 'layers-del', 'layers-merge_down', 'layers-merge_all' ]; } /** * @function attributeChangedCallback @@ -117,6 +128,18 @@ export class SeCMenuLayerDialog extends HTMLElement { this._workarea = document.getElementById(this.source); } break; + case 'layers-dupe': + this.$duplicateLink.textContent = newValue; + break; + case 'layers-del': + this.$deleteLink.textContent = newValue; + break; + case 'layers-merge_down': + this.$mergeDownLink.textContent = newValue; + break; + case 'layers-merge_all': + this.$mergeAllLink.textContent = newValue; + break; default: // super.attributeChangedCallback(name, oldValue, newValue); break; diff --git a/src/editor/panels/LayersPanel.js b/src/editor/panels/LayersPanel.js index b374ea9a..34eac5be 100644 --- a/src/editor/panels/LayersPanel.js +++ b/src/editor/panels/LayersPanel.js @@ -150,11 +150,13 @@ class LayersPanel { menuMore.value = "layer_moreopts"; menuMore.setAttribute("leftclick", true); document.body.append(menuMore); + menuMore.init(i18next); const menuLayerBox = document.createElement("se-cmenu-layers"); menuLayerBox.setAttribute("id", "se-cmenu-layers-list"); menuLayerBox.value = "layerlist"; menuLayerBox.setAttribute("leftclick", false); document.body.append(menuLayerBox); + menuLayerBox.init(i18next); document .getElementById("layer_new") .addEventListener("click", this.newLayer.bind(this)); From 45eb039eb3acd350a4933feb9b4b43b94c5cdcdc Mon Sep 17 00:00:00 2001 From: Agriya Dev5 Date: Fri, 21 May 2021 18:52:56 +0530 Subject: [PATCH 7/9] #101 dialogs i18n new approach changes --- src/editor/dialogs/svgSourceDialog.js | 40 +++++++++++++++++++-------- src/editor/panels/TopPanel.js | 1 + 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/editor/dialogs/svgSourceDialog.js b/src/editor/dialogs/svgSourceDialog.js index 3e8c4bb5..fa5aa22f 100644 --- a/src/editor/dialogs/svgSourceDialog.js +++ b/src/editor/dialogs/svgSourceDialog.js @@ -62,18 +62,12 @@ template.innerHTML = `
- - + +
-

- #{svgEditor.i18next.t('notification.source_dialog_note')} -

- +

+
@@ -101,12 +95,23 @@ export class SeSvgSourceEditorDialog extends HTMLElement { this.$copySec = this._shadowRoot.querySelector('#save_output_btns'); this.$applySec = this._shadowRoot.querySelector('#tool_source_back'); } + /** + * @function init + * @param {any} name + * @returns {void} + */ + init (i18next) { + this.setAttribute('tools-source_save', i18next.t('tools.source_save')); + this.setAttribute('common-cancel', i18next.t('common.cancel')); + this.setAttribute('notification-source_dialog_note', i18next.t('notification.source_dialog_note')); + this.setAttribute('config-done', i18next.t('config.done')); + } /** * @function observedAttributes * @returns {any} observed */ static get observedAttributes () { - return [ 'dialog', 'value', 'applysec', 'copysec' ]; + return [ 'dialog', 'value', 'applysec', 'copysec', 'tools-source_save', 'common-cancel', 'notification-source_dialog_note', 'config-done' ]; } /** * @function attributeChangedCallback @@ -144,6 +149,19 @@ export class SeSvgSourceEditorDialog extends HTMLElement { case 'value': this.$sourceTxt.value = newValue; break; + case 'tools-source_save': + this.$saveBtn.textContent = newValue; + break; + case 'common-cancel': + this.$cancelBtn.textContent = newValue; + break; + case 'notification-source_dialog_note': + const node = this._shadowRoot.querySelector('#copy_save_note'); + node.textContent = newValue; + break; + case 'config-done': + this.$copyBtn.textContent = newValue; + break; default: super.attributeChangedCallback(name, oldValue, newValue); break; diff --git a/src/editor/panels/TopPanel.js b/src/editor/panels/TopPanel.js index 09edeb7d..0de43c49 100644 --- a/src/editor/panels/TopPanel.js +++ b/src/editor/panels/TopPanel.js @@ -990,6 +990,7 @@ class TopPanel { ); newSeEditorDialog.setAttribute("id", "se-svg-editor-dialog"); document.body.append(newSeEditorDialog); + newSeEditorDialog.init(i18next); // register action to top panel buttons $id("tool_source").addEventListener( "click", From 143192d7e37f8f3ec3e4d297241e38d69af698f0 Mon Sep 17 00:00:00 2001 From: Agriya Dev5 Date: Fri, 21 May 2021 18:54:50 +0530 Subject: [PATCH 8/9] #101 unwanted code removed --- src/editor/dialogs/cmenuDialog.js | 1 - src/editor/dialogs/cmenuLayersDialog.js | 1 - src/editor/dialogs/editorPreferencesDialog.js | 1 - src/editor/dialogs/exportDialog.js | 1 - src/editor/dialogs/imagePropertiesDialog.js | 1 - src/editor/dialogs/svgSourceDialog.js | 1 - 6 files changed, 6 deletions(-) diff --git a/src/editor/dialogs/cmenuDialog.js b/src/editor/dialogs/cmenuDialog.js index b3eeb25d..6586b2eb 100644 --- a/src/editor/dialogs/cmenuDialog.js +++ b/src/editor/dialogs/cmenuDialog.js @@ -1,4 +1,3 @@ -/* gl#bals svgEditor */ const template = document.createElement('template'); // eslint-disable-next-line no-unsanitized/property template.innerHTML = ` diff --git a/src/editor/dialogs/cmenuLayersDialog.js b/src/editor/dialogs/cmenuLayersDialog.js index 93e91da8..121353f8 100644 --- a/src/editor/dialogs/cmenuLayersDialog.js +++ b/src/editor/dialogs/cmenuLayersDialog.js @@ -1,4 +1,3 @@ -/* gl#bals svgEditor */ const template = document.createElement('template'); // eslint-disable-next-line no-unsanitized/property template.innerHTML = ` diff --git a/src/editor/dialogs/editorPreferencesDialog.js b/src/editor/dialogs/editorPreferencesDialog.js index 868be581..6eb220f8 100644 --- a/src/editor/dialogs/editorPreferencesDialog.js +++ b/src/editor/dialogs/editorPreferencesDialog.js @@ -1,4 +1,3 @@ -/* gl#bals svgEditor */ const template = document.createElement('template'); // eslint-disable-next-line no-unsanitized/property template.innerHTML = ` diff --git a/src/editor/dialogs/exportDialog.js b/src/editor/dialogs/exportDialog.js index 86c5ff50..1c647335 100644 --- a/src/editor/dialogs/exportDialog.js +++ b/src/editor/dialogs/exportDialog.js @@ -1,4 +1,3 @@ -/* gl#bals svgEditor */ import './se-elix/define/NumberSpinBox.js'; const template = document.createElement('template'); diff --git a/src/editor/dialogs/imagePropertiesDialog.js b/src/editor/dialogs/imagePropertiesDialog.js index 197e15ed..cc363786 100644 --- a/src/editor/dialogs/imagePropertiesDialog.js +++ b/src/editor/dialogs/imagePropertiesDialog.js @@ -1,4 +1,3 @@ -/* gl#bals svgEditor */ import { isValidUnit } from '../../common/units.js'; const template = document.createElement('template'); diff --git a/src/editor/dialogs/svgSourceDialog.js b/src/editor/dialogs/svgSourceDialog.js index fa5aa22f..4f6c4986 100644 --- a/src/editor/dialogs/svgSourceDialog.js +++ b/src/editor/dialogs/svgSourceDialog.js @@ -1,4 +1,3 @@ -/* gl#bals svgEditor */ const template = document.createElement('template'); // eslint-disable-next-line no-unsanitized/property template.innerHTML = ` From da100929894549d0faeec73ef8020dcf93ffcf18 Mon Sep 17 00:00:00 2001 From: Agriya Dev5 Date: Fri, 21 May 2021 19:06:24 +0530 Subject: [PATCH 9/9] #101 lint changes --- src/editor/dialogs/cmenuDialog.js | 9 ++++++--- src/editor/dialogs/cmenuLayersDialog.js | 6 +++--- src/editor/dialogs/editorPreferencesDialog.js | 6 +++--- src/editor/dialogs/exportDialog.js | 8 ++++---- src/editor/dialogs/imagePropertiesDialog.js | 14 +++++++++----- src/editor/dialogs/svgSourceDialog.js | 11 ++++++----- 6 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/editor/dialogs/cmenuDialog.js b/src/editor/dialogs/cmenuDialog.js index 6586b2eb..7416fc10 100644 --- a/src/editor/dialogs/cmenuDialog.js +++ b/src/editor/dialogs/cmenuDialog.js @@ -147,8 +147,8 @@ export class SeCMenuDialog extends HTMLElement { /** * @function init * @param {any} name - * @returns {void} - */ + * @returns {void} + */ init (i18next) { this.setAttribute('tools-cut', i18next.t('tools.cut')); this.setAttribute('tools-copy', i18next.t('tools.copy')); @@ -167,7 +167,10 @@ export class SeCMenuDialog extends HTMLElement { * @returns {any} observed */ static get observedAttributes () { - return [ 'disableallmenu', 'enablemenuitems', 'disablemenuitems', 'tools-cut', 'tools-copy', 'tools-paste', 'tools-paste_in_place', 'tools-delete', 'tools-group', 'tools-ungroup', 'tools-move_front', 'tools-move_up', 'tools-move_down', 'tools-move_back' ]; + return [ 'disableallmenu', 'enablemenuitems', 'disablemenuitems', 'tools-cut', + 'tools-copy', 'tools-paste', 'tools-paste_in_place', 'tools-delete', 'tools-group', + 'tools-ungroup', 'tools-move_front', 'tools-move_up', 'tools-move_down', + 'tools-move_back' ]; } /** * @function attributeChangedCallback diff --git a/src/editor/dialogs/cmenuLayersDialog.js b/src/editor/dialogs/cmenuLayersDialog.js index 121353f8..2fb31a8a 100644 --- a/src/editor/dialogs/cmenuLayersDialog.js +++ b/src/editor/dialogs/cmenuLayersDialog.js @@ -95,14 +95,14 @@ export class SeCMenuLayerDialog extends HTMLElement { /** * @function init * @param {any} name - * @returns {void} - */ + * @returns {void} + */ init (i18next) { this.setAttribute('layers-dupe', i18next.t('layers.dupe')); this.setAttribute('layers-del', i18next.t('layers.del')); this.setAttribute('layers-merge_down', i18next.t('layers.merge_down')); this.setAttribute('layers-merge_all', i18next.t('layers.merge_all')); - } + } /** * @function observedAttributes * @returns {any} observed diff --git a/src/editor/dialogs/editorPreferencesDialog.js b/src/editor/dialogs/editorPreferencesDialog.js index 6eb220f8..3fa6db38 100644 --- a/src/editor/dialogs/editorPreferencesDialog.js +++ b/src/editor/dialogs/editorPreferencesDialog.js @@ -265,8 +265,8 @@ export class SeEditPrefsDialog extends HTMLElement { /** * @function init * @param {any} name - * @returns {void} - */ + * @returns {void} + */ init (i18next) { this.setAttribute('common-ok', i18next.t('common.ok')); this.setAttribute('common-cancel', i18next.t('common.cancel')); @@ -287,7 +287,7 @@ export class SeEditPrefsDialog extends HTMLElement { this.setAttribute('config-units_and_rulers', i18next.t('config.units_and_rulers')); this.setAttribute('config-show_rulers', i18next.t('config.show_rulers')); this.setAttribute('config-base_unit', i18next.t('config.base_unit')); - } + } /** * @function observedAttributes * @returns {any} observed diff --git a/src/editor/dialogs/exportDialog.js b/src/editor/dialogs/exportDialog.js index 1c647335..2c6ddca4 100644 --- a/src/editor/dialogs/exportDialog.js +++ b/src/editor/dialogs/exportDialog.js @@ -99,14 +99,14 @@ export class SeExportDialog extends HTMLElement { /** * @function init * @param {any} name - * @returns {void} - */ + * @returns {void} + */ init (i18next) { this.setAttribute('common-ok', i18next.t('common.ok')); this.setAttribute('common-cancel', i18next.t('common.cancel')); this.setAttribute('ui-quality', i18next.t('ui.quality')); this.setAttribute('ui-export_type_label', i18next.t('ui.export_type_label')); - } + } /** * @function observedAttributes * @returns {any} observed @@ -145,7 +145,7 @@ export class SeExportDialog extends HTMLElement { case 'ui-export_type_label': node = this._shadowRoot.querySelector('#export_select'); node.textContent = newValue; - break; + break; default: // super.attributeChangedCallback(name, oldValue, newValue); break; diff --git a/src/editor/dialogs/imagePropertiesDialog.js b/src/editor/dialogs/imagePropertiesDialog.js index cc363786..aab3bce9 100644 --- a/src/editor/dialogs/imagePropertiesDialog.js +++ b/src/editor/dialogs/imagePropertiesDialog.js @@ -143,8 +143,8 @@ export class SeImgPropDialog extends HTMLElement { /** * @function init * @param {any} name - * @returns {void} - */ + * @returns {void} + */ init (i18next) { this.setAttribute('common-ok', i18next.t('common.ok')); this.setAttribute('common-cancel', i18next.t('common.cancel')); @@ -165,7 +165,11 @@ export class SeImgPropDialog extends HTMLElement { * @returns {any} observed */ static get observedAttributes () { - return [ 'title', 'width', 'height', 'save', 'dialog', 'embed', 'common-ok', 'common-cancel', 'config-image_props', 'config-doc_title', 'config-doc_dims', 'common-width', 'common-height', 'config-select_predefined', 'tools-fit-to-content', 'config-included_images', 'config-image_opt_embed', 'config-image_opt_ref' ]; + return [ 'title', 'width', 'height', 'save', 'dialog', 'embed', 'common-ok', + 'common-cancel', 'config-image_props', 'config-doc_title', 'config-doc_dims', + 'common-width', 'common-height', 'config-select_predefined', + 'tools-fit-to-content', 'config-included_images', 'config-image_opt_embed', + 'config-image_opt_ref' ]; } /** * @function attributeChangedCallback @@ -243,7 +247,7 @@ export class SeImgPropDialog extends HTMLElement { node = this._shadowRoot.querySelector('#svginfo_title'); node.textContent = newValue; break; - case 'config-doc_dims': + case 'config-doc_dims': node = this._shadowRoot.querySelector('#svginfo_dim'); node.textContent = newValue; break; @@ -251,7 +255,7 @@ export class SeImgPropDialog extends HTMLElement { node = this._shadowRoot.querySelector('#svginfo_width'); node.textContent = newValue; break; - case 'common-height': + case 'common-height': node = this._shadowRoot.querySelector('#svginfo_height'); node.textContent = newValue; break; diff --git a/src/editor/dialogs/svgSourceDialog.js b/src/editor/dialogs/svgSourceDialog.js index 4f6c4986..39874645 100644 --- a/src/editor/dialogs/svgSourceDialog.js +++ b/src/editor/dialogs/svgSourceDialog.js @@ -97,14 +97,14 @@ export class SeSvgSourceEditorDialog extends HTMLElement { /** * @function init * @param {any} name - * @returns {void} - */ + * @returns {void} + */ init (i18next) { this.setAttribute('tools-source_save', i18next.t('tools.source_save')); this.setAttribute('common-cancel', i18next.t('common.cancel')); this.setAttribute('notification-source_dialog_note', i18next.t('notification.source_dialog_note')); this.setAttribute('config-done', i18next.t('config.done')); - } + } /** * @function observedAttributes * @returns {any} observed @@ -121,6 +121,7 @@ export class SeSvgSourceEditorDialog extends HTMLElement { */ attributeChangedCallback (name, oldValue, newValue) { if (oldValue === newValue) return; + let node; switch (name) { case 'dialog': if (newValue === 'open') { @@ -155,12 +156,12 @@ export class SeSvgSourceEditorDialog extends HTMLElement { this.$cancelBtn.textContent = newValue; break; case 'notification-source_dialog_note': - const node = this._shadowRoot.querySelector('#copy_save_note'); + node = this._shadowRoot.querySelector('#copy_save_note'); node.textContent = newValue; break; case 'config-done': this.$copyBtn.textContent = newValue; - break; + break; default: super.attributeChangedCallback(name, oldValue, newValue); break;