2020-06-29 09:05:08 -04:00
|
|
|
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)
|
|
|
|
}
|
2020-07-16 06:09:01 -04:00
|
|
|
|
|
|
|
$scope.onToggle = isOpen => {
|
|
|
|
$scope.$applyAsync(() => {
|
|
|
|
$scope.$emit('outline-toggled', isOpen)
|
|
|
|
})
|
|
|
|
}
|
2020-06-29 09:05:08 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
// Wrap React component as Angular component. Only needed for "top-level" component
|
|
|
|
App.component(
|
|
|
|
'outlinePane',
|
2020-07-16 06:09:01 -04:00
|
|
|
react2angular(OutlinePane, [
|
|
|
|
'outline',
|
|
|
|
'jumpToLine',
|
|
|
|
'projectId',
|
|
|
|
'isTexFile',
|
|
|
|
'onToggle'
|
|
|
|
])
|
2020-06-29 09:05:08 -04:00
|
|
|
)
|