feat(shortcut): 将 macOS 全屏切换快捷键注册到快捷键管理面板

- 新增 toggleMacFullscreen action 到 shortcuts.ts
- 新增 platformOnly 字段支持按平台过滤快捷键显示
- 默认绑定 Ctrl+Meta+F,仅 macOS 下显示
- 移除 App.tsx 中的硬编码全屏快捷键判断,统一走 shortcuts 系统
This commit is contained in:
Syngnat
2026-03-20 21:44:12 +08:00
parent e85c561f1e
commit 36a57f9601
3 changed files with 19 additions and 9 deletions

View File

@@ -6,7 +6,8 @@ export type ShortcutAction =
| 'newQueryTab'
| 'toggleLogPanel'
| 'toggleTheme'
| 'openShortcutManager';
| 'openShortcutManager'
| 'toggleMacFullscreen';
export interface ShortcutBinding {
combo: string;
@@ -19,6 +20,7 @@ export interface ShortcutActionMeta {
label: string;
description: string;
allowInEditable?: boolean;
platformOnly?: 'mac';
}
const MODIFIER_ORDER = ['Ctrl', 'Meta', 'Alt', 'Shift'] as const;
@@ -76,6 +78,7 @@ export const SHORTCUT_ACTION_ORDER: ShortcutAction[] = [
'toggleLogPanel',
'toggleTheme',
'openShortcutManager',
'toggleMacFullscreen',
];
export const SHORTCUT_ACTION_META: Record<ShortcutAction, ShortcutActionMeta> = {
@@ -105,6 +108,11 @@ export const SHORTCUT_ACTION_META: Record<ShortcutAction, ShortcutActionMeta> =
description: '打开快捷键设置面板',
allowInEditable: true,
},
toggleMacFullscreen: {
label: '切换原生全屏',
description: 'macOS 原生窗口控制模式下的全屏切换⌃⌘F',
platformOnly: 'mac',
},
};
export const DEFAULT_SHORTCUT_OPTIONS: ShortcutOptions = {
@@ -114,6 +122,7 @@ export const DEFAULT_SHORTCUT_OPTIONS: ShortcutOptions = {
toggleLogPanel: { combo: 'Ctrl+Shift+L', enabled: true },
toggleTheme: { combo: 'Ctrl+Shift+D', enabled: true },
openShortcutManager: { combo: 'Ctrl+,', enabled: true },
toggleMacFullscreen: { combo: 'Ctrl+Meta+F', enabled: true },
};
const normalizeKeyToken = (value: string): string => {