Make WordPress Core


Ignore:
Timestamp:
09/18/2023 06:47:44 AM (16 months ago)
Author:
isabel_brison
Message:

Editor: add text orientation for blocks with typography support.

Adds a new text orientation option to the typography block support, implemented with CSS writing-mode.

Props poena.
Fixes #59306.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-supports/typography.php

    r56535 r56605  
    3535    $has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false );
    3636    $has_text_transform_support  = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false );
     37    $has_writing_mode_support    = _wp_array_get( $typography_supports, array( '__experimentalWritingMode' ), false );
    3738
    3839    $has_typography_support = $has_font_family_support
     
    4445        || $has_text_columns_support
    4546        || $has_text_decoration_support
    46         || $has_text_transform_support;
     47        || $has_text_transform_support
     48        || $has_writing_mode_support;
    4749
    4850    if ( ! $block_type->attributes ) {
     
    106108    $has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false );
    107109    $has_text_transform_support  = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false );
     110    $has_writing_mode_support    = _wp_array_get( $typography_supports, array( '__experimentalWritingMode' ), false );
    108111
    109112    // Whether to skip individual block support features.
     
    117120    $should_skip_text_transform  = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textTransform' );
    118121    $should_skip_letter_spacing  = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'letterSpacing' );
     122    $should_skip_writing_mode    = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'writingMode' );
    119123
    120124    $typography_block_styles = array();
     
    206210    }
    207211
     212    if ( $has_writing_mode_support &&
     213        ! $should_skip_writing_mode &&
     214        isset( $block_attributes['style']['typography']['writingMode'] )
     215    ) {
     216        $typography_block_styles['writingMode'] = _wp_array_get(
     217            $block_attributes,
     218            array( 'style', 'typography', 'writingMode' ),
     219            null
     220        );
     221    }
     222
    208223    $attributes = array();
    209224    $styles     = wp_style_engine_get_styles(
Note: See TracChangeset for help on using the changeset viewer.