Skip to content
Prev Previous commit
Next Next commit
Update save.js
  • Loading branch information
mikachan committed Sep 23, 2025
commit 15848d446f22bd55bc3a2ae4e1e85ea6834ac162
8 changes: 2 additions & 6 deletions packages/block-library/src/table-of-contents/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@
* WordPress dependencies
*/
import { useBlockProps } from '@wordpress/block-editor';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import TableOfContentsList from './list';
import { linearToNestedHeadingList } from './utils';

export default function save( { attributes: { headings = [], ariaLabel } } ) {
export default function save( { attributes: { headings = [] } } ) {
if ( headings.length === 0 ) {
return null;
}
return (
<nav
{ ...useBlockProps.save() }
aria-label={ ariaLabel || __( 'Table of Contents' ) }
>
<nav { ...useBlockProps.save() }>
<ol>
<TableOfContentsList
nestedHeadingList={ linearToNestedHeadingList( headings ) }
Expand Down