Add a command for toggling inline code

Added a command argument selectionOnly, which allows you to disable the current behavior and force the command core:toggle-inline-code to toggle inline code block.
Built a patch:

How to use:

  1. Create a custom command
inkdrop.commands.add(document.body, "custom:toggle-inline-code", async () => {
  const el = document.querySelector('.CodeMirror textarea')
  inkdrop.commands.dispatch(el, 'core:toggle-inline-code', { selectionOnly: false })
});
  1. Add a custom keymap
{
  ".CodeMirror textarea": {
    "cmd-`": "custom:toggle-inline-code"
  }
}

Note 1: You may have to disable the default system shortcut key for “Move focus to next window” to use the key combination Cmd-`.

Note 2: This is experimental and it may be changed in the future.

1 Like