@wordpress/block-library
Version:
Block library for the WordPress editor.
25 lines (24 loc) • 735 B
JavaScript
// packages/block-library/src/table-of-contents/save.js
import { useBlockProps } from "@wordpress/block-editor";
import TableOfContentsList from "./list";
import { linearToNestedHeadingList } from "./utils";
import { jsx } from "react/jsx-runtime";
function save({
attributes: { headings = [], ordered = true }
}) {
if (headings.length === 0) {
return null;
}
const ListTag = ordered ? "ol" : "ul";
return /* @__PURE__ */ jsx("nav", { ...useBlockProps.save(), children: /* @__PURE__ */ jsx(ListTag, { children: /* @__PURE__ */ jsx(
TableOfContentsList,
{
nestedHeadingList: linearToNestedHeadingList(headings),
ordered
}
) }) });
}
export {
save as default
};
//# sourceMappingURL=save.js.map