editor-navigation-toolbar-controller.js 1.2 KB

1234567891011121314151617181920212223242526
  1. import App from '../../../base'
  2. import { react2angular } from 'react2angular'
  3. import EditorNavigationToolbarRoot from '../components/editor-navigation-toolbar-root'
  4. import { rootContext } from '../../../shared/context/root-context'
  5. App.controller('EditorNavigationToolbarController', function ($scope, ide) {
  6. // wrapper is required to avoid scope problems with `this` inside `EditorManager`
  7. $scope.openDoc = (doc, args) => ide.editorManager.openDoc(doc, args)
  8. })
  9. App.component(
  10. 'editorNavigationToolbarRoot',
  11. react2angular(rootContext.use(EditorNavigationToolbarRoot), [
  12. 'openDoc',
  13. // `$scope.onlineUsersArray` is already populated by `OnlineUsersManager`, which also creates
  14. // a new array instance every time the list of online users change (which should refresh the
  15. // value passed to React as a prop, triggering a re-render)
  16. 'onlineUsersArray',
  17. // We're still including ShareController as part fo the React navigation toolbar. The reason is
  18. // the coupling between ShareController's $scope and Angular's ShareProjectModal. Once ShareProjectModal
  19. // is fully ported to React we should be able to repli
  20. 'openShareProjectModal',
  21. ])
  22. )