Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

reducer.ts 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import ReducerRegistry from '../base/redux/ReducerRegistry';
  2. import { SET_DOCUMENT_EDITING_STATUS, SET_DOCUMENT_URL } from './actionTypes';
  3. const DEFAULT_STATE = {
  4. /**
  5. * URL for the shared document.
  6. */
  7. documentUrl: undefined,
  8. /**
  9. * Whether or not Etherpad is currently open.
  10. *
  11. * @public
  12. * @type {boolean}
  13. */
  14. editing: false
  15. };
  16. export interface IEtherpadState {
  17. documentUrl?: string;
  18. editing: boolean;
  19. }
  20. /**
  21. * Reduces the Redux actions of the feature features/etherpad.
  22. */
  23. ReducerRegistry.register<IEtherpadState>(
  24. 'features/etherpad',
  25. (state = DEFAULT_STATE, action): IEtherpadState => {
  26. switch (action.type) {
  27. case SET_DOCUMENT_EDITING_STATUS:
  28. return {
  29. ...state,
  30. editing: action.editing
  31. };
  32. case SET_DOCUMENT_URL:
  33. return {
  34. ...state,
  35. documentUrl: action.documentUrl
  36. };
  37. default:
  38. return state;
  39. }
  40. });