Refactor shortcuts code
bouncepaw opened this issue · comments
Timur Ismagilov commented
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.