@wordpress/block-library
Version:
Block library for the WordPress editor.
28 lines (24 loc) • 644 B
JavaScript
import { createElement } from "@wordpress/element";
/**
* WordPress dependencies
*/
import { useBlockProps } from '@wordpress/block-editor';
/**
* Internal dependencies
*/
import TableOfContentsList from './list';
import { linearToNestedHeadingList } from './utils';
export default function save(_ref) {
let {
attributes: {
headings = []
}
} = _ref;
if (headings.length === 0) {
return null;
}
return createElement("nav", useBlockProps.save(), createElement("ol", null, createElement(TableOfContentsList, {
nestedHeadingList: linearToNestedHeadingList(headings)
})));
}
//# sourceMappingURL=save.js.map