mirror of
https://github.com/lutu-gl/Obsidian-Minimal-Quiz.git
synced 2026-07-22 05:42:37 +00:00
Refactor key registration to use this.scope.register
This commit is contained in:
parent
f0fe69029d
commit
c63b23c2e1
1 changed files with 7 additions and 6 deletions
13
main.ts
13
main.ts
|
|
@ -104,13 +104,14 @@ class QuestionsModal extends Modal {
|
|||
bgEl.classList.add("quiz-no-blur");
|
||||
}
|
||||
|
||||
this.registerKeys();
|
||||
this.render();
|
||||
}
|
||||
this.scope.register([], 'Enter', () => {
|
||||
this.toggleAnswer();
|
||||
});
|
||||
this.scope.register([], ' ', () => {
|
||||
this.toggleAnswer();
|
||||
});
|
||||
|
||||
registerKeys() {
|
||||
this.handleKeyPress = this.handleKeyPress.bind(this);
|
||||
this.component.registerDomEvent(window, "keydown", this.handleKeyPress);
|
||||
this.render();
|
||||
}
|
||||
|
||||
handleKeyPress(event: KeyboardEvent) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue