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()"); + }); +});