#101 pass the strings as attributes and update i18n string in template
parent
480387e308
commit
522860ef6a
|
@ -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');
|
||||
|
|
|
@ -68,7 +68,7 @@ template.innerHTML = `
|
|||
<ul id="cmenu_canvas" class="contextMenu">
|
||||
<li>
|
||||
<a href="#cut" id="se-cut">
|
||||
${svgEditor.i18next.t('tools.cut')}<span class="shortcut">META+X</span>
|
||||
<span class="shortcut">META+X</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -150,7 +150,7 @@ export class SeCMenuDialog extends HTMLElement {
|
|||
* @returns {any} observed
|
||||
*/
|
||||
static get observedAttributes () {
|
||||
return [ 'disableallmenu', 'enablemenuitems', 'disablemenuitems' ];
|
||||
return [ 'disableallmenu', 'enablemenuitems', 'disablemenuitems', 'i18next-tools-cut' ];
|
||||
}
|
||||
/**
|
||||
* @function attributeChangedCallback
|
||||
|
@ -185,6 +185,10 @@ export class SeCMenuDialog extends HTMLElement {
|
|||
selEle.parentElement.classList.add('disabled');
|
||||
});
|
||||
break;
|
||||
case 'i18next-tools-cut':
|
||||
var textnode = document.createTextNode(newValue);
|
||||
this._shadowRoot.querySelector('#se-cut').prepend(textnode);
|
||||
break;
|
||||
default:
|
||||
// super.attributeChangedCallback(name, oldValue, newValue);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue