Skip to content

Commit

Permalink
Preformatted: Add spacing support (#45196)
Browse files Browse the repository at this point in the history
* Preformatted: Add spacing support
  • Loading branch information
carolinan authored Jul 24, 2023
1 parent fbe27a5 commit 132c8e4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 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 @@ -646,7 +646,7 @@ Add text that respects your spacing and tabs, and also allows styling. ([Source]

- **Name:** core/preformatted
- **Category:** text
- **Supports:** anchor, color (background, gradients, text), typography (fontSize, lineHeight)
- **Supports:** anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight)
- **Attributes:** content

## Pullquote
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/preformatted/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
"text": true
}
},
"spacing": {
"padding": true,
"margin": true
},
"typography": {
"fontSize": true,
"lineHeight": true,
Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/preformatted/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.wp-block-preformatted {
// This block has customizable padding, border-box makes that more predictable.
box-sizing: border-box;
white-space: pre-wrap;
}

.wp-block-preformatted.has-background {
// Add low specificity default padding when a background is used.
:where(.wp-block-preformatted.has-background) {
padding: $block-bg-padding--v $block-bg-padding--h;
}

1 comment on commit 132c8e4

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 132c8e4.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5641650626
📝 Reported issues:

Please sign in to comment.