@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
27 lines (26 loc) • 827 B
JavaScript
/**
* WordPress dependencies
*/
import { compose } from '@wordpress/compose';
import { withSelect, withDispatch } from '@wordpress/data';
import { privateApis as preferencesPrivateApis } from '@wordpress/preferences';
/**
* Internal dependencies
*/
import { unlock } from '../../lock-unlock';
import { store as editorStore } from '../../store';
const {
PreferenceBaseOption
} = unlock(preferencesPrivateApis);
export default compose(withSelect(select => ({
isChecked: select(editorStore).isPublishSidebarEnabled()
})), withDispatch(dispatch => {
const {
enablePublishSidebar,
disablePublishSidebar
} = dispatch(editorStore);
return {
onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar()
};
}))(PreferenceBaseOption);
//# sourceMappingURL=enable-publish-sidebar.js.map