reorganization of shortcuts in the options

This commit is contained in:
zadam
2019-11-24 10:40:18 +01:00
parent 1f37d00e42
commit c400a7143c
8 changed files with 223 additions and 181 deletions

View File

@@ -31,31 +31,31 @@ function registerEntrypoints() {
jQuery.hotkeys.options.filterContentEditable = false;
jQuery.hotkeys.options.filterTextInputs = false;
keyboardActionService.setActionHandler("AddLinkToText", () => import(ADD_LINK).then(d => d.showDialog()));
keyboardActionService.setGlobalActionHandler("AddLinkToText", () => import(ADD_LINK).then(d => d.showDialog()));
const showJumpToNoteDialog = () => import(JUMP_TO_NOTE).then(d => d.showDialog());
$("#jump-to-note-dialog-button").on('click', showJumpToNoteDialog);
keyboardActionService.setActionHandler("JumpToNote", showJumpToNoteDialog);
keyboardActionService.setGlobalActionHandler("JumpToNote", showJumpToNoteDialog);
const showRecentChanges = () => import(RECENT_CHANGES).then(d => d.showDialog());
$("#recent-changes-button").on('click', showRecentChanges);
keyboardActionService.setActionHandler("ShowRecentChanges", showRecentChanges);
keyboardActionService.setGlobalActionHandler("ShowRecentChanges", showRecentChanges);
$("#enter-protected-session-button").on('click', protectedSessionService.enterProtectedSession);
$("#leave-protected-session-button").on('click', protectedSessionService.leaveProtectedSession);
$("#toggle-search-button").on('click', searchNotesService.toggleSearch);
keyboardActionService.setActionHandler('SearchNotes', searchNotesService.toggleSearch);
keyboardActionService.setGlobalActionHandler('SearchNotes', searchNotesService.toggleSearch);
const $noteTabContainer = $("#note-tab-container");
const showAttributesDialog = () => import(ATTRIBUTES).then(d => d.showDialog());
$noteTabContainer.on("click", ".show-attributes-button", showAttributesDialog);
keyboardActionService.setActionHandler("ShowAttributes", showAttributesDialog);
keyboardActionService.setGlobalActionHandler("ShowAttributes", showAttributesDialog);
const showNoteInfoDialog = () => import(NOTE_INFO).then(d => d.showDialog());
$noteTabContainer.on("click", ".show-note-info-button", showNoteInfoDialog);
keyboardActionService.setActionHandler("ShowNoteInfo", showNoteInfoDialog);
keyboardActionService.setGlobalActionHandler("ShowNoteInfo", showNoteInfoDialog);
const showNoteRevisionsDialog = function() {
if ($(this).hasClass("disabled")) {
@@ -66,7 +66,7 @@ function registerEntrypoints() {
};
$noteTabContainer.on("click", ".show-note-revisions-button", showNoteRevisionsDialog);
keyboardActionService.setActionHandler("ShowNoteRevisions", showNoteRevisionsDialog);
keyboardActionService.setGlobalActionHandler("ShowNoteRevisions", showNoteRevisionsDialog);
const showNoteSourceDialog = function() {
if ($(this).hasClass("disabled")) {
@@ -77,33 +77,33 @@ function registerEntrypoints() {
};
$noteTabContainer.on("click", ".show-source-button", showNoteSourceDialog);
keyboardActionService.setActionHandler("ShowNoteSource", showNoteSourceDialog);
keyboardActionService.setGlobalActionHandler("ShowNoteSource", showNoteSourceDialog);
const showLinkMapDialog = () => import(LINK_MAP).then(d => d.showDialog());
$noteTabContainer.on("click", ".show-link-map-button", showLinkMapDialog);
keyboardActionService.setActionHandler("ShowLinkMap", showLinkMapDialog);
keyboardActionService.setGlobalActionHandler("ShowLinkMap", showLinkMapDialog);
const showOptionsDialog = () => import(OPTIONS).then(d => d.showDialog());
$("#options-button").on('click', showOptionsDialog);
keyboardActionService.setActionHandler("ShowOptions", showOptionsDialog);
keyboardActionService.setGlobalActionHandler("ShowOptions", showOptionsDialog);
const showHelpDialog = () => import(HELP).then(d => d.showDialog());
$("#show-help-button").on('click', showHelpDialog);
keyboardActionService.setActionHandler("ShowHelp", showHelpDialog);
keyboardActionService.setGlobalActionHandler("ShowHelp", showHelpDialog);
const showSqlConsoleDialog = () => import(SQL_CONSOLE).then(d => d.showDialog());
$("#open-sql-console-button").on('click', showSqlConsoleDialog);
keyboardActionService.setActionHandler("ShowSQLConsole", showSqlConsoleDialog);
keyboardActionService.setGlobalActionHandler("ShowSQLConsole", showSqlConsoleDialog);
$("#show-about-dialog-button").on('click', () => import(ABOUT).then(d => d.showDialog()));
if (utils.isElectron()) {
$("#history-navigation").show();
$("#history-back-button").on('click', window.history.back);
keyboardActionService.setActionHandler("BackInNoteHistory", window.history.back);
keyboardActionService.setGlobalActionHandler("BackInNoteHistory", window.history.back);
$("#history-forward-button").on('click', window.history.forward);
keyboardActionService.setActionHandler("ForwardInNoteHistory", window.history.forward);
keyboardActionService.setGlobalActionHandler("ForwardInNoteHistory", window.history.forward);
}
// hide (toggle) everything except for the note content for zen mode
@@ -113,9 +113,9 @@ function registerEntrypoints() {
};
$("#toggle-zen-mode-button").on('click', toggleZenMode);
keyboardActionService.setActionHandler("ToggleZenMode", toggleZenMode);
keyboardActionService.setGlobalActionHandler("ToggleZenMode", toggleZenMode);
keyboardActionService.setActionHandler("InsertDateTimeToText", () => {
keyboardActionService.setGlobalActionHandler("InsertDateTimeToText", () => {
const date = new Date();
const dateString = utils.formatDateTime(date);
@@ -123,7 +123,7 @@ function registerEntrypoints() {
});
$("#reload-frontend-button").on('click', utils.reloadApp);
keyboardActionService.setActionHandler("ReloadFrontendApp", utils.reloadApp);
keyboardActionService.setGlobalActionHandler("ReloadFrontendApp", utils.reloadApp);
$("#open-dev-tools-button").toggle(utils.isElectron());
@@ -135,7 +135,7 @@ function registerEntrypoints() {
};
$("#open-dev-tools-button").on('click', openDevTools);
keyboardActionService.setActionHandler("OpenDevTools", openDevTools);
keyboardActionService.setGlobalActionHandler("OpenDevTools", openDevTools);
}
let findInPage;
@@ -157,7 +157,7 @@ function registerEntrypoints() {
caseSelectedColor: 'var(--main-border-color)'
});
keyboardActionService.setActionHandler("FindInText", () => {
keyboardActionService.setGlobalActionHandler("FindInText", () => {
if (!glob.activeDialog || !glob.activeDialog.is(":visible")) {
findInPage.openFindWindow();
}
@@ -177,7 +177,7 @@ function registerEntrypoints() {
$("#toggle-fullscreen-button").on('click', toggleFullscreen);
keyboardActionService.setActionHandler("ToggleFullscreen", toggleFullscreen);
keyboardActionService.setGlobalActionHandler("ToggleFullscreen", toggleFullscreen);
}
else {
// outside of electron this is handled by the browser
@@ -185,8 +185,8 @@ function registerEntrypoints() {
}
if (utils.isElectron()) {
keyboardActionService.setActionHandler("ZoomOut", zoomService.decreaseZoomFactor);
keyboardActionService.setActionHandler("ZoomIn", zoomService.increaseZoomFactor);
keyboardActionService.setGlobalActionHandler("ZoomOut", zoomService.decreaseZoomFactor);
keyboardActionService.setGlobalActionHandler("ZoomIn", zoomService.increaseZoomFactor);
}
$(document).on('click', "a[data-action='note-revision']", async event => {
@@ -201,7 +201,7 @@ function registerEntrypoints() {
return false;
});
keyboardActionService.setActionHandler("CloneNotesTo", () => import(CLONE_TO).then(d => {
keyboardActionService.setGlobalActionHandler("CloneNotesTo", () => import(CLONE_TO).then(d => {
const activeNode = treeService.getActiveNode();
const selectedOrActiveNodes = treeService.getSelectedOrActiveNodes(activeNode);
@@ -211,7 +211,7 @@ function registerEntrypoints() {
d.showDialog(noteIds);
}));
keyboardActionService.setActionHandler("MoveNotesTo", () => import(MOVE_TO).then(d => {
keyboardActionService.setGlobalActionHandler("MoveNotesTo", () => import(MOVE_TO).then(d => {
const activeNode = treeService.getActiveNode();
const selectedOrActiveNodes = treeService.getSelectedOrActiveNodes(activeNode);
@@ -219,7 +219,7 @@ function registerEntrypoints() {
d.showDialog(selectedOrActiveNodes);
}));
keyboardActionService.setActionHandler("CreateNoteIntoDayNote", async () => {
keyboardActionService.setGlobalActionHandler("CreateNoteIntoDayNote", async () => {
const todayNote = await dateNoteService.getTodayNote();console.log(todayNote);
const notePath = await treeService.getSomeNotePath(todayNote);
@@ -233,14 +233,14 @@ function registerEntrypoints() {
});
});
keyboardActionService.setActionHandler("EditBranchPrefix", async () => {
keyboardActionService.setGlobalActionHandler("EditBranchPrefix", async () => {
const node = treeService.getActiveNode();
const editBranchPrefixDialog = await import("../dialogs/branch_prefix.js");
editBranchPrefixDialog.showDialog(node);
});
keyboardActionService.setActionHandler("ToggleNoteHoisting", async () => {
keyboardActionService.setGlobalActionHandler("ToggleNoteHoisting", async () => {
const node = treeService.getActiveNode();
hoistedNoteService.getHoistedNoteId().then(async hoistedNoteId => {
@@ -257,7 +257,7 @@ function registerEntrypoints() {
});
});
keyboardActionService.setActionHandler("SearchInSubtree", () => {
keyboardActionService.setGlobalActionHandler("SearchInSubtree", () => {
const node = treeService.getActiveNode();
searchNotesService.searchInSubtree(node.data.noteId);