exchange pm node order

I use dom insertBefore to insert a dom node before other dom node and both exists in dom document and represents a direct child pm node in root doc, it triggers readDOMChange. Before prosemirror-view@v1.23.12, it’s ok, editor view rerender same as my intention, pm node order changes. But after prosemirror-view@v1.23.12, this operation looks like pressing Enter, i found the Influential code:

if ((browser.ios && view.input.lastIOSEnter > - 225 || &&
      addedNodes.some(n => n.nodeName == "DIV" || n.nodeName == "P") &&
      (!change || change.endA >= change.endB) &&
      view.someProp("handleKeyDown", f => f(view, keyEvent(13, "Enter")))) {
    view.input.lastIOSEnter = 0

if i change change.endA >= change.endB to change.endA > change.endB, it will be ok, i think when change dom order, change.endA always equal to change.endB.

Simply change dom order seems a good way to exchange pm node order, can it be improved? Thanks.

Making the change with a ProseMirror transaction would be the recommended way to do this. Directly changing the DOM to make document changes is not something that the library supports.