#631 main menu image path update changes
parent
f5cf062f21
commit
2f75dcb3e3
|
@ -293,7 +293,9 @@ class MainMenu {
|
||||||
/**
|
/**
|
||||||
* Associate all button actions as well as non-button keyboard shortcuts.
|
* Associate all button actions as well as non-button keyboard shortcuts.
|
||||||
*/
|
*/
|
||||||
|
[ "tool_import", "tool_export", "tool_docprops", "tool_editor_prefs", "tool_editor_homepage" ].forEach((attrId) =>
|
||||||
|
$id(attrId).init(this.editor)
|
||||||
|
);
|
||||||
$id("tool_import").addEventListener("click", () => {
|
$id("tool_import").addEventListener("click", () => {
|
||||||
this.clickImport();
|
this.clickImport();
|
||||||
window.dispatchEvent(new CustomEvent("importImages"));
|
window.dispatchEvent(new CustomEvent("importImages"));
|
||||||
|
|
|
@ -29,6 +29,18 @@ export class SeMenuItem extends HTMLElement {
|
||||||
this.$menuitem = this._shadowRoot.querySelector('elix-menu-item');
|
this.$menuitem = this._shadowRoot.querySelector('elix-menu-item');
|
||||||
this.$svg = this.$menuitem.shadowRoot.querySelector('#checkmark');
|
this.$svg = this.$menuitem.shadowRoot.querySelector('#checkmark');
|
||||||
this.$svg.setAttribute('style', 'display: none;');
|
this.$svg.setAttribute('style', 'display: none;');
|
||||||
|
this.editor = null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function init
|
||||||
|
* @param {any} name
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
init (editor) {
|
||||||
|
this.editor = editor;
|
||||||
|
if (this.hasAttribute("src")) {
|
||||||
|
this.setAttribute('src', this.getAttribute("src"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @function observedAttributes
|
* @function observedAttributes
|
||||||
|
@ -46,11 +58,14 @@ export class SeMenuItem extends HTMLElement {
|
||||||
*/
|
*/
|
||||||
attributeChangedCallback (name, oldValue, newValue) {
|
attributeChangedCallback (name, oldValue, newValue) {
|
||||||
let shortcut = '';
|
let shortcut = '';
|
||||||
if (oldValue === newValue) return;
|
if (oldValue === newValue && name !== 'src') return;
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case 'src':
|
case 'src':
|
||||||
this.$img.setAttribute('src', './images/'+newValue);
|
if(this.editor !== null) {
|
||||||
|
const { imgPath } = this.editor.configObj.curConfig;
|
||||||
this.$img.style.display = 'inline-block';
|
this.$img.style.display = 'inline-block';
|
||||||
|
this.$img.setAttribute('src', imgPath + '/' + newValue);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'label':
|
case 'label':
|
||||||
shortcut = this.getAttribute('shortcut');
|
shortcut = this.getAttribute('shortcut');
|
||||||
|
|
|
@ -530,6 +530,7 @@ export default {
|
||||||
$id('tool_imagelib').addEventListener("click", () => {
|
$id('tool_imagelib').addEventListener("click", () => {
|
||||||
showBrowser();
|
showBrowser();
|
||||||
});
|
});
|
||||||
|
$id('tool_imagelib').init(svgEditor);
|
||||||
|
|
||||||
const style = document.createElement('style');
|
const style = document.createElement('style');
|
||||||
style.textContent = '#imgbrowse_holder {' +
|
style.textContent = '#imgbrowse_holder {' +
|
||||||
|
|
|
@ -174,6 +174,9 @@ export default {
|
||||||
$id("tool_open").addEventListener("click", clickOpen.bind(this));
|
$id("tool_open").addEventListener("click", clickOpen.bind(this));
|
||||||
$id("tool_save").addEventListener("click", clickSave.bind(this, "save"));
|
$id("tool_save").addEventListener("click", clickSave.bind(this, "save"));
|
||||||
$id("tool_save_as").addEventListener("click", clickSave.bind(this, "saveas"));
|
$id("tool_save_as").addEventListener("click", clickSave.bind(this, "saveas"));
|
||||||
|
[ "tool_clear", "tool_open", "tool_save", "tool_save_as" ].forEach((attrId) =>
|
||||||
|
$id(attrId).init(svgEditor)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue