mirror of
https://github.com/zadam/trilium.git
synced 2025-11-18 03:00:41 +01:00
keyboard shortcuts WIP
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
const optionService = require('./options');
|
||||
const utils = require('./utils');
|
||||
const log = require('./log');
|
||||
|
||||
const ELECTRON = "electron";
|
||||
@@ -107,12 +108,36 @@ const DEFAULT_KEYBOARD_ACTIONS = [
|
||||
actionName: "ShowAttributes",
|
||||
defaultShortcuts: ["alt+a"]
|
||||
},
|
||||
{
|
||||
actionName: "ShowNoteInfo",
|
||||
defaultShortcuts: []
|
||||
},
|
||||
{
|
||||
actionName: "ShowNoteSource",
|
||||
defaultShortcuts: []
|
||||
},
|
||||
{
|
||||
actionName: "ShowLinkMap",
|
||||
defaultShortcuts: []
|
||||
},
|
||||
{
|
||||
actionName: "ShowOptions",
|
||||
defaultShortcuts: []
|
||||
},
|
||||
{
|
||||
actionName: "ShowNoteRevisions",
|
||||
defaultShortcuts: []
|
||||
},
|
||||
{
|
||||
actionName: "ShowRecentChanges",
|
||||
defaultShortcuts: []
|
||||
},
|
||||
{
|
||||
actionName: "ShowHelp",
|
||||
defaultShortcuts: ["f1"]
|
||||
},
|
||||
{
|
||||
actionName: "OpenSQLConsole",
|
||||
actionName: "ShowSQLConsole",
|
||||
defaultShortcuts: ["alt+o"]
|
||||
},
|
||||
{
|
||||
@@ -157,6 +182,12 @@ const DEFAULT_KEYBOARD_ACTIONS = [
|
||||
}
|
||||
];
|
||||
|
||||
if (process.platform === "darwin") {
|
||||
// Mac has a different history navigation shortcuts - https://github.com/zadam/trilium/issues/376
|
||||
DEFAULT_KEYBOARD_ACTIONS.find(ka => ka.actionName === 'BackInNoteHistory').defaultShortcuts = ["meta+left"];
|
||||
DEFAULT_KEYBOARD_ACTIONS.find(ka => ka.actionName === 'ForwardInNoteHistory').defaultShortcuts = ["meta+right"];
|
||||
}
|
||||
|
||||
async function getKeyboardActions() {
|
||||
const actions = JSON.parse(JSON.stringify(DEFAULT_KEYBOARD_ACTIONS));
|
||||
|
||||
@@ -183,6 +214,8 @@ async function getKeyboardActions() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -102,7 +102,7 @@ async function initStartupOptions() {
|
||||
function getKeyboardDefaultOptions() {
|
||||
return keyboardActions.DEFAULT_KEYBOARD_ACTIONS.map(ka => {
|
||||
return {
|
||||
name: "keyboardShortcuts" + ka.optionName,
|
||||
name: "keyboardShortcuts" + ka.actionName,
|
||||
value: JSON.stringify(ka.defaultShortcuts),
|
||||
isSynced: false
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user