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

View File

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