waynestate / nova-ckeditor4-field

A Laravel Nova CKEditor4 WYSIWYG Field
MIT License
61 stars 24 forks source link

How to disable drag/drop file? #75

Closed bocanhcam closed 1 year ago

bocanhcam commented 1 year ago

Just a question: How to disable drag/drop file and base64 images? Thanks for help !!!

chrispelzer commented 1 year ago

I took a look into this and it's pretty integrated with a couple of core plugins. What exactly is your use case?

Information I found on the CKEditor4 API docs. https://ckeditor.com/docs/ckeditor4/latest/features/drop_paste.html https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_plugins_clipboard.html#method-preventDefaultDropOnElement

It looks to be possible to have a specific option to disable drag and drop behavior. Though I'll have to see how it works all together.

bocanhcam commented 1 year ago

I don't want the user to upload a base64 image because it is heavy.

This code seems to work on disabling drag-drop images. but not if the user uploads it via the upload image tool.

So I also want to disable or remove all base64 images if they had uploaded

editor.on('drop', (evt) => {
   evt.stop();
}, {priority: 'high'});

editor.on('dragover', (evt) => {
        evt.stop();
}, {priority: 'high'});