bouncepaw / mycorrhiza

🍄📑 Filesystem and git-based wiki engine for the independent web written in Go using Mycomarkup as its primary markup language.

Home Page:https://mycorrhiza.wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refactor shortcuts code

bouncepaw opened this issue · comments

There is that file static/shortcuts.js that handles the shortcut and the shortcut cheatsheet logic. It is actually hard to understand, at least for me. I want there to be a refactoring. Myself, I tried to do it a couple of times, but always ended up getting lost and dropping it, like today.

So, I want the following:

  • Make the code shorter. Currently, there are 370 lines.
  • Make the code more declarative.
  • Do not use that <template>, remove it. If you need the template, just construct it in-script. It makes more sense.

Extra goals:

  • Make it extensible. Provide some global function (window.rrhAddShortcut, maybe) for customization. Currently, I have no idea how to add my own shortcut on my wiki. Maybe it is possible.
  • Localize it. Currently, only the close button's aria-label is localized.