Skip to content

Commit

Permalink
Global styles: Reselect blocks after pasting styles (#47590)
Browse files Browse the repository at this point in the history
  • Loading branch information
glendaviesnz authored Feb 2, 2023
1 parent 584ec05 commit fb1671b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/block-editor/src/components/block-actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export default function BlockActions( {
setBlockMovingClientId,
setNavigationMode,
selectBlock,
clearSelectedBlock,
multiSelect,
} = useDispatch( blockEditorStore );

const notifyCopy = useNotifyCopy();
Expand Down Expand Up @@ -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
);
},
} );
}

1 comment on commit fb1671b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in fb1671b.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4070621452
📝 Reported issues:

Please sign in to comment.