@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
35 lines (32 loc) • 808 B
JavaScript
import { createElement } from "@wordpress/element";
/**
* WordPress dependencies
*/
import { withSelect } from '@wordpress/data';
/**
* Internal dependencies
*/
import PostTypeSupportCheck from '../post-type-support-check';
export function PostLastRevisionCheck({
lastRevisionId,
revisionsCount,
children
}) {
if (!lastRevisionId || revisionsCount < 2) {
return null;
}
return createElement(PostTypeSupportCheck, {
supportKeys: "revisions"
}, children);
}
export default withSelect(select => {
const {
getCurrentPostLastRevisionId,
getCurrentPostRevisionsCount
} = select('core/editor');
return {
lastRevisionId: getCurrentPostLastRevisionId(),
revisionsCount: getCurrentPostRevisionsCount()
};
})(PostLastRevisionCheck);
//# sourceMappingURL=check.js.map