glsp icon indicating copy to clipboard operation
glsp copied to clipboard

Investigate Theia Clipboard API usage for improved Copy/Paste (with user permission support)

Open JonasHelming opened this issue 5 years ago • 1 comments

Workflow example / Theia Integration

When I copy an element via the context menu or the edit menu I get this error on paste and nothing happens:

"Please use the browser's paste command or shortcut"

Copying via shortcut works!

JonasHelming avatar Jan 25 '21 19:01 JonasHelming

This is a general issue when running Theia in the browser, because browsers disallow programmatic access to the clipboard to prevent webapplications to read your local clipboard without the user realizing it, but -- depending on the browser -- they only allow clipboard read access

  • if the user explicitly invokes it (with the common shortcut like Ctrl-V)
  • if the user previously gave permission (on access browsers would show a security warning and ask for permission, similar to accessing the webcam etc.)

I think it is the same with Monaco; try for instance to copy and paste in a text editor in Theia with the context menu. Thus, we implemented the same behavior as in Theia also in Theia GLSP. There is a clipboard API now in Theia that models the VSCode API though. We could investigate whether this improves the situation, but I don't really think so.

planger avatar Jan 25 '21 19:01 planger