Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy plot to clipboard errors in Positron Web #4433

Closed
sharon-wang opened this issue Aug 21, 2024 · 2 comments
Closed

Copy plot to clipboard errors in Positron Web #4433

sharon-wang opened this issue Aug 21, 2024 · 2 comments
Assignees
Labels
area: plots Issues related to Plots category. area: workbench Issues related to Workbench category. bug Something isn't working

Comments

@sharon-wang
Copy link
Member

sharon-wang commented Aug 21, 2024

System details:

Positron and OS details:

Positron Version: 2024.03.0 build undefined
Code - OSS Version: 1.91.0-dev
Commit: Unknown
Date: Unknown
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36

Ran in Arc Browser (Version 1.56.0 (52658); Chromium Engine Version 127.0.6533.120) on Mac, but any browser should do.

Interpreter details:

Any, but I was using R 4.3.1.

Describe the issue:

The "copy plot to clipboard" action errors in the plots pane in Positron Web.

Steps to reproduce the issue:

copy_plot_clipboard_positron_web.mp4

In Positron Web:

  1. Start an R interpreter
  2. Run plot(iris) in the console
  3. Click the "copy plot to clipboard" button in the plots pane
  4. The image doesn't get copied to the clipboard and there is an error in the console

Expected or desired behavior:

The plot image should be copied to the clipboard, like on Positron Desktop.

Were there any error messages in the UI, Output panel, or Developer Tools console?

Developer Tools console output:

  ERR Failed to execute 'write' on 'Clipboard': Failed to read or decode Blob for clipboard item type image/png.: Error: Failed to execute 'write' on 'Clipboard': Failed to read or decode Blob for clipboard item type image/png.

Relevant code

// --- Start Positron ---
async writeImage(data: string): Promise<void> {
const blob = new Blob([data], { type: 'image/png' });
navigator.clipboard.write([
new ClipboardItem({
[blob.type]: blob
}
)]);
}
// --- End Positron ---

@sharon-wang sharon-wang added bug Something isn't working area: plots Issues related to Plots category. area: workbench Issues related to Workbench category. labels Aug 21, 2024
@sharon-wang
Copy link
Member Author

sharon-wang commented Aug 27, 2024

Right-click to copy the plot would be a great alternative to the copy button! Right-clicking currently doesn't seem to work on the plot, but a corresponding context menu like the one for the Console or an Editor would be great.

Here's a video where I plot(iris), then right-click in a few areas of the IDE:

right_click_plots.mp4

@testlabauto
Copy link
Contributor

Verified Fixed

Positron Version(s) : 2024.09.0-33
OS Version          : OSX

Test scenario(s)

plot(iris)
sucessful copy to clipboard

Link(s) to TestRail test cases run or created:
N/A

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: plots Issues related to Plots category. area: workbench Issues related to Workbench category. bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants