Skip to content

Commit

Permalink
Core Block Reference: Add allowedBlocks field (WordPress#59424)
Browse files Browse the repository at this point in the history
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: fabiankaegy <[email protected]>
  • Loading branch information
3 people authored Feb 28, 2024
1 parent 682fe72 commit 6808d7d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bin/api-docs/gen-block-lib-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ function readBlockJSON( filename ) {
parent,
ancestor,
__experimental,
allowedBlocks,
} = blockjson;
const sourcefile = getSourceFromFile( filename );
const blockInfoList = [ `- **Name:** ${ name }` ];
Expand All @@ -172,6 +173,11 @@ function readBlockJSON( filename ) {
if ( ancestor?.length > 0 ) {
blockInfoList.push( `- **Ancestor:** ${ ancestor.join( ', ' ) }` );
}
if ( allowedBlocks?.length > 0 ) {
blockInfoList.push(
`- **Allowed Blocks:** ${ allowedBlocks.join( ', ' ) }`
);
}
if ( supports ) {
blockInfoList.push(
`- **Supports:** ${ processObjWithInnerKeys(
Expand Down
14 changes: 14 additions & 0 deletions docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Prompt visitors to take action with a group of button-style links. ([Source](htt

- **Name:** core/buttons
- **Category:** design
- **Allowed Blocks:** core/button
- **Supports:** align (full, wide), anchor, interactivity (clientNavigation), layout (default, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin), typography (fontSize, lineHeight), ~~html~~

## Calendar
Expand Down Expand Up @@ -105,6 +106,7 @@ Display content in multiple columns, with blocks added to each column. ([Source]

- **Name:** core/columns
- **Category:** design
- **Allowed Blocks:** core/column
- **Supports:** align (full, wide), anchor, color (background, button, gradients, heading, link, text), interactivity (clientNavigation), layout (default, ~~allowEditing~~, ~~allowInheriting~~, ~~allowSwitching~~), shadow, spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** isStackedOnMobile, templateLock, verticalAlignment

Expand Down Expand Up @@ -194,6 +196,7 @@ Displays a paginated navigation to next/previous set of comments, when applicabl
- **Name:** core/comments-pagination
- **Category:** theme
- **Parent:** core/comments
- **Allowed Blocks:** core/comments-pagination-previous, core/comments-pagination-numbers, core/comments-pagination-next
- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), layout (default, ~~allowInheriting~~, ~~allowSwitching~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~
- **Attributes:** paginationArrow

Expand Down Expand Up @@ -287,6 +290,7 @@ A form. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/blo
- **Name:** core/form
- **Experimental:** true
- **Category:** common
- **Allowed Blocks:** core/paragraph, core/heading, core/form-input, core/form-submit-button, core/form-submission-notification, core/group, core/columns
- **Supports:** anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~className~~
- **Attributes:** action, email, method, submissionMethod

Expand Down Expand Up @@ -319,6 +323,7 @@ A submission button for forms. ([Source](https://github.com/WordPress/gutenberg/
- **Experimental:** true
- **Category:** common
- **Ancestor:** core/form
- **Allowed Blocks:** core/buttons, core/button

## Classic

Expand All @@ -335,6 +340,7 @@ Display multiple images in a rich gallery. ([Source](https://github.com/WordPres

- **Name:** core/gallery
- **Category:** media
- **Allowed Blocks:** core/image
- **Supports:** align, anchor, color (background, gradients, ~~text~~), interactivity (clientNavigation), layout (default, ~~allowEditing~~, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin, padding), units (em, px, rem, vh, vw), ~~html~~
- **Attributes:** allowResize, caption, columns, fixedHeight, ids, imageCrop, images, linkTarget, linkTo, randomOrder, shortCodeTransforms, sizeSlug

Expand Down Expand Up @@ -408,6 +414,7 @@ Create a bulleted or numbered list. ([Source](https://github.com/WordPress/guten

- **Name:** core/list
- **Category:** text
- **Allowed Blocks:** core/list-item
- **Supports:** __unstablePasteTextInline, anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~className~~
- **Attributes:** ordered, placeholder, reversed, start, type, values

Expand All @@ -418,6 +425,7 @@ Create a list item. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/
- **Name:** core/list-item
- **Category:** text
- **Parent:** core/list
- **Allowed Blocks:** core/list
- **Supports:** interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~className~~
- **Attributes:** content, placeholder

Expand Down Expand Up @@ -463,6 +471,7 @@ A collection of blocks that allow visitors to get around your site. ([Source](ht

- **Name:** core/navigation
- **Category:** theme
- **Allowed Blocks:** core/navigation-link, core/search, core/social-links, core/page-list, core/spacer, core/home-link, core/site-title, core/site-logo, core/navigation-submenu, core/loginout, core/buttons
- **Supports:** align (full, wide), ariaLabel, inserter, interactivity, layout (allowSizingOnChildren, default, ~~allowInheriting~~, ~~allowSwitching~~, ~~allowVerticalAlignment~~), spacing (blockGap, units), typography (fontSize, lineHeight), ~~html~~, ~~renaming~~
- **Attributes:** __unstableLocation, backgroundColor, customBackgroundColor, customOverlayBackgroundColor, customOverlayTextColor, customTextColor, hasIcon, icon, maxNestingLevel, openSubmenusOnClick, overlayBackgroundColor, overlayMenu, overlayTextColor, ref, rgbBackgroundColor, rgbTextColor, showSubmenuIcon, templateLock, textColor

Expand All @@ -473,6 +482,7 @@ Add a page, link, or another item to your navigation. ([Source](https://github.c
- **Name:** core/navigation-link
- **Category:** design
- **Parent:** core/navigation
- **Allowed Blocks:** core/navigation-link, core/navigation-submenu, core/page-list
- **Supports:** interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~renaming~~, ~~reusable~~
- **Attributes:** description, id, isTopLevelLink, kind, label, opensInNewTab, rel, title, type, url

Expand Down Expand Up @@ -501,6 +511,7 @@ Display a list of all pages. ([Source](https://github.com/WordPress/gutenberg/tr

- **Name:** core/page-list
- **Category:** widgets
- **Allowed Blocks:** core/page-list-item
- **Supports:** interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~
- **Attributes:** isNested, parentPageID

Expand Down Expand Up @@ -566,6 +577,7 @@ This block is deprecated. Please use the Comments block instead. ([Source](https
- **Name:** core/post-comment
- **Experimental:** fse
- **Category:** theme
- **Allowed Blocks:** core/avatar, core/comment-author-name, core/comment-content, core/comment-date, core/comment-edit-link, core/comment-reply-link
- **Supports:** interactivity (clientNavigation), ~~html~~, ~~inserter~~
- **Attributes:** commentId

Expand Down Expand Up @@ -722,6 +734,7 @@ Displays a paginated navigation to next/previous set of posts, when applicable.
- **Name:** core/query-pagination
- **Category:** theme
- **Ancestor:** core/query
- **Allowed Blocks:** core/query-pagination-previous, core/query-pagination-numbers, core/query-pagination-next
- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), layout (default, ~~allowInheriting~~, ~~allowSwitching~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~
- **Attributes:** paginationArrow, showLabel

Expand Down Expand Up @@ -861,6 +874,7 @@ Display icons linking to your social media profiles or sites. ([Source](https://

- **Name:** core/social-links
- **Category:** widgets
- **Allowed Blocks:** core/social-link
- **Supports:** align (center, left, right), anchor, color (background, gradients, ~~enableContrastChecker~~, ~~text~~), interactivity (clientNavigation), layout (default, ~~allowInheriting~~, ~~allowSwitching~~, ~~allowVerticalAlignment~~), spacing (blockGap, margin, padding, units)
- **Attributes:** customIconBackgroundColor, customIconColor, iconBackgroundColor, iconBackgroundColorValue, iconColor, iconColorValue, openInNewTab, showLabels, size

Expand Down

0 comments on commit 6808d7d

Please sign in to comment.