@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
38 lines (37 loc) • 1.23 kB
JavaScript
// packages/editor/src/components/revision-diff-panel/index.js
import { PanelBody } from "@wordpress/components";
import PostPanelRow from "../post-panel-row/index.mjs";
import { jsx } from "react/jsx-runtime";
function RevisionDiffPanel({ title, entries, initialOpen }) {
if (!entries) {
return null;
}
const fields = Object.entries(entries).map(([key, parts]) => /* @__PURE__ */ jsx(PostPanelRow, { label: key, children: /* @__PURE__ */ jsx("span", { className: "editor-revision-fields-diff__value", children: parts.map((part, index) => {
if (part.added) {
return /* @__PURE__ */ jsx(
"ins",
{
className: "editor-revision-fields-diff__added",
children: part.value
},
index
);
}
if (part.removed) {
return /* @__PURE__ */ jsx(
"del",
{
className: "editor-revision-fields-diff__removed",
children: part.value
},
index
);
}
return /* @__PURE__ */ jsx("span", { children: part.value }, index);
}) }) }, key));
return /* @__PURE__ */ jsx(PanelBody, { title, initialOpen, children: fields });
}
export {
RevisionDiffPanel as default
};
//# sourceMappingURL=index.mjs.map