aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/display-generator.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-18 15:23:49 -0500
committerGitHub <noreply@github.com>2021-01-18 15:23:49 -0500
commitcbc5ab5696a64fe10d5a37d25cc6e87d8d44481f (patch)
tree1b4de6a6176926b1c2251de291264b33de67eb2c /ext/mixed/js/display-generator.js
parent0420a29d77e7e91a87f8f70623e1dff067640fd8 (diff)
Hotkey help controller (#1272)
* Create HotkeyHelpController * Expose getAllTemplates * Update hotkeys on the context page * Update hotkeys on the display pages * Fix display issue where a hotkey used to be defined but no longer is
Diffstat (limited to 'ext/mixed/js/display-generator.js')
-rw-r--r--ext/mixed/js/display-generator.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/mixed/js/display-generator.js b/ext/mixed/js/display-generator.js
index b48ddadc..0102afbc 100644
--- a/ext/mixed/js/display-generator.js
+++ b/ext/mixed/js/display-generator.js
@@ -22,9 +22,10 @@
*/
class DisplayGenerator {
- constructor({japaneseUtil, mediaLoader}) {
+ constructor({japaneseUtil, mediaLoader, hotkeyHelpController}) {
this._japaneseUtil = japaneseUtil;
this._mediaLoader = mediaLoader;
+ this._hotkeyHelpController = hotkeyHelpController;
this._templates = null;
this._termPitchAccentStaticTemplateIsSetup = false;
}
@@ -32,6 +33,14 @@ class DisplayGenerator {
async prepare() {
const html = await api.getDisplayTemplatesHtml();
this._templates = new HtmlTemplateCollection(html);
+ this.updateHotkeys();
+ }
+
+ updateHotkeys() {
+ const hotkeyHelpController = this._hotkeyHelpController;
+ for (const template of this._templates.getAllTemplates()) {
+ hotkeyHelpController.setupNode(template.content);
+ }
}
preparePitchAccents() {