How do I call undo on an EditorView from an external method?


I have multiple elements on my web app including multiple prosemirror editors that are visible at once. To correctly undo/redo in the correct order, I have a global undo manager which I push to the stack every time an undo point is set on any of the elements/prosemirror instances. All seems to be in order but the only issue is I can’t seem to call the undo/redo commands outside of the prosemirror keymaps/menu.

How do I expose the prosemirror undo/redo commands to an external method? Ideally something I can call like so:

import {undo, redo, history} from "prosemirror-history";

function undo(editorView) {


Nevermind. I figured it out. I was missing including dispatch in the undo() method