@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
43 lines (39 loc) • 1.16 kB
JavaScript
import { createElement } from "@wordpress/element";
/**
* WordPress dependencies
*/
import { sprintf, _n } from '@wordpress/i18n';
import { Button } from '@wordpress/components';
import { withSelect } from '@wordpress/data';
import { backup } from '@wordpress/icons';
/**
* Internal dependencies
*/
import PostLastRevisionCheck from './check';
import { getWPAdminURL } from '../../utils/url';
function LastRevision({
lastRevisionId,
revisionsCount
}) {
return createElement(PostLastRevisionCheck, null, createElement(Button, {
href: getWPAdminURL('revision.php', {
revision: lastRevisionId,
gutenberg: true
}),
className: "editor-post-last-revision__title",
icon: backup
}, sprintf(
/* translators: %d: number of revisions */
_n('%d Revision', '%d Revisions', revisionsCount), revisionsCount)));
}
export default withSelect(select => {
const {
getCurrentPostLastRevisionId,
getCurrentPostRevisionsCount
} = select('core/editor');
return {
lastRevisionId: getCurrentPostLastRevisionId(),
revisionsCount: getCurrentPostRevisionsCount()
};
})(LastRevision);
//# sourceMappingURL=index.js.map