UNPKG

@wordpress/editor

Version:
37 lines (34 loc) 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = PostVisibilityCheck; var _data = require("@wordpress/data"); var _store = require("../../store"); /** * WordPress dependencies */ /** * Internal dependencies */ /** * Determines if the current post can be edited (published) * and passes this information to the provided render function. * * @param {Object} props The component props. * @param {Function} props.render Function to render the component. * Receives an object with a `canEdit` property. * @return {JSX.Element} The rendered component. */ function PostVisibilityCheck({ render }) { const canEdit = (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; }); return render({ canEdit }); } //# sourceMappingURL=check.js.map