interface.js: explicitly request to mount forms after creating elements
This commit is contained in:
parent
949a0a0951
commit
10d913154c
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "encryptme",
|
"name": "encryptme",
|
||||||
"version": "0.5.0",
|
"version": "0.5.1",
|
||||||
"description": "Simple online cryptography app.",
|
"description": "Simple online cryptography app.",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -155,6 +155,8 @@ let decManualKey = decForm.createCheckBox({
|
|||||||
let decButton = decForm.createButton({label: "Decrypt"});
|
let decButton = decForm.createButton({label: "Decrypt"});
|
||||||
let decOut = decForm.createOutput({label: "Output"});
|
let decOut = decForm.createOutput({label: "Output"});
|
||||||
|
|
||||||
|
tabs.mountForms();
|
||||||
|
|
||||||
function getKeyMaterial(password) {
|
function getKeyMaterial(password) {
|
||||||
let enc = new TextEncoder();
|
let enc = new TextEncoder();
|
||||||
return window.crypto.subtle.importKey(
|
return window.crypto.subtle.importKey(
|
||||||
|
@ -97,7 +97,7 @@ function dataTypeSupports(params, validTypes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Form extends InterfaceElement {
|
class Form extends InterfaceElement {
|
||||||
constructor({tag, par=document.body, label}) {
|
constructor({tag, par=document.body, label, mounted=false}) {
|
||||||
super({});
|
super({});
|
||||||
|
|
||||||
if (tag === undefined) {
|
if (tag === undefined) {
|
||||||
@ -121,7 +121,9 @@ class Form extends InterfaceElement {
|
|||||||
this.advanced = advancedToggle.value;
|
this.advanced = advancedToggle.value;
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
par.appendChild(this.fragment);
|
if (mounted) {
|
||||||
|
this.mount(par);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#hidden = false;
|
#hidden = false;
|
||||||
@ -488,7 +490,8 @@ class TabList extends InterfaceElement {
|
|||||||
this.handle = tag;
|
this.handle = tag;
|
||||||
}
|
}
|
||||||
this.fragment.appendChild(this.handle);
|
this.fragment.appendChild(this.handle);
|
||||||
par.appendChild(this.fragment);
|
|
||||||
|
this.mount(par);
|
||||||
}
|
}
|
||||||
|
|
||||||
tabs = [];
|
tabs = [];
|
||||||
@ -532,6 +535,12 @@ class TabList extends InterfaceElement {
|
|||||||
|
|
||||||
return form;
|
return form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mountForms() {
|
||||||
|
for (const tab of this.tabs) {
|
||||||
|
tab.form.mount(this.par);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { TabList, FormElement, Form };
|
export { TabList, FormElement, Form };
|
||||||
|
Loading…
Reference in New Issue
Block a user