2020-06-29 09:05:08 -04:00
|
|
|
import App from '../../../base'
|
2020-09-01 04:09:04 -04:00
|
|
|
import OutlinePane from '../components/outline-pane'
|
2020-06-29 09:05:08 -04:00
|
|
|
import { react2angular } from 'react2angular'
|
|
|
|
|
2020-07-16 10:04:04 -04:00
|
|
|
App.controller('OutlineController', function($scope, ide, eventTracking) {
|
2020-06-29 09:05:08 -04:00
|
|
|
$scope.isTexFile = false
|
|
|
|
$scope.outline = []
|
2020-07-16 10:04:04 -04:00
|
|
|
$scope.eventTracking = eventTracking
|
2020-06-29 09:05:08 -04:00
|
|
|
|
|
|
|
$scope.$on('outline-manager:outline-changed', onOutlineChange)
|
|
|
|
|
|
|
|
function onOutlineChange(e, outlineInfo) {
|
|
|
|
$scope.$applyAsync(() => {
|
|
|
|
$scope.isTexFile = outlineInfo.isTexFile
|
|
|
|
$scope.outline = outlineInfo.outline
|
2020-07-28 05:37:46 -04:00
|
|
|
$scope.highlightedLine = outlineInfo.highlightedLine
|
2020-06-29 09:05:08 -04:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-08-24 08:20:54 -04:00
|
|
|
$scope.jumpToLine = (lineNo, syncToPdf) => {
|
|
|
|
ide.outlineManager.jumpToLine(lineNo, syncToPdf)
|
2020-07-16 10:04:04 -04:00
|
|
|
eventTracking.sendMB('outline-jump-to-line')
|
2020-06-29 09:05:08 -04:00
|
|
|
}
|
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
|
2020-07-16 10:04:04 -04:00
|
|
|
App.component('outlinePane', react2angular(OutlinePane))
|