editor-navigation-toolbar-controller.js 1.2 KB

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