mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-12 20:02:28 +08:00
server: Fix crash when starting server in Docker due to translations
This commit is contained in:
parent
5c44ac5ad8
commit
e45c5f429d
@ -18,6 +18,7 @@ const isElectron = utils.isElectron();
|
||||
* e.g. CTRL-C in note tree does something a bit different from CTRL-C in the text editor.
|
||||
*/
|
||||
|
||||
function getDefaultKeyboardActions() {
|
||||
if (!t("keyboard_actions.note-navigation")) {
|
||||
throw new Error("Keyboard actions loaded before translations.");
|
||||
}
|
||||
@ -602,6 +603,9 @@ const DEFAULT_KEYBOARD_ACTIONS: KeyboardShortcut[] = [
|
||||
}
|
||||
];
|
||||
|
||||
/*
|
||||
* Apply macOS-specific tweaks.
|
||||
*/
|
||||
const platformModifier = isMac ? 'Meta' : 'Ctrl';
|
||||
|
||||
for (const action of DEFAULT_KEYBOARD_ACTIONS) {
|
||||
@ -610,8 +614,11 @@ for (const action of DEFAULT_KEYBOARD_ACTIONS) {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
};
|
||||
|
@ -126,7 +126,7 @@ function initStartupOptions() {
|
||||
}
|
||||
|
||||
function getKeyboardDefaultOptions() {
|
||||
return (keyboardActions.DEFAULT_KEYBOARD_ACTIONS
|
||||
return (keyboardActions.getDefaultKeyboardActions()
|
||||
.filter(ka => !!ka.actionName) as KeyboardShortcutWithRequiredActionName[])
|
||||
.map(ka => ({
|
||||
name: `keyboardShortcuts${ka.actionName.charAt(0).toUpperCase()}${ka.actionName.slice(1)}`,
|
||||
|
Loading…
x
Reference in New Issue
Block a user