diff --git a/src/editor/components/seMenu.js b/src/editor/components/seMenu.js index ccecd6c8..2c766e31 100644 --- a/src/editor/components/seMenu.js +++ b/src/editor/components/seMenu.js @@ -2,7 +2,6 @@ import 'elix/define/MenuButton.js'; import 'elix/define/MenuItem.js'; - const template = document.createElement('template'); template.innerHTML = ` @@ -42,7 +41,7 @@ export class SeMenu extends HTMLElement { * @returns {any} observed */ static get observedAttributes () { - return ['label']; + return ['label', 'src']; } /** @@ -53,8 +52,15 @@ export class SeMenu extends HTMLElement { * @returns {void} */ attributeChangedCallback (name, oldValue, newValue) { + var image = new Image(); if (oldValue === newValue) return; switch (name) { + case 'src': + image.src = newValue; + image.width = 18; + image.height = 18; + this.$label.prepend(image); + break; case 'label': this.$label.prepend(newValue); break; @@ -79,6 +85,21 @@ export class SeMenu extends HTMLElement { set label (value) { this.setAttribute('label', value); } + /** + * @function get + * @returns {any} + */ + get src () { + return this.getAttribute('src'); + } + + /** + * @function set + * @returns {void} + */ + set src (value) { + this.setAttribute('src', value); + } /** * @function connectedCallback * @returns {void} diff --git a/src/editor/index.html b/src/editor/index.html index 95063f5d..8b25f2ef 100644 --- a/src/editor/index.html +++ b/src/editor/index.html @@ -74,7 +74,7 @@
L a y e r s
- +