From 7357f3ccfdcf2d49bfb8b4bab7aee7629a0c0606 Mon Sep 17 00:00:00 2001 From: zhaojisen <1301338853@qq.com> Date: Tue, 10 Sep 2024 15:33:36 +0800 Subject: [PATCH] fixed: terminal hotkey change --- ui/src/hooks/helper/index.ts | 2 +- ui/src/router/helper/guard.ts | 10 +--------- ui/src/store/modules/terminal.ts | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/ui/src/hooks/helper/index.ts b/ui/src/hooks/helper/index.ts index 3b1de532..e4d6683e 100644 --- a/ui/src/hooks/helper/index.ts +++ b/ui/src/hooks/helper/index.ts @@ -115,7 +115,7 @@ export const handleTerminalResize = ( * @param terminal */ export const handleCustomKey = (e: KeyboardEvent, terminal: Terminal): boolean => { - if (e.altKey && (e.key === 'ArrowRight' || e.key === 'ArrowLeft')) { + if (e.altKey && e.shiftKey && (e.key === 'ArrowRight' || e.key === 'ArrowLeft')) { switch (e.key) { case 'ArrowRight': sendEventToLuna('KEYEVENT', 'alt+right'); diff --git a/ui/src/router/helper/guard.ts b/ui/src/router/helper/guard.ts index fdd03f39..bc6b339c 100644 --- a/ui/src/router/helper/guard.ts +++ b/ui/src/router/helper/guard.ts @@ -31,22 +31,13 @@ const getLunaConfig = () => { const localSetting: string | null = localStorage.getItem('LunaSetting'); - info(localSetting); - console.log('localSetting', localSetting); - let fontSize = terminalStore.fontSize; if (localSetting !== null) { - // 将 localSetting 从字符串解析为对象 const parsedSetting = JSON.parse(localSetting); - info(parsedSetting); - - // 确保解析成功后才能继续使用 const commandLine = parsedSetting['command_line']; - info(commandLine); - if (commandLine) { fontSize = commandLine['character_terminal_font_size']; setTerminalConfig('quickPaste', commandLine['is_right_click_quickly_paste'] ? '1' : '0'); @@ -58,6 +49,7 @@ const getLunaConfig = () => { setTerminalConfig('fontSize', 13); } + setTerminalConfig('fontSize', fontSize); setTerminalConfig('ctrlCAsCtrlZ', '0'); }; const startUp = async (): Promise => { diff --git a/ui/src/store/modules/terminal.ts b/ui/src/store/modules/terminal.ts index 3a771a5a..f4ca3c88 100644 --- a/ui/src/store/modules/terminal.ts +++ b/ui/src/store/modules/terminal.ts @@ -6,7 +6,7 @@ export const useTerminalStore = defineStore('terminal', { state: (): ITerminalConfig => ({ fontSize: 14, themeName: '', - quickPaste: '1', + quickPaste: '0', ctrlCAsCtrlZ: '', backspaceAsCtrlH: '0', lineHeight: 1,