Execute keymap function after baseKeymap

#1

I have a situation where I am using the baseKeymap plugin and I want to trigger a change in my own keymap plugin but after the baseKeymap has dispatched its change. Because the baseKeymap returns true when it is finished, mine will never be called. Is there a way to have my keymap execute after baseKeymap. I thought about wrapping the baseKeymap function in particular but because I want to make a state change this causes a “Applying a mismatched transaction” error.

#2

Wrapping the command that you want to redefine is probably the way to go. The mismatched transaction error most likely just means that you’re starting from the wrong (previous) state when adding your own transaction.

#3

Perfect thanks! For reference, the keymap functions get passed state, dispatch and view. I was trying to reuse the same state even after passing it into the baseKeymap function. The solution was to get the state object from view.state and work with that.