From cba580f42824dd9b3b8fa4e1b0bca23b69ed0255 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Sat, 13 Apr 2024 13:32:19 -0400 Subject: [PATCH] Tweaks for scrolling * Make cm-scroller scroll by default * Remove scrollPastEnd extension. Anyone can add it, but harder to remove if you don't want it --- index.html | 2 +- src/extensions/baseTheme.ts | 7 ++----- src/extensions/index.ts | 5 ++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 7405394..44c74dc 100644 --- a/index.html +++ b/index.html @@ -34,7 +34,7 @@ #editor { flex: 1; - overflow: auto; + overflow: hidden; } diff --git a/src/extensions/baseTheme.ts b/src/extensions/baseTheme.ts index d54cfb0..8f6560e 100644 --- a/src/extensions/baseTheme.ts +++ b/src/extensions/baseTheme.ts @@ -4,11 +4,8 @@ export default EditorView.baseTheme({ "&": { height: '100%', }, - ".cm-editor": { - height: '100%', - overflow: 'auto' - }, ".cm-scroller": { - flex: '1' + flex: '1', + overflow: 'auto', } }) diff --git a/src/extensions/index.ts b/src/extensions/index.ts index ea207b5..ccfcb73 100644 --- a/src/extensions/index.ts +++ b/src/extensions/index.ts @@ -4,7 +4,7 @@ import { defaultKeymap, history, historyKeymap } from '@codemirror/commands' import { bracketMatching } from '@codemirror/language' import { lintKeymap } from '@codemirror/lint' import { highlightSelectionMatches, searchKeymap } from '@codemirror/search' -import { drawSelection, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, scrollPastEnd, keymap, lineNumbers } from '@codemirror/view' +import { drawSelection, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, keymap, lineNumbers } from '@codemirror/view' import { ChordPro } from '@chordbook/codemirror-lang-chordpro' import { oneDark } from '@codemirror/theme-one-dark' import baseTheme from './baseTheme' @@ -44,6 +44,5 @@ export default [ return false }, }, - ]), - scrollPastEnd(), + ]) ]