Skip to content

Commit

Permalink
Details: Add allowedBlocks and TemplateLock attributes (WordPress#68489)
Browse files Browse the repository at this point in the history
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
  • Loading branch information
3 people authored Jan 7, 2025
1 parent 2c674ab commit 4ae5d8d
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 @@ -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

Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/details/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"type": "rich-text",
"source": "rich-text",
"selector": "summary"
},
"allowedBlocks": {
"type": "array"
}
},
"supports": {
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/details/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 4ae5d8d

Please sign in to comment.