Skip to content

Commit

Permalink
Tweaks for scrolling
Browse files Browse the repository at this point in the history
* Make cm-scroller scroll by default
* Remove scrollPastEnd extension. Anyone can add it, but harder to remove if you don't want it
  • Loading branch information
bkeepers committed Apr 13, 2024
1 parent 87a75c8 commit cba580f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#editor {
flex: 1;
overflow: auto;
overflow: hidden;
}
</style>
</head>
Expand Down
7 changes: 2 additions & 5 deletions src/extensions/baseTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ export default EditorView.baseTheme({
"&": {
height: '100%',
},
".cm-editor": {
height: '100%',
overflow: 'auto'
},
".cm-scroller": {
flex: '1'
flex: '1',
overflow: 'auto',
}
})
5 changes: 2 additions & 3 deletions src/extensions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -44,6 +44,5 @@ export default [
return false
},
},
]),
scrollPastEnd(),
])
]

0 comments on commit cba580f

Please sign in to comment.