@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
30 lines (29 loc) • 919 B
JavaScript
/**
* WordPress dependencies
*/
import { useDispatch, useSelect } from '@wordpress/data';
import { privateApis as preferencesPrivateApis } from '@wordpress/preferences';
/**
* Internal dependencies
*/
import { unlock } from '../../lock-unlock';
import { store as editorStore } from '../../store';
import { jsx as _jsx } from "react/jsx-runtime";
const {
PreferenceBaseOption
} = unlock(preferencesPrivateApis);
export default function EnablePublishSidebarOption(props) {
const isChecked = useSelect(select => {
return select(editorStore).isPublishSidebarEnabled();
}, []);
const {
enablePublishSidebar,
disablePublishSidebar
} = useDispatch(editorStore);
return /*#__PURE__*/_jsx(PreferenceBaseOption, {
isChecked: isChecked,
onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar(),
...props
});
}
//# sourceMappingURL=enable-publish-sidebar.js.map