From 0242d6b0c317a1fc0f1f46129505ca3c2e11c01b Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Tue, 31 Jan 2023 15:57:58 +1300 Subject: [PATCH 1/2] Reselect blocks after pasting styles in order to make sure that any optional tools panel items are selected --- .../block-editor/src/components/block-actions/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/block-editor/src/components/block-actions/index.js b/packages/block-editor/src/components/block-actions/index.js index a7fe38245e5ac..7cefa015a4646 100644 --- a/packages/block-editor/src/components/block-actions/index.js +++ b/packages/block-editor/src/components/block-actions/index.js @@ -58,6 +58,8 @@ export default function BlockActions( { setBlockMovingClientId, setNavigationMode, selectBlock, + clearSelectedBlock, + multiSelect, } = useDispatch( blockEditorStore ); const notifyCopy = useNotifyCopy(); @@ -132,6 +134,13 @@ export default function BlockActions( { }, async onPasteStyles() { await pasteStyles( blocks ); + + // Need to reselect the block(s) in order for optional tool panel control changes to register + clearSelectedBlock(); + multiSelect( + blocks[ 0 ].clientId, + blocks[ blocks.length - 1 ].clientId + ); }, } ); } From 8a1f03ccc92ea51e30c107a8a4a588312c28372a Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Tue, 31 Jan 2023 16:36:18 +1300 Subject: [PATCH 2/2] Add period to comment --- packages/block-editor/src/components/block-actions/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/block-actions/index.js b/packages/block-editor/src/components/block-actions/index.js index 7cefa015a4646..cbaee74fe199f 100644 --- a/packages/block-editor/src/components/block-actions/index.js +++ b/packages/block-editor/src/components/block-actions/index.js @@ -135,7 +135,7 @@ export default function BlockActions( { async onPasteStyles() { await pasteStyles( blocks ); - // Need to reselect the block(s) in order for optional tool panel control changes to register + // Need to reselect the block(s) in order for optional tool panel control changes to register. clearSelectedBlock(); multiSelect( blocks[ 0 ].clientId,