Is there an easy way to disable being able to drop things into the editor?
When #202 is merged you can use this snippet Released with [email protected]
new Editor({
extensions: [],
onDrop(view, event, slice, moved) {
// return true to stop the drop event
// this will just prevent drop from external sources
return !moved;
},
});
In the mean time use this: This is for versions older than 1.14.0
new Editor({
extensions: [],
onPaste(view, { type }, slice, moved = false) {
// moved is unset on paste events so the fallback of false is used
// skip paste events
if (type === 'paste') return false;
return !moved;
},
});
My current solution, not very well tested:
new Editor({
extensions: [],
// tell ProseMirror to ignore drop event
editorProps: { handleDOMEvents: {
drop: (view, e) => { e.preventDefault(); },
} },
// hide the drop position indicator
dropCursor: { width: 0, color: 'transparent' },
});
Most helpful comment
When #202 is merged you can use this snippetReleased with [email protected]In the mean time use this:This is for versions older than 1.14.0