Unify copy/paste?
- Dominant language
- Jupyter Notebook
- Stars
- 13.3k
- Forks
- 5.8k
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 7
Description
We currently have two kinds of copy/paste in notebooks: Ctrl-C/Ctrl-V (or Cmd- on Mac) uses the system clipboard, through somewhat restricted browser APIs, while our copy/paste toolbar buttons and C/V shortcuts store data within the Javascript, which is simpler, but only works within a single page.
We have said that this is a browser limitation, that we can only access the clipboard when the user presses a system clipboard shortcut like Ctrl-C. This is now at least partially wrong: a click event can trigger a copy event with `document.execCommand('copy');`.
This raises the possibility of dropping our own clipboard and relying on the system one, but a bit more research indicates that neither Firefox nor Chrome allows `document.execCommand('paste');` in web content. So we could offer a copy button, but the user would have to press Ctrl-V to paste.
There is a [new Async clipboard API](https://developers.google.com/web/updates/2018/03/clipboardapi) in the works that would make it possible to paste with explicit user permission. But at least Chrome only intends to support this on HTTPS pages. That's a reasonable policy in general, but AFAIK we can't easily use HTTPS on localhost, so it won't help for a lot of users.
Contributor guide
Research direction
The issue does not name files or tests. Start by researching the notebook's existing system and JavaScript clipboard paths, then compare browser support for document.execCommand and the Async Clipboard API; done would require a documented implementation direction for unifying copy/paste.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, jupyter-notebook
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100