@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
48 lines (39 loc) • 989 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PostPendingStatusCheck = PostPendingStatusCheck;
exports.default = void 0;
var _lodash = require("lodash");
var _compose = require("@wordpress/compose");
var _data = require("@wordpress/data");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PostPendingStatusCheck({
hasPublishAction,
isPublished,
children
}) {
if (isPublished || !hasPublishAction) {
return null;
}
return children;
}
var _default = (0, _compose.compose)((0, _data.withSelect)(select => {
const {
isCurrentPostPublished,
getCurrentPostType,
getCurrentPost
} = select('core/editor');
return {
hasPublishAction: (0, _lodash.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false),
isPublished: isCurrentPostPublished(),
postType: getCurrentPostType()
};
}))(PostPendingStatusCheck);
exports.default = _default;
//# sourceMappingURL=check.js.map