jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.67k stars 4.92k forks source link

Bug Report: Copy/Paste, Drag&Drop and "Insert" Images into Markdown cells does not working in Classic Jupyter v6 #6015

Open richlysakowski opened 3 years ago

richlysakowski commented 3 years ago

The functionality for "Drag and Drop" and "Copy and Paste" into markdown cells no longer work to insert image files directly into Jupyter Classic Notebook.

I am running on this platform: Jupyter Notebook CLASSIC v6.1.5 client/server with IPython 7.21.0 kernel on Python 3.7.9 Kernel FireFox 86.01 and Chrome Version 89.0.4389.90 (Official Build) (64-bit) on Windows 10.

The expected behavior is:. 1) After an image file is dragged into a markdown cell, 2) the image file HTML code is returned to the markdown cell and appears there. 3) After the markdown cell is executed the image appears. 4) The JPEG image is encoded as a text stream in the .ipynb file.

An update of Jupyter Notebook Classic (CLIENT or server) somehow disabled these capabilities. The update was sometime between April 19, 2019... see Getting an image into Jupyter NB is a much simpler operation than most people have alluded to here. and July 24, 2020 "this does not work in Windows". It worked fine in Jupyter Classic Notebook 2019 (Classic Server v5.7.4. Not sure about client version.).

Also the Classic Jupyter Notebook "Insert Images" submenu on the "Edit" menu is disabled in all of my browsers. (I have never actually seen it work in any browser. )

It is a lot more work (and some people don't know how) to write HTML code use a Python code to store images in the Classic Juptyer Notebook. More than the usability issue are the problems (logistic, archiving, communication) inherent in packing and unpacking a directory of image files along with the .ipynb file to move a notebook's contents from place to place. Things invariably get left behind or lost.

What else I have tried:

1) I tried a FireFox browser hack to enable clipboard events, but it does not work there [ Copy/Paste between notebooks gets stuck at "Press Ctrl-V again to paste" message

3214 ](https://github.com/jupyter/notebook/issues/3214)

The solution was "set dom.event.clipboardevents.enabled to true". I still get the popup in Firefox and Paste does not work.

2) It works in Jupyter Lab v2.2.7 using Python 3.7.9 on Windows 10. After the image file is dragged into a markdown cell, the HTML file link is returned to and appears in the markdown cell. This is the expected behavior.

kevin-bates commented 3 years ago

Hi @richdevboston - I don't think what you're experiencing was intentional, especially since lab 2.x (which also runs on the same notebook server) has this working. In addition, given this used to work, this would be considered a regression and should be something that is addressed.

I am unable to reproduce it on macOS 11.2.3 running Chrome 89.0.4389.82 and Python 3.7.8 (and also works when the server is on RHEL 7.9, Python 3.8). Here's a gif demonstrating what appears to be the intended behavior. The Notebook version is 6.2.0, but I suspect there are other things in play relative to your environment.

NB6015

I probably can't help much more than trying things out since this is likely something on the front-end or in the kernel itself and is not an issue in the server proper. If there's anything you'd like me to try, just ask.

If anyone with more browser experience than myself (i.e., nearly zero) feels they can help, please chime in. It would be great if someone on Windows 10 could check this out as well.

richlysakowski commented 3 years ago

@kevin-bates Thanks for illustrating the Drag&Drop functionality. It works exactly as illustrated above in your GIF file for in JupyterLab on Windows 10. This is also the former (expected) behavior for Jupyter CLASSIC Notebook on Windows 10.

From your GIF image file, it looks like you are launching the Jupyter Classic Notebook from the Jupyter Lab.

You are right that it is probably a iPython kernel or JavaScript issue. I don't know enough right now about the Jupyter Classic Notebook front-end code to fix it myself.

kevin-bates commented 3 years ago

From your GIF image file, it looks like you are launching the Jupyter Classic Notebook from the Jupyter Lab.

Not sure what you mean by "launching notebook from lab". This is pure Juptyer Notebook - 6.2.0 - which is why I showed the about box. I just reproduced again - having made sure to uninstall any lab extensions prior.