Skip to content

Commit

Permalink
Reorder menu items as detailed in #50446 (#50453)
Browse files Browse the repository at this point in the history
  • Loading branch information
glendaviesnz authored May 9, 2023
1 parent e5e87c0 commit 24e2967
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
import {
createSlotFill,
MenuGroup,
MenuItem,
__experimentalStyleProvider as StyleProvider,
} from '@wordpress/components';
import { useSelect } from '@wordpress/data';
import { pipe } from '@wordpress/compose';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -17,6 +20,7 @@ import {
} from '../convert-to-group-buttons';
import { BlockLockMenuItem, useBlockLock } from '../block-lock';
import { store as blockEditorStore } from '../../store';
import BlockModeToggle from '../block-settings-menu/block-mode-toggle';

const { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );

Expand Down Expand Up @@ -74,16 +78,32 @@ const BlockSettingsMenuControlsSlot = ( {

return (
<MenuGroup>
{ showConvertToGroupButton && (
<ConvertToGroupButton
{ ...convertToGroupButtonProps }
onClose={ fillProps?.onClose }
/>
) }
{ showLockButton && (
<BlockLockMenuItem
clientId={ selectedClientIds[ 0 ] }
/>
) }
{ fills }
{ showConvertToGroupButton && (
<ConvertToGroupButton
{ ...convertToGroupButtonProps }
onClose={ fillProps?.onClose }
{ fillProps?.canMove && ! fillProps?.onlyBlock && (
<MenuItem
onClick={ pipe(
fillProps?.onClose,
fillProps?.onMoveTo
) }
>
{ __( 'Move to' ) }
</MenuItem>
) }
{ fillProps?.count === 1 && (
<BlockModeToggle
clientId={ fillProps?.firstBlockClientId }
onToggle={ fillProps?.onClose }
/>
) }
</MenuGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { pipe, useCopyToClipboard } from '@wordpress/compose';
*/
import BlockActions from '../block-actions';
import BlockIcon from '../block-icon';
import BlockModeToggle from './block-mode-toggle';
import BlockHTMLConvertButton from './block-html-convert-button';
import __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';
import BlockSettingsMenuControls from '../block-settings-menu-controls';
Expand Down Expand Up @@ -291,19 +290,6 @@ export function BlockSettingsDropdown( {
</MenuItem>
</>
) }
{ canMove && ! onlyBlock && (
<MenuItem
onClick={ pipe( onClose, onMoveTo ) }
>
{ __( 'Move to' ) }
</MenuItem>
) }
{ count === 1 && (
<BlockModeToggle
clientId={ firstBlockClientId }
onToggle={ onClose }
/>
) }
</MenuGroup>
<MenuGroup>
<CopyMenuItem
Expand All @@ -316,7 +302,14 @@ export function BlockSettingsDropdown( {
</MenuItem>
</MenuGroup>
<BlockSettingsMenuControls.Slot
fillProps={ { onClose } }
fillProps={ {
onClose,
canMove,
onMoveTo,
onlyBlock,
count,
firstBlockClientId,
} }
clientIds={ clientIds }
__unstableDisplayLocation={
__unstableDisplayLocation
Expand Down

1 comment on commit 24e2967

@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 24e2967.
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/4930746920
📝 Reported issues:

Please sign in to comment.