Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group: Add allowedBlocks attribute and pass it to innerBlockProps #49128

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ Gather blocks in a layout container. ([Source](https://github.com/WordPress/gute
- **Name:** core/group
- **Category:** design
- **Supports:** align (full, wide), anchor, ariaLabel, color (background, gradients, link, text), dimensions (minHeight), position (sticky), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** tagName, templateLock
- **Attributes:** allowedBlocks, tagName, templateLock

## Heading

Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/group/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"templateLock": {
"type": [ "string", "boolean" ],
"enum": [ "all", "insert", "contentOnly", false ]
},
"allowedBlocks": {
"type": "array"
}
},
"supports": {
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/group/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function GroupEdit( {
[ clientId ]
);

const { tagName: TagName = 'div', templateLock, layout = {} } = attributes;
const { tagName: TagName = 'div', templateLock, allowedBlocks, layout = {} } = attributes;

// Layout settings.
const defaultLayout = useSetting( 'layout' ) || {};
Expand Down Expand Up @@ -131,6 +131,7 @@ function GroupEdit( {
: { className: 'wp-block-group__inner-container' },
{
templateLock,
allowedBlocks,
renderAppender,
__unstableDisableLayoutClassNames: ! layoutSupportEnabled,
}
Expand Down