Skip to content

Commit

Permalink
Update block-settings-dropdown.js
Browse files Browse the repository at this point in the history
  • Loading branch information
richtabor committed Jan 25, 2023
1 parent 1cb9ec5 commit e180b7c
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ const POPOVER_PROPS = {
variant: 'toolbar',
};

function CopyMenuItem( { blocks, onCopy } ) {
function CopyMenuItem( { blocks, onCopy, label } ) {
const ref = useCopyToClipboard( () => serialize( blocks ), onCopy );
const copyMenuItemLabel =
const copyMenuItemBlocksLabel =
blocks.length > 1 ? __( 'Copy blocks' ) : __( 'Copy block' );
const copyMenuItemLabel = label ? label : copyMenuItemBlocksLabel;
return <MenuItem ref={ ref }>{ copyMenuItemLabel }</MenuItem>;
}

Expand Down Expand Up @@ -263,9 +264,6 @@ export function BlockSettingsDropdown( {
blocks={ blocks }
onCopy={ onCopy }
/>
<MenuItem onClick={ onPasteStyles }>
{ __( 'Paste styles' ) }
</MenuItem>
{ canDuplicate && (
<MenuItem
onClick={ pipe(
Expand Down Expand Up @@ -314,6 +312,16 @@ export function BlockSettingsDropdown( {
/>
) }
</MenuGroup>
<MenuGroup>
<CopyMenuItem
blocks={ blocks }
onCopy={ onCopy }
label={ __( 'Copy styles' ) }
/>
<MenuItem onClick={ onPasteStyles }>
{ __( 'Paste styles' ) }
</MenuItem>
</MenuGroup>
<BlockSettingsMenuControls.Slot
fillProps={ { onClose } }
clientIds={ clientIds }
Expand Down

0 comments on commit e180b7c

Please sign in to comment.