quill-image-drop-and-paste icon indicating copy to clipboard operation
quill-image-drop-and-paste copied to clipboard

Inserting any URL in editor is being recognized as image

Open HeitorBRaymundo opened this issue 2 years ago • 1 comments

quill-image-drop-and-paste version 1.2.11 quill version 1.3.7

When Im inserting a new URL from any website on my quill editor the plugin recognized it as image an then inserting this URL as src attribute inside an img tag.

image image

The problem is the function urlIsImage that are not handling with URL properly. image

During the next weekend I'll try to open a PR to solve this issue, but if somebody knows some workaround to solve this, I'm all ears.

HeitorBRaymundo avatar Oct 28 '22 12:10 HeitorBRaymundo

@chenjuneking I saw this commit you made but I think thats does not solve the problem.

In the function urlIsImage the url is being inserting on img.src = url.

I updated to the new version 1.2.14 and the problem still ocurring: image

HeitorBRaymundo avatar Oct 28 '22 12:10 HeitorBRaymundo

Hi, @HeitorBRaymundo . The url wouldn't be inserted into the editor as a image if the pasted url wasn't a valid image's url. In order to know the pasted content was an image's url, we need to detect it. An image's url could be the format as https://xxx.com/image.png, that had the .png suffix could be easy to identify. Also, it could be the format as https://xxx.com/13y47wsu237, there was not any suffix, we are not able to know whether it's an image unless we read it. That's why the http request sent, just for the image's url detect needed.

chenjuneking avatar Oct 31 '22 02:10 chenjuneking

@chenjuneking thanks for your explanation. Last week I had a problem with CORS, the request was being blocked by our policies and then an error was throw, but I figured out that the version in our production env was 1.12.13 and then we upgraded to the version 1.12.14.

Everything is fine, thanks once more.

HeitorBRaymundo avatar Oct 31 '22 12:10 HeitorBRaymundo