quill
quill copied to clipboard
On Quill 2.0.0-dev.3 impossible to override default image handler
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
-
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);
-
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.
-
Paste an image into the editor, an Image will appear, even though the evt.preventDefault is called.
This is the behavior I'm seeing as well
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'
});
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: