@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
39 lines (35 loc) • 995 B
JavaScript
import { createElement } from "@wordpress/element";
/**
* External dependencies
*/
import { get } from 'lodash';
/**
* WordPress dependencies
*/
import { withInstanceId, compose } from '@wordpress/compose';
import { withSelect } from '@wordpress/data';
/**
* Internal dependencies
*/
import PostTypeSupportCheck from '../post-type-support-check';
export function PostAuthorCheck({
hasAssignAuthorAction,
authors,
children
}) {
if (!hasAssignAuthorAction || !authors || 1 >= authors.length) {
return null;
}
return createElement(PostTypeSupportCheck, {
supportKeys: "author"
}, children);
}
export default compose([withSelect(select => {
const post = select('core/editor').getCurrentPost();
return {
hasAssignAuthorAction: get(post, ['_links', 'wp:action-assign-author'], false),
postType: select('core/editor').getCurrentPostType(),
authors: select('core').getAuthors()
};
}), withInstanceId])(PostAuthorCheck);
//# sourceMappingURL=check.js.map