Can I let ProseMirror ignore some dom changes?

I want to drag some nodes such as image and paragraph. I use a javascript lib: draggable. Normally, this lib will generate an element as mirror from the drag source element. The mirror element doesn’t affect the doucment’s data. So I want the ProseMirror ignore the mirror element.

How dose ProseMirror deal with dom changes?

It registers a mutation observer and, whenever part of the editable document changes, re-parses that and generates a transaction from the modified content, redrawing the affected elements as necessary.

What kind of changes is draggable creating, and why are you using it? If the affected nodes can be wrapped in node views, you could try using their ignoreMutation method to address this.

Is there a switch to control the prosemirror ignore all mutation. I have try to use ignoreMutation in topNode and it dosen’t work.

I’m not sure if you’ve played with it, but I was able to implement a custom drag/drop for nodes by directly setting

/** @type {[Selection, Slice]} (both prosemirror types) */
const [sel, slice] = props.getOverlappingSelectionSlice() ?? props.getNodeSelectionSlice()

// Need to set selection so the drop performs a "move"
view.dispatch(view.state.tr.setSelection(sel))
editorView.dragging = { move: true, slice:  }

when the user starts dragging.

This fixed the drag/drop/move behavior for me.