From c88d91be9d2f0f3f7a1dde25ad61731874a07105 Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Fri, 13 Dec 2024 13:05:23 +0530 Subject: [PATCH] Read More: Refactor settings panel to use ToolsPanel --- packages/block-library/src/read-more/edit.js | 38 ++++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/packages/block-library/src/read-more/edit.js b/packages/block-library/src/read-more/edit.js index 8486dd6e50141..25cf5d7e1ac51 100644 --- a/packages/block-library/src/read-more/edit.js +++ b/packages/block-library/src/read-more/edit.js @@ -6,7 +6,11 @@ import { RichText, useBlockProps, } from '@wordpress/block-editor'; -import { ToggleControl, PanelBody } from '@wordpress/components'; +import { + ToggleControl, + __experimentalToolsPanel as ToolsPanel, + __experimentalToolsPanelItem as ToolsPanelItem, +} from '@wordpress/components'; import { createBlock, getDefaultBlockName } from '@wordpress/blocks'; import { __ } from '@wordpress/i18n'; @@ -19,18 +23,30 @@ export default function ReadMore( { return ( <> - - setAttributes( { linkTarget: '_self' } ) } + > + - setAttributes( { - linkTarget: value ? '_blank' : '_self', - } ) + isShownByDefault + hasValue={ () => linkTarget !== '_self' } + onDeselect={ () => + setAttributes( { linkTarget: '_self' } ) } - checked={ linkTarget === '_blank' } - /> - + > + + setAttributes( { + linkTarget: value ? '_blank' : '_self', + } ) + } + checked={ linkTarget === '_blank' } + /> + +