mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	server: Fix crash when starting server in Docker due to translations
This commit is contained in:
		| @@ -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)}`, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user