feat(ui): add collapsible persistent sidebar

This commit is contained in:
Logan.Li committed 2026-08-06 17:56:55 +08:00
1 parent 9ce71795b8
commit 101d2164b4
13 files changed
+153 -29

No files matched your search

+9
View File
@@ -9,6 +9,7 @@
* - Ctrl+1~9: 跳转到指定索引标签
* - Ctrl+W: 关闭当前标签
* - F11: 全屏切换
* - Ctrl/Cmd+B: 折叠/展开侧栏
* - Ctrl+Shift+N: 新建标签
* - Ctrl+Shift+P: 打开命令面板
* - Ctrl+N: 新建会话
@@ -125,6 +126,7 @@ function shouldFireInInput(e: KeyboardEvent): boolean {
KeybindingAction.TAB_PREV,
KeybindingAction.TAB_GOTO_N,
KeybindingAction.VIEW_FULLSCREEN,
KeybindingAction.VIEW_TOGGLE_SIDEBAR,
KeybindingAction.TOOLS_COMMAND_PALETTE,
]
@@ -202,6 +204,13 @@ export function useKeyboardShortcuts(): void {
return
}
// ---- Ctrl/Cmd+B: 折叠侧栏 ----
if (matchesKeySequence(e, keys[KeybindingAction.VIEW_TOGGLE_SIDEBAR])) {
e.preventDefault()
window.dispatchEvent(new CustomEvent('opsxshell:toggle-sidebar'))
return
}
// ---- 以下快捷键在输入框中不触发 (除非 fireInInput=true) ----
if (isInputElement(e) && !shouldFireInInput(e)) {
return