From 3bfc351cc875482f5992e8f5a7e4bcfde5f45b64 Mon Sep 17 00:00:00 2001 From: Fabian Todt Date: Fri, 21 Apr 2023 09:03:26 +0200 Subject: [PATCH] Add allowedBlocks to innerBlocks of Media & Text block --- docs/reference-guides/core-blocks.md | 2 +- packages/block-library/src/media-text/block.json | 3 +++ packages/block-library/src/media-text/edit.js | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index ade895c75a359a..6c6879d36107ab 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -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 diff --git a/packages/block-library/src/media-text/block.json b/packages/block-library/src/media-text/block.json index ded230a2eb1006..ac88c9ca6d4df9 100644 --- a/packages/block-library/src/media-text/block.json +++ b/packages/block-library/src/media-text/block.json @@ -89,6 +89,9 @@ }, "focalPoint": { "type": "object" + }, + "allowedBlocks": { + "type": "array" } }, "supports": { diff --git a/packages/block-library/src/media-text/edit.js b/packages/block-library/src/media-text/edit.js index 7f46febcef5179..f2848a584d0d8a 100644 --- a/packages/block-library/src/media-text/edit.js +++ b/packages/block-library/src/media-text/edit.js @@ -143,6 +143,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes, clientId } ) { mediaWidth, rel, verticalAlignment, + allowedBlocks, } = attributes; const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG; @@ -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 (