#se-img-prop-dialog inject this component in the DOM dynamically

This commit is contained in:
Agriya Dev5
2020-12-09 18:36:21 +05:30
parent cb9c75671a
commit cebafe58f2
3 changed files with 12 additions and 5 deletions

View File

@@ -127,6 +127,7 @@ export class SeImgPropDialog extends HTMLElement {
constructor () { constructor () {
super(); super();
// create the shadowDom and insert the template // create the shadowDom and insert the template
this.eventlisten = false;
this._shadowRoot = this.attachShadow({mode: 'open'}); this._shadowRoot = this.attachShadow({mode: 'open'});
this._shadowRoot.appendChild(template.content.cloneNode(true)); this._shadowRoot.appendChild(template.content.cloneNode(true));
this.$saveBtn = this._shadowRoot.querySelector('#tool_docprops_save'); this.$saveBtn = this._shadowRoot.querySelector('#tool_docprops_save');
@@ -180,10 +181,12 @@ export class SeImgPropDialog extends HTMLElement {
} }
break; break;
case 'dialog': case 'dialog':
if (newValue === 'open') { if (this.eventlisten) {
this.$dialog.open(); if (newValue === 'open') {
} else { this.$dialog.open();
this.$dialog.close(); } else {
this.$dialog.close();
}
} }
break; break;
case 'save': case 'save':
@@ -366,6 +369,7 @@ export class SeImgPropDialog extends HTMLElement {
this.$saveBtn.addEventListener('click', onSaveHandler); this.$saveBtn.addEventListener('click', onSaveHandler);
this.$cancelBtn.addEventListener('click', onCancelHandler); this.$cancelBtn.addEventListener('click', onCancelHandler);
this.$dialog.addEventListener('close', onCancelHandler); this.$dialog.addEventListener('close', onCancelHandler);
this.eventlisten = true;
} }
} }

View File

@@ -440,7 +440,6 @@
</form> </form>
</div> </div>
</div> </div>
<se-img-prop-dialog id="se-img-prop" title="" width="" height="" save="" dialog=""></se-img-prop-dialog>
<div id="svg_prefs"> <div id="svg_prefs">
<div class="overlay"></div> <div class="overlay"></div>
<div id="svg_prefs_container"> <div id="svg_prefs_container">

View File

@@ -610,6 +610,10 @@ editor.init = () => {
*/ */
editor.storage = localStorage; editor.storage = localStorage;
} }
// Image props dialog added to DOM
const newSeImgPropDialog = document.createElement('se-img-prop-dialog');
newSeImgPropDialog.setAttribute('id', 'se-img-prop');
document.body.append(newSeImgPropDialog);
} catch (err) {} } catch (err) {}
// get list of languages from options in the HTML // get list of languages from options in the HTML