How to disable drag and drop of quill js (angular NG QUILL) without disable the formats image?
-
Options for Quill: https://quilljs.com/docs/configuration/ - Pay attention to the format option. Other than that, I don't see any other included options to disable the drag and drop. – Ryan C May 10 '18 at 13:15
-
1@RyanC that sucks so much, I think I will go with froala editor – Ke Vin May 17 '18 at 16:51
6 Answers
Had the same issue using "react-quill-with-table" due to a module called "uploader" enabled by default.
Fixed by overriding it:
class ByeByeUploader {}
Quill.register({
"modules/uploader": ByeByeUploader
}, true);
Alternatively, it seems to provide a "handler" option which can be overridden to do nothing:
<ReactQuill
modules={{
uploader: {
handler: ()=>{}
}
}}
...
Finally, if your issue is not coming from this module I suggest you set a DOM breakpoint on the quill container DIV for subtree modifications to get a better understanding

- 1,410
- 1
- 15
- 22
One way of doing this is by wrapping the editor in a div and preventing the default nature of drop event.
Here's an example...
<div onDrop={(e) => e.preventDefault()}>
<ReactQuill {...props}/> //Your editor component
</div>

- 202
- 3
- 10
I had the same issue with Quill editor but I fixed the issue. Please see my code:
<div id="quill-editor" (dragover)="false"></div>
So if you put (dragover)="false"
in your editor div
, the problem will be solved.

- 191
- 2
- 6
Along with (dragover)="false"
you can also add below code inside onEditorCreated(quill) event handler to disable copy-paste of images.
quill.clipboard.addMatcher('IMG', (node, delta) => {
const Delta = Quill.import('delta');
return new Delta().insert('');
})
quill.clipboard.addMatcher('PICTURE', (node, delta) => {
const Delta = Quill.import('delta');
return new Delta().insert('');
})
Sharing links to related threads,

- 11
- 3
Disable default bahaviour of image using following html, javascript
$('img').on('dragstart', function(event) { event.preventDefault(); });

- 57,590
- 26
- 140
- 166

- 19
- 3
This is a browser behavior. Quill
does nothing with this.
// 此处用于禁用拖拽事件
window.addEventListener('dragover', function(e) {
e = e || event
e.preventDefault()
}, false)
window.addEventListener('drop', function(e) {
e = e || event
e.preventDefault()
}, false)

- 1
- 3