I want to extract some information from a file that is going to be dropped before I decide to paste it or not in my CKEDITOR:
`CKEDITOR.on('instanceReady', (ev) => {
ev.editor.document.on('drop', (ev2) => {
if (ev2.data.$.dataTransfer.files) {
// avoid to upload the file before my decission
}
});
});`
I tried with event.stop() and event.cancel() but they just do nothing... any ideas?
After a bit more of research I found that the problem was not exactly in the drop event and how to prevent the upload, but actually, it was depending in the 'fileUploadRequest' which is actually the one that ends uploading the file. So to avoid the upload for example, we can just cancel the event and therefore the default behaviour:
ev.editor.on('fileUploadRequest', (ev2) => {
ev2.cancel();
});