Merge pull request #8804 from overleaf/jel-rich-text-pos

[web] Fix stored rich text position

GitOrigin-RevId: 7ef916919220d63d88f66ee261f91a5af08dcefb
This commit is contained in:
Jessica Lawshe
2022-07-27 08:24:16 -05:00
committed by Copybot
parent dc483b483e
commit 20b624bbd1
3 changed files with 10 additions and 1 deletions
@@ -25,6 +25,11 @@ export default BinaryFilesManager = class BinaryFilesManager {
}
openFile(file) {
if (this.$scope.ui.view === 'editor') {
// store position before switching to binary view
this.$scope.$broadcast('store-doc-position')
}
this.ide.fileTreeManager.selectEntity(file)
if (this.$scope.ui.view !== 'history') {
this.$scope.ui.view = 'file'
@@ -201,6 +201,10 @@ export default EditorManager = (function () {
options = {}
}
sl_console.log(`[openDoc] Opening ${doc.id}`)
if (this.$scope.ui.view === 'editor') {
// store position of previous doc before switching docs
this.$scope.$broadcast('store-doc-position')
}
this.$scope.ui.view = 'editor'
const done = isNewDoc => {
@@ -24,7 +24,7 @@ export default CursorPositionManager = class CursorPositionManager {
this.localStorage = localStorage
this.$scope.$on('editorInit', this.jumpToPositionInNewDoc)
this.$scope.$on('beforeChangeDocument', this.storePositionAndLine)
this.$scope.$on('store-doc-position', this.storePositionAndLine)
this.$scope.$on('afterChangeDocument', this.jumpToPositionInNewDoc)