posit-dev / positron

Positron, a next-generation data science IDE
Other
2.38k stars 70 forks source link

Can't copy text on external webpages loaded in the Viewer pane #3640

Open sharon-wang opened 2 months ago

sharon-wang commented 2 months ago

Positron Version: 2024.06.1-17

Positron Version: 2024.06.1 (Universal) build 17 Code - OSS Version: 1.90.0 Commit: 893521ef243f50fd4017232709c85086702b38d6 Date: 2024-06-25T03:49:55.034Z Electron: 29.4.0 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Darwin arm64 23.4.0

Steps to reproduce the issue:

  1. Open an external URL in the Viewer, e.g. Command Prompt > Viewer: Open URL in Viewer > https://wesmckinney.com/book/python-basics
  2. Copy something to the clipboard from somewhere other than the Viewer Pane (just so we can use a previous clipboard value to differentiate between what we are trying to copy in the Viewer Pane)
  3. Select some text on the page in the Viewer, then right-click to Copy or Cmd/Ctrl+C
  4. Paste the text somewhere
  5. Notice that the text pasted is not the text from the Viewer Pane that was selected

https://github.com/posit-dev/positron/assets/25834218/6153be1b-bef0-41b8-95a2-4ca89e88f48c

This is similar to https://github.com/posit-dev/positron/issues/2993, but for external URLs. Both Cmd/Ctrl+C and right-click context menu don't seem to work.

What did you expect to happen?

I expected to be able to copy content from the Viewer.

Were there any error messages in the output or Developer Tools console?

No

sharon-wang commented 2 months ago

Just skimmed through the description of https://github.com/posit-dev/positron/pull/3430 -- I don't think I should be hitting the "Simple Web Browser" code path since the URLs are being loaded in the Viewer Pane, but I'm not sure if external URLs are handled differently by the Viewer.

juliasilge commented 2 months ago

This URL should probably open in an external browser as the Viewer isn't meant for real websites; maybe we can prompt a user to open an external URL in a browser instead of the Viewer.

jmcphers commented 2 months ago

This is what I think we should show if you try to open an external URL in the Viewer pane -- same thing you see if trying to click on one in the Console. It goes through the trusted domain settings so there's a level of security built in.

image
sharon-wang commented 2 months ago

Could there be room for a user opting-in to a limited browsing experience in the Viewer?

Maybe it's just the workflow I had when walking through the Python for Data Analysis lessons, but I really liked having the book open in the Viewer while I was tinkering around in IDE to run code in the console, view my session variables, see plots, look at help docs, use the data explorer, etc.. I didn't have to leave the IDE to look at a browser because everything I needed was in Positron!

isabelizimm commented 2 months ago

fwiw, this may be a workflow that happens more in Python. I also have used the viewer as a browser for Python package documentation (when the Help pane docstrings were minimal) and really liked the experience.