PerBothner / DomTerm

DOM/JavaScript-based terminal-emulator/console

Home Page:https://domterm.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

copy & paste does not work

albertz opened this issue · comments

At least on MacOSX, in Firefox (the only backend I can currently use, because of this).
I'm on latest head b0e36f5.
Not sure if it is supposed to work or not.
MacOSX uses the super key + c/v for copy/paste. I see @sc or @sv being printed in the shell. But normally the terminal emulator should not catch and handle any of the super keys anyway (at least on MacOSX), but instead the application should handle that (in this case Firefox). Also, it seems to partly handle it, because the menu flashes (this happens on OSX when you press a key combination which is registered in the app menu, like copy/paste).

Ah, I just found the problem mentioned in the docs. But anyway, good to have it also here as a GitHub issue. Or is this a wontfix for some reason? Not sure what you mean by "security restrictions" in the doc.

This is fixed now with my recent MacOSX fixes.

You mean copy and paste now works as expected using keyboard shortcuts?
I would not expect the Paste menu command to work if using Firefox or Chrome, only if sing Electron or Qt.
The Copy menu command may work. (A recent change to not use iframes when using jsMenus seems to have fixed that.)
It seems doable to fix the Paste menu entries by having the server call the pbpaste command on behalf of the browser.

I meant specifically Electron (which was broken before my recent fixes).

I did not try Firefox or Chrome again. Maybe it does not work. But in principle, I don't really see a reason why it should not work (or why there is no way to make it work). I can copy & paste on any other website as well?

There are restrictions on whether a web application can read or write to the clipboard: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard
This is to prevent a malicious web application from spying on or modifying a user's clipboard. It is possible to give an extension the needed premissions. but that seems to require the user to install an extension (or web application), which is more complicated than just opening a web page. This is not a problem when using Electron.

This is only when your web app catches the key event and handles it manually. But the browser already does copy & paste for you.

"This is only when your web app catches the key event and handles it manually. But the browser already does copy & paste for you."

Copy/Paste key-bindings work, and the browser Edit menu seems to work. I'm concerned about handling menu events when using the jsMenus package, which is a plain-JavaScript library. It would be nice to have Paste working in that case.