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

Allow the specification of blocks allowed within columns #25778

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/block-library/src/column/block.json
Expand Up @@ -12,6 +12,9 @@
"width": {
"type": "string"
},
"allowedBlocks": {
"type": "array"
},
aristath marked this conversation as resolved.
Show resolved Hide resolved
"templateLock": {
"type": "string"
}
Expand Down
8 changes: 7 additions & 1 deletion packages/block-library/src/column/edit.js
Expand Up @@ -27,7 +27,12 @@ import { __ } from '@wordpress/i18n';
import { CSS_UNITS } from '../columns/utils';

function ColumnEdit( {
attributes: { verticalAlignment, width, templateLock = false },
attributes: {
verticalAlignment,
width,
templateLock = false,
allowedBlocks,
},
setAttributes,
clientId,
} ) {
Expand Down Expand Up @@ -67,6 +72,7 @@ function ColumnEdit( {
} );
const innerBlocksProps = useInnerBlocksProps( blockProps, {
templateLock,
allowedBlocks,
Copy link
Member

Choose a reason for hiding this comment

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

What happens when allowedBlocks is undefined?

renderAppender: hasChildBlocks
? undefined
: InnerBlocks.ButtonBlockAppender,
Expand Down