[Solved] Overriding control keys

I am working on the Table Editor plugin and attempting to make it so when the cursor is in a table, the Enter and Tab keys have altered behavior. I have successfully done this! However I am unable to get the default Enter behavior when the cursor is not in a table.

Here’s the code I’ve put together to accomplish the key binding.

The problem is that CodeMirror.Pass does not seem to be functioning correctly as described in the documentation. Here’s the relevant documentation: https://codemirror.net/doc/manual.html#keymaps

Let me know if you have any ideas! Thanks :slight_smile:

I was able to use this by listening for “keydown”. Note that “keyhandled” does not work because that means CodeMirror already did something with it, you’re just being informed after the fact.

This does mean that I can’t nicely hook into shortcuts like “shift-tab” and need to manually remember if the shift key is pressed. But that’s not so bad.

1 Like