mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Jump to line after the stored scroll position has been restored (#12324)
GitOrigin-RevId: 82265c6b0cab1ed3a34343efc5d47648e72dc41e
This commit is contained in:
parent
4ccf67203b
commit
9c78422efa
1 changed files with 12 additions and 7 deletions
|
@ -281,14 +281,19 @@ export default EditorManager = (function () {
|
|||
// allow Ace to display document before moving, delay until next tick
|
||||
// added delay to make this happen later that gotoStoredPosition in
|
||||
// CursorPositionManager
|
||||
return setTimeout(() => this.jumpToLine(options), 0)
|
||||
} else if (options.gotoOffset != null) {
|
||||
return setTimeout(() => {
|
||||
return this.$scope.$broadcast(
|
||||
'editor:gotoOffset',
|
||||
options.gotoOffset
|
||||
setTimeout(() => this.jumpToLine(options))
|
||||
// when opening a doc in CM6, jump to the line again after a stored scroll position has been restored
|
||||
if (isNewDoc) {
|
||||
window.addEventListener(
|
||||
'editor:scroll-position-restored',
|
||||
() => this.jumpToLine(options),
|
||||
{ once: true }
|
||||
)
|
||||
}, 0)
|
||||
}
|
||||
} else if (options.gotoOffset != null) {
|
||||
setTimeout(() => {
|
||||
this.$scope.$broadcast('editor:gotoOffset', options.gotoOffset)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue