interface.js: added placeholder support

This commit is contained in:
dogeystamp 2023-01-30 16:18:29 -05:00
parent 25be65b32f
commit b9a56f38f5
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
2 changed files with 9 additions and 2 deletions

View File

@ -16,9 +16,13 @@ let tabs = new TabList({});
let encForm = tabs.createForm({label: "Encryption"});
let encMsg = encForm.createTextArea({label: "Message"});
let encMsg = encForm.createTextArea({
label: "Message",
placeholder: "Type a secret message",
});
let encPass = encForm.createPasswordInput({
label: "Password",
placeholder: "Enter your password",
enabledFunc: function() {return !encManualKey.value}
});
let encPbkdf2Iters = encForm.createNumberInput({
@ -122,10 +126,12 @@ let decForm = tabs.createForm({label: "Decryption"});
let decMsg = decForm.createTextArea({
label: "Encrypted message",
placeholder: "Paste the encrypted output",
dataType: "json-b64",
});
let decPass = decForm.createPasswordInput({
label: "Password",
placeholder: "Enter your password",
enabledFunc: function() {return !decManualKey.value}
});
let decKey = decForm.createMediumTextBox({

View File

@ -302,7 +302,7 @@ function bufToB64 (buf) {
class FormElement extends InterfaceElement {
constructor({tag, fragment, advanced=false, form,
value, dataType,
value, dataType, placeholder,
labelTag, label="",
enabled=true, enabledFunc,
visibleFunc
@ -349,6 +349,7 @@ class FormElement extends InterfaceElement {
this.advanced = advanced;
if (value !== undefined) this.value = value;
if (placeholder !== undefined) this.handle.placeholder = placeholder;
}
get value() {