editor-navigation-toolbar-controller.js 885 B

123456789101112131415161718192021
  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. ])
  18. )