Skip to content

Commit

Permalink
Table of contents: add spacing supports (#43368)
Browse files Browse the repository at this point in the history
* Adding spacing block supports to table of contents

* Now that the table of contents block has a block supports it will appear in the site editor block search results for the term 'header'. 'header' appears in the block.json description and is therefore a match.
  • Loading branch information
ramonjd authored Aug 19, 2022
1 parent f62d10d commit 3102e12
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ Summarize your post with a list of headings. Add HTML anchors to Heading blocks

- **Name:** core/table-of-contents
- **Category:** layout
- **Supports:** ~~html~~
- **Supports:** spacing (margin, padding), ~~html~~
- **Attributes:** headings, onlyIncludeCurrentPage

## Tag Cloud
Expand Down
6 changes: 5 additions & 1 deletion packages/block-library/src/table-of-contents/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
}
},
"supports": {
"html": false
"html": false,
"spacing": {
"margin": true,
"padding": true
}
},
"example": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ describe( 'Global styles sidebar', () => {
const results = await page.$$(
'.edit-site-block-types-item-list div[role="listitem"]'
);
expect( results.length ).toEqual( 1 );
// Matches both Heading and Table of Contents blocks. (The latter contains "heading" in its description.)
expect( results.length ).toEqual( 2 );
} );
} );
} );

0 comments on commit 3102e12

Please sign in to comment.