pb: copy to the clipboard in the browser
Instead of erroring, the wasm `pb` branch now writes the inner command's data to the host page's clipboard via navigator.clipboard (new hel_clipboard_write host hook). Runs inside the Enter-keypress handler, so the clipboard user-gesture requirement is met. Native pbcopy/xclip path unchanged.
This commit is contained in:
@@ -221,6 +221,9 @@
|
||||
};
|
||||
window.hel_storage_get = (k) => localStorage.getItem("hel:" + k);
|
||||
window.hel_storage_set = (k, v) => localStorage.setItem("hel:" + k, v);
|
||||
// `pb` copies to the system clipboard. Fire-and-forget: it runs inside the Enter
|
||||
// keypress handler, so the user-gesture requirement for clipboard write is met.
|
||||
window.hel_clipboard_write = (text) => { try { navigator.clipboard.writeText(text); } catch (e) {} };
|
||||
|
||||
// ---- helpers ----
|
||||
const persist = () => hel_command("save " + CATALOG_KEY);
|
||||
|
||||
Reference in New Issue
Block a user