keyboard handlers for dialogs

This commit is contained in:
zadam
2020-01-20 22:35:52 +01:00
parent c5eac8f438
commit c83ca78565
9 changed files with 150 additions and 122 deletions

View File

@@ -3,9 +3,6 @@ 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 = `
<div class="standard-top-widget">
<style>
@@ -74,15 +71,8 @@ export default class StandardTopWidget extends BasicWidget {
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(".jump-to-note-dialog-button").on('click', () => this.trigger('jumpToNote'));
this.$widget.find(".recent-changes-button").on('click', () => this.trigger('showRecentChanges'));
this.$widget.find(".enter-protected-session-button").on('click', protectedSessionService.enterProtectedSession);
this.$widget.find(".leave-protected-session-button").on('click', protectedSessionService.leaveProtectedSession);