Quill: Image Drop always enabled #1108

Created on 19 Sep 2018  路  2Comments  路  Source: quilljs/quill

It is possible to drop images in text editor even if we set explicitly formats allowed. It does not work on insert/paste but it works when you drag and drop an image. Tried to add logic like in the other events to only allow whitelisted formats but couldn't find the method, and modules are registered previous quill instance is created.

Steps for Reproduction

  1. Visit https://codepen.io/anon/pen/bxOQxJ
  2. Drag and drop an image from other website browser tab/page
  3. Image is showed inside editor

Expected behavior:
If Image is not allowed in formats, editor should not modify text/html.
Actual behavior:
An img node is created after you drop an image

Include browser, operating system and respective versions
Chrome 69.0.3497.100
High Sierra
Version:
1.3.6

See #1108

Most helpful comment

My solution : add editor div ondragover="return false;"

All 2 comments

I have to agree with the expected behaviour. Since image is removed in whitelisted format it should not be allowed at all.

In the meantime, I ended up disabling drop event on the editor instance. Works but user can't drop anything including text and stuff. Well, I guess they can just copy & paste for those.

My solution : add editor div ondragover="return false;"

Was this page helpful?
0 / 5 - 0 ratings