Partial Javascript clipboard support #29298
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Partial fix for #12587 . I'm not sure it can be fully fixed for now, see note below. Partially address #12587
In this PR:
Add OS clipboard set support to OS Javascript
This is straight forward, and seems to work quite well with the
ClipboardAPI
. It's async, so it doesn't happenAdd OS clipboard support to paste 'events' (updating local clipboard)
Listen to paste events to update local clipboard.
CTRL+V still not working out of the box.
To do that, We would need to change how we handle keypress, most likely making it worse and less safe. In the end, I'm not sure we can fix it properly for now.
Maybe in the future, with the Clipboard API, support of which is still pretty limited on chrome, and only available to extensions in Firefox.
For now, you can paste via:
And THEN press CTRL+V
Implement Clipboard API read when supported. (chrome only atm)
Being async, the first time a value is pasted GUI elements will still return the previous one(*).
This at least until 'clipboardchange' window event gets implemented by user agents.
(*)Note: We could implement some sort of clipboard manager that refreshes the value every few seconds and keeps the local keyboard in sync. It would still be chrome only, and it seems a bit hacky, but it would probably work.
Some references:
Clipboard (
readText
limited to extensions,writeText
limited to user callbacks. See also FF1515122 )clipboardchange (supported by no-one).