如何避免使用ckeditor 'drop'时上传图片?

How to avoid the image to be uploaded when 'drop' using ckeditor?

我想从一个将要删除的文件中提取一些信息,然后再决定是否将其粘贴到我的 CKEDITOR 中:

`CKEDITOR.on('instanceReady', (ev) => {

        ev.editor.document.on('drop', (ev2) => {
            if (ev2.data.$.dataTransfer.files) {
                // avoid to upload the file before my decission
            }
        });
    });`

我试过 event.stop() 和 event.cancel() 但他们什么也没做...有什么想法吗?

经过更多的研究,我发现问题不完全在于丢弃事件以及如何防止上传,但实际上,它取决于 'fileUploadRequest',这实际上是结束的那个上传文件。例如,为了避免上传,我们可以取消事件,因此取消默认行为:

ev.editor.on('fileUploadRequest', (ev2) => {
            ev2.cancel();
        });