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

Fixes 3182 #5598

Merged

Conversation

withrocks
Copy link
Contributor

@withrocks withrocks commented Jul 10, 2020

Issue #3182 "Can't paste two images from clipboard in markdown cell"
happens when the user tries to paste a second image into a text
cell and the image gets the same attachment key as the previous one.

This patch fixes that issue by adding an index to each picture that's
pasted after the previous one. Example:

  • User pastes an image blob A. The text ![image.png](attachment:image.png)
    is added to the text cell and the blob is saved as attachment image.png
  • The user pastes a second image blob B. The same happens as with blob
    A, except the key is now image-2.png rather than image.png

Special case:

If the user pastes the exact same blob A twice, it will not be added to
the attachments, but the textcell will get a second entry of
![image.png](attachment:image.png).

Issue 3182 "Can't paste two images from clipboard in markdown cell"
happens when the user tries to paste a second image into a text
cell and the image gets the same attachment key as the previous one.

This patch fixes that issue by adding an index to each picture that's
pasted after the previous one. Example:

* User pastes an image blob A. The text `![image.png](attachment:image.png)`
  is added to the text cell and the blob is saved as attachment `image.png`
* The user pastes a second image blob B. The same happens as with blob
  A, except the key is now `image-1.png` rather than `image.png`

Special case:

If the user pastes the exact same blob A twice, it will not be added to
the attachments, but the textcell will get a second entry of
`![image.png](attachment:image.png)`.
@withrocks
Copy link
Contributor Author

I wasn't able to read the general Jupyter general contribution guidelines because the link is broken: https://jupyter.readthedocs.io/en/latest/contributor/content-contributor.html

I hope that won't be an issue.

@kevin-bates
Copy link
Member

Hi @withrocks - your PR content seems fine although I'm not qualified to review it.

The broken link should point here: https://jupyter.readthedocs.io/en/latest/contributing/content-contributor.html

I've opened issue #5599 for this.

Copy link
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@blink1073 blink1073 added this to the 6.2 milestone Jul 22, 2020
@kevin-bates kevin-bates mentioned this pull request Jul 22, 2020
24 tasks
@blink1073 blink1073 modified the milestones: 6.2, 6.1 Jul 23, 2020
@blink1073 blink1073 merged commit a94d316 into jupyter:master Jul 23, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants