fix(web): paste clipboard text into the TEXT / MText editors

Ctrl+V was globally bound to the entity paste command, so it never pasted
into an open text editor, and even when routed there iced's clipboard read
is a no-op on the web. Route Ctrl+V to the focused editor and, on the web,
read the system clipboard via the browser's async Clipboard API (the
keypress is a user gesture, so the read is permitted):

- MText editor: insert at the caret (web + native).
- TEXT field: append on the web; native lets the text_input paste itself.
- No editor open: falls through to the entity paste command as before.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-20 17:05:02 +03:00
commit e1c5917644
5 changed files with 77 additions and 1 deletions

View file

@ -106,6 +106,9 @@ web-sys = { version = "0.3", features = [
"Blob",
"Url",
"Response",
# Async clipboard read for paste into the text/MText editors (iced's own
# clipboard read is a no-op on the web).
"Clipboard",
] }
# Browsers without WebGPU (e.g. Firefox by default) need wgpu's WebGL2 backend;
# `webgl` enables it. `fira-sans` embeds the default UI font — the web has no