Skip to content

Commit

Permalink
Group: Add allowedBlocks attribute and pass it to innerBlockProps (#4…
Browse files Browse the repository at this point in the history
…9128)

Group: Add allowedBlocks attribute and pass it to innerBlockProps

Co-authored-by: Robin Schülein <robins@animalequality.de>
  • Loading branch information
sque89 and Robin Schülein committed Apr 20, 2023
1 parent 4e94b3c commit 646f2e8
Show file tree
Hide file tree
Showing 3 changed files with 11 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 @@ -303,7 +303,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
8 changes: 7 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,12 @@ 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 +136,7 @@ function GroupEdit( {
: { className: 'wp-block-group__inner-container' },
{
templateLock,
allowedBlocks,
renderAppender,
__unstableDisableLayoutClassNames: ! layoutSupportEnabled,
}
Expand Down

0 comments on commit 646f2e8

Please sign in to comment.