helwasm: Enter in the master field copies the result (like Copy)

This commit is contained in:
Oleksandr Kozachuk
2026-06-10 00:26:59 +02:00
parent 507335168c
commit 90dd2532b5
+8
View File
@@ -521,6 +521,14 @@
$("#qsecret").addEventListener("click", () => $("#qsecret").classList.toggle("revealed"));
// Click the master field to show what you typed; click again to re-mask.
$("#master").addEventListener("click", () => $("#master").classList.toggle("revealed"));
// Enter in the master field copies the result, like pressing Copy (the keydown
// gesture lets the clipboard write through). Generate first so it's current.
$("#master").addEventListener("keydown", (e) => {
if (e.key !== "Enter") return;
e.preventDefault();
quickGen(false);
if (lastSecret) copyText(lastSecret); else toast("Nothing to copy");
});
$("#copy").onclick = () => (lastSecret ? copyText(lastSecret) : toast("Nothing to copy"));
$("#saveBtn").onclick = saveStep;