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