Skip to content

Commit

Permalink
Merge pull request #1474 from jumpserver/pr@dev@fixed_setting-sync
Browse files Browse the repository at this point in the history
fixed: terminal hotkey change
  • Loading branch information
ZhaoJiSen authored Sep 10, 2024
2 parents 5281464 + 7357f3c commit 475a27d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ui/src/hooks/helper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
10 changes: 1 addition & 9 deletions ui/src/router/helper/guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -58,6 +49,7 @@ const getLunaConfig = () => {
setTerminalConfig('fontSize', 13);
}

setTerminalConfig('fontSize', fontSize);
setTerminalConfig('ctrlCAsCtrlZ', '0');
};
const startUp = async (): Promise<boolean> => {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/store/modules/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const useTerminalStore = defineStore('terminal', {
state: (): ITerminalConfig => ({
fontSize: 14,
themeName: '',
quickPaste: '1',
quickPaste: '0',
ctrlCAsCtrlZ: '',
backspaceAsCtrlH: '0',
lineHeight: 1,
Expand Down

0 comments on commit 475a27d

Please sign in to comment.