-
Notifications
You must be signed in to change notification settings - Fork 5k
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 and paste cells with system clipboard #1286
Conversation
Nice, I never got the copy&paste operation to work with anything else than Chrome in my extension. |
Thanks @juhasch - apologies for not basing it on your extension. I didn't think to look for an existing extension, and I was told about it after I'd already got copy & paste working on Chrome. As you suggested, I've added storing the JSON data with the correct mime type, and storing plain text of just the cell sources so you can paste into a text editor. |
No problem. I am happy to see this functionality going into the notebook itself. |
Thanks All ! |
Ahh, darn, I wanted to discuss this in the context of integration with On Mon, Apr 4, 2016 at 11:25 AM, Matthias Bussonnier <
Brian E. Granger |
I am strong +1 on the feature, but want to make sure users can cut/copy/paste between JupyterLab and the main notebook. @sccolbert @blink1073 @jasongrout The main question is if the data being put into the system clipboard is really the best format. |
This seems like a good approach to me. |
|
Great. Anyway, I guess we can assume people will copy and past between same version of notebook/jupyterlab, so we can update the internal representation if needed without breaking anything. |
Should we be including the nbformat string so frontends can reason about On Mon, Apr 4, 2016 at 1:02 PM, Matthias Bussonnier <
Brian E. Granger |
Yeah. I think we should have some discussion on standardizing what the payload should be and for which mimetypes, so that frontends can reason about payloads effectively. |
Here is an issue for tracking the clipboard format. |
@takluyver I am a newbie of jupyter and Python. I want to know how to let the nice 'copy/paste' work? I run the jupyter/notebook, in a running docker container. I have done the bellow command from Terminal of the notebook.
|
Hi @booox : this work to use the system clipboard is in master (the development version), but not yet in a stable release. If you want to try the development version, follow the instructions here. With the released version, you can copy and paste cells within a notebook (use shortcuts |
This allows cells to be copied and pasted between notebook tabs using (Ctrl/Cmd + C/V), and even between different browsers (on Firefox and Chrome; IE certainly won't work, and from the info on caniuse.com, I doubt Safari will).
I'm not up to speed with our JS conventions, so I'm sure this breaks them in half a dozen ways (I'm a new contributor simulator ;-). But it does work, at least for me.
Limitations:
application/json
data on the clipboard. So I wrap JSON data in<pre class="jupyter-nb-cells-json"></pre>
and pretend it's HTML. The code receiving it looks for those tags and gets the JSON data from between them. Not elegant, but it works.On Chrome, we can get a paste event without that, so the dialog is not used.