mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-12 13:42:06 -05:00
0e9771ac09
File outline extras GitOrigin-RevId: c35c4f35dce280c9f44c02b567df9734943d0cb0
39 lines
926 B
JavaScript
39 lines
926 B
JavaScript
import App from '../../../base'
|
|
import OutlinePane from '../components/OutlinePane'
|
|
import { react2angular } from 'react2angular'
|
|
|
|
App.controller('OutlineController', function($scope, ide) {
|
|
$scope.isTexFile = false
|
|
$scope.outline = []
|
|
|
|
$scope.$on('outline-manager:outline-changed', onOutlineChange)
|
|
|
|
function onOutlineChange(e, outlineInfo) {
|
|
$scope.$applyAsync(() => {
|
|
$scope.isTexFile = outlineInfo.isTexFile
|
|
$scope.outline = outlineInfo.outline
|
|
})
|
|
}
|
|
|
|
$scope.jumpToLine = lineNo => {
|
|
ide.outlineManager.jumpToLine(lineNo)
|
|
}
|
|
|
|
$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(OutlinePane, [
|
|
'outline',
|
|
'jumpToLine',
|
|
'projectId',
|
|
'isTexFile',
|
|
'onToggle'
|
|
])
|
|
)
|