@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
44 lines (43 loc) • 2.06 kB
JavaScript
// packages/editor/src/components/sidebar/post-revision-summary.js
import { useSelect } from "@wordpress/data";
import { __experimentalVStack as VStack } from "@wordpress/components";
import { store as editorStore } from "../../store/index.mjs";
import { unlock } from "../../lock-unlock.mjs";
import RevisionAuthorPanel from "../revision-author-panel/index.mjs";
import RevisionCreatedPanel from "../revision-created-panel/index.mjs";
import { PostContentInformationUI } from "../post-content-information/index.mjs";
import RevisionFieldsDiffPanel from "../revision-fields-diff/index.mjs";
import PostPanelSection from "../post-panel-section/index.mjs";
import PostCardPanel from "../post-card-panel/index.mjs";
import { OpenRevisionsClassicScreen } from "./post-summary.mjs";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
function PostRevisionSummary() {
const { revisionId, postId, postContent } = useSelect((select) => {
const { getCurrentRevisionId, getCurrentRevision, getCurrentPostId } = unlock(select(editorStore));
const _revisionId = getCurrentRevisionId();
return {
revisionId: _revisionId,
postId: getCurrentPostId(),
postContent: _revisionId && getCurrentRevision()?.content?.raw
};
}, []);
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__ */ jsxs(VStack, { spacing: 1, children: [
/* @__PURE__ */ jsx(PostContentInformationUI, { postContent }),
/* @__PURE__ */ jsx(RevisionCreatedPanel, {})
] }),
/* @__PURE__ */ jsx(OpenRevisionsClassicScreen, { revisionId }),
/* @__PURE__ */ jsx(RevisionAuthorPanel, {})
] }) }),
/* @__PURE__ */ jsx(RevisionFieldsDiffPanel, {})
] });
}
export {
PostRevisionSummary as default
};
//# sourceMappingURL=post-revision-summary.mjs.map