Add hotkeys, document hotkeys, make 'DefaultGUI' runnable via NodeJS, generate hotkey documentation

This commit is contained in:
Pieter Vander Vennet 2022-12-24 03:44:21 +01:00
parent e2419c19cd
commit 43613e4ece
16 changed files with 328 additions and 89 deletions

View file

@ -5,6 +5,7 @@ import { UIEventSource } from "../../Logic/UIEventSource"
import Hash from "../../Logic/Web/Hash"
import BaseUIElement from "../BaseUIElement"
import Title from "./Title"
import Hotkeys from "./Hotkeys"
/**
*
@ -82,12 +83,11 @@ export default class ScrollableFullScreen {
}
private static initEmpty(): FixedUiElement {
document.addEventListener("keyup", function (event) {
if (event.code === "Escape") {
ScrollableFullScreen.collapse()
event.preventDefault()
}
})
Hotkeys.RegisterHotkey(
{ nomod: "Escape", onUp: true },
"Close the sidebar",
ScrollableFullScreen.collapse
)
return new FixedUiElement("")
}
@ -117,7 +117,7 @@ export default class ScrollableFullScreen {
this._fullscreencomponent.AttachTo("fullscreen")
const fs = document.getElementById("fullscreen")
ScrollableFullScreen._currentlyOpen = this
fs.classList.remove("hidden")
fs?.classList?.remove("hidden")
}
private BuildComponent(title: BaseUIElement, content: BaseUIElement): BaseUIElement {