mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 18:20:09 +02:00
* Added toggle chat button to navigation header * new `useBrowserWindow` hook to work with browser title and focus * react2angular chat toggle button plumbing GitOrigin-RevId: 4380f1db9c7cc9a25bfb8d7a33e18d61b1d32993
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
import App from '../../../base'
|
|
import { react2angular } from 'react2angular'
|
|
import { rootContext } from '../root-context'
|
|
|
|
App.controller('ReactRootContextController', function($scope, ide) {
|
|
$scope.editorLoading = !!ide.$scope.state.loading
|
|
ide.$scope.$watch('state.loading', editorLoading => {
|
|
$scope.editorLoading = editorLoading
|
|
})
|
|
|
|
$scope.setChatIsOpenAngular = value => {
|
|
ide.$scope.$applyAsync(() => {
|
|
ide.$scope.ui.chatOpen = value
|
|
})
|
|
}
|
|
|
|
// we need to pass `$scope.ui.chatOpen` to Angular while both React and Angular
|
|
// Navigation Toolbars exist in the codebase. Once the Angular version is removed,
|
|
// the React Navigation Toolbar will be the only source of truth for the open/closed state,
|
|
// but `setChatIsOpenAngular` will still need to exist since Angular is responsible of the
|
|
// global layout
|
|
$scope.chatIsOpenAngular = ide.$scope.ui.chatOpen
|
|
ide.$scope.$watch('ui.chatOpen', value => {
|
|
$scope.chatIsOpenAngular = value
|
|
})
|
|
})
|
|
|
|
App.component(
|
|
'sharedContextReact',
|
|
react2angular(rootContext.component, [
|
|
'editorLoading',
|
|
'setChatIsOpenAngular',
|
|
'chatIsOpenAngular'
|
|
])
|
|
)
|