Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
3 changes: 3 additions & 0 deletions backport-changelog/7.1/12011.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/12011

* https://github.com/WordPress/gutenberg/pull/73320
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ New styles options are integrated into theme.json on a regular basis. Knowing th
| `typography.textColumns` | 6.1 | N/A |
| `typography.textDecoration` | 5.9 | 6.2 |
| `typography.textIndent` | 7.0 | 7.0 |
| `typography.textShadow` | 7.1 | N/A |
| `typography.textTransform` | 5.9 | 6.0 |
| `typography.writingMode` | 6.3 | 6.3 |
| `spacing.padding` | 5.9 | 5.9 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ Typography styles.
| textAlign | Sets the `text-align` CSS property. | `string`, `{ ref }` |
| textColumns | Sets the `column-count` CSS property. | `string`, `{ ref }` |
| textDecoration | Sets the `text-decoration` CSS property. | `string`, `{ ref }` |
| textShadow | Sets the `text-shadow` CSS property. | `string`, `{ ref }` |
| writingMode | Sets the `writing-mode` CSS property. | `string`, `{ ref }` |
| textTransform | Sets the `text-transform` CSS property. | `string`, `{ ref }` |

Expand Down
2 changes: 2 additions & 0 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ class WP_Theme_JSON_Gutenberg {
'--wp--style--root--padding-bottom' => array( 'spacing', 'padding', 'bottom' ),
'--wp--style--root--padding-left' => array( 'spacing', 'padding', 'left' ),
'text-decoration' => array( 'typography', 'textDecoration' ),
'text-shadow' => array( 'typography', 'textShadow' ),
'text-transform' => array( 'typography', 'textTransform' ),
'text-indent' => array( 'typography', 'textIndent' ),
'filter' => array( 'filter', 'duotone' ),
Expand Down Expand Up @@ -583,6 +584,7 @@ class WP_Theme_JSON_Gutenberg {
'textColumns' => null,
'textDecoration' => null,
'textIndent' => null,
'textShadow' => null,
'textTransform' => null,
'writingMode' => null,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
// Set the opacity of the initial block appender to the same as placeholder text in an empty Paragraph block.
opacity: 0.62;

// Reset the text shadow from the global styles.
text-shadow: none;

// The following prevents user agent styles from applying margins to the appender's inner paragraph.
// This in turn prevents layout shift due to layout styles removing margins from first and last children.
margin-block-start: 0;
Expand Down
2 changes: 2 additions & 0 deletions packages/block-editor/src/components/rich-text/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
// Use opacity to work in various editor styles.
// We don't specify the color here, because blocks or editor styles might provide their own.
opacity: 0.62;
// Reset the text shadow from the global styles.
text-shadow: none;
Comment on lines +13 to +14

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure whether to add this, but if we don't reset the shadow, the placeholder is very hard to see.

Image

}

&:focus {
Expand Down
6 changes: 6 additions & 0 deletions packages/style-engine/src/class-wp-style-engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ final class WP_Style_Engine {
),
'path' => array( 'typography', 'textIndent' ),
),
'textShadow' => array(
'property_keys' => array(
'default' => 'text-shadow',
),
'path' => array( 'typography', 'textShadow' ),
),
'textTransform' => array(
'property_keys' => array(
'default' => 'text-transform',
Expand Down
13 changes: 13 additions & 0 deletions packages/style-engine/src/styles/typography/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,18 @@ const writingMode = {
},
};

const textShadow = {
name: 'textShadow',
generate: ( style: Style, options: StyleOptions ) => {
return generateRule(
style,
options,
[ 'typography', 'textShadow' ],
'textShadow'
);
},
};

export default [
fontFamily,
fontSize,
Expand All @@ -146,6 +158,7 @@ export default [
textColumns,
textDecoration,
textIndent,
textShadow,
textTransform,
writingMode,
];
9 changes: 8 additions & 1 deletion packages/style-engine/src/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ describe( 'generate', () => {
lineHeight: '3.3',
textColumns: '2',
textDecoration: 'line-through',
textShadow: '1px 1px 2px red',
letterSpacing: '12px',
textTransform: 'uppercase',
},
Expand All @@ -91,7 +92,7 @@ describe( 'generate', () => {
}
)
).toEqual(
".some-selector { color: #cccccc; background: linear-gradient(135deg,rgb(255,203,112) 0%,rgb(33,32,33) 42%,rgb(65,88,208) 100%); background-color: #111111; min-height: 50vh; min-width: 25vw; object-fit: cover; outline-color: red; outline-style: dashed; outline-offset: 2px; outline-width: 4px; margin-top: 11px; margin-right: 12px; margin-bottom: 13px; margin-left: 14px; padding-top: 10px; padding-bottom: 5px; font-family: 'Helvetica Neue',sans-serif; font-size: 2.2rem; font-style: italic; font-weight: 800; letter-spacing: 12px; line-height: 3.3; column-count: 2; text-decoration: line-through; text-transform: uppercase; }"
".some-selector { color: #cccccc; background: linear-gradient(135deg,rgb(255,203,112) 0%,rgb(33,32,33) 42%,rgb(65,88,208) 100%); background-color: #111111; min-height: 50vh; min-width: 25vw; object-fit: cover; outline-color: red; outline-style: dashed; outline-offset: 2px; outline-width: 4px; margin-top: 11px; margin-right: 12px; margin-bottom: 13px; margin-left: 14px; padding-top: 10px; padding-bottom: 5px; font-family: 'Helvetica Neue',sans-serif; font-size: 2.2rem; font-style: italic; font-weight: 800; letter-spacing: 12px; line-height: 3.3; column-count: 2; text-decoration: line-through; text-shadow: 1px 1px 2px red; text-transform: uppercase; }"
);
} );

Expand Down Expand Up @@ -257,6 +258,7 @@ describe( 'getCSSRules', () => {
lineHeight: '3.3',
textColumns: '2',
textDecoration: 'line-through',
textShadow: '1px 1px 2px red',
letterSpacing: '12px',
textTransform: 'uppercase',
},
Expand Down Expand Up @@ -378,6 +380,11 @@ describe( 'getCSSRules', () => {
key: 'textDecoration',
value: 'line-through',
},
{
selector: '.some-selector',
key: 'textShadow',
value: '1px 1px 2px red',
},
{
selector: '.some-selector',
key: 'textTransform',
Expand Down
1 change: 1 addition & 0 deletions packages/style-engine/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export interface Style {
lineHeight?: CSSProperties[ 'lineHeight' ];
textColumns?: CSSProperties[ 'columnCount' ];
textDecoration?: CSSProperties[ 'textDecoration' ];
textShadow?: CSSProperties[ 'textShadow' ];
textTransform?: CSSProperties[ 'textTransform' ];
writingMode?: CSSProperties[ 'writingMode' ];
};
Expand Down
7 changes: 6 additions & 1 deletion phpunit/class-wp-theme-json-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,11 @@ public function test_get_stylesheet() {
'textAlign' => 'center',
),
),
'core/paragraph' => array(
'typography' => array(
'textShadow' => '1px 1px 2px rgba(0,0,0,0.3)',
),
),
'core/post-date' => array(
'color' => array(
'text' => '#123456',
Expand Down Expand Up @@ -618,7 +623,7 @@ public function test_get_stylesheet() {
);

$variables = ':root{--wp--preset--color--grey: grey;--wp--preset--gradient--custom-gradient: linear-gradient(135deg,rgba(0,0,0) 0%,rgb(0,0,0) 100%);--wp--preset--font-size--small: 14px;--wp--preset--font-size--big: 41px;--wp--preset--font-family--arial: Arial, serif;}.wp-block-group{--wp--custom--base-font: 16;--wp--custom--line-height--small: 1.2;--wp--custom--line-height--medium: 1.4;--wp--custom--line-height--large: 1.8;}';
$styles = static::$base_styles . 'body{color: var(--wp--preset--color--grey);}a:where(:not(.wp-element-button)){background-color: #333;color: #111;}:root :where(.wp-element-button, .wp-block-button__link){box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.66);}:root :where(.wp-block-cover){min-height: unset;aspect-ratio: 16/9;}:root :where(.wp-block-group){background: var(--wp--preset--gradient--custom-gradient);border-radius: 10px;min-height: 50vh;padding: 24px;}:root :where(.wp-block-group a:where(:not(.wp-element-button))){color: #111;}:root :where(.wp-block-heading){color: #123456;}:root :where(.wp-block-heading a:where(:not(.wp-element-button))){background-color: #333;color: #111;font-size: 60px;}:root :where(.wp-block-media-text){text-align: center;}:root :where(.wp-block-post-date){color: #123456;}:root :where(.wp-block-post-date a:where(:not(.wp-element-button))){background-color: #777;color: #555;}:root :where(.wp-block-post-excerpt){column-count: 2;}:root :where(.wp-block-image){margin-bottom: 30px;}:root :where(.wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder){border-top-left-radius: 10px;border-bottom-right-radius: 1em;}:root :where(.wp-block-image img, .wp-block-image .components-placeholder){filter: var(--wp--preset--duotone--custom-duotone);}';
$styles = static::$base_styles . 'body{color: var(--wp--preset--color--grey);}a:where(:not(.wp-element-button)){background-color: #333;color: #111;}:root :where(.wp-element-button, .wp-block-button__link){box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.66);}:root :where(.wp-block-cover){min-height: unset;aspect-ratio: 16/9;}:root :where(.wp-block-group){background: var(--wp--preset--gradient--custom-gradient);border-radius: 10px;min-height: 50vh;padding: 24px;}:root :where(.wp-block-group a:where(:not(.wp-element-button))){color: #111;}:root :where(.wp-block-heading){color: #123456;}:root :where(.wp-block-heading a:where(:not(.wp-element-button))){background-color: #333;color: #111;font-size: 60px;}:root :where(.wp-block-media-text){text-align: center;}:root :where(p){text-shadow: 1px 1px 2px rgba(0,0,0,0.3);}:root :where(.wp-block-post-date){color: #123456;}:root :where(.wp-block-post-date a:where(:not(.wp-element-button))){background-color: #777;color: #555;}:root :where(.wp-block-post-excerpt){column-count: 2;}:root :where(.wp-block-image){margin-bottom: 30px;}:root :where(.wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder){border-top-left-radius: 10px;border-bottom-right-radius: 1em;}:root :where(.wp-block-image img, .wp-block-image .components-placeholder){filter: var(--wp--preset--duotone--custom-duotone);}';
$presets = '.has-grey-color{color: var(--wp--preset--color--grey) !important;}.has-grey-background-color{background-color: var(--wp--preset--color--grey) !important;}.has-grey-border-color{border-color: var(--wp--preset--color--grey) !important;}.has-custom-gradient-gradient-background{background: var(--wp--preset--gradient--custom-gradient) !important;}.has-small-font-size{font-size: var(--wp--preset--font-size--small) !important;}.has-big-font-size{font-size: var(--wp--preset--font-size--big) !important;}.has-arial-font-family{font-family: var(--wp--preset--font-family--arial) !important;}';
$all = $variables . $styles . $presets;

Expand Down
7 changes: 7 additions & 0 deletions schemas/json/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -1797,6 +1797,13 @@
{ "$ref": "#/definitions/refComplete" }
]
},
"textShadow": {
"description": "Sets the `text-shadow` CSS property.",
"oneOf": [
{ "type": "string" },
{ "$ref": "#/definitions/refComplete" }
]
},
"writingMode": {
"description": "Sets the `writing-mode` CSS property.",
"oneOf": [
Expand Down
Loading