Skip to content

Commit

Permalink
Media & Text: Add allowedBlocks attribute and pass it to innerBlock (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gaambo authored Apr 25, 2023
1 parent 152bdcc commit 744ba04
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ Set media and words side-by-side for a richer layout. ([Source](https://github.c
- **Name:** core/media-text
- **Category:** media
- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** align, focalPoint, href, imageFill, isStackedOnMobile, linkClass, linkDestination, linkTarget, mediaAlt, mediaId, mediaLink, mediaPosition, mediaSizeSlug, mediaType, mediaUrl, mediaWidth, rel, verticalAlignment
- **Attributes:** align, allowedBlocks, focalPoint, href, imageFill, isStackedOnMobile, linkClass, linkDestination, linkTarget, mediaAlt, mediaId, mediaLink, mediaPosition, mediaSizeSlug, mediaType, mediaUrl, mediaWidth, rel, verticalAlignment

## Unsupported

Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/media-text/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
},
"focalPoint": {
"type": "object"
},
"allowedBlocks": {
"type": "array"
}
},
"supports": {
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/media-text/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes, clientId } ) {
mediaWidth,
rel,
verticalAlignment,
allowedBlocks,
} = attributes;
const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;

Expand Down Expand Up @@ -315,7 +316,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes, clientId } ) {

const innerBlocksProps = useInnerBlocksProps(
{ className: 'wp-block-media-text__content' },
{ template: TEMPLATE }
{ template: TEMPLATE, allowedBlocks }
);

return (
Expand Down

0 comments on commit 744ba04

Please sign in to comment.