Make WordPress Core

Changeset 56605


Ignore:
Timestamp:
09/18/2023 06:47:44 AM (20 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.

Location:
trunk/src/wp-includes
Files:
3 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(
  • trunk/src/wp-includes/class-wp-theme-json.php

    r56559 r56605  
    204204     * @since 6.2.0 Added `outline-*`, and `min-height` properties.
    205205     * @since 6.3.0 Added `column-count` property.
     206     * @since 6.4.0 Added `writing-mode` property.
    206207     *
    207208     * @var array
     
    262263        'filter'                            => array( 'filter', 'duotone' ),
    263264        'box-shadow'                        => array( 'shadow' ),
     265        'writing-mode'                      => array( 'typography', 'writingMode' ),
    264266    );
    265267
     
    341343     *              `position.fixed` and `position.sticky`.
    342344     * @since 6.3.0 Added support for `typography.textColumns`, removed `layout.definitions`.
    343      * @since 6.4.0 Added `layout.allowEditing`.
     345     * @since 6.4.0 Added `layout.allowEditing` and `typography.writingMode`.
    344346     *
    345347     * @var array
     
    410412            'textDecoration' => null,
    411413            'textTransform'  => null,
     414            'writingMode'    => null,
    412415        ),
    413416    );
     
    472475            'textDecoration' => null,
    473476            'textTransform'  => null,
     477            'writingMode'    => null,
    474478        ),
    475479        'css'        => null,
  • trunk/src/wp-includes/theme.json

    r56055 r56605  
    264264            "lineHeight": false,
    265265            "textDecoration": true,
    266             "textTransform": true
     266            "textTransform": true,
     267            "writingMode": false
    267268        },
    268269        "blocks": {
Note: See TracChangeset for help on using the changeset viewer.