Seems like the description here doesn’t explain how to add shortcuts specific to the editor and all editor shortcuts seem to have associated buttons where the shortcut is defined via the ‘shortcuts’ field (or hard coded in $:/core/ui/EditTemplate). I want to define a shortcut without an associated button.
Concretely, I want to create a shortcut to add the Katex markup $$ $$ around the text, and there are already button tiddlers that I don’t want to change.
Perhaps there’s another way, but it seems most straightforward to clone an existing button, tweak its behavior to your needs, assign a shortcut, then use css to make the actual button hidden. Is there some reason this wouldn’t work for you?
The actual button is katex with a dropdown. I want to keep it.
@Ittayd I just revisited short cuts as having not created one fore a long time;
What you need is a three step process;
- Create an Editor toolbar button, with its internal actions
- Create a shortcut according to the instructions (no need to code any actions)
- Set the editor toolbar buttons, shortcuts field, to the one you created eg
((katex))
Well that is another requirement. I noticed if you hide a EditorToolbar behind the more button its shortcut no longer works.
I sure this can be solved, and you can provide a better icon but here is a “rough and ready” working package using ctrl-k.
editor-toolbar-katex.json (1.1 KB)
I believe there is a way through CSS to hide the button without it maintaining the shortcut.
This is not currently directly supported; editor keyboard shortcuts are tied to an associated toolbar button.
This is because internally the keyboard shortcuts are actually a shortcut to clicking the associated button.
Thanks. So what should I do if I want a button that will not be visible? CSS or something else?
CSS might indeed be the simplest way to get things moving if you wanted to hack it.
It sounds like your problem is just that there isn’t a core keyboard shortcut for the KaTeX editor toolbar button. That would be a reasonable thing to fix in the core, so I think that would be the best approach.
I think KaTeX toolbar buttons should come with the plugin. The core should provide the tooling to make it happen.
The KaTeX toolbar buttons do come with the plugin. I should have said “…fix in the core KaTeX plugin”.