CodeMirrorWikiEditor: scroll selection into view on inital load

Without the scrollIntoView option set, CodeMirror will always scroll
to the bottom.

See:
https://codemirror.net/docs/ref/#state.TransactionSpec.scrollIntoView

Bug: T317243
Change-Id: I3174685cd3508abf8074eb47e8f2bf81bd303916
This commit is contained in:
MusikAnimal 2023-10-20 20:35:18 -04:00
parent 361741ec86
commit 314bd6d8c4
3 changed files with 4 additions and 3 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -76,7 +76,8 @@ export default class CodeMirrorWikiEditor extends CodeMirror {
this.view.dispatch( {
selection: EditorSelection.create( [
EditorSelection.range( selectionStart, selectionEnd )
] )
] ),
scrollIntoView: true
} );
if ( hasFocus ) {
this.view.focus();