@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
37 lines (34 loc) • 985 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = PostScheduleCheck;
var _data = require("@wordpress/data");
var _store = require("../../store");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Wrapper component that renders its children only if post has a publish action.
*
* @param {Object} props Props.
* @param {Element} props.children Children to be rendered.
*
* @return {Component} - The component to be rendered or null if there is no publish action.
*/
function PostScheduleCheck({
children
}) {
const hasPublishAction = (0, _data.useSelect)(select => {
var _select$getCurrentPos;
return (_select$getCurrentPos = select(_store.store).getCurrentPost()._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false;
}, []);
if (!hasPublishAction) {
return null;
}
return children;
}
//# sourceMappingURL=check.js.map