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): recover shortcuts after a lost IME compositionend
t8y20b66871846aa
diff --git a/apps/desktop/src/components/editor/QueryEditor.vue b/apps/desktop/src/components/editor/QueryEditor.vueindex 954289b1b7..7e37dd9280 100644--- a/apps/desktop/src/components/editor/QueryEditor.vue+++ b/apps/desktop/src/components/editor/QueryEditor.vue@@ -522,6 +522,7 @@ let previewContextRefreshTimer: ReturnType<typeof setTimeout> | null = null;let editorIsActive = true;let imeCompositionActive = false;+let imeCompositionRecovered = false;let pendingImeModelEmit = false;const postCompositionKeyGuard = createQueryEditorPostCompositionKeyGuard();let postCompositionKeyGuardCleanup: (() => void) | null = null;@@ -2112,7 +2113,12 @@ const { editorIndentUnit, handleTab, handleEnter, acceptCompletionOrNextSnippetF});function isEditorComposing(currentView: EditorViewType): boolean {- return imeCompositionActive || currentView.compositionStarted || currentView.composing;+ if (imeCompositionActive) return true;+ // A real key with isComposing=false proves the IME stalled before sending+ // compositionend. Ignore the stale CodeMirror flags until the next+ // compositionstart, otherwise every shortcut stays blocked.+ if (imeCompositionRecovered) return false;+ return currentView.compositionStarted || currentView.composing;}async function flushImeComposition() {@@ -2451,16 +2457,20 @@ const codeMirrorLifecycle = useQueryEditorCodeMirror({return insertDroppedTableReference(currentView, event);},blur(_event, currentView) {+ imeCompositionActive = false;+ imeCompositionRecovered = false;documentState.recordSelection(currentView);return false;},compositionstart() {imeCompositionActive = true;+ imeCompositionRecovered = false;completion.invalidateRequests();return false;},compositionend() {imeCompositionActive = false;+ imeCompositionRecovered = false;window.setTimeout(flushImeComposition, 0);return false;},@@ -3152,6 +3162,11 @@ function unfoldAll(): boolean {function shouldBlockExecutionShortcut(event?: KeyboardEvent, currentView: EditorViewType | null = view.value): boolean {if (props.isExecuting) return true;if (event?.repeat) return true;+ if (event && !event.isComposing && event.keyCode !== 229 && event.key !== "Process") {+ // A stalled IME can drop compositionend; a real key proves it is over.+ imeCompositionActive = false;+ imeCompositionRecovered = true;+ }return (currentView ? isEditorComposing(currentView) : false) || (event ? postCompositionKeyGuard.blocks(event) : false);}diff --git a/apps/desktop/src/components/editor/__tests__/QueryEditor.componentSplit.integration.spec.ts b/apps/desktop/src/components/editor/__tests__/QueryEditor.componentSplit.integration.spec.tsindex c64edefc0c..1d87b2c1d0 100644--- a/apps/desktop/src/components/editor/__tests__/QueryEditor.componentSplit.integration.spec.ts+++ b/apps/desktop/src/components/editor/__tests__/QueryEditor.componentSplit.integration.spec.ts@@ -104,6 +104,18 @@ describe("QueryEditor component split integration", () => {expect(props.modelValue).toBe(original);});+ it("recovers execution shortcuts after a lost compositionend", async () => {+ const { editor, view } = await mountEditor({ modelValue: "SELECT 1" });+ view.contentDOM.dispatchEvent(new CompositionEvent("compositionstart", { bubbles: true }));+ const composing = new KeyboardEvent("keydown", { key: "Process", keyCode: 229, isComposing: true, bubbles: true, cancelable: true });+ expect(editor.shouldBlockExecutionShortcut(composing)).toBe(true);++ const plain = new KeyboardEvent("keydown", { key: "a", bubbles: true, cancelable: true });+ view.contentDOM.dispatchEvent(plain);+ expect(editor.shouldBlockExecutionShortcut(plain)).toBe(false);+ view.contentDOM.dispatchEvent(new CompositionEvent("compositionend", { bubbles: true }));+ });+it("executes each IRIS query separately after the Contains operator", async () => {const first = "select * from oec_order_adminstatus where STAT_Code [ '123'";const second = "select top 10 * from Ens_HOSDocument";