1
0
Fork 0
mirror of https://github.com/overleaf/overleaf.git synced 2025-04-08 01:34:32 +00:00

Merge pull request 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 3b5afb6d4c
commit e3758f2060
3 changed files with 10 additions and 1 deletions
services/web/frontend/js/ide
binary-files
editor
EditorManager.js
directives/aceEditor/cursor-position

View file

@ -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'

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 => {

View file

@ -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)