Investigate the possibility of improving ClipboardService usage
#6,209 opened on Sep 18, 2019
Repository metrics
- Stars
- (18,676 stars)
- PR merge metrics
- (Avg merge 15d 4h) (75 merged PRs in 30d)
Description
Description
This is the follow-up issue for the PR https://github.com/eclipse-theia/theia/pull/5994.
There're two problems with the BrowserClipboardService impl which relies on Async Clipboard API for accessing the system clipboard:
1/ It works only for localhost and for the pages, loaded over https. But for non-secure http pages, it's prohibited due to the security concerns.
2/ It works well in Chrome but it requires performing additional steps in FireFox to unlock Async Clipboard API. One needs to enable API through the dom.events.testing.asyncClipboard preference. See the PR https://github.com/eclipse-theia/theia/pull/5994 description for the details.
It looks like BrowserClipboardService needs to use both Async Clipboard API and document.execCommand API to work properly for the different cases.
Note, FF requires calling document.execCommand('cut'/'copy') inside the short-living event handlers of user actions like mouse click, keypress etc. See https://github.com/eclipse-theia/theia/pull/5994#issuecomment-528883872 for the details. So it won't work when a plugin calls it through env.clipboard plugin API.
Also:
TerminalCopyOnSelectionHander has to be replaced with ClipboardService and copy on select for terminals has to be tested as a part of this issue
see https://github.com/eclipse-theia/theia/pull/6536#issuecomment-553446153