Skip to content

Commit

Permalink
Latest posts and latest comments: add spacing support (#45110)
Browse files Browse the repository at this point in the history
* Latest posts and latest comments: add spacing support
  • Loading branch information
carolinan authored Nov 3, 2022
1 parent 21075e1 commit de034d2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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, spacing (margin, padding), ~~html~~
- **Attributes:** commentsToShow, displayAvatar, displayDate, displayExcerpt

## Latest Posts
Expand All @@ -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, 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
Expand Down
6 changes: 5 additions & 1 deletion packages/block-library/src/latest-comments/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
},
"supports": {
"align": true,
"html": false
"html": false,
"spacing": {
"margin": true,
"padding": true
}
},
"editorStyle": "wp-block-latest-comments-editor",
"style": "wp-block-latest-comments"
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/latest-comments/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default function LatestComments( { attributes, setAttributes } ) {
<ServerSideRender
block="core/latest-comments"
attributes={ attributes }
skipBlockSupportAttributes
// The preview uses the site's locale to make it more true to how
// the block appears on the frontend. Setting the locale
// explicitly prevents any middleware from setting it to 'user'.
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/latest-comments/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ ol.wp-block-latest-comments {
// Due to low specificity this will be safely overriden
// by default wp-block layout styles in the Post/Site editor
margin-left: 0;

// This block has customizable padding, border-box makes that more predictable.
box-sizing: border-box;
}

// Higher specificity - target list via wrapper.
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/latest-posts/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
"supports": {
"align": true,
"html": false,
"spacing": {
"margin": true,
"padding": true
},
"typography": {
"fontSize": true,
"lineHeight": true,
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/latest-posts/style.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.wp-block-latest-posts {
// This block has customizable padding, border-box makes that more predictable.
box-sizing: border-box;

&.alignleft {
/*rtl:ignore*/
margin-right: 2em;
Expand Down

0 comments on commit de034d2

Please sign in to comment.