UNPKG

@wordpress/editor

Version:
50 lines (49 loc) 1.78 kB
// packages/editor/src/components/sidebar/post-revision-summary.js import { useSelect } from "@wordpress/data"; import { ExternalLink, __experimentalVStack as VStack } from "@wordpress/components"; import { __ } from "@wordpress/i18n"; import { addQueryArgs } from "@wordpress/url"; import { store as editorStore } from "../../store/index.mjs"; import { unlock } from "../../lock-unlock.mjs"; import PostRevisionsTimeline from "../post-revisions-timeline/index.mjs"; import PostPanelSection from "../post-panel-section/index.mjs"; import PostCardPanel from "../post-card-panel/index.mjs"; import RevisionFieldsDiffPanel from "../revision-fields-diff/index.mjs"; import { Fragment, jsx, jsxs } from "react/jsx-runtime"; function PostRevisionSummary() { const { revisionId, postId } = useSelect((select) => { const { getCurrentRevisionId, getCurrentPostId } = unlock( select(editorStore) ); return { revisionId: getCurrentRevisionId(), postId: getCurrentPostId() }; }, []); if (!revisionId) { return null; } return /* @__PURE__ */ jsxs(Fragment, { children: [ /* @__PURE__ */ jsx(PostPanelSection, { className: "editor-post-summary", children: /* @__PURE__ */ jsxs(VStack, { spacing: 4, children: [ /* @__PURE__ */ jsx(PostCardPanel, { postId, hideActions: true }), /* @__PURE__ */ jsx( ExternalLink, { href: addQueryArgs("revision.php", { revision: revisionId }), children: __("Open classic revisions screen") } ) ] }) }), /* @__PURE__ */ jsx(RevisionFieldsDiffPanel, {}), /* @__PURE__ */ jsx(PostRevisionsTimeline, {}) ] }); } export { PostRevisionSummary as default }; //# sourceMappingURL=post-revision-summary.mjs.map