Repository navigation
Fix copy command - #3290
Merged
Merged
Fix copy command#3290
Conversation
Signed-off-by: Andrew Stein <steinlink@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR fixes a bug in the design of
<perspective-viewer>'s copy API.viewer.copy()and the copy menus in the status bar and panel menu did not write the clipboard until the export had finished (a timer polled for the result and then calledclipboard.write). That happens outside the user gesture, which Safari can reject. Also, thewrite's promise was also discarded, socopy()resolved even when the write was denied. If the export failed, the timer leaked. Modified:copy_to_clipboardnow callsnavigator.clipboard.writebefore returning, passing aClipboardItemwhose value is aPromisefor the exported data. The returned future rejects if the Clipboard API is missing, if the export fails, or if the write is denied.export_method_to_blobnow reads the selection when it is called, not when the export first runs.onpointerdownnever fired for plugins, because Yew's event handling does not follow slot assignment. It is replaced by a plainpointerdownlistener on the viewer element, matching the existingcontextmenulistener.copy({ method: "plugin" })on a chart now writes image/png (it was labelled the PNG text/plain).