From af17ec08a97096744d51519846a1b32d7cc63382 Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Tue, 23 Dec 2025 19:28:08 +0900 Subject: [PATCH] Block support: Add anchor support for dynamic blocks --- .../block-api/block-supports.md | 2 +- docs/reference-guides/core-blocks.md | 144 +++++++++--------- lib/block-supports/anchor.php | 64 ++++++++ lib/load.php | 1 + .../src/accordion-item/block.json | 1 + .../src/accordion-panel/block.json | 1 + .../block-library/src/archives/block.json | 1 + packages/block-library/src/avatar/block.json | 1 + .../block-library/src/breadcrumbs/block.json | 1 + .../block-library/src/calendar/block.json | 1 + .../block-library/src/categories/block.json | 1 + .../src/comment-author-name/block.json | 1 + .../src/comment-content/block.json | 1 + .../block-library/src/comment-date/block.json | 1 + .../src/comment-edit-link/block.json | 1 + .../src/comment-reply-link/block.json | 1 + .../src/comment-template/block.json | 1 + .../src/comments-pagination-next/block.json | 1 + .../comments-pagination-numbers/block.json | 1 + .../comments-pagination-previous/block.json | 1 + .../src/comments-pagination/block.json | 1 + .../src/comments-title/block.json | 2 +- .../block-library/src/comments/block.json | 1 + packages/block-library/src/embed/block.json | 1 + .../block-library/src/footnotes/block.json | 1 + .../block-library/src/home-link/block.json | 1 + .../src/latest-comments/block.json | 1 + .../block-library/src/latest-posts/block.json | 1 + .../block-library/src/loginout/block.json | 1 + packages/block-library/src/math/block.json | 1 + packages/block-library/src/more/block.json | 1 + .../src/navigation-link/block.json | 1 + .../src/navigation-overlay-close/block.json | 1 + .../src/navigation-submenu/block.json | 1 + .../block-library/src/navigation/block.json | 1 + .../block-library/src/nextpage/block.json | 1 + .../src/page-list-item/block.json | 1 + .../block-library/src/page-list/block.json | 1 + .../src/post-author-biography/block.json | 1 + .../src/post-author-name/block.json | 1 + .../block-library/src/post-author/block.json | 1 + .../src/post-comments-count/block.json | 1 + .../src/post-comments-form/block.json | 1 + .../src/post-comments-link/block.json | 1 + .../block-library/src/post-content/block.json | 1 + .../block-library/src/post-date/block.json | 1 + .../block-library/src/post-excerpt/block.json | 1 + .../src/post-featured-image/block.json | 1 + .../src/post-navigation-link/block.json | 1 + .../src/post-template/block.json | 1 + .../block-library/src/post-terms/block.json | 1 + .../src/post-time-to-read/block.json | 1 + .../block-library/src/post-title/block.json | 1 + .../src/query-no-results/block.json | 1 + .../src/query-pagination-next/block.json | 1 + .../src/query-pagination-numbers/block.json | 1 + .../src/query-pagination-previous/block.json | 1 + .../src/query-pagination/block.json | 1 + .../block-library/src/query-title/block.json | 1 + .../block-library/src/query-total/block.json | 1 + packages/block-library/src/query/block.json | 1 + .../block-library/src/read-more/block.json | 1 + packages/block-library/src/rss/block.json | 1 + packages/block-library/src/search/block.json | 1 + .../block-library/src/site-logo/block.json | 1 + .../block-library/src/site-tagline/block.json | 1 + .../block-library/src/site-title/block.json | 1 + .../block-library/src/social-link/block.json | 1 + .../src/table-of-contents/block.json | 1 + packages/block-library/src/tabs/block.json | 1 + .../block-library/src/tag-cloud/block.json | 1 + .../block-library/src/term-count/block.json | 1 + .../src/term-description/block.json | 1 + .../block-library/src/term-name/block.json | 1 + .../src/term-template/block.json | 1 + .../block-library/src/terms-query/block.json | 1 + phpunit/block-supports/anchor.php | 85 +++++++++++ 77 files changed, 295 insertions(+), 74 deletions(-) create mode 100644 lib/block-supports/anchor.php create mode 100644 phpunit/block-supports/anchor.php diff --git a/docs/reference-guides/block-api/block-supports.md b/docs/reference-guides/block-api/block-supports.md index dcc70c5ae2aec5..b719ebbe17feb7 100644 --- a/docs/reference-guides/block-api/block-supports.md +++ b/docs/reference-guides/block-api/block-supports.md @@ -75,7 +75,7 @@ function Edit( { attributes } ) { - Type: `boolean` - Default value: `false` -Anchors let you link directly to a specific block on a page. This property adds a field to define an id for the block and a button to copy the direct link. _Important: It doesn't work with dynamic blocks yet._ +Anchors let you link directly to a specific block on a page. This property adds a field to define an id for the block and a button to copy the direct link. ```js // Declare support for anchor links. diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 3fdb9f888d338d..5a6c1f6551bb1f 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -36,7 +36,7 @@ Wraps the heading and panel in one unit. ([Source](https://github.com/WordPress/ - **Category:** design - **Parent:** core/accordion - **Allowed Blocks:** core/accordion-heading, core/accordion-panel -- **Supports:** color (background, gradients, text), contentRole, interactivity, layout (~~allowEditing~~), shadow, spacing (blockGap, margin), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, text), contentRole, interactivity, layout (~~allowEditing~~), shadow, spacing (blockGap, margin), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** openByDefault ## Accordion Panel @@ -46,7 +46,7 @@ Contains the hidden or revealed content beneath the heading. ([Source](https://g - **Name:** core/accordion-panel - **Category:** design - **Parent:** core/accordion-item -- **Supports:** allowedBlocks, color (background, gradients, text), contentRole, interactivity, layout (~~allowEditing~~), shadow, spacing (blockGap, padding), typography (fontSize, lineHeight), ~~html~~, ~~lock~~, ~~visibility~~ +- **Supports:** allowedBlocks, anchor, color (background, gradients, text), contentRole, interactivity, layout (~~allowEditing~~), shadow, spacing (blockGap, padding), typography (fontSize, lineHeight), ~~html~~, ~~lock~~, ~~visibility~~ - **Attributes:** isSelected, openByDefault, templateLock ## Archives @@ -55,7 +55,7 @@ Display a date archive of your posts. ([Source](https://github.com/WordPress/gut - **Name:** core/archives - **Category:** widgets -- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align, anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** displayAsDropdown, showLabel, showPostCounts, type ## Audio @@ -73,7 +73,7 @@ Add a user’s avatar. ([Source](https://github.com/WordPress/gutenberg/tree/tru - **Name:** core/avatar - **Category:** theme -- **Supports:** align, color (~~background~~, ~~text~~), filter (duotone), interactivity (clientNavigation), spacing (margin, padding), ~~alignWide~~, ~~html~~ +- **Supports:** align, anchor, color (~~background~~, ~~text~~), filter (duotone), interactivity (clientNavigation), spacing (margin, padding), ~~alignWide~~, ~~html~~ - **Attributes:** isLink, linkTarget, size, userId ## Pattern @@ -91,7 +91,7 @@ Display a breadcrumb trail showing the path to the current page. ([Source](https - **Name:** core/breadcrumbs - **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** prefersTaxonomy, separator, showCurrentItem, showHomeItem, showOnHomePage ## Button @@ -119,7 +119,7 @@ A calendar of your site’s posts. ([Source](https://github.com/WordPress/gutenb - **Name:** core/calendar - **Category:** widgets -- **Supports:** align, color (background, link, text), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align, anchor, color (background, link, text), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** month, year ## Terms List @@ -128,7 +128,7 @@ Display a list of all terms of a given taxonomy. ([Source](https://github.com/Wo - **Name:** core/categories - **Category:** widgets -- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align, anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** displayAsDropdown, label, showEmpty, showHierarchy, showLabel, showOnlyTopLevel, showPostCounts, taxonomy ## Code @@ -178,7 +178,7 @@ Displays the name of the author of the comment. ([Source](https://github.com/Wor - **Name:** core/comment-author-name - **Category:** theme - **Ancestor:** core/comment-template -- **Supports:** color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** isLink, linkTarget, textAlign ## Comment Content @@ -188,7 +188,7 @@ Displays the contents of a comment. ([Source](https://github.com/WordPress/guten - **Name:** core/comment-content - **Category:** theme - **Ancestor:** core/comment-template -- **Supports:** color (background, gradients, link, text), spacing (padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, link, text), spacing (padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Comment Date @@ -198,7 +198,7 @@ Displays the date on which the comment was posted. ([Source](https://github.com/ - **Name:** core/comment-date - **Category:** theme - **Ancestor:** core/comment-template -- **Supports:** color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** format, isLink ## Comment Edit Link @@ -208,7 +208,7 @@ Displays a link to edit the comment in the WordPress Dashboard. This link is onl - **Name:** core/comment-edit-link - **Category:** theme - **Ancestor:** core/comment-template -- **Supports:** color (background, gradients, link, ~~text~~), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, link, ~~text~~), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** linkTarget, textAlign ## Comment Reply Link @@ -218,7 +218,7 @@ Displays a link to reply to a comment. ([Source](https://github.com/WordPress/gu - **Name:** core/comment-reply-link - **Category:** theme - **Ancestor:** core/comment-template -- **Supports:** color (background, gradients, link, ~~text~~), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, link, ~~text~~), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Comment Template @@ -228,7 +228,7 @@ Contains the block elements used to display a comment, like the title, date, aut - **Name:** core/comment-template - **Category:** design - **Parent:** core/comments -- **Supports:** align, interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** align, anchor, interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ ## Comments @@ -236,7 +236,7 @@ An advanced block that allows displaying post comments using different visual co - **Name:** core/comments - **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** legacy, tagName ## Comments Pagination @@ -247,7 +247,7 @@ Displays a paginated navigation to next/previous set of comments, when applicabl - **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~~ +- **Supports:** align, anchor, color (background, gradients, link, text), interactivity (clientNavigation), layout (default, ~~allowInheriting~~, ~~allowSwitching~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** paginationArrow ## Comments Next Page @@ -257,7 +257,7 @@ Displays the next comment's page link. ([Source](https://github.com/WordPress/gu - **Name:** core/comments-pagination-next - **Category:** theme - **Parent:** core/comments-pagination -- **Supports:** color (background, gradients, ~~text~~), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, gradients, ~~text~~), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label ## Comments Page Numbers @@ -267,7 +267,7 @@ Displays a list of page numbers for comments pagination. ([Source](https://githu - **Name:** core/comments-pagination-numbers - **Category:** theme - **Parent:** core/comments-pagination -- **Supports:** color (background, gradients, ~~text~~), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, gradients, ~~text~~), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ ## Comments Previous Page @@ -276,7 +276,7 @@ Displays the previous comment's page link. ([Source](https://github.com/WordPres - **Name:** core/comments-pagination-previous - **Category:** theme - **Parent:** core/comments-pagination -- **Supports:** color (background, gradients, ~~text~~), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, gradients, ~~text~~), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label ## Comments Title @@ -286,7 +286,7 @@ Displays a title with the number of comments. ([Source](https://github.com/WordP - **Name:** core/comments-title - **Category:** theme - **Ancestor:** core/comments -- **Supports:** align, color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~anchor~~, ~~html~~ +- **Supports:** align, anchor, color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** level, levelOptions, showCommentsCount, showPostTitle, textAlign ## Cover @@ -313,7 +313,7 @@ Add a block that displays content pulled from other sites, like Twitter or YouTu - **Name:** core/embed - **Category:** embed -- **Supports:** align, interactivity (clientNavigation), spacing (margin) +- **Supports:** align, anchor, interactivity (clientNavigation), spacing (margin) - **Attributes:** allowResponsive, caption, previewable, providerNameSlug, responsive, type, url ## File @@ -331,7 +331,7 @@ Display footnotes added to the page. ([Source](https://github.com/WordPress/gute - **Name:** core/footnotes - **Category:** text -- **Supports:** color (background, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~inserter~~, ~~multiple~~, ~~reusable~~ +- **Supports:** anchor, color (background, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~inserter~~, ~~multiple~~, ~~reusable~~ ## Form @@ -419,7 +419,7 @@ Create a link that always points to the homepage of the site. Usually not necess - **Name:** core/home-link - **Category:** design - **Parent:** core/navigation -- **Supports:** interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label ## Custom HTML @@ -446,7 +446,7 @@ Display a list of your most recent comments. ([Source](https://github.com/WordPr - **Name:** core/latest-comments - **Category:** widgets -- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align, anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** commentsToShow, displayAvatar, displayContent, displayDate ## Latest Posts @@ -455,7 +455,7 @@ Display a list of your most recent posts. ([Source](https://github.com/WordPress - **Name:** core/latest-posts - **Category:** widgets -- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align, anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** addLinkToFeaturedImage, categories, columns, displayAuthor, displayFeaturedImage, displayPostContent, displayPostContentRadio, displayPostDate, excerptLength, featuredImageAlign, featuredImageSizeHeight, featuredImageSizeSlug, featuredImageSizeWidth, order, orderBy, postLayout, postsToShow, selectedAuthor ## List @@ -485,7 +485,7 @@ Show login & logout links. ([Source](https://github.com/WordPress/gutenberg/tree - **Name:** core/loginout - **Category:** theme -- **Supports:** className, color (background, gradients, link, ~~text~~), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight) +- **Supports:** anchor, className, color (background, gradients, link, ~~text~~), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight) - **Attributes:** displayLoginAsForm, redirectToCurrent ## Math @@ -494,7 +494,7 @@ Display mathematical notation using LaTeX. ([Source](https://github.com/WordPres - **Name:** core/math - **Category:** text -- **Supports:** color (background, gradients, text), spacing (margin, padding), typography (fontSize), ~~html~~ +- **Supports:** anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize), ~~html~~ - **Attributes:** latex, mathML ## Media & Text @@ -521,7 +521,7 @@ Content before this block will be shown in the excerpt on your archives page. ([ - **Name:** core/more - **Category:** design -- **Supports:** interactivity (clientNavigation), ~~className~~, ~~customClassName~~, ~~html~~, ~~multiple~~ +- **Supports:** anchor, interactivity (clientNavigation), ~~className~~, ~~customClassName~~, ~~html~~, ~~multiple~~ - **Attributes:** customText, noTeaser ## Navigation @@ -531,7 +531,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, contentRole, inserter, interactivity, layout (allowSizingOnChildren, default, ~~allowInheriting~~, ~~allowSwitching~~, ~~allowVerticalAlignment~~), spacing (blockGap, units), typography (fontSize, lineHeight), ~~html~~, ~~renaming~~ +- **Supports:** align (full, wide), anchor, ariaLabel, contentRole, 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, overlay, overlayBackgroundColor, overlayMenu, overlayTextColor, ref, rgbBackgroundColor, rgbTextColor, showSubmenuIcon, templateLock, textColor ## Custom Link @@ -542,7 +542,7 @@ Add a page, link, or another item to your navigation. ([Source](https://github.c - **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~~ +- **Supports:** anchor, interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~renaming~~, ~~reusable~~ - **Attributes:** description, id, isTopLevelLink, kind, label, opensInNewTab, rel, title, type, url ## Navigation Overlay Close @@ -552,7 +552,7 @@ A customizable button to close overlays. ([Source](https://github.com/WordPress/ - **Name:** core/navigation-overlay-close - **Experimental:** true - **Category:** design -- **Supports:** color (background, text, ~~gradients~~), spacing (padding), typography (fontSize, lineHeight) +- **Supports:** anchor, color (background, text, ~~gradients~~), spacing (padding), typography (fontSize, lineHeight) - **Attributes:** displayMode, text ## Submenu @@ -562,7 +562,7 @@ Add a submenu to your navigation. ([Source](https://github.com/WordPress/gutenbe - **Name:** core/navigation-submenu - **Category:** design - **Parent:** core/navigation -- **Supports:** interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** description, id, isTopLevelItem, kind, label, opensInNewTab, rel, title, type, url ## Page Break @@ -572,7 +572,7 @@ Separate your content into a multi-page experience. ([Source](https://github.com - **Name:** core/nextpage - **Category:** design - **Parent:** core/post-content -- **Supports:** interactivity (clientNavigation), ~~className~~, ~~customClassName~~, ~~html~~ +- **Supports:** anchor, interactivity (clientNavigation), ~~className~~, ~~customClassName~~, ~~html~~ ## Page List @@ -581,7 +581,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:** color (background, gradients, link, text), contentRole, interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, gradients, link, text), contentRole, interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** isNested, parentPageID ## Page List Item @@ -591,7 +591,7 @@ Displays a page inside a list of all pages. ([Source](https://github.com/WordPre - **Name:** core/page-list-item - **Category:** widgets - **Parent:** core/page-list -- **Supports:** interactivity (clientNavigation), ~~html~~, ~~inserter~~, ~~lock~~, ~~reusable~~ +- **Supports:** anchor, interactivity (clientNavigation), ~~html~~, ~~inserter~~, ~~lock~~, ~~reusable~~ - **Attributes:** hasChildren, id, label, link, title ## Paragraph @@ -618,7 +618,7 @@ Display post author details such as name, avatar, and bio. ([Source](https://git - **Name:** core/post-author - **Category:** theme -- **Supports:** color (background, gradients, link, text), filter (duotone), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, link, text), filter (duotone), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** avatarSize, byline, isLink, linkTarget, showAvatar, showBio, textAlign ## Author Biography @@ -627,7 +627,7 @@ The author biography. ([Source](https://github.com/WordPress/gutenberg/tree/trun - **Name:** core/post-author-biography - **Category:** theme -- **Supports:** color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight) +- **Supports:** anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight) - **Attributes:** textAlign ## Author Name @@ -636,7 +636,7 @@ The author name. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/pac - **Name:** core/post-author-name - **Category:** theme -- **Supports:** color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** isLink, linkTarget, textAlign ## Comment (deprecated) @@ -656,7 +656,7 @@ Display a post's comments count. ([Source](https://github.com/WordPress/gutenber - **Name:** core/post-comments-count - **Category:** theme -- **Supports:** color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Comments Form @@ -665,7 +665,7 @@ Display a post's comments form. ([Source](https://github.com/WordPress/gutenberg - **Name:** core/post-comments-form - **Category:** theme -- **Supports:** color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Comments Link @@ -674,7 +674,7 @@ Displays the link to the current post comments. ([Source](https://github.com/Wor - **Name:** core/post-comments-link - **Category:** theme -- **Supports:** color (background, link, ~~text~~), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, link, ~~text~~), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Content @@ -683,7 +683,7 @@ Displays the contents of a post or page. ([Source](https://github.com/WordPress/ - **Name:** core/post-content - **Category:** theme -- **Supports:** align (full, wide), background (backgroundImage, backgroundSize), color (background, gradients, heading, link, text), dimensions (minHeight), interactivity (clientNavigation), layout, spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, background (backgroundImage, backgroundSize), color (background, gradients, heading, link, text), dimensions (minHeight), interactivity (clientNavigation), layout, spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** tagName ## Date @@ -692,7 +692,7 @@ Display a custom date. ([Source](https://github.com/WordPress/gutenberg/tree/tru - **Name:** core/post-date - **Category:** theme -- **Supports:** color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** datetime, format, isLink, textAlign ## Excerpt @@ -701,7 +701,7 @@ Display the excerpt. ([Source](https://github.com/WordPress/gutenberg/tree/trunk - **Name:** core/post-excerpt - **Category:** theme -- **Supports:** color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** excerptLength, moreText, showMoreOnNewLine, textAlign ## Featured Image @@ -710,7 +710,7 @@ Display a post's featured image. ([Source](https://github.com/WordPress/gutenber - **Name:** core/post-featured-image - **Category:** theme -- **Supports:** align (center, full, left, right, wide), color (~~background~~, ~~text~~), filter (duotone), interactivity (clientNavigation), shadow (), spacing (margin, padding), ~~html~~ +- **Supports:** align (center, full, left, right, wide), anchor, color (~~background~~, ~~text~~), filter (duotone), interactivity (clientNavigation), shadow (), spacing (margin, padding), ~~html~~ - **Attributes:** aspectRatio, customGradient, customOverlayColor, dimRatio, gradient, height, isLink, linkTarget, overlayColor, rel, scale, sizeSlug, useFirstImageFromPost, width ## Post Navigation Link @@ -719,7 +719,7 @@ Displays the next or previous post link that is adjacent to the current post. ([ - **Name:** core/post-navigation-link - **Category:** theme -- **Supports:** color (background, link, text), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, link, text), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** arrow, label, linkLabel, showTitle, taxonomy, textAlign, type ## Post Template @@ -729,7 +729,7 @@ Contains the block elements used to render a post, like the title, date, feature - **Name:** core/post-template - **Category:** theme - **Ancestor:** core/query -- **Supports:** align (full, wide), color (background, gradients, link, text), interactivity (clientNavigation), layout, spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), interactivity (clientNavigation), layout, spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ ## Post Terms @@ -737,7 +737,7 @@ Post terms. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages - **Name:** core/post-terms - **Category:** theme -- **Supports:** color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** prefix, separator, suffix, term, textAlign ## Time to Read @@ -746,7 +746,7 @@ Show minutes required to finish reading the post. Can also show a word count. ([ - **Name:** core/post-time-to-read - **Category:** theme -- **Supports:** color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** averageReadingSpeed, displayAsRange, displayMode, textAlign ## Title @@ -755,7 +755,7 @@ Displays the title of a post, page, or any other content-type. ([Source](https:/ - **Name:** core/post-title - **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** isLink, level, levelOptions, linkTarget, rel, textAlign ## Preformatted @@ -782,7 +782,7 @@ An advanced block that allows displaying post types based on different query par - **Name:** core/query - **Category:** theme -- **Supports:** align (full, wide), contentRole, interactivity, layout, ~~html~~ +- **Supports:** align (full, wide), anchor, contentRole, interactivity, layout, ~~html~~ - **Attributes:** enhancedPagination, namespace, query, queryId, tagName ## No Results @@ -792,7 +792,7 @@ Contains the block elements used to render content when no query results are fou - **Name:** core/query-no-results - **Category:** theme - **Ancestor:** core/query -- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** align, anchor, color (background, gradients, link, text), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ ## Pagination @@ -802,7 +802,7 @@ Displays a paginated navigation to next/previous set of posts, when applicable. - **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~~ +- **Supports:** align, anchor, color (background, gradients, link, text), interactivity (clientNavigation), layout (default, ~~allowInheriting~~, ~~allowSwitching~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** paginationArrow, showLabel ## Next Page @@ -812,7 +812,7 @@ Displays the next posts page link. ([Source](https://github.com/WordPress/gutenb - **Name:** core/query-pagination-next - **Category:** theme - **Parent:** core/query-pagination -- **Supports:** color (background, gradients, ~~text~~), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, gradients, ~~text~~), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label ## Page Numbers @@ -822,7 +822,7 @@ Displays a list of page numbers for pagination. ([Source](https://github.com/Wor - **Name:** core/query-pagination-numbers - **Category:** theme - **Parent:** core/query-pagination -- **Supports:** color (background, gradients, ~~text~~), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, gradients, ~~text~~), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** midSize ## Previous Page @@ -832,7 +832,7 @@ Displays the previous posts page link. ([Source](https://github.com/WordPress/gu - **Name:** core/query-pagination-previous - **Category:** theme - **Parent:** core/query-pagination -- **Supports:** color (background, gradients, ~~text~~), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, gradients, ~~text~~), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label ## Query Title @@ -841,7 +841,7 @@ Display the query title. ([Source](https://github.com/WordPress/gutenberg/tree/t - **Name:** core/query-title - **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** level, levelOptions, showPrefix, showSearchTerm, textAlign, type ## Query Total @@ -851,7 +851,7 @@ Display the total number of results in a query. ([Source](https://github.com/Wor - **Name:** core/query-total - **Category:** theme - **Ancestor:** core/query -- **Supports:** align (full, wide), color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** displayType ## Quote @@ -869,7 +869,7 @@ Displays the link of a post, page, or any other content-type. ([Source](https:// - **Name:** core/read-more - **Category:** theme -- **Supports:** color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** content, linkTarget ## RSS @@ -878,7 +878,7 @@ Display entries from any RSS or Atom feed. ([Source](https://github.com/WordPres - **Name:** core/rss - **Category:** widgets -- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), ~~html~~ +- **Supports:** align, anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), ~~html~~ - **Attributes:** blockLayout, columns, displayAuthor, displayDate, displayExcerpt, excerptLength, feedURL, itemsToShow, openInNewTab, rel ## Search @@ -887,7 +887,7 @@ Help visitors find your content. ([Source](https://github.com/WordPress/gutenber - **Name:** core/search - **Category:** widgets -- **Supports:** align (center, left, right), color (background, gradients, text), interactivity, spacing (margin), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (center, left, right), anchor, color (background, gradients, text), interactivity, spacing (margin), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** buttonPosition, buttonText, buttonUseIcon, isSearchFieldHidden, label, placeholder, query, showLabel, width, widthUnit ## Separator @@ -914,7 +914,7 @@ Display an image to represent this site. Update this block and the changes apply - **Name:** core/site-logo - **Category:** theme -- **Supports:** align, color (~~background~~, ~~text~~), filter (duotone), interactivity (clientNavigation), spacing (margin, padding), ~~alignWide~~, ~~html~~ +- **Supports:** align, anchor, color (~~background~~, ~~text~~), filter (duotone), interactivity (clientNavigation), spacing (margin, padding), ~~alignWide~~, ~~html~~ - **Attributes:** isLink, linkTarget, shouldSyncIcon, width ## Site Tagline @@ -923,7 +923,7 @@ Describe in a few words what this site is about. This is important for search re - **Name:** core/site-tagline - **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, text), contentRole, interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, text), contentRole, interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** level, levelOptions, textAlign ## Site Title @@ -932,7 +932,7 @@ Displays the name of this site. Update the block, and the changes apply everywhe - **Name:** core/site-title - **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** isLink, level, levelOptions, linkTarget, textAlign ## Social Icon @@ -942,7 +942,7 @@ Display an icon linking to a social profile or site. ([Source](https://github.co - **Name:** core/social-link - **Category:** widgets - **Parent:** core/social-links -- **Supports:** interactivity (clientNavigation), ~~html~~, ~~reusable~~ +- **Supports:** anchor, interactivity (clientNavigation), ~~html~~, ~~reusable~~ - **Attributes:** label, rel, service, url ## Social Icons @@ -991,7 +991,7 @@ Summarize your post with a list of headings. Add HTML anchors to Heading blocks - **Name:** core/table-of-contents - **Experimental:** true - **Category:** design -- **Supports:** ariaLabel, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, ariaLabel, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** headings, maxLevel, onlyIncludeCurrentPage, ordered ## Tabs @@ -1002,7 +1002,7 @@ Display content in a tabbed interface to help users navigate detailed content wi - **Experimental:** true - **Category:** design - **Allowed Blocks:** core/tab -- **Supports:** align, color (~~background~~, ~~text~~), interactivity, spacing (blockGap, margin, ~~padding~~), typography (fontSize), ~~html~~ +- **Supports:** align, anchor, color (~~background~~, ~~text~~), interactivity, spacing (blockGap, margin, ~~padding~~), typography (fontSize), ~~html~~ - **Attributes:** activeTabIndex, customTabActiveColor, customTabActiveTextColor, customTabHoverColor, customTabHoverTextColor, customTabInactiveColor, customTabTextColor, orientation, tabActiveColor, tabActiveTextColor, tabHoverColor, tabHoverTextColor, tabInactiveColor, tabTextColor, tabsId ## Tag Cloud @@ -1011,7 +1011,7 @@ A cloud of popular keywords, each sized by how often it appears. ([Source](https - **Name:** core/tag-cloud - **Category:** widgets -- **Supports:** align, interactivity (clientNavigation), spacing (margin, padding), typography (lineHeight), ~~html~~ +- **Supports:** align, anchor, interactivity (clientNavigation), spacing (margin, padding), typography (lineHeight), ~~html~~ - **Attributes:** largestFontSize, numberOfTags, showTagCounts, smallestFontSize, taxonomy ## Template Part @@ -1029,7 +1029,7 @@ Displays the post count of a taxonomy term. ([Source](https://github.com/WordPre - **Name:** core/term-count - **Category:** theme -- **Supports:** color (background, gradients, text), interactivity (clientNavigation), spacing (padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, text), interactivity (clientNavigation), spacing (padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** bracketType ## Term Description @@ -1038,7 +1038,7 @@ Display the description of categories, tags and custom taxonomies when viewing a - **Name:** core/term-description - **Category:** theme -- **Supports:** align (full, wide), color (background, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Term Name @@ -1047,7 +1047,7 @@ Displays the name of a taxonomy term. ([Source](https://github.com/WordPress/gut - **Name:** core/term-name - **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, link, text), interactivity (clientNavigation), spacing (padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** isLink, level, levelOptions, textAlign ## Term Template @@ -1057,7 +1057,7 @@ Contains the block elements used to render a taxonomy term, like the name, descr - **Name:** core/term-template - **Category:** theme - **Ancestor:** core/terms-query -- **Supports:** align (full, wide), color (background, gradients, link, text), interactivity (clientNavigation), layout, spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), interactivity (clientNavigation), layout, spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ ## Terms Query @@ -1065,7 +1065,7 @@ An advanced block that allows displaying taxonomy terms based on different query - **Name:** core/terms-query - **Category:** theme -- **Supports:** align (full, wide), interactivity, layout, ~~html~~ +- **Supports:** align (full, wide), anchor, interactivity, layout, ~~html~~ - **Attributes:** tagName, termQuery ## Text Columns (deprecated) diff --git a/lib/block-supports/anchor.php b/lib/block-supports/anchor.php new file mode 100644 index 00000000000000..4516c4cd020a13 --- /dev/null +++ b/lib/block-supports/anchor.php @@ -0,0 +1,64 @@ +attributes ) { + $block_type->attributes = array(); + } + + if ( ! array_key_exists( 'anchor', $block_type->attributes ) ) { + $block_type->attributes['anchor'] = array( + 'type' => 'string', + ); + } +} + +/** + * Add the anchor id to the output. + * + * @param WP_Block_Type $block_type Block Type. + * @param array $block_attributes Block attributes. + * + * @return array Block anchor id. + */ +function gutenberg_apply_anchor_support( $block_type, $block_attributes ) { + if ( ! $block_attributes ) { + return array(); + } + + $has_anchor_support = block_has_support( $block_type, array( 'anchor' ), false ); + if ( ! $has_anchor_support ) { + return array(); + } + + $has_anchor = array_key_exists( 'anchor', $block_attributes ); + if ( ! $has_anchor || empty( $block_attributes['anchor'] ) ) { + return array(); + } + + return array( 'id' => $block_attributes['anchor'] ); +} + +// Register the block support. +WP_Block_Supports::get_instance()->register( + 'anchor', + array( + 'register_attribute' => 'gutenberg_register_anchor_support', + 'apply' => 'gutenberg_apply_anchor_support', + ) +); diff --git a/lib/load.php b/lib/load.php index de60320737312c..91a3cbf9a4925d 100644 --- a/lib/load.php +++ b/lib/load.php @@ -186,6 +186,7 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/block-supports/background.php'; require __DIR__ . '/block-supports/block-style-variations.php'; require __DIR__ . '/block-supports/aria-label.php'; +require __DIR__ . '/block-supports/anchor.php'; require __DIR__ . '/block-supports/block-visibility.php'; // Client-side media processing. diff --git a/packages/block-library/src/accordion-item/block.json b/packages/block-library/src/accordion-item/block.json index 43029948aa029e..b3c55c5bbb396a 100644 --- a/packages/block-library/src/accordion-item/block.json +++ b/packages/block-library/src/accordion-item/block.json @@ -8,6 +8,7 @@ "parent": [ "core/accordion" ], "allowedBlocks": [ "core/accordion-heading", "core/accordion-panel" ], "supports": { + "anchor": true, "html": false, "color": { "background": true, diff --git a/packages/block-library/src/accordion-panel/block.json b/packages/block-library/src/accordion-panel/block.json index 1ebeafd9a777ca..da8930b2ad0212 100644 --- a/packages/block-library/src/accordion-panel/block.json +++ b/packages/block-library/src/accordion-panel/block.json @@ -7,6 +7,7 @@ "description": "Contains the hidden or revealed content beneath the heading.", "parent": [ "core/accordion-item" ], "supports": { + "anchor": true, "html": false, "color": { "background": true, diff --git a/packages/block-library/src/archives/block.json b/packages/block-library/src/archives/block.json index 0351a4b694c002..d70f3a4ce43a61 100644 --- a/packages/block-library/src/archives/block.json +++ b/packages/block-library/src/archives/block.json @@ -25,6 +25,7 @@ } }, "supports": { + "anchor": true, "align": true, "__experimentalBorder": { "radius": true, diff --git a/packages/block-library/src/avatar/block.json b/packages/block-library/src/avatar/block.json index 5c13258bb3c11d..0cb92d81865c75 100644 --- a/packages/block-library/src/avatar/block.json +++ b/packages/block-library/src/avatar/block.json @@ -25,6 +25,7 @@ }, "usesContext": [ "postType", "postId", "commentId" ], "supports": { + "anchor": true, "html": false, "align": true, "alignWide": false, diff --git a/packages/block-library/src/breadcrumbs/block.json b/packages/block-library/src/breadcrumbs/block.json index e7b6f6f4201a95..597e36c41ae50b 100644 --- a/packages/block-library/src/breadcrumbs/block.json +++ b/packages/block-library/src/breadcrumbs/block.json @@ -30,6 +30,7 @@ }, "usesContext": [ "postId", "postType", "templateSlug" ], "supports": { + "anchor": true, "html": false, "align": [ "wide", "full" ], "spacing": { diff --git a/packages/block-library/src/calendar/block.json b/packages/block-library/src/calendar/block.json index 5816b8c75eaca5..c714f44e5e4b3d 100644 --- a/packages/block-library/src/calendar/block.json +++ b/packages/block-library/src/calendar/block.json @@ -16,6 +16,7 @@ } }, "supports": { + "anchor": true, "align": true, "html": false, "color": { diff --git a/packages/block-library/src/categories/block.json b/packages/block-library/src/categories/block.json index 8320fa912a175f..e9192495b73825 100644 --- a/packages/block-library/src/categories/block.json +++ b/packages/block-library/src/categories/block.json @@ -43,6 +43,7 @@ }, "usesContext": [ "enhancedPagination" ], "supports": { + "anchor": true, "align": true, "html": false, "spacing": { diff --git a/packages/block-library/src/comment-author-name/block.json b/packages/block-library/src/comment-author-name/block.json index 1889d054c940e7..50bd3ef0945a92 100644 --- a/packages/block-library/src/comment-author-name/block.json +++ b/packages/block-library/src/comment-author-name/block.json @@ -22,6 +22,7 @@ }, "usesContext": [ "commentId" ], "supports": { + "anchor": true, "html": false, "spacing": { "margin": true, diff --git a/packages/block-library/src/comment-content/block.json b/packages/block-library/src/comment-content/block.json index 0e812299a45e89..fc58cc50a7e4db 100644 --- a/packages/block-library/src/comment-content/block.json +++ b/packages/block-library/src/comment-content/block.json @@ -14,6 +14,7 @@ } }, "supports": { + "anchor": true, "color": { "gradients": true, "link": true, diff --git a/packages/block-library/src/comment-date/block.json b/packages/block-library/src/comment-date/block.json index 1e8110f836d93b..39ac5ccc29ac18 100644 --- a/packages/block-library/src/comment-date/block.json +++ b/packages/block-library/src/comment-date/block.json @@ -18,6 +18,7 @@ }, "usesContext": [ "commentId" ], "supports": { + "anchor": true, "html": false, "color": { "gradients": true, diff --git a/packages/block-library/src/comment-edit-link/block.json b/packages/block-library/src/comment-edit-link/block.json index 578b284715c2a0..013a449e782cdf 100644 --- a/packages/block-library/src/comment-edit-link/block.json +++ b/packages/block-library/src/comment-edit-link/block.json @@ -18,6 +18,7 @@ } }, "supports": { + "anchor": true, "html": false, "color": { "link": true, diff --git a/packages/block-library/src/comment-reply-link/block.json b/packages/block-library/src/comment-reply-link/block.json index 68aa93c3c1526a..e7f19fa2bf6c7b 100644 --- a/packages/block-library/src/comment-reply-link/block.json +++ b/packages/block-library/src/comment-reply-link/block.json @@ -14,6 +14,7 @@ } }, "supports": { + "anchor": true, "color": { "gradients": true, "link": true, diff --git a/packages/block-library/src/comment-template/block.json b/packages/block-library/src/comment-template/block.json index 08fd591b42409b..f0d3caeb625a52 100644 --- a/packages/block-library/src/comment-template/block.json +++ b/packages/block-library/src/comment-template/block.json @@ -9,6 +9,7 @@ "textdomain": "default", "usesContext": [ "postId" ], "supports": { + "anchor": true, "align": true, "html": false, "reusable": false, diff --git a/packages/block-library/src/comments-pagination-next/block.json b/packages/block-library/src/comments-pagination-next/block.json index 22e20bfa8dbf2d..34d568743dbb1f 100644 --- a/packages/block-library/src/comments-pagination-next/block.json +++ b/packages/block-library/src/comments-pagination-next/block.json @@ -14,6 +14,7 @@ }, "usesContext": [ "postId", "comments/paginationArrow" ], "supports": { + "anchor": true, "reusable": false, "html": false, "color": { diff --git a/packages/block-library/src/comments-pagination-numbers/block.json b/packages/block-library/src/comments-pagination-numbers/block.json index 4d06094edd6170..a4cd4fd1850cb6 100644 --- a/packages/block-library/src/comments-pagination-numbers/block.json +++ b/packages/block-library/src/comments-pagination-numbers/block.json @@ -9,6 +9,7 @@ "textdomain": "default", "usesContext": [ "postId" ], "supports": { + "anchor": true, "reusable": false, "html": false, "color": { diff --git a/packages/block-library/src/comments-pagination-previous/block.json b/packages/block-library/src/comments-pagination-previous/block.json index 0871b000c569dd..f71e89e4b283a5 100644 --- a/packages/block-library/src/comments-pagination-previous/block.json +++ b/packages/block-library/src/comments-pagination-previous/block.json @@ -14,6 +14,7 @@ }, "usesContext": [ "postId", "comments/paginationArrow" ], "supports": { + "anchor": true, "reusable": false, "html": false, "color": { diff --git a/packages/block-library/src/comments-pagination/block.json b/packages/block-library/src/comments-pagination/block.json index b29d95bc4f1c9a..59b8d30ccc9131 100644 --- a/packages/block-library/src/comments-pagination/block.json +++ b/packages/block-library/src/comments-pagination/block.json @@ -27,6 +27,7 @@ "comments/paginationArrow": "paginationArrow" }, "supports": { + "anchor": true, "align": true, "reusable": false, "html": false, diff --git a/packages/block-library/src/comments-title/block.json b/packages/block-library/src/comments-title/block.json index b66b741e1916a0..675aae734df176 100644 --- a/packages/block-library/src/comments-title/block.json +++ b/packages/block-library/src/comments-title/block.json @@ -29,7 +29,7 @@ } }, "supports": { - "anchor": false, + "anchor": true, "align": true, "html": false, "__experimentalBorder": { diff --git a/packages/block-library/src/comments/block.json b/packages/block-library/src/comments/block.json index ceb8f750c3472d..47f58ed5afe332 100644 --- a/packages/block-library/src/comments/block.json +++ b/packages/block-library/src/comments/block.json @@ -17,6 +17,7 @@ } }, "supports": { + "anchor": true, "align": [ "wide", "full" ], "html": false, "color": { diff --git a/packages/block-library/src/embed/block.json b/packages/block-library/src/embed/block.json index 5bfb63b0fa9e94..d6f7c501d65074 100644 --- a/packages/block-library/src/embed/block.json +++ b/packages/block-library/src/embed/block.json @@ -41,6 +41,7 @@ } }, "supports": { + "anchor": true, "align": true, "spacing": { "margin": true diff --git a/packages/block-library/src/footnotes/block.json b/packages/block-library/src/footnotes/block.json index 1fe74abb471ee5..1a3c2ee9001715 100644 --- a/packages/block-library/src/footnotes/block.json +++ b/packages/block-library/src/footnotes/block.json @@ -9,6 +9,7 @@ "textdomain": "default", "usesContext": [ "postId", "postType" ], "supports": { + "anchor": true, "__experimentalBorder": { "radius": true, "color": true, diff --git a/packages/block-library/src/home-link/block.json b/packages/block-library/src/home-link/block.json index 4b5103ec0c75ab..42652ba9b72ca5 100644 --- a/packages/block-library/src/home-link/block.json +++ b/packages/block-library/src/home-link/block.json @@ -23,6 +23,7 @@ "style" ], "supports": { + "anchor": true, "reusable": false, "html": false, "typography": { diff --git a/packages/block-library/src/latest-comments/block.json b/packages/block-library/src/latest-comments/block.json index 28f5ce1ea47dac..b72c9d2132d5d1 100644 --- a/packages/block-library/src/latest-comments/block.json +++ b/packages/block-library/src/latest-comments/block.json @@ -29,6 +29,7 @@ } }, "supports": { + "anchor": true, "align": true, "color": { "gradients": true, diff --git a/packages/block-library/src/latest-posts/block.json b/packages/block-library/src/latest-posts/block.json index 58b1c6da81ca33..03de79be44ce71 100644 --- a/packages/block-library/src/latest-posts/block.json +++ b/packages/block-library/src/latest-posts/block.json @@ -83,6 +83,7 @@ } }, "supports": { + "anchor": true, "align": true, "html": false, "color": { diff --git a/packages/block-library/src/loginout/block.json b/packages/block-library/src/loginout/block.json index f2aaafd60fde05..b4c038542b0609 100644 --- a/packages/block-library/src/loginout/block.json +++ b/packages/block-library/src/loginout/block.json @@ -21,6 +21,7 @@ "viewportWidth": 350 }, "supports": { + "anchor": true, "className": true, "color": { "background": true, diff --git a/packages/block-library/src/math/block.json b/packages/block-library/src/math/block.json index a7cce62167ffbf..a305900ab99619 100644 --- a/packages/block-library/src/math/block.json +++ b/packages/block-library/src/math/block.json @@ -8,6 +8,7 @@ "keywords": [ "equation", "formula", "latex", "mathematics" ], "textdomain": "default", "supports": { + "anchor": true, "html": false, "__experimentalBorder": { "color": true, diff --git a/packages/block-library/src/more/block.json b/packages/block-library/src/more/block.json index 01c4b3ce961e50..89091541fa9ee9 100644 --- a/packages/block-library/src/more/block.json +++ b/packages/block-library/src/more/block.json @@ -19,6 +19,7 @@ } }, "supports": { + "anchor": true, "customClassName": false, "className": false, "html": false, diff --git a/packages/block-library/src/navigation-link/block.json b/packages/block-library/src/navigation-link/block.json index 99d893120cea1f..997275574f1acf 100644 --- a/packages/block-library/src/navigation-link/block.json +++ b/packages/block-library/src/navigation-link/block.json @@ -63,6 +63,7 @@ "style" ], "supports": { + "anchor": true, "reusable": false, "html": false, "__experimentalSlashInserter": true, diff --git a/packages/block-library/src/navigation-overlay-close/block.json b/packages/block-library/src/navigation-overlay-close/block.json index 8ccd4535301a43..cff91e265758d5 100644 --- a/packages/block-library/src/navigation-overlay-close/block.json +++ b/packages/block-library/src/navigation-overlay-close/block.json @@ -22,6 +22,7 @@ } }, "supports": { + "anchor": true, "color": { "gradients": false, "__experimentalDefaultControls": { diff --git a/packages/block-library/src/navigation-submenu/block.json b/packages/block-library/src/navigation-submenu/block.json index 33af205689b9a6..4b0481699961b7 100644 --- a/packages/block-library/src/navigation-submenu/block.json +++ b/packages/block-library/src/navigation-submenu/block.json @@ -59,6 +59,7 @@ "style" ], "supports": { + "anchor": true, "reusable": false, "html": false, "typography": { diff --git a/packages/block-library/src/navigation/block.json b/packages/block-library/src/navigation/block.json index d19fec529eca30..a22147947fd8c2 100644 --- a/packages/block-library/src/navigation/block.json +++ b/packages/block-library/src/navigation/block.json @@ -106,6 +106,7 @@ "maxNestingLevel": "maxNestingLevel" }, "supports": { + "anchor": true, "align": [ "wide", "full" ], "ariaLabel": true, "contentRole": true, diff --git a/packages/block-library/src/nextpage/block.json b/packages/block-library/src/nextpage/block.json index 3dd1a24d36e59d..62c09f435d7f54 100644 --- a/packages/block-library/src/nextpage/block.json +++ b/packages/block-library/src/nextpage/block.json @@ -9,6 +9,7 @@ "parent": [ "core/post-content" ], "textdomain": "default", "supports": { + "anchor": true, "customClassName": false, "className": false, "html": false, diff --git a/packages/block-library/src/page-list-item/block.json b/packages/block-library/src/page-list-item/block.json index 7890771f639219..3efcb585446b6c 100644 --- a/packages/block-library/src/page-list-item/block.json +++ b/packages/block-library/src/page-list-item/block.json @@ -41,6 +41,7 @@ "openSubmenusOnClick" ], "supports": { + "anchor": true, "reusable": false, "html": false, "lock": false, diff --git a/packages/block-library/src/page-list/block.json b/packages/block-library/src/page-list/block.json index 317502b1200b49..71b7e8f54db0a2 100644 --- a/packages/block-library/src/page-list/block.json +++ b/packages/block-library/src/page-list/block.json @@ -34,6 +34,7 @@ "openSubmenusOnClick" ], "supports": { + "anchor": true, "reusable": false, "html": false, "typography": { diff --git a/packages/block-library/src/post-author-biography/block.json b/packages/block-library/src/post-author-biography/block.json index c6e27bc484dfd0..0dae76af70341d 100644 --- a/packages/block-library/src/post-author-biography/block.json +++ b/packages/block-library/src/post-author-biography/block.json @@ -16,6 +16,7 @@ "viewportWidth": 350 }, "supports": { + "anchor": true, "spacing": { "margin": true, "padding": true diff --git a/packages/block-library/src/post-author-name/block.json b/packages/block-library/src/post-author-name/block.json index 23211f0bf5bf46..5ca356f8334ef5 100644 --- a/packages/block-library/src/post-author-name/block.json +++ b/packages/block-library/src/post-author-name/block.json @@ -26,6 +26,7 @@ "viewportWidth": 350 }, "supports": { + "anchor": true, "html": false, "spacing": { "margin": true, diff --git a/packages/block-library/src/post-author/block.json b/packages/block-library/src/post-author/block.json index a83bb48bd840a6..a05b94e4effa4c 100644 --- a/packages/block-library/src/post-author/block.json +++ b/packages/block-library/src/post-author/block.json @@ -37,6 +37,7 @@ }, "usesContext": [ "postType", "postId", "queryId" ], "supports": { + "anchor": true, "html": false, "spacing": { "margin": true, diff --git a/packages/block-library/src/post-comments-count/block.json b/packages/block-library/src/post-comments-count/block.json index fa8ade2f2c12f1..2c7016c74b9127 100644 --- a/packages/block-library/src/post-comments-count/block.json +++ b/packages/block-library/src/post-comments-count/block.json @@ -16,6 +16,7 @@ "viewportWidth": 350 }, "supports": { + "anchor": true, "html": false, "color": { "gradients": true, diff --git a/packages/block-library/src/post-comments-form/block.json b/packages/block-library/src/post-comments-form/block.json index 4b6b333b75cfab..a3d6c49026a486 100644 --- a/packages/block-library/src/post-comments-form/block.json +++ b/packages/block-library/src/post-comments-form/block.json @@ -13,6 +13,7 @@ }, "usesContext": [ "postId", "postType" ], "supports": { + "anchor": true, "html": false, "color": { "gradients": true, diff --git a/packages/block-library/src/post-comments-link/block.json b/packages/block-library/src/post-comments-link/block.json index e0dcdb9afa03d3..fb300d7020d4b8 100644 --- a/packages/block-library/src/post-comments-link/block.json +++ b/packages/block-library/src/post-comments-link/block.json @@ -16,6 +16,7 @@ "viewportWidth": 350 }, "supports": { + "anchor": true, "html": false, "color": { "link": true, diff --git a/packages/block-library/src/post-content/block.json b/packages/block-library/src/post-content/block.json index 264f6959304fe8..517af414872703 100644 --- a/packages/block-library/src/post-content/block.json +++ b/packages/block-library/src/post-content/block.json @@ -17,6 +17,7 @@ "viewportWidth": 350 }, "supports": { + "anchor": true, "align": [ "wide", "full" ], "html": false, "layout": true, diff --git a/packages/block-library/src/post-date/block.json b/packages/block-library/src/post-date/block.json index ea99f6ab5ff8d4..7952e36af36614 100644 --- a/packages/block-library/src/post-date/block.json +++ b/packages/block-library/src/post-date/block.json @@ -28,6 +28,7 @@ "viewportWidth": 350 }, "supports": { + "anchor": true, "html": false, "color": { "gradients": true, diff --git a/packages/block-library/src/post-excerpt/block.json b/packages/block-library/src/post-excerpt/block.json index c0037b0e5b39cd..1a92da2332db62 100644 --- a/packages/block-library/src/post-excerpt/block.json +++ b/packages/block-library/src/post-excerpt/block.json @@ -28,6 +28,7 @@ "viewportWidth": 350 }, "supports": { + "anchor": true, "html": false, "color": { "gradients": true, diff --git a/packages/block-library/src/post-featured-image/block.json b/packages/block-library/src/post-featured-image/block.json index 3cd144caa0cf42..f5619dc29fac5c 100644 --- a/packages/block-library/src/post-featured-image/block.json +++ b/packages/block-library/src/post-featured-image/block.json @@ -65,6 +65,7 @@ "viewportWidth": 350 }, "supports": { + "anchor": true, "align": [ "left", "right", "center", "wide", "full" ], "color": { "text": false, diff --git a/packages/block-library/src/post-navigation-link/block.json b/packages/block-library/src/post-navigation-link/block.json index 2fda6a01cf5162..6d51d619637c97 100644 --- a/packages/block-library/src/post-navigation-link/block.json +++ b/packages/block-library/src/post-navigation-link/block.json @@ -37,6 +37,7 @@ }, "usesContext": [ "postType" ], "supports": { + "anchor": true, "reusable": false, "html": false, "color": { diff --git a/packages/block-library/src/post-template/block.json b/packages/block-library/src/post-template/block.json index d379a46d3142f8..fdd8e647154cca 100644 --- a/packages/block-library/src/post-template/block.json +++ b/packages/block-library/src/post-template/block.json @@ -17,6 +17,7 @@ "postType" ], "supports": { + "anchor": true, "reusable": false, "html": false, "align": [ "wide", "full" ], diff --git a/packages/block-library/src/post-terms/block.json b/packages/block-library/src/post-terms/block.json index e7567ba657c3bc..0ae8fbcd9d521d 100644 --- a/packages/block-library/src/post-terms/block.json +++ b/packages/block-library/src/post-terms/block.json @@ -33,6 +33,7 @@ "viewportWidth": 350 }, "supports": { + "anchor": true, "html": false, "color": { "gradients": true, diff --git a/packages/block-library/src/post-time-to-read/block.json b/packages/block-library/src/post-time-to-read/block.json index 386312e00434e0..a9f64490731b62 100644 --- a/packages/block-library/src/post-time-to-read/block.json +++ b/packages/block-library/src/post-time-to-read/block.json @@ -25,6 +25,7 @@ } }, "supports": { + "anchor": true, "color": { "gradients": true, "__experimentalDefaultControls": { diff --git a/packages/block-library/src/post-title/block.json b/packages/block-library/src/post-title/block.json index 5587d71b148d0c..1fb7efcf82db55 100644 --- a/packages/block-library/src/post-title/block.json +++ b/packages/block-library/src/post-title/block.json @@ -39,6 +39,7 @@ "viewportWidth": 350 }, "supports": { + "anchor": true, "align": [ "wide", "full" ], "html": false, "color": { diff --git a/packages/block-library/src/query-no-results/block.json b/packages/block-library/src/query-no-results/block.json index 44d2ceef987e2f..3e6479a5aa20a2 100644 --- a/packages/block-library/src/query-no-results/block.json +++ b/packages/block-library/src/query-no-results/block.json @@ -9,6 +9,7 @@ "textdomain": "default", "usesContext": [ "queryId", "query" ], "supports": { + "anchor": true, "align": true, "reusable": false, "html": false, diff --git a/packages/block-library/src/query-pagination-next/block.json b/packages/block-library/src/query-pagination-next/block.json index ec56125ee3b766..86acaa7462d324 100644 --- a/packages/block-library/src/query-pagination-next/block.json +++ b/packages/block-library/src/query-pagination-next/block.json @@ -20,6 +20,7 @@ "enhancedPagination" ], "supports": { + "anchor": true, "reusable": false, "html": false, "color": { diff --git a/packages/block-library/src/query-pagination-numbers/block.json b/packages/block-library/src/query-pagination-numbers/block.json index 8a9f0ee69f14e4..75b2e4476accba 100644 --- a/packages/block-library/src/query-pagination-numbers/block.json +++ b/packages/block-library/src/query-pagination-numbers/block.json @@ -15,6 +15,7 @@ }, "usesContext": [ "queryId", "query", "enhancedPagination" ], "supports": { + "anchor": true, "reusable": false, "html": false, "color": { diff --git a/packages/block-library/src/query-pagination-previous/block.json b/packages/block-library/src/query-pagination-previous/block.json index d1e34c8630250d..f13c9d4704cf1f 100644 --- a/packages/block-library/src/query-pagination-previous/block.json +++ b/packages/block-library/src/query-pagination-previous/block.json @@ -20,6 +20,7 @@ "enhancedPagination" ], "supports": { + "anchor": true, "reusable": false, "html": false, "color": { diff --git a/packages/block-library/src/query-pagination/block.json b/packages/block-library/src/query-pagination/block.json index 355b188e442d8d..c5e8cde66e7bce 100644 --- a/packages/block-library/src/query-pagination/block.json +++ b/packages/block-library/src/query-pagination/block.json @@ -28,6 +28,7 @@ "showLabel": "showLabel" }, "supports": { + "anchor": true, "align": true, "reusable": false, "html": false, diff --git a/packages/block-library/src/query-title/block.json b/packages/block-library/src/query-title/block.json index 549451bbfc67b8..41e9e3fd29b624 100644 --- a/packages/block-library/src/query-title/block.json +++ b/packages/block-library/src/query-title/block.json @@ -36,6 +36,7 @@ }, "usesContext": [ "query" ], "supports": { + "anchor": true, "align": [ "wide", "full" ], "html": false, "color": { diff --git a/packages/block-library/src/query-total/block.json b/packages/block-library/src/query-total/block.json index 21f6ba0673903f..9cd803a5665b94 100644 --- a/packages/block-library/src/query-total/block.json +++ b/packages/block-library/src/query-total/block.json @@ -15,6 +15,7 @@ }, "usesContext": [ "queryId", "query" ], "supports": { + "anchor": true, "align": [ "wide", "full" ], "html": false, "spacing": { diff --git a/packages/block-library/src/query/block.json b/packages/block-library/src/query/block.json index 33ba8bfd925ca8..2014e1ebb257e2 100644 --- a/packages/block-library/src/query/block.json +++ b/packages/block-library/src/query/block.json @@ -50,6 +50,7 @@ "enhancedPagination": "enhancedPagination" }, "supports": { + "anchor": true, "align": [ "wide", "full" ], "html": false, "layout": true, diff --git a/packages/block-library/src/read-more/block.json b/packages/block-library/src/read-more/block.json index eabc7acf3e3a37..084d46fa6936b1 100644 --- a/packages/block-library/src/read-more/block.json +++ b/packages/block-library/src/read-more/block.json @@ -18,6 +18,7 @@ }, "usesContext": [ "postId" ], "supports": { + "anchor": true, "html": false, "color": { "gradients": true, diff --git a/packages/block-library/src/rss/block.json b/packages/block-library/src/rss/block.json index fc49e1d858e898..e16c0c62881c90 100644 --- a/packages/block-library/src/rss/block.json +++ b/packages/block-library/src/rss/block.json @@ -50,6 +50,7 @@ } }, "supports": { + "anchor": true, "align": true, "html": false, "interactivity": { diff --git a/packages/block-library/src/search/block.json b/packages/block-library/src/search/block.json index c5af5a29d21beb..a6146d4404041f 100644 --- a/packages/block-library/src/search/block.json +++ b/packages/block-library/src/search/block.json @@ -49,6 +49,7 @@ } }, "supports": { + "anchor": true, "align": [ "left", "center", "right" ], "color": { "gradients": true, diff --git a/packages/block-library/src/site-logo/block.json b/packages/block-library/src/site-logo/block.json index b49588d3716fa9..e1cd662f60f3ef 100644 --- a/packages/block-library/src/site-logo/block.json +++ b/packages/block-library/src/site-logo/block.json @@ -32,6 +32,7 @@ } }, "supports": { + "anchor": true, "html": false, "align": true, "alignWide": false, diff --git a/packages/block-library/src/site-tagline/block.json b/packages/block-library/src/site-tagline/block.json index 7f94d962e9cbcc..756b2dcb8183ac 100644 --- a/packages/block-library/src/site-tagline/block.json +++ b/packages/block-library/src/site-tagline/block.json @@ -27,6 +27,7 @@ } }, "supports": { + "anchor": true, "align": [ "wide", "full" ], "html": false, "color": { diff --git a/packages/block-library/src/site-title/block.json b/packages/block-library/src/site-title/block.json index 8edf6b945f9ce2..ac6a3c10e086a7 100644 --- a/packages/block-library/src/site-title/block.json +++ b/packages/block-library/src/site-title/block.json @@ -33,6 +33,7 @@ "viewportWidth": 500 }, "supports": { + "anchor": true, "align": [ "wide", "full" ], "html": false, "color": { diff --git a/packages/block-library/src/social-link/block.json b/packages/block-library/src/social-link/block.json index 667fd74b208f29..db59656abb1c04 100644 --- a/packages/block-library/src/social-link/block.json +++ b/packages/block-library/src/social-link/block.json @@ -32,6 +32,7 @@ "iconBackgroundColorValue" ], "supports": { + "anchor": true, "reusable": false, "html": false, "interactivity": { diff --git a/packages/block-library/src/table-of-contents/block.json b/packages/block-library/src/table-of-contents/block.json index 410da6beb938c4..10cf66652dc55c 100644 --- a/packages/block-library/src/table-of-contents/block.json +++ b/packages/block-library/src/table-of-contents/block.json @@ -29,6 +29,7 @@ } }, "supports": { + "anchor": true, "ariaLabel": true, "html": false, "color": { diff --git a/packages/block-library/src/tabs/block.json b/packages/block-library/src/tabs/block.json index f7cf570bcf6ca5..1d421819032347 100644 --- a/packages/block-library/src/tabs/block.json +++ b/packages/block-library/src/tabs/block.json @@ -76,6 +76,7 @@ } ], "supports": { + "anchor": true, "align": true, "color": { "text": false, diff --git a/packages/block-library/src/tag-cloud/block.json b/packages/block-library/src/tag-cloud/block.json index 044bc0c5333768..5e43bf20735419 100644 --- a/packages/block-library/src/tag-cloud/block.json +++ b/packages/block-library/src/tag-cloud/block.json @@ -35,6 +35,7 @@ { "name": "outline", "label": "Outline" } ], "supports": { + "anchor": true, "html": false, "align": true, "spacing": { diff --git a/packages/block-library/src/term-count/block.json b/packages/block-library/src/term-count/block.json index c4de1e61f8d1f5..4a7c578bb0b5b9 100644 --- a/packages/block-library/src/term-count/block.json +++ b/packages/block-library/src/term-count/block.json @@ -15,6 +15,7 @@ } }, "supports": { + "anchor": true, "html": false, "color": { "gradients": true, diff --git a/packages/block-library/src/term-description/block.json b/packages/block-library/src/term-description/block.json index a882625ad6f504..e5c17b764f0612 100644 --- a/packages/block-library/src/term-description/block.json +++ b/packages/block-library/src/term-description/block.json @@ -13,6 +13,7 @@ } }, "supports": { + "anchor": true, "align": [ "wide", "full" ], "html": false, "color": { diff --git a/packages/block-library/src/term-name/block.json b/packages/block-library/src/term-name/block.json index a8b2a59cf9d9e8..44a063303dd702 100644 --- a/packages/block-library/src/term-name/block.json +++ b/packages/block-library/src/term-name/block.json @@ -25,6 +25,7 @@ } }, "supports": { + "anchor": true, "align": [ "wide", "full" ], "html": false, "color": { diff --git a/packages/block-library/src/term-template/block.json b/packages/block-library/src/term-template/block.json index 2f4b9838c71bd7..8914bf6376aa77 100644 --- a/packages/block-library/src/term-template/block.json +++ b/packages/block-library/src/term-template/block.json @@ -9,6 +9,7 @@ "textdomain": "default", "usesContext": [ "termQuery" ], "supports": { + "anchor": true, "reusable": false, "html": false, "align": [ "wide", "full" ], diff --git a/packages/block-library/src/terms-query/block.json b/packages/block-library/src/terms-query/block.json index 05b7a2c12e22fb..1741de5e5b2fd4 100644 --- a/packages/block-library/src/terms-query/block.json +++ b/packages/block-library/src/terms-query/block.json @@ -31,6 +31,7 @@ "termQuery": "termQuery" }, "supports": { + "anchor": true, "align": [ "wide", "full" ], "html": false, "layout": true, diff --git a/phpunit/block-supports/anchor.php b/phpunit/block-supports/anchor.php new file mode 100644 index 00000000000000..cf7cb75e6a7ac9 --- /dev/null +++ b/phpunit/block-supports/anchor.php @@ -0,0 +1,85 @@ +test_block_name = null; + } + + public function tear_down() { + unregister_block_type( $this->test_block_name ); + $this->test_block_name = null; + parent::tear_down(); + } + + /** + * Registers a new block for testing anchor support. + * + * @param string $block_name Name for the test block. + * @param array $supports Array defining block support configuration. + * + * @return WP_Block_Type The block type for the newly registered test block. + */ + private function register_anchor_block_with_support( $block_name, $supports = array() ) { + $this->test_block_name = $block_name; + register_block_type( + $this->test_block_name, + array( + 'api_version' => 3, + 'supports' => $supports, + ) + ); + $registry = WP_Block_Type_Registry::get_instance(); + + return $registry->get_registered( $this->test_block_name ); + } + + /** + * Tests that anchor block support works as expected. + * + * @dataProvider data_anchor_block_support + * + * @param boolean|array $support Anchor block support configuration. + * @param string $value Anchor value for attribute object. + * @param array $expected Expected anchor block support output. + */ + public function test_gutenberg_apply_anchor_support( $support, $value, $expected ) { + $block_type = self::register_anchor_block_with_support( + 'test/anchor-block', + array( 'anchor' => $support ) + ); + $block_attrs = array( 'anchor' => $value ); + $actual = gutenberg_apply_anchor_support( $block_type, $block_attrs ); + + $this->assertSame( $expected, $actual ); + } + + /** + * Data provider. + * + * @return array + */ + public function data_anchor_block_support() { + return array( + 'anchor id attribute is applied' => array( + 'support' => true, + 'value' => 'my-anchor', + 'expected' => array( 'id' => 'my-anchor' ), + ), + 'anchor id attribute is not applied if block does not support it' => array( + 'support' => false, + 'value' => 'my-anchor', + 'expected' => array(), + ), + ); + } +}