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。

feat(editor): add scroll space past last line

greathaoqi1748638a551a
diff --git a/apps/desktop/src/components/editor/QueryEditor.vue b/apps/desktop/src/components/editor/QueryEditor.vue
index 9863cde253..98f8a44075 100644
--- a/apps/desktop/src/components/editor/QueryEditor.vue
+++ b/apps/desktop/src/components/editor/QueryEditor.vue
@@ -3246,7 +3246,7 @@ onMounted(async () => {
if (!editorRef.value) return;
const [
- { EditorView, keymap, rectangularSelection, hoverTooltip, showTooltip, Decoration, tooltips, gutter, GutterMarker, lineNumberMarkers, lineNumbers, highlightActiveLineGutter, highlightSpecialChars, drawSelection, dropCursor, crosshairCursor, ViewPlugin },
+ { EditorView, keymap, rectangularSelection, hoverTooltip, showTooltip, Decoration, tooltips, gutter, GutterMarker, lineNumberMarkers, lineNumbers, highlightActiveLineGutter, highlightSpecialChars, drawSelection, dropCursor, crosshairCursor, scrollPastEnd, ViewPlugin },
{ EditorState, EditorSelection, Compartment, Prec, RangeSet, StateEffect, StateField },
langSql,
{ autocompletion, startCompletion, acceptCompletion, closeBrackets, closeBracketsKeymap, snippetCompletion, completionStatus, completionKeymap, insertCompletionText, nextSnippetField },
@@ -3687,6 +3687,7 @@ onMounted(async () => {
trimmedSelectionLayer(),
selectionMatchOccurrences(),
dropCursor(),
+ props.readOnly ? [] : scrollPastEnd(),
EditorView.dragMovesSelection.of((event) => !event.ctrlKey && !event.metaKey),
EditorState.allowMultipleSelections.of(true),
indentOnInput(),
diff --git a/apps/desktop/src/lib/__tests__/editor/queryEditorScrollPastEnd.spec.ts b/apps/desktop/src/lib/__tests__/editor/queryEditorScrollPastEnd.spec.ts
new file mode 100644
index 0000000000..df05e7d4e2
--- /dev/null
+++ b/apps/desktop/src/lib/__tests__/editor/queryEditorScrollPastEnd.spec.ts
@@ -0,0 +1,11 @@
+import { readFileSync } from "node:fs";
+import { describe, expect, it } from "vitest";
+
+const queryEditorSource = readFileSync(new URL("../../../components/editor/QueryEditor.vue", import.meta.url), "utf8");
+
+describe("QueryEditor bottom scroll space", () => {
+ it("allows editable documents to scroll past the last line without changing read-only previews", () => {
+ expect(queryEditorSource).toContain("scrollPastEnd, ViewPlugin");
+ expect(queryEditorSource).toContain("props.readOnly ? [] : scrollPastEnd()");
+ });
+});