kensnyder / quill-image-drop-module

A module for Quill rich text editor to allow images to be pasted and drag/dropped into the editor.
217 stars 78 forks source link

Does it work in Chrome? #13

Open pmarcini opened 6 years ago

pmarcini commented 6 years ago

I can't seem to get the demo to work in chrome: https://plnkr.co/edit/ubVmPkBjqQESsefM3JrT?p=preview However, it will work in FF, IE. Is there some sort of security setting needed to enable it to work in Chrome?

Thanks

brianreeve commented 6 years ago

I can confirm this used to work in Chrome earlier this year, but seems to no longer work (possibly as of Chrome 66).

It seems now, clipboard permissions are blocked unless using localhost or a secure site. (See https://developers.google.com/web/updates/2018/03/clipboardapi for more information.)

However, pasting an image the first time on a page does not prompt for access to read the clipboard and no image shows. Nor does explicitly allowing clipboard access, which can be found here:

Click the info icon (localhost) or the lock icon (https host) in the address bar > Site settings > Clipboard > Allow

I noticed that this module uses the fallback synchronous method (https://github.com/kensnyder/quill-image-drop-module/blob/dabeb264ce20005f452166f028d02e6594cd9729/src/ImageDrop.js#L21), however it is not currently working in Chrome.

stropitek commented 6 years ago

Hello,

It seems indeed not to work in Chrome for me too. I opened the dev tools and found that the paste is handled correctly by Chrome, but that there seems to be a bug in the library (maybe I'm just not using the version of Quill this library was written for): image The variable t contains

{ index: 36, length: 0}

therefore the condition which allows to insert the image is never met.

@kensnyder would you accept a PR on this? I would:

poshest commented 6 years ago

Any progress on this? Thanks!

sunchenguang commented 6 years ago

any progress? paste image, it's a important feature for me.

sunchenguang commented 6 years ago

just remove the condition, it works

chentianming11 commented 6 years ago

this is problem for me, it doesn't work in chrome. how to deal with it?

hparth commented 5 years ago

By removing condition it's partially working on Chrome. Working - Open an image and copy from that editor or in windows os do print screen, then paste is working fine Not working - Directly copy an image file from explorer and then paste, it is not working