mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #8347 from overleaf/ae-outline-performance
Only update the outline view when the outline changes GitOrigin-RevId: aadf0016111a5f3568475b9ee1849acc46934a30
This commit is contained in:
parent
bb04841504
commit
1f62553b0a
1 changed files with 9 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
import { isEqual, cloneDeep } from 'lodash'
|
||||
import './controllers/outline-controller'
|
||||
import { matchOutline, nestOutline } from './outline-parser'
|
||||
import isValidTeXFile from '../../main/is-valid-tex-file'
|
||||
|
@ -9,6 +10,7 @@ class OutlineManager {
|
|||
this.shareJsDoc = null
|
||||
this.isTexFile = false
|
||||
this.flatOutline = []
|
||||
this.previousFlatOutline = []
|
||||
this.outline = []
|
||||
this.highlightedLine = null
|
||||
this.ignoreNextScroll = false
|
||||
|
@ -67,14 +69,19 @@ class OutlineManager {
|
|||
}
|
||||
|
||||
updateOutline() {
|
||||
this.outline = []
|
||||
if (this.isTexFile) {
|
||||
const content = this.ide.editorManager.getCurrentDocValue()
|
||||
if (content) {
|
||||
this.flatOutline = matchOutline(content)
|
||||
this.outline = nestOutline(this.flatOutline)
|
||||
if (!isEqual(this.flatOutline, this.previousFlatOutline)) {
|
||||
this.previousFlatOutline = cloneDeep(this.flatOutline)
|
||||
this.outline = nestOutline(this.flatOutline)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
this.previousFlatOutline = []
|
||||
this.outline = []
|
||||
}
|
||||
|
||||
// set highlightedLine to the closest outline line above the editorLine
|
||||
|
|
Loading…
Reference in a new issue