overleaf/services/web/frontend/js/features/binary-file/controllers/binary-file-controller.js
Jakob Ackermann 8f0a0439cd Merge pull request #4069 from overleaf/as-file-views-use-context
Pull project id from `EditorContext` instead of `window` in file views

GitOrigin-RevId: 78c2686d8bcd1e95414631ca77143fd9ae3edbc6
2021-05-22 02:05:56 +00:00

23 lines
643 B
JavaScript

import App from '../../../base'
import { react2angular } from 'react2angular'
import _ from 'lodash'
import { rootContext } from '../../../shared/context/root-context'
import BinaryFile from '../components/binary-file'
export default App.controller(
'ReactBinaryFileController',
function ($scope, $rootScope) {
$scope.file = $scope.openFile
$scope.storeReferencesKeys = newKeys => {
const oldKeys = $rootScope._references.keys
return ($rootScope._references.keys = _.union(oldKeys, newKeys))
}
}
)
App.component(
'binaryFile',
react2angular(rootContext.use(BinaryFile), ['storeReferencesKeys', 'file'])
)