@wordpress/edit-post
Version:
Edit Post module for WordPress.
33 lines (30 loc) • 951 B
JavaScript
/**
* WordPress dependencies
*/
import { compose, ifCondition } from '@wordpress/compose';
import { withSelect, withDispatch } from '@wordpress/data';
/**
* Internal dependencies
*/
import BaseOption from './base';
export default compose(withSelect(function (select, _ref) {
var panelName = _ref.panelName;
var _select = select('core/edit-post'),
isEditorPanelEnabled = _select.isEditorPanelEnabled,
isEditorPanelRemoved = _select.isEditorPanelRemoved;
return {
isRemoved: isEditorPanelRemoved(panelName),
isChecked: isEditorPanelEnabled(panelName)
};
}), ifCondition(function (_ref2) {
var isRemoved = _ref2.isRemoved;
return !isRemoved;
}), withDispatch(function (dispatch, _ref3) {
var panelName = _ref3.panelName;
return {
onChange: function onChange() {
return dispatch('core/edit-post').toggleEditorPanelEnabled(panelName);
}
};
}))(BaseOption);
//# sourceMappingURL=enable-panel.js.map