mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Clamp pos when storing scroll position (#30773)
GitOrigin-RevId: b381950e209c18a5fbba07604839b7c3eac90da8
This commit is contained in:
@@ -155,7 +155,8 @@ const storeScrollPosition = (
|
||||
) => {
|
||||
const key = buildStorageKey(docId)
|
||||
const data = customLocalStorage.getItem(key)
|
||||
const firstVisibleLine = view.state.doc.lineAt(lineInfo.first.from).number
|
||||
const pos = Math.min(lineInfo.first.from, view.state.doc.length)
|
||||
const firstVisibleLine = view.state.doc.lineAt(pos).number
|
||||
|
||||
customLocalStorage.setItem(key, { ...data, firstVisibleLine })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user