Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

fix(editor): restore drag selection near insert value hints

二丫讲梵607d3a90702a
diff --git a/apps/desktop/src/lib/editor/codemirrorInsertValueHints.ts b/apps/desktop/src/lib/editor/codemirrorInsertValueHints.ts
index 9776dac954..214ca485f7 100644
--- a/apps/desktop/src/lib/editor/codemirrorInsertValueHints.ts
+++ b/apps/desktop/src/lib/editor/codemirrorInsertValueHints.ts
@@ -1,4 +1,4 @@
-import { EditorSelection, StateEffect, type Extension } from "@codemirror/state";
+import { StateEffect, type Extension } from "@codemirror/state";
import { Decoration, EditorView, ViewPlugin, WidgetType, type DecorationSet, type ViewUpdate } from "@codemirror/view";
import { matchDollarQuoteTag } from "@/lib/sql/semantic/tokens";
import { buildInsertValueHints, expandToSqlStatementWindow, findEnclosingDollarQuoteStartInText, insertValueHintsNeedTableColumns, parseInsertValuesClauses, type InsertValueHint, type InsertValuesClause, type TextRange } from "@/lib/sql/insertValueHints";
@@ -249,24 +249,9 @@ export function createInsertValueHintsExtension(options: InsertValueHintsExtensi
{ decorations: (value) => value.decorations },
);
- const clickWithoutScroll = EditorView.domEventHandlers({
- mousedown(event, view) {
- if (!(options.isEnabled?.() ?? true)) return false;
- const pluginState = view.plugin(plugin);
- if (!pluginState) return false;
- const pos = view.posAtCoords({ x: event.clientX, y: event.clientY });
- if (pos == null || !isInsertValueHintDecorationAt(pluginState.decorations, pos)) return false;
- event.preventDefault();
- view.dispatch({
- selection: EditorSelection.cursor(pos),
- ...insertValueHintsRefreshDispatchSpec,
- });
- view.focus();
- return true;
- },
- });
-
- return [insertValueHintsTheme, plugin, clickWithoutScroll];
+ // Let CodeMirror handle pointer selection near hints. Consuming mousedown
+ // here prevents its drag-selection handler from starting.
+ return [insertValueHintsTheme, plugin];
}
export function requestInsertValueHintsRefresh(view: EditorView) {