mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-06-28 17:31:32 +08:00
✨ feat(query-editor): 支持查询重命名导出与保存快捷键
- 支持已保存查询重命名并同步当前标签标题 - 新增 SQL 文件导出接口、Wails 绑定和浏览器 mock - 补充 Ctrl/Cmd+S 保存查询与 Ctrl+, 快捷键入口修复 - 覆盖 SQL 编辑器保存、导出和快捷键回归测试
This commit is contained in:
@@ -3,6 +3,7 @@ import type { KeyboardEvent as ReactKeyboardEvent } from 'react';
|
||||
export type ShortcutAction =
|
||||
| 'runQuery'
|
||||
| 'selectCurrentStatement'
|
||||
| 'saveQuery'
|
||||
| 'sendAIChatMessage'
|
||||
| 'focusSidebarSearch'
|
||||
| 'newQueryTab'
|
||||
@@ -87,6 +88,7 @@ const KEY_ALIASES: Record<string, string> = {
|
||||
export const SHORTCUT_ACTION_ORDER: ShortcutAction[] = [
|
||||
'runQuery',
|
||||
'selectCurrentStatement',
|
||||
'saveQuery',
|
||||
'sendAIChatMessage',
|
||||
'focusSidebarSearch',
|
||||
'newQueryTab',
|
||||
@@ -109,6 +111,12 @@ export const SHORTCUT_ACTION_META: Record<ShortcutAction, ShortcutActionMeta> =
|
||||
description: '在查询编辑器中选中光标所在 SQL 语句',
|
||||
scope: 'queryEditor',
|
||||
},
|
||||
saveQuery: {
|
||||
label: '保存查询',
|
||||
description: '保存当前查询页;未命名查询会打开保存弹窗',
|
||||
scope: 'queryEditor',
|
||||
allowInEditable: true,
|
||||
},
|
||||
sendAIChatMessage: {
|
||||
label: 'AI 聊天发送',
|
||||
description: '在 AI 输入框中发送当前消息,Shift+Enter 始终换行',
|
||||
@@ -170,6 +178,10 @@ export const DEFAULT_SHORTCUT_OPTIONS: ShortcutOptions = {
|
||||
mac: { combo: 'Meta+E', enabled: true },
|
||||
windows: { combo: 'Ctrl+E', enabled: true },
|
||||
},
|
||||
saveQuery: {
|
||||
mac: { combo: 'Meta+S', enabled: true },
|
||||
windows: { combo: 'Ctrl+S', enabled: true },
|
||||
},
|
||||
sendAIChatMessage: {
|
||||
mac: { combo: 'Enter', enabled: true },
|
||||
windows: { combo: 'Enter', enabled: true },
|
||||
@@ -466,6 +478,15 @@ export const getShortcutDisplayLabel = (
|
||||
.join('');
|
||||
};
|
||||
|
||||
export const getShortcutPrimaryModifierDisplayLabel = (
|
||||
platform: ShortcutPlatform,
|
||||
): string => getShortcutDisplayLabel(platform === 'mac' ? 'Meta' : 'Ctrl', platform);
|
||||
|
||||
export const getPrimaryShortcutDisplayLabel = (
|
||||
key: string,
|
||||
platform: ShortcutPlatform,
|
||||
): string => getShortcutDisplayLabel(`${platform === 'mac' ? 'Meta' : 'Ctrl'}+${key}`, platform);
|
||||
|
||||
export const resolveShortcutDisplay = (
|
||||
options: Partial<ShortcutOptions> | null | undefined,
|
||||
action: ShortcutAction,
|
||||
|
||||
Reference in New Issue
Block a user