From 8bcd8df2221924b22235f211cbb043a58e336455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Wrede?= Date: Fri, 7 Oct 2022 10:48:56 +0200 Subject: [PATCH 1/4] Add anchor support --- .../block-api/block-supports.md | 4 +- docs/reference-guides/core-blocks.md | 2 +- lib/block-supports/anchor.php | 63 +++++++++++++++++++ lib/load.php | 1 + .../block-library/src/calendar/block.json | 1 + 5 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 lib/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 53d7088576b18..f305d3f2957f7 100644 --- a/docs/reference-guides/block-api/block-supports.md +++ b/docs/reference-guides/block-api/block-supports.md @@ -48,7 +48,7 @@ function render_block() { - 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. @@ -569,7 +569,7 @@ attributes: { } ``` -A spacing property may define an array of allowable sides – 'top', 'right', 'bottom', 'left' – that can be configured. When such arbitrary sides are defined, only UI controls for those sides are displayed. +A spacing property may define an array of allowable sides – 'top', 'right', 'bottom', 'left' – that can be configured. When such arbitrary sides are defined, only UI controls for those sides are displayed. Axial sides are defined with the `vertical` and `horizontal` terms, and display a single UI control for each axial pair (for example, `vertical` controls both the top and bottom sides). A spacing property may support arbitrary individual sides **or** axial sides, but not a mix of both. diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index e5e60e22d0c96..e776ecea9de79 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -68,7 +68,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), typography (fontSize, lineHeight) +- **Supports:** align, anchor, color (background, link, text), typography (fontSize, lineHeight) - **Attributes:** month, year ## Categories List diff --git a/lib/block-supports/anchor.php b/lib/block-supports/anchor.php new file mode 100644 index 0000000000000..38e6411f8e4e1 --- /dev/null +++ b/lib/block-supports/anchor.php @@ -0,0 +1,63 @@ +supports, array( 'anchor' ), true ); + if ( ! $has_anchor_support ) { + return; + } + + if ( ! $block_type->attributes ) { + $block_type->attributes = array(); + } + + if ( ! array_key_exists( 'anchor', $block_type->attributes ) ) { + $block_type->attributes['anchor'] = array( + 'type' => 'string', + ); + } +} + +/** + * Add the anchor to the output. + * + * @param WP_Block_Type $block_type Block Type. + * @param array $block_attributes Block attributes. + * + * @return array Block anchor. + */ +function gutenberg_apply_anchor_support( $block_type, $block_attributes ) { + if ( gutenberg_should_skip_block_supports_serialization( $block_type, 'anchor' ) ) { + return array(); + } + + $has_anchor_support = _wp_array_get( $block_type->supports, array( 'anchor' ), true ); + if ( ! $has_anchor_support ) { + return array(); + } + + $has_anchor = array_key_exists( 'anchor', $block_attributes ); + if ( ! $has_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 7ece2d359b5bf..d5def9e5ace28 100644 --- a/lib/load.php +++ b/lib/load.php @@ -138,3 +138,4 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/block-supports/spacing.php'; require __DIR__ . '/block-supports/dimensions.php'; require __DIR__ . '/block-supports/duotone.php'; +require __DIR__ . '/block-supports/anchor.php'; diff --git a/packages/block-library/src/calendar/block.json b/packages/block-library/src/calendar/block.json index 2accd7142c7cc..c772cf58411f0 100644 --- a/packages/block-library/src/calendar/block.json +++ b/packages/block-library/src/calendar/block.json @@ -17,6 +17,7 @@ }, "supports": { "align": true, + "anchor": true, "color": { "link": true, "__experimentalSkipSerialization": [ "text", "background" ], From 85fffae328d7c82bbbd042c5ea3031ee239bdf52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Wrede?= Date: Fri, 7 Oct 2022 12:44:14 +0200 Subject: [PATCH 2/4] Add anchor support --- docs/reference-guides/core-blocks.md | 104 +++++++++--------- lib/block-supports/anchor.php | 4 + .../block-library/src/archives/block.json | 1 + packages/block-library/src/avatar/block.json | 1 + .../block-library/src/categories/block.json | 1 + .../src/comment-author-avatar/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 + .../block-library/src/comments/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 + .../block-library/src/navigation/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 + .../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 + 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 + .../block-library/src/tag-cloud/block.json | 1 + .../src/template-part/block.json | 1 + .../src/term-description/block.json | 1 + 54 files changed, 108 insertions(+), 52 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index e776ecea9de79..f9973d1c94a11 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -14,7 +14,7 @@ Display a date archive of your posts. ([Source](https://github.com/WordPress/gut - **Name:** core/archives - **Category:** widgets -- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align, anchor, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** displayAsDropdown, showLabel, showPostCounts, type ## Audio @@ -32,7 +32,7 @@ Add a user’s avatar. ([Source](https://github.com/WordPress/gutenberg/tree/tru - **Name:** core/avatar - **Category:** theme -- **Supports:** align, color (~~background~~, ~~text~~), spacing (margin, padding), ~~alignWide~~, ~~html~~ +- **Supports:** align, anchor, color (~~background~~, ~~text~~), spacing (margin, padding), ~~alignWide~~, ~~html~~ - **Attributes:** isLink, linkTarget, size, userId ## Reusable block @@ -77,7 +77,7 @@ Display a list of all categories. ([Source](https://github.com/WordPress/gutenbe - **Name:** core/categories - **Category:** widgets -- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align, anchor, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** displayAsDropdown, showEmpty, showHierarchy, showOnlyTopLevel, showPostCounts ## Code @@ -113,7 +113,7 @@ This block is deprecated. Please use the Avatar block instead. ([Source](https:/ - **Name:** core/comment-author-avatar - **Category:** theme -- **Supports:** color (background, ~~text~~), spacing (margin, padding), ~~html~~, ~~inserter~~ +- **Supports:** anchor, color (background, ~~text~~), spacing (margin, padding), ~~html~~, ~~inserter~~ - **Attributes:** height, width ## Comment Author Name @@ -122,7 +122,7 @@ Displays the name of the author of the comment. ([Source](https://github.com/Wor - **Name:** core/comment-author-name - **Category:** theme -- **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:** isLink, linkTarget, textAlign ## Comment Content @@ -131,7 +131,7 @@ Displays the contents of a comment. ([Source](https://github.com/WordPress/guten - **Name:** core/comment-content - **Category:** theme -- **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 @@ -140,7 +140,7 @@ Displays the date on which the comment was posted. ([Source](https://github.com/ - **Name:** core/comment-date - **Category:** theme -- **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:** format, isLink ## Comment Edit Link @@ -149,7 +149,7 @@ Displays a link to edit the comment in the WordPress Dashboard. This link is onl - **Name:** core/comment-edit-link - **Category:** theme -- **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:** linkTarget, textAlign ## Comment Reply Link @@ -158,7 +158,7 @@ Displays a link to reply to a comment. ([Source](https://github.com/WordPress/gu - **Name:** core/comment-reply-link - **Category:** theme -- **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 @@ -167,7 +167,7 @@ Contains the block elements used to display a comment, like the title, date, aut - **Name:** core/comment-template - **Category:** design -- **Supports:** align, typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** align, anchor, typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** ## Comments @@ -176,7 +176,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, link, text), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** legacy, tagName ## Comments Pagination @@ -185,7 +185,7 @@ Displays a paginated navigation to next/previous set of comments, when applicabl - **Name:** core/comments-pagination - **Category:** theme -- **Supports:** align, color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** align, anchor, color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** paginationArrow ## Comments Next Page @@ -194,7 +194,7 @@ Displays the next comment's page link. ([Source](https://github.com/WordPress/gu - **Name:** core/comments-pagination-next - **Category:** theme -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label ## Comments Page Numbers @@ -203,7 +203,7 @@ Displays a list of page numbers for comments pagination. ([Source](https://githu - **Name:** core/comments-pagination-numbers - **Category:** theme -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** ## Comments Previous Page @@ -212,7 +212,7 @@ Displays the previous comment's page link. ([Source](https://github.com/WordPres - **Name:** core/comments-pagination-previous - **Category:** theme -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label ## Comments Title @@ -293,7 +293,7 @@ Create a link that always points to the homepage of the site. Usually not necess - **Name:** core/home-link - **Category:** design -- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label ## Custom HTML @@ -320,7 +320,7 @@ Display a list of your most recent comments. ([Source](https://github.com/WordPr - **Name:** core/latest-comments - **Category:** widgets -- **Supports:** align, ~~html~~ +- **Supports:** align, anchor, ~~html~~ - **Attributes:** commentsToShow, displayAvatar, displayDate, displayExcerpt ## Latest Posts @@ -329,7 +329,7 @@ Display a list of your most recent posts. ([Source](https://github.com/WordPress - **Name:** core/latest-posts - **Category:** widgets -- **Supports:** align, typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align, anchor, typography (fontSize, lineHeight), ~~html~~ - **Attributes:** addLinkToFeaturedImage, categories, columns, displayAuthor, displayFeaturedImage, displayPostContent, displayPostContentRadio, displayPostDate, excerptLength, featuredImageAlign, featuredImageSizeHeight, featuredImageSizeSlug, featuredImageSizeWidth, order, orderBy, postLayout, postsToShow, selectedAuthor ## List @@ -356,7 +356,7 @@ Show login & logout links. ([Source](https://github.com/WordPress/gutenberg/tree - **Name:** core/loginout - **Category:** theme -- **Supports:** className, typography (~~fontSize~~) +- **Supports:** anchor, className, typography (~~fontSize~~) - **Attributes:** displayLoginAsForm, redirectToCurrent ## Media & Text @@ -392,7 +392,7 @@ A collection of blocks that allow visitors to get around your site. ([Source](ht - **Name:** core/navigation - **Category:** theme -- **Supports:** align (full, wide), inserter, spacing (blockGap, units), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, inserter, spacing (blockGap, units), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** __unstableLocation, backgroundColor, customBackgroundColor, customOverlayBackgroundColor, customOverlayTextColor, customTextColor, hasIcon, icon, maxNestingLevel, openSubmenusOnClick, overlayBackgroundColor, overlayMenu, overlayTextColor, ref, rgbBackgroundColor, rgbTextColor, showSubmenuIcon, textColor ## Custom Link @@ -428,7 +428,7 @@ Display a list of all pages. ([Source](https://github.com/WordPress/gutenberg/tr - **Name:** core/page-list - **Category:** widgets -- **Supports:** ~~html~~, ~~reusable~~ +- **Supports:** anchor, ~~html~~, ~~reusable~~ - **Attributes:** ## Paragraph @@ -455,7 +455,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), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** avatarSize, byline, isLink, linkTarget, showAvatar, showBio, textAlign ## Post Author Biography @@ -464,7 +464,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), spacing (margin, padding), typography (fontSize, lineHeight) +- **Supports:** anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight) - **Attributes:** textAlign ## Post Author Name @@ -473,7 +473,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), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** isLink, linkTarget, textAlign ## Post Comment (deprecated) @@ -491,7 +491,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), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, text), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Post Comments Form @@ -500,7 +500,7 @@ Display a post's comments form. ([Source](https://github.com/WordPress/gutenberg - **Name:** core/post-comments-form - **Category:** theme -- **Supports:** color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Post Comments Link @@ -509,7 +509,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~~), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, link, ~~text~~), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Post Content @@ -518,7 +518,7 @@ Displays the contents of a post or page. ([Source](https://github.com/WordPress/ - **Name:** core/post-content - **Category:** theme -- **Supports:** align (full, wide), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, typography (fontSize, lineHeight), ~~html~~ - **Attributes:** ## Post Date @@ -527,7 +527,7 @@ Add the date of this post. ([Source](https://github.com/WordPress/gutenberg/tree - **Name:** core/post-date - **Category:** theme -- **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:** displayType, format, isLink, textAlign ## Post Excerpt @@ -536,7 +536,7 @@ Display a post's excerpt. ([Source](https://github.com/WordPress/gutenberg/tree/ - **Name:** core/post-excerpt - **Category:** theme -- **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:** moreText, showMoreOnNewLine, textAlign ## Post Featured Image @@ -545,7 +545,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~~), spacing (margin, padding), ~~html~~ +- **Supports:** align (center, full, left, right, wide), anchor, color (~~background~~, ~~text~~), spacing (margin, padding), ~~html~~ - **Attributes:** customGradient, customOverlayColor, dimRatio, gradient, height, isLink, linkTarget, overlayColor, rel, scale, sizeSlug, width ## Post Navigation Link @@ -554,7 +554,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), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** arrow, label, linkLabel, showTitle, textAlign, type ## Post Template @@ -563,7 +563,7 @@ Contains the block elements used to render a post, like the title, date, feature - **Name:** core/post-template - **Category:** theme -- **Supports:** align, typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** align, anchor, typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** ## Post Terms @@ -572,7 +572,7 @@ Post terms. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages - **Name:** core/post-terms - **Category:** theme -- **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:** prefix, separator, suffix, term, textAlign ## Post Title @@ -581,7 +581,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), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** isLink, level, linkTarget, rel, textAlign ## Preformatted @@ -608,7 +608,7 @@ An advanced block that allows displaying post types based on different query par - **Name:** core/query - **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, link, text), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), ~~html~~ - **Attributes:** displayLayout, namespace, query, queryId, tagName ## No results @@ -617,7 +617,7 @@ Contains the block elements used to render content when no query results are fou - **Name:** core/query-no-results - **Category:** theme -- **Supports:** align, color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** align, anchor, color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** ## Pagination @@ -626,7 +626,7 @@ Displays a paginated navigation to next/previous set of posts, when applicable. - **Name:** core/query-pagination - **Category:** theme -- **Supports:** align, color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** align, anchor, color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** paginationArrow ## Next Page @@ -635,7 +635,7 @@ Displays the next posts page link. ([Source](https://github.com/WordPress/gutenb - **Name:** core/query-pagination-next - **Category:** theme -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label ## Page Numbers @@ -644,7 +644,7 @@ Displays a list of page numbers for pagination ([Source](https://github.com/Word - **Name:** core/query-pagination-numbers - **Category:** theme -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** ## Previous Page @@ -653,7 +653,7 @@ Displays the previous posts page link. ([Source](https://github.com/WordPress/gu - **Name:** core/query-pagination-previous - **Category:** theme -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label ## Query Title @@ -662,7 +662,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), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** level, showPrefix, showSearchTerm, textAlign, type ## Quote @@ -680,7 +680,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), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** content, linkTarget ## RSS @@ -689,7 +689,7 @@ Display entries from any RSS or Atom feed. ([Source](https://github.com/WordPres - **Name:** core/rss - **Category:** widgets -- **Supports:** align, ~~html~~ +- **Supports:** align, anchor, ~~html~~ - **Attributes:** blockLayout, columns, displayAuthor, displayDate, displayExcerpt, excerptLength, feedURL, itemsToShow ## Search @@ -698,7 +698,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), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (center, left, right), anchor, color (background, gradients, text), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** buttonPosition, buttonText, buttonUseIcon, label, placeholder, query, showLabel, width, widthUnit ## Separator @@ -725,7 +725,7 @@ Display a graphic to represent this site. Update the block, and the changes appl - **Name:** core/site-logo - **Category:** theme -- **Supports:** align, color (~~background~~, ~~text~~), spacing (margin, padding), ~~alignWide~~, ~~html~~ +- **Supports:** align, anchor, color (~~background~~, ~~text~~), spacing (margin, padding), ~~alignWide~~, ~~html~~ - **Attributes:** isLink, linkTarget, shouldSyncIcon, width ## Site Tagline @@ -734,7 +734,7 @@ Describe in a few words what the site is about. The tagline can be used in searc - **Name:** core/site-tagline - **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Site Title @@ -743,7 +743,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), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** isLink, level, linkTarget, textAlign ## Social Icon @@ -752,7 +752,7 @@ Display an icon linking to a social media profile or site. ([Source](https://git - **Name:** core/social-link - **Category:** widgets -- **Supports:** ~~html~~, ~~reusable~~ +- **Supports:** anchor, ~~html~~, ~~reusable~~ - **Attributes:** label, service, url ## Social Icons @@ -797,7 +797,7 @@ A cloud of your most used tags. ([Source](https://github.com/WordPress/gutenberg - **Name:** core/tag-cloud - **Category:** widgets -- **Supports:** align, spacing (margin, padding), typography (lineHeight), ~~html~~ +- **Supports:** align, anchor, spacing (margin, padding), typography (lineHeight), ~~html~~ - **Attributes:** largestFontSize, numberOfTags, showTagCounts, smallestFontSize, taxonomy ## Template Part @@ -806,7 +806,7 @@ Edit the different global regions of your site, like the header, footer, sidebar - **Name:** core/template-part - **Category:** theme -- **Supports:** align, ~~html~~, ~~reusable~~ +- **Supports:** align, anchor, ~~html~~, ~~reusable~~ - **Attributes:** area, slug, tagName, theme ## Term Description @@ -815,7 +815,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), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Text Columns (deprecated) diff --git a/lib/block-supports/anchor.php b/lib/block-supports/anchor.php index 38e6411f8e4e1..52539030a5787 100644 --- a/lib/block-supports/anchor.php +++ b/lib/block-supports/anchor.php @@ -36,6 +36,10 @@ function gutenberg_register_anchor_support( $block_type ) { * @return array Block anchor. */ function gutenberg_apply_anchor_support( $block_type, $block_attributes ) { + if ( ! $block_attributes ) { + return array(); + } + if ( gutenberg_should_skip_block_supports_serialization( $block_type, 'anchor' ) ) { return array(); } diff --git a/packages/block-library/src/archives/block.json b/packages/block-library/src/archives/block.json index 3e589af452fa9..edc6895e14b06 100644 --- a/packages/block-library/src/archives/block.json +++ b/packages/block-library/src/archives/block.json @@ -26,6 +26,7 @@ }, "supports": { "align": true, + "anchor": true, "html": false, "spacing": { "margin": true, diff --git a/packages/block-library/src/avatar/block.json b/packages/block-library/src/avatar/block.json index 690ef358a0ca1..3fbb6dd9221ae 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/categories/block.json b/packages/block-library/src/categories/block.json index adf28dc42b4f0..a90a527e35c45 100644 --- a/packages/block-library/src/categories/block.json +++ b/packages/block-library/src/categories/block.json @@ -30,6 +30,7 @@ }, "supports": { "align": true, + "anchor": true, "html": false, "spacing": { "margin": true, diff --git a/packages/block-library/src/comment-author-avatar/block.json b/packages/block-library/src/comment-author-avatar/block.json index e0351e2453d99..2b6cefd6db998 100644 --- a/packages/block-library/src/comment-author-avatar/block.json +++ b/packages/block-library/src/comment-author-avatar/block.json @@ -20,6 +20,7 @@ }, "usesContext": [ "commentId" ], "supports": { + "anchor": true, "html": false, "inserter": false, "__experimentalBorder": { diff --git a/packages/block-library/src/comment-author-name/block.json b/packages/block-library/src/comment-author-name/block.json index 59300c317a679..cfa036fa80e2d 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 0c28c25f330ca..69917ccce6aea 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 e90cb0b0d8c4d..ea1e263338139 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 14795c83e1c53..e695ddc3801f7 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 9d4a1d8668acc..7ed60f34f581f 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 1a8dd4da1ada3..e703e531570bf 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, "reusable": false, "html": false, "align": true, diff --git a/packages/block-library/src/comments-pagination-next/block.json b/packages/block-library/src/comments-pagination-next/block.json index 48da9495bff62..f0cee1a1cdbe6 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 479872bccf140..0ab4f965ff1cd 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 a48782af29760..211e1a33305a0 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 ffa2828912f26..d7c8be4b8eaa2 100644 --- a/packages/block-library/src/comments-pagination/block.json +++ b/packages/block-library/src/comments-pagination/block.json @@ -17,6 +17,7 @@ "comments/paginationArrow": "paginationArrow" }, "supports": { + "anchor": true, "align": true, "reusable": false, "html": false, diff --git a/packages/block-library/src/comments/block.json b/packages/block-library/src/comments/block.json index 59d315b5fcb83..42d92cc5b7b5d 100644 --- a/packages/block-library/src/comments/block.json +++ b/packages/block-library/src/comments/block.json @@ -18,6 +18,7 @@ }, "supports": { "align": [ "wide", "full" ], + "anchor": true, "html": false, "color": { "gradients": true, diff --git a/packages/block-library/src/home-link/block.json b/packages/block-library/src/home-link/block.json index 567bdf8c27ba7..df964ad76bc68 100644 --- a/packages/block-library/src/home-link/block.json +++ b/packages/block-library/src/home-link/block.json @@ -22,6 +22,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 4f8b0fbf54284..75737f56ee4f2 100644 --- a/packages/block-library/src/latest-comments/block.json +++ b/packages/block-library/src/latest-comments/block.json @@ -29,6 +29,7 @@ }, "supports": { "align": true, + "anchor": true, "html": false }, "editorStyle": "wp-block-latest-comments-editor", diff --git a/packages/block-library/src/latest-posts/block.json b/packages/block-library/src/latest-posts/block.json index b423b09d900cb..2a41d7522b427 100644 --- a/packages/block-library/src/latest-posts/block.json +++ b/packages/block-library/src/latest-posts/block.json @@ -84,6 +84,7 @@ }, "supports": { "align": true, + "anchor": true, "html": false, "typography": { "fontSize": true, diff --git a/packages/block-library/src/loginout/block.json b/packages/block-library/src/loginout/block.json index 3db9d0040ce5f..aea0bb9e68840 100644 --- a/packages/block-library/src/loginout/block.json +++ b/packages/block-library/src/loginout/block.json @@ -18,6 +18,7 @@ } }, "supports": { + "anchor": true, "className": true, "typography": { "fontSize": false diff --git a/packages/block-library/src/navigation/block.json b/packages/block-library/src/navigation/block.json index 5e856a30ceaba..a8c65b5a88b75 100644 --- a/packages/block-library/src/navigation/block.json +++ b/packages/block-library/src/navigation/block.json @@ -88,6 +88,7 @@ }, "supports": { "align": [ "wide", "full" ], + "anchor": true, "html": false, "inserter": true, "typography": { diff --git a/packages/block-library/src/page-list/block.json b/packages/block-library/src/page-list/block.json index 3068a1fb8bc00..e6f2fba71727a 100644 --- a/packages/block-library/src/page-list/block.json +++ b/packages/block-library/src/page-list/block.json @@ -24,6 +24,7 @@ "openSubmenusOnClick" ], "supports": { + "anchor": true, "reusable": false, "html": false }, diff --git a/packages/block-library/src/post-author-biography/block.json b/packages/block-library/src/post-author-biography/block.json index 434b6b0965880..a2e5f327acfeb 100644 --- a/packages/block-library/src/post-author-biography/block.json +++ b/packages/block-library/src/post-author-biography/block.json @@ -13,6 +13,7 @@ }, "usesContext": [ "postType", "postId" ], "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 34cf8886e9f03..d4cfedfc71ad6 100644 --- a/packages/block-library/src/post-author-name/block.json +++ b/packages/block-library/src/post-author-name/block.json @@ -22,6 +22,7 @@ }, "usesContext": [ "postType", "postId" ], "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 7d7cd28225bc8..bb9f69ade07e6 100644 --- a/packages/block-library/src/post-author/block.json +++ b/packages/block-library/src/post-author/block.json @@ -35,6 +35,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 150293b29c986..eb81ab5844426 100644 --- a/packages/block-library/src/post-comments-count/block.json +++ b/packages/block-library/src/post-comments-count/block.json @@ -14,6 +14,7 @@ }, "usesContext": [ "postId" ], "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 47cc0a443baee..e2bcf99faadff 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 3df8788ee5d76..3551d6cfd965f 100644 --- a/packages/block-library/src/post-comments-link/block.json +++ b/packages/block-library/src/post-comments-link/block.json @@ -14,6 +14,7 @@ } }, "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 c330f624ee142..ab8757bfc3187 100644 --- a/packages/block-library/src/post-content/block.json +++ b/packages/block-library/src/post-content/block.json @@ -8,6 +8,7 @@ "textdomain": "default", "usesContext": [ "postId", "postType", "queryId" ], "supports": { + "anchor": true, "align": [ "wide", "full" ], "html": false, "__experimentalLayout": true, diff --git a/packages/block-library/src/post-date/block.json b/packages/block-library/src/post-date/block.json index b469dbe87d7e0..41c45a4a57e26 100644 --- a/packages/block-library/src/post-date/block.json +++ b/packages/block-library/src/post-date/block.json @@ -24,6 +24,7 @@ }, "usesContext": [ "postId", "postType", "queryId" ], "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 03107ff900e06..223b4c68bde0e 100644 --- a/packages/block-library/src/post-excerpt/block.json +++ b/packages/block-library/src/post-excerpt/block.json @@ -20,6 +20,7 @@ }, "usesContext": [ "postId", "postType", "queryId" ], "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 40f51cffa06e7..e6c8c3bfbbd3f 100644 --- a/packages/block-library/src/post-featured-image/block.json +++ b/packages/block-library/src/post-featured-image/block.json @@ -53,6 +53,7 @@ "usesContext": [ "postId", "postType", "queryId" ], "supports": { "align": [ "left", "right", "center", "wide", "full" ], + "anchor": true, "color": { "__experimentalDuotone": "img, .wp-block-post-featured-image__placeholder, .components-placeholder__illustration, .components-placeholder::before", "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 7b8d87fe26ad7..2bdfa654798ee 100644 --- a/packages/block-library/src/post-navigation-link/block.json +++ b/packages/block-library/src/post-navigation-link/block.json @@ -31,6 +31,7 @@ } }, "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 380b6d55f71fa..52eeb6d8ad31c 100644 --- a/packages/block-library/src/post-template/block.json +++ b/packages/block-library/src/post-template/block.json @@ -19,6 +19,7 @@ "reusable": false, "html": false, "align": true, + "anchor": true, "__experimentalLayout": { "allowEditing": false }, diff --git a/packages/block-library/src/post-terms/block.json b/packages/block-library/src/post-terms/block.json index e14f96170ca88..1633c7c01b82c 100644 --- a/packages/block-library/src/post-terms/block.json +++ b/packages/block-library/src/post-terms/block.json @@ -28,6 +28,7 @@ }, "usesContext": [ "postId", "postType" ], "supports": { + "anchor": true, "html": false, "color": { "gradients": true, diff --git a/packages/block-library/src/post-title/block.json b/packages/block-library/src/post-title/block.json index 015896ff1bad0..4a56a6f37b779 100644 --- a/packages/block-library/src/post-title/block.json +++ b/packages/block-library/src/post-title/block.json @@ -31,6 +31,7 @@ }, "supports": { "align": [ "wide", "full" ], + "anchor": true, "html": false, "color": { "gradients": true, diff --git a/packages/block-library/src/query-no-results/block.json b/packages/block-library/src/query-no-results/block.json index f042223f36aec..789dcc8e66f60 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 ad87d05b5ed99..d4861519f149e 100644 --- a/packages/block-library/src/query-pagination-next/block.json +++ b/packages/block-library/src/query-pagination-next/block.json @@ -14,6 +14,7 @@ }, "usesContext": [ "queryId", "query", "paginationArrow" ], "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 fd28596581961..a05faff5f1b52 100644 --- a/packages/block-library/src/query-pagination-numbers/block.json +++ b/packages/block-library/src/query-pagination-numbers/block.json @@ -9,6 +9,7 @@ "textdomain": "default", "usesContext": [ "queryId", "query" ], "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 484cefe6bbd82..823808b0fb054 100644 --- a/packages/block-library/src/query-pagination-previous/block.json +++ b/packages/block-library/src/query-pagination-previous/block.json @@ -14,6 +14,7 @@ }, "usesContext": [ "queryId", "query", "paginationArrow" ], "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 f75f4077d4e13..fa980575ec969 100644 --- a/packages/block-library/src/query-pagination/block.json +++ b/packages/block-library/src/query-pagination/block.json @@ -18,6 +18,7 @@ "paginationArrow": "paginationArrow" }, "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 33df75866bce0..029762c321e39 100644 --- a/packages/block-library/src/query-title/block.json +++ b/packages/block-library/src/query-title/block.json @@ -27,6 +27,7 @@ } }, "supports": { + "anchor": true, "align": [ "wide", "full" ], "html": false, "color": { diff --git a/packages/block-library/src/query/block.json b/packages/block-library/src/query/block.json index cd09e22ee57f7..55c9a84418247 100644 --- a/packages/block-library/src/query/block.json +++ b/packages/block-library/src/query/block.json @@ -49,6 +49,7 @@ }, "supports": { "align": [ "wide", "full" ], + "anchor": true, "html": false, "color": { "gradients": true, diff --git a/packages/block-library/src/read-more/block.json b/packages/block-library/src/read-more/block.json index 61b0452c7c80e..ed2b23c3b7f0f 100644 --- a/packages/block-library/src/read-more/block.json +++ b/packages/block-library/src/read-more/block.json @@ -17,6 +17,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 8a351d877a751..2e3fd4b2d385e 100644 --- a/packages/block-library/src/rss/block.json +++ b/packages/block-library/src/rss/block.json @@ -43,6 +43,7 @@ }, "supports": { "align": true, + "anchor": true, "html": false }, "editorStyle": "wp-block-rss-editor", diff --git a/packages/block-library/src/search/block.json b/packages/block-library/src/search/block.json index fbd0fa874c408..387295ebb36de 100644 --- a/packages/block-library/src/search/block.json +++ b/packages/block-library/src/search/block.json @@ -46,6 +46,7 @@ }, "supports": { "align": [ "left", "center", "right" ], + "anchor": true, "color": { "gradients": true, "__experimentalSkipSerialization": true, diff --git a/packages/block-library/src/site-logo/block.json b/packages/block-library/src/site-logo/block.json index f7efcb72159ff..f5eab1de304bc 100644 --- a/packages/block-library/src/site-logo/block.json +++ b/packages/block-library/src/site-logo/block.json @@ -31,6 +31,7 @@ }, "supports": { "html": false, + "anchor": true, "align": true, "alignWide": false, "color": { diff --git a/packages/block-library/src/site-tagline/block.json b/packages/block-library/src/site-tagline/block.json index ba477290a53df..c7da7ebf3fdde 100644 --- a/packages/block-library/src/site-tagline/block.json +++ b/packages/block-library/src/site-tagline/block.json @@ -13,6 +13,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 aeac5ee57462f..b69acda934fda 100644 --- a/packages/block-library/src/site-title/block.json +++ b/packages/block-library/src/site-title/block.json @@ -27,6 +27,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 90a3f270d738d..d6087360dc6ee 100644 --- a/packages/block-library/src/social-link/block.json +++ b/packages/block-library/src/social-link/block.json @@ -25,6 +25,7 @@ "iconBackgroundColorValue" ], "supports": { + "anchor": true, "reusable": false, "html": false }, diff --git a/packages/block-library/src/tag-cloud/block.json b/packages/block-library/src/tag-cloud/block.json index c722227398603..ec1e333512719 100644 --- a/packages/block-library/src/tag-cloud/block.json +++ b/packages/block-library/src/tag-cloud/block.json @@ -36,6 +36,7 @@ ], "supports": { "html": false, + "anchor": true, "align": true, "spacing": { "margin": true, diff --git a/packages/block-library/src/template-part/block.json b/packages/block-library/src/template-part/block.json index 3801eee941bc9..282ac2ca22127 100644 --- a/packages/block-library/src/template-part/block.json +++ b/packages/block-library/src/template-part/block.json @@ -21,6 +21,7 @@ } }, "supports": { + "anchor": true, "align": true, "html": false, "reusable": false diff --git a/packages/block-library/src/term-description/block.json b/packages/block-library/src/term-description/block.json index 66eb9348a4709..5e945b2d0f637 100644 --- a/packages/block-library/src/term-description/block.json +++ b/packages/block-library/src/term-description/block.json @@ -12,6 +12,7 @@ } }, "supports": { + "anchor": true, "align": [ "wide", "full" ], "html": false, "color": { From 291cced2e2cc5289f06f32e2c3bb6d1e4fc944ca Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Tue, 31 Jan 2023 13:11:35 +0100 Subject: [PATCH 3/4] Remove duplicate block support after merge conflict --- packages/block-library/src/comments/block.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/block-library/src/comments/block.json b/packages/block-library/src/comments/block.json index dd95128d453eb..19490f6e99eb4 100644 --- a/packages/block-library/src/comments/block.json +++ b/packages/block-library/src/comments/block.json @@ -29,7 +29,6 @@ "link": true } }, - "html": false, "spacing": { "margin": true, "padding": true From 27b1f794bdfc8e3dbe3fe39e1e86c2b58d17225c Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Tue, 31 Jan 2023 14:10:39 +0100 Subject: [PATCH 4/4] Use wp_should_skip_block_supports_serialization --- lib/block-supports/anchor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/block-supports/anchor.php b/lib/block-supports/anchor.php index 52539030a5787..8f704a5019b36 100644 --- a/lib/block-supports/anchor.php +++ b/lib/block-supports/anchor.php @@ -40,7 +40,7 @@ function gutenberg_apply_anchor_support( $block_type, $block_attributes ) { return array(); } - if ( gutenberg_should_skip_block_supports_serialization( $block_type, 'anchor' ) ) { + if ( wp_should_skip_block_supports_serialization( $block_type, 'anchor' ) ) { return array(); }