diff --git a/packages/block-library/src/table-of-contents/edit.js b/packages/block-library/src/table-of-contents/edit.js index c95b89200cb88c..2a545da3ae8bc9 100644 --- a/packages/block-library/src/table-of-contents/edit.js +++ b/packages/block-library/src/table-of-contents/edit.js @@ -10,11 +10,12 @@ import { } from '@wordpress/block-editor'; import { createBlock } from '@wordpress/blocks'; import { - PanelBody, Placeholder, ToggleControl, ToolbarButton, ToolbarGroup, + __experimentalToolsPanel as ToolsPanel, + __experimentalToolsPanelItem as ToolsPanelItem, } from '@wordpress/components'; import { useDispatch, useSelect } from '@wordpress/data'; import { renderToString } from '@wordpress/element'; @@ -108,25 +109,41 @@ export default function TableOfContentsEdit( { const inspectorControls = ( - - { + setAttributes( { + onlyIncludeCurrentPage: false, + } ); + } } + > + onlyIncludeCurrentPage !== false } label={ __( 'Only include current page' ) } - checked={ onlyIncludeCurrentPage } - onChange={ ( value ) => - setAttributes( { onlyIncludeCurrentPage: value } ) + onDeselect={ () => + setAttributes( { onlyIncludeCurrentPage: false } ) } - help={ - onlyIncludeCurrentPage - ? __( - 'Only including headings from the current page (if the post is paginated).' - ) - : __( - 'Toggle to only include headings from the current page (if the post is paginated).' - ) - } - /> - + isShownByDefault + > + + setAttributes( { onlyIncludeCurrentPage: value } ) + } + help={ + onlyIncludeCurrentPage + ? __( + 'Only including headings from the current page (if the post is paginated).' + ) + : __( + 'Toggle to only include headings from the current page (if the post is paginated).' + ) + } + /> + + );