overleaf/services/web/frontend/js/ide/outline/controllers/OutlineController.js
Timothée Alby 558854f51b Merge pull request #3030 from overleaf/ta-outline-highlight
Outline Highlight

GitOrigin-RevId: f51eec6f1714403d749e454b55be363819930b98
2020-08-10 15:54:08 +00:00

33 lines
993 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 => {
ide.outlineManager.jumpToLine(lineNo)
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))