webview: can't get paste to work
I added an option to DomTerm to use a trivial Webview front-end for the GUI. (I basically just load a URL specified on the command-line, which is invoked by the domterm driver/server.) It mostly works, though there are some glitches. Most critically: paste doesn’t work, whether I type the keyboard shortcuts, use my custom menu entry, or the default context menu. The build instruction discuss the experimental --with-webview configure option and --webview run-time option.
What OS are you using (uname -a, or Windows version)?
I tried both Fedora GNU/Linux 32 and MacOS Catalina.
What programming language are you using (C/C++/Go/Rust)?
C++ (g++) for the Webview “browser”, C for the core server, JavaScript for the GUI.
What did you expect to see and what you saw instead?
Clicking Ctrl-Shift-V (on Fedora) or Cmd-V (on MacOS) should paste from the clipboard, but nothing happens. Likewise using the Paste entry from the Edit or popup menu.
The JavaScript normally uses document.execCommand("paste", false) (along with a "paste" event handler). I also tried using navigator.clipboard.readText().
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (6 by maintainers)
I added these two listeners and copy paste keyboard shortcuts works on MacOS (Big Sur Version 11.2.1) And no “beep”!
To make it work on Mac listen to the keypress event in JS and then call document.execCommand(“paste”).
With the latest check-in, Paste (with from keyboard short-cut and mouse/menu actions) seems to work as expected on Fedora Linux. Copy using keyboard short-cuts works, though mouse/menu action doesn’t (but that could be relating to mouse-handling issues).
Both Paste and Copy seem to be still broken on MacOS, but it’s quite possible I’m doing something wrong. (I’m getting a strange “beep” instead.)