feat(query-editor): 支持查询重命名导出与保存快捷键

- 支持已保存查询重命名并同步当前标签标题

- 新增 SQL 文件导出接口、Wails 绑定和浏览器 mock

- 补充 Ctrl/Cmd+S 保存查询与 Ctrl+, 快捷键入口修复

- 覆盖 SQL 编辑器保存、导出和快捷键回归测试
This commit is contained in:
Syngnat
2026-05-31 22:32:48 +08:00
parent e687ae2819
commit 63db9fecb3
11 changed files with 583 additions and 35 deletions

View File

@@ -14,7 +14,7 @@ const getGlobalShortcutCaseBlock = (action: string) => {
const afterCase = appSource.slice(start + caseToken.length);
const nextCaseIndex = afterCase.search(/\n\s+case '[^']+':/);
const switchEndIndex = afterCase.indexOf("window.addEventListener('keydown', handleGlobalShortcut);");
const switchEndIndex = afterCase.indexOf("window.addEventListener('keydown', handleGlobalShortcut, true);");
const endIndex = nextCaseIndex >= 0 ? nextCaseIndex : switchEndIndex;
expect(endIndex).toBeGreaterThan(-1);
@@ -178,6 +178,11 @@ describe('tool center menu entries', () => {
expect(appSource).toContain('setTheme, toggleAIPanel, useNativeMacWindowControls');
});
it('captures global shortcuts before Monaco/editor defaults consume them', () => {
expect(appSource).toContain("window.addEventListener('keydown', handleGlobalShortcut, true);");
expect(appSource).toContain("window.removeEventListener('keydown', handleGlobalShortcut, true);");
});
it('listens for command search query-tab events and routes them through handleNewQuery', () => {
expect(appSource).toContain("window.addEventListener('gonavi:create-query-tab', handleCreateQueryTabEvent as EventListener);");
expect(appSource).toContain("window.removeEventListener('gonavi:create-query-tab', handleCreateQueryTabEvent as EventListener);");