chenjuneking / quill-image-drop-and-paste

A quill editor module for drop and paste image, with a callback hook before insert image into the editor
ISC License
105 stars 44 forks source link

Duplicate image on paste #52

Closed Eraldo closed 1 month ago

Eraldo commented 7 months ago

I have defined a custom image handler and that does trigger a modal to upload an image and that does work. I also replaced it with a function that only does alert("Works!"); just to be sure it's not the cause of my issue.

However immediately upon pasting the image inside the editor, I immediately get an inserted image as a string blob inserted into the editor. This way after continuing with my upload modal, I end up having two images. Once the inline string blob and once an image tag with my uploaded image as src.

PS: There is a typo in the docs: "didnot" => "did not". ;)

If you didnot config a image handler, it will insert the image with dataURL into the quill editor directory after your drop/paste.

Any help on how to prevent the default behaviour is highly appreciated. 🙏

chenjuneking commented 6 months ago

Sorry for your trouble, could you provide some codes or screen videos showing the issue?

Eraldo commented 6 months ago

Sorry for your trouble, could you provide some codes or screen videos showing the issue?

Sure, thanks for asking: https://youtu.be/245KPVeXZ3g

linxianxi commented 4 months ago

same

dalexander-trc commented 3 months ago

Also experiencing this.

"ngx-quill": "~25.3.0",
"parchment": "~3.0.0",
"quill": "~2.0.2",
"quill-image-drop-and-paste": "~1.3.0"
granawkins commented 3 months ago

same

VaguelySerious commented 2 months ago

Hi all, it looks like Quill >2.0.0 might have added native image upload functionality which conflicts with this module, hence duplicate uploads. If you want to fix the duplicate issue easily, just add uploader: { handler: () => {} }, to your modules list in Quill, or do something like this:

class NoopClass {}

Quill.register({
  "modules/uploader": NoopClass
}, true);

I don't know if the native version is better or worse, just that this fixes it. Cheers.

chenjuneking commented 1 month ago

fixed on version ^2.0.0.