Skip to content

Commit

Permalink
Details: Add allowedBlocks and TemplateLock attributes (#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

1 comment on commit 4ae5d8d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 4ae5d8d.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12647022864
📝 Reported issues:

Please sign in to comment.