Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add anchor support
  • Loading branch information
Soean committed Oct 7, 2022
commit 85fffae328d7c82bbbd042c5ea3031ee239bdf52
104 changes: 52 additions & 52 deletions docs/reference-guides/core-blocks.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions lib/block-supports/anchor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/archives/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"supports": {
"align": true,
"anchor": true,
"html": false,
"spacing": {
"margin": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/avatar/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"usesContext": [ "postType", "postId", "commentId" ],
"supports": {
"anchor": true,
"html": false,
"align": true,
"alignWide": false,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/categories/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
},
"supports": {
"align": true,
"anchor": true,
"html": false,
"spacing": {
"margin": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
},
"usesContext": [ "commentId" ],
"supports": {
"anchor": true,
"html": false,
"inserter": false,
"__experimentalBorder": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"usesContext": [ "commentId" ],
"supports": {
"anchor": true,
"html": false,
"spacing": {
"margin": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/comment-content/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
}
},
"supports": {
"anchor": true,
"color": {
"gradients": true,
"link": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/comment-date/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"usesContext": [ "commentId" ],
"supports": {
"anchor": true,
"html": false,
"color": {
"gradients": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/comment-edit-link/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
}
},
"supports": {
"anchor": true,
"html": false,
"color": {
"link": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/comment-reply-link/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
}
},
"supports": {
"anchor": true,
"color": {
"gradients": true,
"link": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/comment-template/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"textdomain": "default",
"usesContext": [ "postId" ],
"supports": {
"anchor": true,
"reusable": false,
"html": false,
"align": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"usesContext": [ "postId", "comments/paginationArrow" ],
"supports": {
"anchor": true,
"reusable": false,
"html": false,
"color": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"textdomain": "default",
"usesContext": [ "postId" ],
"supports": {
"anchor": true,
"reusable": false,
"html": false,
"color": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"usesContext": [ "postId", "comments/paginationArrow" ],
"supports": {
"anchor": true,
"reusable": false,
"html": false,
"color": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"comments/paginationArrow": "paginationArrow"
},
"supports": {
"anchor": true,
"align": true,
"reusable": false,
"html": false,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/comments/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"supports": {
"align": [ "wide", "full" ],
"anchor": true,
"html": false,
"color": {
"gradients": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/home-link/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"style"
],
"supports": {
"anchor": true,
"reusable": false,
"html": false,
"typography": {
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/latest-comments/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
},
"supports": {
"align": true,
"anchor": true,
"html": false
},
"editorStyle": "wp-block-latest-comments-editor",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/latest-posts/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
},
"supports": {
"align": true,
"anchor": true,
"html": false,
"typography": {
"fontSize": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/loginout/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
}
},
"supports": {
"anchor": true,
"className": true,
"typography": {
"fontSize": false
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/navigation/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
},
"supports": {
"align": [ "wide", "full" ],
"anchor": true,
"html": false,
"inserter": true,
"typography": {
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/page-list/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"openSubmenusOnClick"
],
"supports": {
"anchor": true,
"reusable": false,
"html": false
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"usesContext": [ "postType", "postId" ],
"supports": {
"anchor": true,
"spacing": {
"margin": true,
"padding": true
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-author-name/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"usesContext": [ "postType", "postId" ],
"supports": {
"anchor": true,
"html": false,
"spacing": {
"margin": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-author/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
},
"usesContext": [ "postType", "postId", "queryId" ],
"supports": {
"anchor": true,
"html": false,
"spacing": {
"margin": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"usesContext": [ "postId" ],
"supports": {
"anchor": true,
"html": false,
"color": {
"gradients": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-comments-form/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"usesContext": [ "postId", "postType" ],
"supports": {
"anchor": true,
"html": false,
"color": {
"gradients": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-comments-link/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
}
},
"supports": {
"anchor": true,
"html": false,
"color": {
"link": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-content/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"textdomain": "default",
"usesContext": [ "postId", "postType", "queryId" ],
"supports": {
"anchor": true,
"align": [ "wide", "full" ],
"html": false,
"__experimentalLayout": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-date/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"usesContext": [ "postId", "postType", "queryId" ],
"supports": {
"anchor": true,
"html": false,
"color": {
"gradients": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-excerpt/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
},
"usesContext": [ "postId", "postType", "queryId" ],
"supports": {
"anchor": true,
"html": false,
"color": {
"gradients": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
}
},
"supports": {
"anchor": true,
"reusable": false,
"html": false,
"color": {
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-template/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"reusable": false,
"html": false,
"align": true,
"anchor": true,
"__experimentalLayout": {
"allowEditing": false
},
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-terms/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
},
"usesContext": [ "postId", "postType" ],
"supports": {
"anchor": true,
"html": false,
"color": {
"gradients": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
},
"supports": {
"align": [ "wide", "full" ],
"anchor": true,
"html": false,
"color": {
"gradients": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/query-no-results/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"textdomain": "default",
"usesContext": [ "queryId", "query" ],
"supports": {
"anchor": true,
"align": true,
"reusable": false,
"html": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"usesContext": [ "queryId", "query", "paginationArrow" ],
"supports": {
"anchor": true,
"reusable": false,
"html": false,
"color": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"textdomain": "default",
"usesContext": [ "queryId", "query" ],
"supports": {
"anchor": true,
"reusable": false,
"html": false,
"color": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"usesContext": [ "queryId", "query", "paginationArrow" ],
"supports": {
"anchor": true,
"reusable": false,
"html": false,
"color": {
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/query-pagination/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"paginationArrow": "paginationArrow"
},
"supports": {
"anchor": true,
"align": true,
"reusable": false,
"html": false,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/query-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
}
},
"supports": {
"anchor": true,
"align": [ "wide", "full" ],
"html": false,
"color": {
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/query/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
},
"supports": {
"align": [ "wide", "full" ],
"anchor": true,
"html": false,
"color": {
"gradients": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/read-more/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"usesContext": [ "postId" ],
"supports": {
"anchor": true,
"html": false,
"color": {
"gradients": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/rss/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
},
"supports": {
"align": true,
"anchor": true,
"html": false
},
"editorStyle": "wp-block-rss-editor",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/search/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
},
"supports": {
"align": [ "left", "center", "right" ],
"anchor": true,
"color": {
"gradients": true,
"__experimentalSkipSerialization": true,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/site-logo/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
},
"supports": {
"html": false,
"anchor": true,
"align": true,
"alignWide": false,
"color": {
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/site-tagline/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
}
},
"supports": {
"anchor": true,
"align": [ "wide", "full" ],
"html": false,
"color": {
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/site-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"viewportWidth": 500
},
"supports": {
"anchor": true,
"align": [ "wide", "full" ],
"html": false,
"color": {
Expand Down
Loading