Move cursor to end of document and scroll it into view

This commit is contained in:
Jonatan Heyman 2022-12-30 11:05:30 +01:00
parent 5a4a092521
commit 570fdba08b
1 changed files with 3 additions and 2 deletions

View File

@ -57,7 +57,7 @@ editor.update([
editor.state.update({
changes:{
from: 0,
to: editor.state.length,
to: editor.state.doc.length,
insert: initialData,
},
annotations: heynoteEvent.of(INITIAL_DATA),
@ -66,7 +66,8 @@ editor.update([
editor.dispatch({
selection: {anchor: 0, head: 0},
selection: {anchor: editor.state.doc.length, head: editor.state.doc.length},
scrollIntoView: true,
})
editor.focus()