mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2024-11-15 18:08:21 +01:00
1 line
21 KiB
Plaintext
1 line
21 KiB
Plaintext
|
{"version":3,"file":"ext-storage.js","sources":["../../../../src/editor/extensions/ext-storage/storageDialog.js","../../../../src/editor/extensions/ext-storage/ext-storage.js"],"sourcesContent":["/* globals svgEditor */\nimport storageDialogHTML from './storageDialog.html'\n\nconst template = document.createElement('template')\ntemplate.innerHTML = storageDialogHTML\n/**\n * @class SeStorageDialog\n */\nexport class SeStorageDialog extends HTMLElement {\n /**\n * @function constructor\n */\n constructor () {\n super()\n // create the shadowDom and insert the template\n this._shadowRoot = this.attachShadow({ mode: 'open' })\n this._shadowRoot.append(template.content.cloneNode(true))\n this.$dialog = this._shadowRoot.querySelector('#dialog_box')\n this.$storage = this._shadowRoot.querySelector('#js-storage')\n this.$okBtn = this._shadowRoot.querySelector('#storage_ok')\n this.$cancelBtn = this._shadowRoot.querySelector('#storage_cancel')\n this.$storageInput = this._shadowRoot.querySelector('#se-storage-pref')\n this.$rememberInput = this._shadowRoot.querySelector('#se-remember')\n }\n\n /**\n * @function init\n * @param {any} name\n * @returns {void}\n */\n init (i18next) {\n this.setAttribute('common-ok', i18next.t('common.ok'))\n this.setAttribute('common-cancel', i18next.t('common.cancel'))\n this.setAttribute('notify-editor_pref_msg', i18next.t('notification.editorPreferencesMsg'))\n this.setAttribute('properties-prefs_and_content', i18next.t('properties.prefs_and_content'))\n this.setAttribute('properties-prefs_only', i18next.t('properties.prefs_only'))\n this.setAttribute('properties-no_prefs_or_content', i18next.t('properties.no_prefs_or_content'))\n this.setAttribute('tools-remember_this_choice', i18next.t('tools.remember_this_choice'))\n this.setAttribute('tools-remember_this_choice_title', i18next.t('tools.remember_this_choice_title'))\n }\n\n /**\n * @function observedAttributes\n * @returns {any} observed\n */\n static get observedAttributes () {\n return ['dialog', 'storage', 'common-ok', 'common-cancel', 'notify-editor_pref_msg', 'properties-prefs_and_content', 'tools-remember_this_choice', 'tools-remember_this_choice_title', 'properties-prefs_only', 'properties-no_prefs_or_content']\n }\n\n /**\n * @function attributeChangedCallback\n * @param {string} name\n * @param {string} oldValue\n * @param {string} newValue\n * @returns {void}\n */\n attributeChangedCallback (name, oldValue, newValue) {\n let node\n switch (name) {\n case 'dialog':\n if (newValue === 'open') {\n this.$dialog.open()\n } else {\n this.$dialog.close()\n }\n break\n case 'storage':\n if (newValue === 'true') {\n this.$storageInput.options[0].disabled = false\n } else {\n this.$storageInput.options[0].disabled = true\n }\n break\n case 'common-ok':\n this.$okBtn.textContent = newValue\n break\n case 'common-cancel':\n this.$cancelBtn.textContent = newValue\n break\n case 'notify-editor_pref_msg':\n node = this._shadowRoot.querySelector('#notificationNote')\n node.textContent = newValue\n break\n case 'properties-prefs_and_content':\n node = this._shadowRoot.querySelector('#prefsAndContent')\n node.textContent = newValue\n break\n case 'properties-prefs_only':\n node = this._shadowRoot.querySelector('#prefsOnly')\n node.textContent = newValue\n break\n case 'properties-no_prefs_or_content':\n node = this._shadowRoot.querySelector('#noPrefsOrContent')\n node.textContent = newValue\n break\n case 'tools-remember_this_choice':\n node = this._shadowRoot.querySelector('#se-remember-title')\n node.prepend(newValue)\n break\n case 'tools-remember_this_choice_title':\n node = this._shadowRoot.querySelector('#se-remember-title')\n node.setAttribute('title', ne
|