mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
1be43911b4
Set Prettier's "trailingComma" setting to "es5" GitOrigin-RevId: 9f14150511929a855b27467ad17be6ab262fe5d5
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
import App from '../../../base'
|
|
import OutlinePane from '../components/outline-pane'
|
|
import { react2angular } from 'react2angular'
|
|
import { rootContext } from '../../../shared/context/root-context'
|
|
|
|
App.controller('OutlineController', function ($scope, ide, eventTracking) {
|
|
$scope.isTexFile = false
|
|
$scope.outline = []
|
|
$scope.eventTracking = eventTracking
|
|
|
|
$scope.$on('outline-manager:outline-changed', onOutlineChange)
|
|
|
|
function onOutlineChange(e, outlineInfo) {
|
|
$scope.$applyAsync(() => {
|
|
$scope.isTexFile = outlineInfo.isTexFile
|
|
$scope.outline = outlineInfo.outline
|
|
$scope.highlightedLine = outlineInfo.highlightedLine
|
|
})
|
|
}
|
|
|
|
$scope.jumpToLine = (lineNo, syncToPdf) => {
|
|
ide.outlineManager.jumpToLine(lineNo, syncToPdf)
|
|
eventTracking.sendMB('outline-jump-to-line')
|
|
}
|
|
|
|
$scope.onToggle = isOpen => {
|
|
$scope.$applyAsync(() => {
|
|
$scope.$emit('outline-toggled', isOpen)
|
|
})
|
|
}
|
|
})
|
|
|
|
// Wrap React component as Angular component. Only needed for "top-level" component
|
|
App.component(
|
|
'outlinePane',
|
|
react2angular(rootContext.use(OutlinePane), [
|
|
'outline',
|
|
'jumpToLine',
|
|
'highlightedLine',
|
|
'eventTracking',
|
|
'onToggle',
|
|
'isTexFile',
|
|
])
|
|
)
|