overleaf/services/web/frontend/js/ide/outline/controllers/OutlineController.js
Timothée Alby bc90ffb1e8 Merge pull request #3105 from overleaf/ta-outline-go-to-pdf
[Outline] Go To PDF on Double-Click

GitOrigin-RevId: 0be4207eb26d0712814097b71906b3c9c37d4790
2020-08-25 02:04:05 +00:00

33 lines
1,017 B
JavaScript

import App from '../../../base'
import OutlinePane from '../components/OutlinePane'
import { react2angular } from 'react2angular'
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(OutlinePane))