From 4ae5d8d629d04c28f34c64af7c5c901fe941cbd2 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Tue, 7 Jan 2025 16:23:17 +0900 Subject: [PATCH] Details: Add allowedBlocks and TemplateLock attributes (#68489) Co-authored-by: t-hamano Co-authored-by: Mamaduka --- docs/reference-guides/core-blocks.md | 2 +- packages/block-library/src/details/block.json | 3 +++ packages/block-library/src/details/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 6f8a69e04a880..3b251813e41c0 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -255,7 +255,7 @@ Hide and show additional content. ([Source](https://github.com/WordPress/gutenbe - **Name:** core/details - **Category:** text - **Supports:** align (full, wide), anchor, color (background, gradients, link, text), interactivity (clientNavigation), layout (~~allowEditing~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** showContent, summary +- **Attributes:** allowedBlocks, showContent, summary ## Embed diff --git a/packages/block-library/src/details/block.json b/packages/block-library/src/details/block.json index 0cd0040cdde1b..e28d94c03b9aa 100644 --- a/packages/block-library/src/details/block.json +++ b/packages/block-library/src/details/block.json @@ -16,6 +16,9 @@ "type": "rich-text", "source": "rich-text", "selector": "summary" + }, + "allowedBlocks": { + "type": "array" } }, "supports": { diff --git a/packages/block-library/src/details/edit.js b/packages/block-library/src/details/edit.js index 9bebdee1a7670..9cf6a7a845612 100644 --- a/packages/block-library/src/details/edit.js +++ b/packages/block-library/src/details/edit.js @@ -31,11 +31,12 @@ const TEMPLATE = [ ]; function DetailsEdit( { attributes, setAttributes, clientId } ) { - const { showContent, summary } = attributes; + const { showContent, summary, allowedBlocks } = attributes; const blockProps = useBlockProps(); const innerBlocksProps = useInnerBlocksProps( blockProps, { template: TEMPLATE, __experimentalCaptureToolbars: true, + allowedBlocks, } ); const dropdownMenuProps = useToolsPanelDropdownMenuProps();