quill icon indicating copy to clipboard operation
quill copied to clipboard

On Quill 2.0.0-dev.3 impossible to override default image handler

Open BFUculsion opened this issue 5 years ago • 2 comments
trafficstars

Browser: Version 79.0.3945.79 (Official Build) Built on Ubuntu , running on Ubuntu 18.04 (64-bit)

Quill Version: 2.0.0-dev.3

  1. Create a custom quill image handler and register it as a plugin attached to the 'image' format. Also, intercept the drop and paste on quill's root element via something like this.quill.root.addEventListener('drop', this.handleDrop, false); this.quill.root.addEventListener('paste', this.handlePaste, false);

  2. Configure the plug to not update the editor state at all, e.g. by having a handleDrop or handlePaste that intercepts evt.preventDefault(), but does nothing else.

  3. Paste an image into the editor, an Image will appear, even though the evt.preventDefault is called.

BFUculsion avatar Jan 28 '20 00:01 BFUculsion

This is the behavior I'm seeing as well

csculley avatar Nov 10 '23 22:11 csculley

Are you trying to disable dropping images? You can override the handler of the uploader module:

var quill = new Quill('#editor-container', {
  modules: {
    toolbar: [
      [{ header: [1, 2, false] }],
      ['bold', 'italic', 'underline'],
      ['image', 'code-block']
    ],
    uploader: {
      handler: () => {}
    },
  },
  placeholder: 'Compose an epic...',
  theme: 'snow'  // or 'bubble'
});

benbro avatar Jan 31 '24 06:01 benbro

Quill 2.0 has been released (announcement post) with many changes and fixes. If this is still an issue please create a new issue after reviewing our updated Contributing guide :pray:

quill-bot avatar Apr 17 '24 11:04 quill-bot