您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

middleware.js 744B

123456789101112131415161718192021222324252627282930
  1. // @flow
  2. import { MiddlewareRegistry } from '../base/redux';
  3. import UIEvents from '../../../service/UI/UIEvents';
  4. import { TOGGLE_DOCUMENT_EDITING } from './actionTypes';
  5. declare var APP: Object;
  6. /**
  7. * Middleware that captures actions related to collaborative document editing
  8. * and notifies components not hooked into redux.
  9. *
  10. * @param {Store} store - The redux store.
  11. * @returns {Function}
  12. */
  13. // eslint-disable-next-line no-unused-vars
  14. MiddlewareRegistry.register(store => next => action => {
  15. if (typeof APP === 'undefined') {
  16. return next(action);
  17. }
  18. switch (action.type) {
  19. case TOGGLE_DOCUMENT_EDITING:
  20. APP.UI.emitEvent(UIEvents.ETHERPAD_CLICKED);
  21. break;
  22. }
  23. return next(action);
  24. });