25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(editor): preserve focus after executing SQL
zipg0dfc6b5cd837
diff --git a/apps/desktop/src/components/editor/QueryEditor.vue b/apps/desktop/src/components/editor/QueryEditor.vueindex f7b3fa699b..99b1c5eb7f 100644--- a/apps/desktop/src/components/editor/QueryEditor.vue+++ b/apps/desktop/src/components/editor/QueryEditor.vue@@ -623,6 +623,7 @@ function emitExecutionRequest(source: SqlExecutionOverride, openInNewResultTab =function requestExecute(options: RequestExecuteOptions = {}) {const currentView = view.value;if (!currentView) return false;+ currentView.focus();return requestExecuteFromView(currentView, currentView.state.selection.main.head, options);}diff --git a/apps/desktop/src/components/layout/EditorToolbar.vue b/apps/desktop/src/components/layout/EditorToolbar.vueindex 9fc8044903..269cb482c4 100644--- a/apps/desktop/src/components/layout/EditorToolbar.vue+++ b/apps/desktop/src/components/layout/EditorToolbar.vue@@ -229,6 +229,7 @@ async function changeCatalog(selectedCatalog: string) {class="h-6 w-6":class="executeButtonClass":disabled="activeTab.isCancelling || activeTab.isExplaining || (!activeTab.isExecuting && !executableSql.trim())"+ @mousedown.prevent@click="activeTab.isExecuting ? emit('cancel') : emit('execute')"><Loader2 v-if="activeTab.isCancelling" class="h-3.5 w-3.5 animate-spin" />diff --git a/apps/desktop/src/lib/__tests__/editor/queryEditorFocus.spec.ts b/apps/desktop/src/lib/__tests__/editor/queryEditorFocus.spec.tsindex 59ff8fe965..fb64dc9a61 100644--- a/apps/desktop/src/lib/__tests__/editor/queryEditorFocus.spec.ts+++ b/apps/desktop/src/lib/__tests__/editor/queryEditorFocus.spec.ts@@ -4,6 +4,7 @@ import { focusEditorView, type EditorViewLike } from "@/lib/editor/queryEditorFoconst queryEditorSource = readFileSync(new URL("../../../components/editor/QueryEditor.vue", import.meta.url), "utf8");const contentAreaSource = readFileSync(new URL("../../../components/layout/ContentArea.vue", import.meta.url), "utf8");+const editorToolbarSource = readFileSync(new URL("../../../components/layout/EditorToolbar.vue", import.meta.url), "utf8");function createMockView(overrides: Partial<EditorViewLike> = {}): EditorViewLike {return {@@ -47,3 +48,10 @@ describe("QueryEditor auto focus wiring", () => {expect(contentAreaSource).toMatch(/<QueryEditor[\s\S]*?\sauto-focus\s[\s\S]*?:model-value="activeTab\.sql"/);});});++describe("QueryEditor toolbar focus", () => {+ it("does not move focus from the editor when clicking execute", () => {+ expect(editorToolbarSource).toMatch(/:disabled="activeTab\.isCancelling[\s\S]*?@mousedown\.prevent[\s\S]*?@click="activeTab\.isExecuting \? emit\('cancel'\) : emit\('execute'\)"/);+ expect(queryEditorSource).toMatch(/function requestExecute\([\s\S]*?const currentView = view\.value;[\s\S]*?currentView\.focus\(\);[\s\S]*?requestExecuteFromView\(currentView/);+ });+});