After using Joplin for awhile to take notes, specifically for physics where I have to type long equations with a lot of repeated KaTex syntax, I've come to the realization that having a shorthand for words would be helpful. Instead of writing "\overrightarrow" in front of every vector, I could just have a keybind to "paste" it in.
I looked at the API for a bit and thought it was possible so I started writing it, but I soon realized that plugins do not have direct access to the DOM. I switched tracks into trying to make a sort of autofill plugin, akin to most code editors but with KaTex syntax. AFAIK this also isn't possible since it's outside the scope of contentScripts
and I wouldn't be able to render a window on the body of the note. I could probably achieve something similar with a modal but at that point it would just be more effort to click something on the screen then to just write it; I want to speed up the process (even if it's only be a few fractions of a second, it adds up), not slow it down.
So I guess my question is: am I wrong? Could this technically be possible?
If not, I'm trying to think of a way that would be able to do either of these things without the stated security and performance risks stated in the docs. For the former idea, it could be entirely possible if there was a listener built in to handle keyboard events. This wouldn't pose a security risk if it was only over the note body because you can already do essentially the same thing by using onNoteChange()
and just getting the new characters. I guess I could do that, however I'd like to use modifiers for UX.
The aforementioned autocomplete idea, in my opinion, has a lot of potential uses. Perhaps if something native was introduced to allow this behavior in plugins, it could be expanded on quite heavily and improve UX as there are a lot of heavy syntax based languages used inside of Joplin.