Fix scroll bug when moving between pages

pull/36/head
Zef Hemel 2022-07-18 12:10:31 +02:00
parent 311e8f0341
commit 96d945bc56
1 changed files with 3 additions and 1 deletions

View File

@ -598,11 +598,13 @@ export class Editor {
if (pageState) {
// Restore state
// console.log("Restoring selection state", pageState);
editorView.scrollDOM.scrollTop = pageState!.scrollTop;
editorView.dispatch({
selection: pageState.selection,
scrollIntoView: true,
});
editorView.scrollDOM.scrollTop = pageState!.scrollTop;
} else {
editorView.scrollDOM.scrollTop = 0;
}
editorView.focus();
}