|
|
|
|
@ -18,11 +18,12 @@ const isElectron = utils.isElectron();
|
|
|
|
|
* e.g. CTRL-C in note tree does something a bit different from CTRL-C in the text editor.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (!t("keyboard_actions.note-navigation")) {
|
|
|
|
|
function getDefaultKeyboardActions() {
|
|
|
|
|
if (!t("keyboard_actions.note-navigation")) {
|
|
|
|
|
throw new Error("Keyboard actions loaded before translations.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const DEFAULT_KEYBOARD_ACTIONS: KeyboardShortcut[] = [
|
|
|
|
|
const DEFAULT_KEYBOARD_ACTIONS: KeyboardShortcut[] = [
|
|
|
|
|
{
|
|
|
|
|
separator: t("keyboard_actions.note-navigation")
|
|
|
|
|
},
|
|
|
|
|
@ -600,18 +601,24 @@ const DEFAULT_KEYBOARD_ACTIONS: KeyboardShortcut[] = [
|
|
|
|
|
description: t("keyboard_actions.force-save-revision"),
|
|
|
|
|
scope: "window"
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const platformModifier = isMac ? 'Meta' : 'Ctrl';
|
|
|
|
|
/*
|
|
|
|
|
* Apply macOS-specific tweaks.
|
|
|
|
|
*/
|
|
|
|
|
const platformModifier = isMac ? 'Meta' : 'Ctrl';
|
|
|
|
|
|
|
|
|
|
for (const action of DEFAULT_KEYBOARD_ACTIONS) {
|
|
|
|
|
for (const action of DEFAULT_KEYBOARD_ACTIONS) {
|
|
|
|
|
if (action.defaultShortcuts) {
|
|
|
|
|
action.defaultShortcuts = action.defaultShortcuts.map(shortcut => shortcut.replace("CommandOrControl", platformModifier));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DEFAULT_KEYBOARD_ACTIONS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getKeyboardActions() {
|
|
|
|
|
const actions: KeyboardShortcut[] = JSON.parse(JSON.stringify(DEFAULT_KEYBOARD_ACTIONS));
|
|
|
|
|
const actions: KeyboardShortcut[] = JSON.parse(JSON.stringify(getDefaultKeyboardActions()));
|
|
|
|
|
|
|
|
|
|
for (const action of actions) {
|
|
|
|
|
action.effectiveShortcuts = action.defaultShortcuts ? action.defaultShortcuts.slice() : [];
|
|
|
|
|
@ -642,6 +649,6 @@ function getKeyboardActions() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
DEFAULT_KEYBOARD_ACTIONS,
|
|
|
|
|
getDefaultKeyboardActions,
|
|
|
|
|
getKeyboardActions
|
|
|
|
|
};
|
|
|
|
|
|