Skip to content

Commit

Permalink
Move copy and pasting styles menu items to a separate menu group (#47430
Browse files Browse the repository at this point in the history
)
  • Loading branch information
richtabor authored Jan 26, 2023
1 parent 4133f9c commit 26a6bd4
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 26a6bd4

Please sign in to comment.