UNPKG

@wordpress/edit-post

Version:
30 lines (29 loc) 776 B
/** * WordPress dependencies */ import { compose, ifCondition } from '@wordpress/compose'; import { withSelect, withDispatch } from '@wordpress/data'; /** * Internal dependencies */ import BaseOption from './base'; import { store as editPostStore } from '../../../store'; export default compose(withSelect((select, { panelName }) => { const { isEditorPanelEnabled, isEditorPanelRemoved } = select(editPostStore); return { isRemoved: isEditorPanelRemoved(panelName), isChecked: isEditorPanelEnabled(panelName) }; }), ifCondition(({ isRemoved }) => !isRemoved), withDispatch((dispatch, { panelName }) => ({ onChange: () => dispatch(editPostStore).toggleEditorPanelEnabled(panelName) })))(BaseOption); //# sourceMappingURL=enable-panel.js.map