Skip to content

Commit

Permalink
Editor: Fix writingMode support in dynamic blocks.
Browse files Browse the repository at this point in the history
Adds missing handling for the `typography.writingMode` property to the style engine, so that dynamic blocks correctly render text orientation styles on the site frontend.

Props wildworks, aaronrobertshaw, poena, get_dave, ndiego.
Fixes #62189.
See #59306.


git-svn-id: https://develop.svn.wordpress.org/trunk@59199 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
andrewserong committed Oct 9, 2024
1 parent 8eec9f2 commit 2ae4473
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/wp-includes/style-engine/class-wp-style-engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* @since 6.4.0 Added support for background.backgroundImage.
* @since 6.5.0 Added support for background.backgroundPosition,
* background.backgroundRepeat and dimensions.aspectRatio.
* @since 6.7.0 Added support for typography.writingMode.
*/
#[AllowDynamicProperties]
final class WP_Style_Engine {
Expand Down Expand Up @@ -305,6 +306,12 @@ final class WP_Style_Engine {
),
'path' => array( 'typography', 'letterSpacing' ),
),
'writingMode' => array(
'property_keys' => array(
'default' => 'writing-mode',
),
'path' => array( 'typography', 'writingMode' ),
),
),
);

Expand Down
5 changes: 4 additions & 1 deletion tests/phpunit/tests/style-engine/styleEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function tear_down() {
* @ticket 58590
* @ticket 60175
* @ticket 61720
* @ticket 62189
*
* @covers ::wp_style_engine_get_styles
*
Expand Down Expand Up @@ -228,11 +229,12 @@ public function data_wp_style_engine_get_styles() {
'textDecoration' => 'underline',
'textTransform' => 'uppercase',
'letterSpacing' => '2',
'writingMode' => 'vertical-rl',
),
),
'options' => null,
'expected_output' => array(
'css' => 'font-size:clamp(2em, 2vw, 4em);font-family:Roboto,Oxygen-Sans,Ubuntu,sans-serif;font-style:italic;font-weight:800;line-height:1.3;column-count:2;text-decoration:underline;text-transform:uppercase;letter-spacing:2;',
'css' => 'font-size:clamp(2em, 2vw, 4em);font-family:Roboto,Oxygen-Sans,Ubuntu,sans-serif;font-style:italic;font-weight:800;line-height:1.3;column-count:2;text-decoration:underline;text-transform:uppercase;letter-spacing:2;writing-mode:vertical-rl;',
'declarations' => array(
'font-size' => 'clamp(2em, 2vw, 4em)',
'font-family' => 'Roboto,Oxygen-Sans,Ubuntu,sans-serif',
Expand All @@ -243,6 +245,7 @@ public function data_wp_style_engine_get_styles() {
'text-decoration' => 'underline',
'text-transform' => 'uppercase',
'letter-spacing' => '2',
'writing-mode' => 'vertical-rl',
),
),
),
Expand Down

0 comments on commit 2ae4473

Please sign in to comment.