From cdc85a515b1de7339cf11f732fcf351dc7f69642 Mon Sep 17 00:00:00 2001 From: pmkrawczyk <63370626+pmkrawczyk@users.noreply.github.com> Date: Tue, 5 Jul 2022 22:02:32 +0200 Subject: [PATCH] Fix image paths (#813) * Update seExplorerButton.js * Update seFlyingButton.js * Fix linter --- src/editor/components/seExplorerButton.js | 210 ++++++++++++---------- src/editor/components/seFlyingButton.js | 171 +++++++++--------- 2 files changed, 201 insertions(+), 180 deletions(-) diff --git a/src/editor/components/seExplorerButton.js b/src/editor/components/seExplorerButton.js index b3411b5a..f6b5175e 100644 --- a/src/editor/components/seExplorerButton.js +++ b/src/editor/components/seExplorerButton.js @@ -1,103 +1,5 @@ /* globals svgEditor */ -const template = document.createElement('template') -template.innerHTML = ` - -
- -
- -
- -
- -` /** * @class ExplorerButton */ @@ -108,8 +10,11 @@ export class ExplorerButton extends HTMLElement { constructor () { super() // create the shadowDom and insert the template + // create the shadowDom and insert the template + this.imgPath = svgEditor.configObj.curConfig.imgPath + this.template = this.createTemplate(this.imgPath) this._shadowRoot = this.attachShadow({ mode: 'open' }) - this._shadowRoot.append(template.content.cloneNode(true)) + this._shadowRoot.append(this.template.content.cloneNode(true)) // locate the component this.$button = this._shadowRoot.querySelector('.menu-button') this.$overall = this._shadowRoot.querySelector('.overall') @@ -122,6 +27,113 @@ export class ExplorerButton extends HTMLElement { this.imgPath = svgEditor.configObj.curConfig.imgPath } + /** + * @function createTemplate + * @param {string} imgPath + * @returns {any} template + */ + + createTemplate (imgPath) { + const template = document.createElement('template') + template.innerHTML = ` + + +
+ +
+ +
+ +
` + return template + } + /** * @function observedAttributes * @returns {any} observed diff --git a/src/editor/components/seFlyingButton.js b/src/editor/components/seFlyingButton.js index 863f51c6..11485326 100644 --- a/src/editor/components/seFlyingButton.js +++ b/src/editor/components/seFlyingButton.js @@ -1,85 +1,6 @@ /* globals svgEditor */ import { t } from '../locale.js' -const template = document.createElement('template') -template.innerHTML = ` - -
- - - -
- -` /** * @class FlyingButton */ @@ -90,8 +11,10 @@ export class FlyingButton extends HTMLElement { constructor () { super() // create the shadowDom and insert the template + this.imgPath = svgEditor.configObj.curConfig.imgPath + this.template = this.createTemplate(this.imgPath) this._shadowRoot = this.attachShadow({ mode: 'open' }) - this._shadowRoot.append(template.content.cloneNode(true)) + this._shadowRoot.append(this.template.content.cloneNode(true)) // locate the component this.$button = this._shadowRoot.querySelector('.menu-button') this.$handle = this._shadowRoot.querySelector('.handle') @@ -101,7 +24,93 @@ export class FlyingButton extends HTMLElement { // the last element of the div is the slot // we retrieve all elements added in the slot (i.e. se-buttons) this.$elements = this.$menu.lastElementChild.assignedElements() - this.imgPath = svgEditor.configObj.curConfig.imgPath + } + + /** + * @function createTemplate + * @param {string} imgPath + * @returns {any} template + */ + + createTemplate (imgPath) { + const template = document.createElement('template') + template.innerHTML = ` + + +
+ + +
` + return template } /**