Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block Setttings Menu Controls: Add unstableDisplayLocation prop. #43987

Merged
merged 5 commits into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ function ReusableBlocksMenuItems() {
);
}
```

## Props

### `context`

- **Type:** `String`
- **Default:** `undefined`

A string representing the context where the component is being included. This can be used to conditionalise certain beheaviours.
getdave marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ import { store as blockEditorStore } from '../../store';

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

const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
const BlockSettingsMenuControlsSlot = ( {
fillProps,
clientIds = null,
context,
} ) => {
const { selectedBlocks, selectedClientIds, canRemove } = useSelect(
( select ) => {
const {
Expand Down Expand Up @@ -58,7 +62,14 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
( isGroupable || isUngroupable ) && canRemove;

return (
<Slot fillProps={ { ...fillProps, selectedBlocks, selectedClientIds } }>
<Slot
fillProps={ {
...fillProps,
selectedBlocks,
selectedClientIds,
context,
getdave marked this conversation as resolved.
Show resolved Hide resolved
getdave marked this conversation as resolved.
Show resolved Hide resolved
} }
>
{ ( fills ) => {
if (
! fills?.length > 0 &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export function BlockSettingsDropdown( {
clientIds,
__experimentalSelectBlock,
children,
context,
...props
} ) {
const blockClientIds = castArray( clientIds );
Expand Down Expand Up @@ -289,6 +290,7 @@ export function BlockSettingsDropdown( {
<BlockSettingsMenuControls.Slot
fillProps={ { onClose } }
clientIds={ clientIds }
context={ context }
/>
{ typeof children === 'function'
? children( { onClose } )
Expand Down