You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

actions.any.js 996B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // @flow
  2. import type { Dispatch } from 'redux';
  3. import {
  4. SET_TOOLBOX_ENABLED,
  5. SET_TOOLBOX_VISIBLE
  6. } from './actionTypes';
  7. /**
  8. * Enables/disables the toolbox.
  9. *
  10. * @param {boolean} enabled - True to enable the toolbox or false to disable it.
  11. * @returns {{
  12. * type: SET_TOOLBOX_ENABLED,
  13. * enabled: boolean
  14. * }}
  15. */
  16. export function setToolboxEnabled(enabled: boolean): Object {
  17. return {
  18. type: SET_TOOLBOX_ENABLED,
  19. enabled
  20. };
  21. }
  22. /**
  23. * Shows/hides the toolbox.
  24. *
  25. * @param {boolean} visible - True to show the toolbox or false to hide it.
  26. * @returns {Function}
  27. */
  28. export function setToolboxVisible(visible: boolean): Object {
  29. return (dispatch: Dispatch<any>, getState: Function) => {
  30. const { toolbarConfig: { alwaysVisible } } = getState()['features/base/config'];
  31. if (!visible && alwaysVisible) {
  32. return;
  33. }
  34. dispatch({
  35. type: SET_TOOLBOX_VISIBLE,
  36. visible
  37. });
  38. };
  39. }