quill-image-drop-module
quill-image-drop-module copied to clipboard
copy img dom but paste twice
move your mouse on a picture in chrome , use the right-click mouse menu option, copy img, then paste into editor,two different img src will show. one img src is Original source , another is base64 data.
env: chrome, https://plnkr.co/edit/ubVmPkBjqQESsefM3JrT?p=preview win10
I guess because there is no evt.preventDefault();
after line 57.
Which browsers need the image paste functionality, since it seems the Chrome (v 63.0.3239.132) handles pasting.
Is there a solution for this? Adding evt.preventDefault() after line 57 does not work.
I actually made it work by wrapping changing handlePaste function to the following:
handlePaste(evt) {
evt.preventDefault();
if (evt.clipboardData && evt.clipboardData.items && evt.clipboardData.items.length) {
this.readFiles(evt.clipboardData.items, dataUrl => {
setTimeout(() => this.insert(dataUrl), 0);
});
}
}
@frankyvij I can confirm, I had similar problem, see the resulting dom:
I also had to comment out selection checking line 50 - the problem was that quill returned selection as an object with valid index and insert was never called. Therefore I use same code as @frankyvij .
Browser user agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)"