diff --git a/src/wp-includes/block-supports/typography.php b/src/wp-includes/block-supports/typography.php index b31464c12d547..f1a69572a0f6c 100644 --- a/src/wp-includes/block-supports/typography.php +++ b/src/wp-includes/block-supports/typography.php @@ -34,6 +34,7 @@ function wp_register_typography_support( $block_type ) { $has_text_columns_support = _wp_array_get( $typography_supports, array( 'textColumns' ), false ); $has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false ); $has_text_transform_support = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false ); + $has_writing_mode_support = _wp_array_get( $typography_supports, array( '__experimentalWritingMode' ), false ); $has_typography_support = $has_font_family_support || $has_font_size_support @@ -43,7 +44,8 @@ function wp_register_typography_support( $block_type ) { || $has_line_height_support || $has_text_columns_support || $has_text_decoration_support - || $has_text_transform_support; + || $has_text_transform_support + || $has_writing_mode_support; if ( ! $block_type->attributes ) { $block_type->attributes = array(); @@ -105,6 +107,7 @@ function wp_apply_typography_support( $block_type, $block_attributes ) { $has_text_columns_support = _wp_array_get( $typography_supports, array( 'textColumns' ), false ); $has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false ); $has_text_transform_support = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false ); + $has_writing_mode_support = _wp_array_get( $typography_supports, array( '__experimentalWritingMode' ), false ); // Whether to skip individual block support features. $should_skip_font_size = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontSize' ); @@ -116,6 +119,7 @@ function wp_apply_typography_support( $block_type, $block_attributes ) { $should_skip_text_decoration = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textDecoration' ); $should_skip_text_transform = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textTransform' ); $should_skip_letter_spacing = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'letterSpacing' ); + $should_skip_writing_mode = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'writingMode' ); $typography_block_styles = array(); if ( $has_font_size_support && ! $should_skip_font_size ) { @@ -205,6 +209,17 @@ function wp_apply_typography_support( $block_type, $block_attributes ) { ); } + if ( $has_writing_mode_support && + ! $should_skip_writing_mode && + isset( $block_attributes['style']['typography']['writingMode'] ) + ) { + $typography_block_styles['writingMode'] = _wp_array_get( + $block_attributes, + array( 'style', 'typography', 'writingMode' ), + null + ); + } + $attributes = array(); $styles = wp_style_engine_get_styles( array( 'typography' => $typography_block_styles ), diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index 95cbac23c3322..14a2d80408bf1 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -203,6 +203,7 @@ class WP_Theme_JSON { * removed the `--wp--style--block-gap` property. * @since 6.2.0 Added `outline-*`, and `min-height` properties. * @since 6.3.0 Added `column-count` property. + * @since 6.4.0 Added `writing-mode` property. * * @var array */ @@ -261,6 +262,7 @@ class WP_Theme_JSON { 'text-transform' => array( 'typography', 'textTransform' ), 'filter' => array( 'filter', 'duotone' ), 'box-shadow' => array( 'shadow' ), + 'writing-mode' => array( 'typography', 'writingMode' ), ); /** @@ -340,7 +342,7 @@ class WP_Theme_JSON { * @since 6.2.0 Added `dimensions.minHeight`, 'shadow.presets', 'shadow.defaultPresets', * `position.fixed` and `position.sticky`. * @since 6.3.0 Added support for `typography.textColumns`, removed `layout.definitions`. - * @since 6.4.0 Added `layout.allowEditing`. + * @since 6.4.0 Added `layout.allowEditing` and `typography.writingMode`. * * @var array */ @@ -409,6 +411,7 @@ class WP_Theme_JSON { 'textColumns' => null, 'textDecoration' => null, 'textTransform' => null, + 'writingMode' => null, ), ); @@ -471,6 +474,7 @@ class WP_Theme_JSON { 'textColumns' => null, 'textDecoration' => null, 'textTransform' => null, + 'writingMode' => null, ), 'css' => null, ); diff --git a/src/wp-includes/theme.json b/src/wp-includes/theme.json index fd116a42ba724..e209d947d105b 100644 --- a/src/wp-includes/theme.json +++ b/src/wp-includes/theme.json @@ -263,7 +263,8 @@ "letterSpacing": true, "lineHeight": false, "textDecoration": true, - "textTransform": true + "textTransform": true, + "writingMode": false }, "blocks": { "core/button": {