laurent22 / joplin

Joplin - the privacy-focused note taking app with sync capabilities for Windows, macOS, Linux, Android and iOS.
https://joplinapp.org
Other
45.4k stars 4.94k forks source link

DESKTOP: Paste does not work for images #2663

Open Rishabh-malhotraa opened 4 years ago

Rishabh-malhotraa commented 4 years ago

Description

Paste function for Images do not work the way it should me (both Right click-> paste and Ctrl+V) when pasting images to Joplin editor.

Actual behaviour

paste-bug

Expected Behaviour

paste-expected-behaviour

Tasks

@PackElend @tessus @laurent22 @bedwardly-down what do you guys think about this, and if this behaviour is indeed unexpected and should be fixed then I would like to work on it.

laurent22 commented 4 years ago

Thanks for looking into it @Rishgod, it's indeed a bug that would need to be fixed. If you can look at it that would be great.

bedwardly-down commented 4 years ago

There's also another three other things that happen (at least on mobile):

  1. pasting any images with text in them, Joplin turns the text part into a text entry in your note instead of pasting the image (could be OCR related)
  2. attaching images using the Attach image function doesn't place the image at the cursor but at the bottom of the not
    1. when multiple images are attached at one time, they aren't attached in proper order but seemingly random placement

Since all clients share the same code for much of the core functions, is it possible these could all be caused by the same bug in the code or be separate bugs altogether?

laurent22 commented 4 years ago

pasting any images with text in them, Joplin turns the text part into a text entry in your note instead of pasting the image (could be OCR related)

It's been looked at by several people and so far no good fix for this. When there's text and image at the same time, it's hard to guess what should be pasted (there are several discussions about this here and the forum).

when multiple images are attached at one time, they aren't attached in proper order but seemingly random placement

Perhaps add a bug about this? I guess they should be sorted in alphabetical order? I found that this issue is not really Joplin specific. Whenever I import multiple files in any app, the order is often random.

attaching images using the Attach image function doesn't place the image at the cursor but at the bottom of the not

It indeed should insert at cursor so feel free to create a separate GH issue for this.

bedwardly-down commented 4 years ago

Heading to work but will try to do here in a bit. Thanks

deadpool1999 commented 4 years ago

Copying an image from a web browser (chrome ) and then doing the above mentioned operations{ctrl+v} gives the desired result!! It's some security issue with chrome i guess, like for a div element with contentEditable="true" everything works fine as long as the copy paste happens b/w similar environments. (So copying from chrome and pasting the image in my note works fine, but the same isn't true for a remote location(desktop). )

Rishabh-malhotraa commented 4 years ago

Copying an image from a web browser (chrome ) and then doing the above mentioned operations{ctrl+v} gives the desired result!! It's some security issue with chrome i guess, like for a div element with contentEditable="true" everything works fine as long as the copy paste happens b/w similar environments. (So copying from chrome and pasting the image in my note works fine, but the same isn't true for a remote location(desktop). )

@deadpool1999 thanks for pointing it out, I look into the same.

yasithdev commented 4 years ago

Hello everyone, would you mind if I take on this issue?

Rishabh-malhotraa commented 4 years ago

Hello everyone, would you mind if I take on this issue?

hey @yasithmilinda I' almost done with this, mind taking some other issue :)

yasithdev commented 4 years ago

Hey @Rishgod, no problem! :) I'll look into other issues, thanks!

Rishabh-malhotraa commented 4 years ago

After doing a lot of research and trying everything it is not possible to Implement this feature

B3

When I was trying to fix this, I was really surprised to find out that clipboardImageCheck is always true, irrespective of the fact that the clipboard has an image or not.

b0-gif


When you copy an image in Windows Explorer, you are copying the file instead of copying the contents of the image. But that's, not the case if you take a screenshot or copy the photo from a picture app.

b2-gif

It does not look like Electron supports this feature, I google a lot about it and I also found a lot of similar issue on GitHub.

There are certain workaround to it I found on Github, here

It basically how to get file pointers in the clipboard, but it can only get only one file's path if multi files are copied(the very first image if you select many).

@laurent22 Thoughts?

deadpool1999 commented 4 years ago

Yes , electron js uses node and chromium , so this issue can't be solved. This issue also exists with the word online and also the docs online version (when opened in chrome) but it is not the same if opened in Firefox ! Trying to read the clipboard content also shows 0 items in it. So can't also use some other api to upload the image somewhere and then fetch it in chrome!

tessus commented 4 years ago

@PackElend we have an upstream label. Does your external mean the same?

PackElend commented 4 years ago

it properly means the same; i refer to code outside the Joplin universe, so basically 3rd party dependencies

I renamed the label to allow better filtering on externals.

ffgm commented 4 years ago

@laurent22

kuraci commented 4 years ago

Srtongly hope this bug fixed. When copy only one image to joplin,image is well copied. The image source code looks like : ![aeee9eaf6f8200d572cc214ef8150f19.png](:/70790836e2a7486790cae028e4ae11de)

But if copy more, such as with some words , only are copied. Image would lost while link of image left. Image would display well in loacal device but the image on remote device will lost,because the image link the lacal path The image source code looks like : ![aeee9eaf6f8200d572cc214ef8150f19.png](file:///F:/%E5%BC%A0%E5%B9%B4%E4%BF%9D/%E6%96%B0%E5%BB%BA%E6%96%87%E4%BB%B6%E5%A4%B9%20(2)/_resources/70790836e2a7486790cae028e4ae11de.png)

madrix01 commented 3 years ago

Hello everyone, I'm an intermediate developer, I love open source and looking forward for participating in GSoC'22. I want to start contributing to Joplin. Can someone guide me for the same and I also wanted to know how to contact a mentor for GSoC'22. Thank you!

laurent22 commented 3 years ago

There's no mentor to contact yet since we have nothing ready for 2022, but if in the meantime you want to get used to the codebase, a good option is to check the issue tracker from time to time and see if you can work on the issues with labels "bug" and "high". Or alternatively you can try to find some good plugin idea and work on it.

robertchen commented 3 years ago

copy HTML and paste to word, word has images, but copy html contents paste to joplin, the images are lost

oryoruk commented 3 months ago

I am having this issue (Joplin 2.14.22). I can drag and drop images fine, but cannot paste images/image screenshots into the markdown or rich-text editors.