v1.3.0: 主题系统+代码分割+设置重构+命令片段库+命令面板+连接面板 | 19 files +2141/-257 | tsc零错误 构建成功

This commit is contained in:
OpsXShell Dev committed 2026-04-18 19:25:45 +08:00
1 parent caba5f4c0d
commit 1f2de032a4
19 files changed
+2142 -258

No files matched your search

+12 -1
View File
@@ -1,5 +1,5 @@
/**
* useKeyboardShortcuts - 全局快捷键管理 Hook
* useKeyboardShortcuts - 全局快捷键管理 Hook (v1.3.0)
*
* 在 App.tsx 挂载,处理全局键盘快捷键:
* - Ctrl+Tab / Ctrl+Shift+Tab: 切换标签
@@ -7,10 +7,12 @@
* - Ctrl+W: 关闭当前标签
* - F11: 全屏切换
* - Ctrl+Shift+N: 新建标签
* - Ctrl+Shift+P: 打开命令面板 (通过 commandPaletteStore)
*/
import { useEffect } from 'react'
import { useTabStore } from '../stores/tabStore'
import { useCommandPaletteStore } from '../stores/commandPaletteStore'
import { createLogger } from '../utils/logger'
const logger = createLogger('KeyboardShortcuts')
@@ -37,6 +39,8 @@ function shouldSkipInInput(e: KeyboardEvent): boolean {
if ((e.ctrlKey || e.metaKey) && e.key === 'Tab') return false
// F11:始终生效
if ( e.key === 'F11') return false
// Ctrl+Shift+P:命令面板始终生效
if ((e.ctrlKey || e.metaKey) && e.shiftKey && (e.key === 'p' || e.key === 'P')) return false
// 其他快捷键在输入框中不触发
return true
}
@@ -46,6 +50,13 @@ export function useKeyboardShortcuts(): void {
const handleKeyDown = (e: KeyboardEvent) => {
const ctrlOrMeta = e.ctrlKey || e.metaKey
// ---- Ctrl+Shift+P: 切换命令面板 (通过 commandPaletteStore) ----
if (ctrlOrMeta && e.shiftKey && (e.key === 'p' || e.key === 'P')) {
e.preventDefault()
useCommandPaletteStore.getState().toggle()
return
}
// ---- Ctrl+Tab: 切换到下一个标签 ----
if (ctrlOrMeta && e.key === 'Tab' && !e.shiftKey) {
e.preventDefault()