Propagating command+z out of the view

I have an electron app using ProseMirror. The ProseMirror state is part of a larger redux state, and as such I’m handling undo-redo at a higher level than ProseMirror. I have a menu item that is supposed to trigger undo, and it’s bound to command+z (on mac).

The problem I’m facing is that when ProseMirror has focus, it explicitly prevents command+z from propagating out of the control. The interaction of captureKeyDown() and editHandlers.keydown in prosemirror-view ends up calling preventDefault on the relevant keydown events, and this seems to mean that the menu won’t get triggered by these events.

Is there a supported way to instruct ProseMirror to not swallow these events?

If not, is there some way to know that they happened at all? Or am I just approaching this problem in the wrong way? Is there some canonical way to manage un/redo “above” prosemirror?

No, there’s no supported way to do this. You could bind that key to a function that directly invokes the parent component’s undo, possibly.

I was able to add an extra key mapping to the editor state which dispatches the appropriate redux “undo” action. This seems to work correctly, and it’s not very intrusive. Thanks for the hint!