import BasicWidget from "./basic_widget.js"; import HistoryNavigationWidget from "./history_navigation.js"; import keyboardActionService from "../services/keyboard_actions.js"; import protectedSessionService from "../services/protected_session.js"; const JUMP_TO_NOTE = "../dialogs/jump_to_note.js"; const RECENT_CHANGES = "../dialogs/recent_changes.js"; const TPL = `
`; export default class StandardTopWidget extends BasicWidget { render() { this.$widget = $(TPL); const historyNavigationWidget = new HistoryNavigationWidget(this.appContext); this.$widget.prepend(historyNavigationWidget.render()); const showJumpToNoteDialog = () => import(JUMP_TO_NOTE).then(d => d.showDialog()); this.$widget.find(".jump-to-note-dialog-button").on('click', showJumpToNoteDialog); const showRecentChanges = () => import(RECENT_CHANGES).then(d => d.showDialog()); this.$widget.find(".recent-changes-button").on('click', showRecentChanges); // FIXME keyboardActionService.setGlobalActionHandler("JumpToNote", showJumpToNoteDialog); keyboardActionService.setGlobalActionHandler("ShowRecentChanges", showRecentChanges); this.$widget.find(".enter-protected-session-button").on('click', protectedSessionService.enterProtectedSession); this.$widget.find(".leave-protected-session-button").on('click', protectedSessionService.leaveProtectedSession); return this.$widget } }