Make WordPress Core


Ignore:
Timestamp:
06/22/2023 08:16:05 AM (2 years ago)
Author:
isabel_brison
Message:

Editor: add text columns to typography support.

Adds a text columns feature to the typography block support that uses CSS column-count for multi-column text.

Props ramonopoly, aaronrobertshaw.
Fixes #58549.

File:
1 edited

Legend:

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

    r55947 r55985  
    1111 *
    1212 * @since 5.6.0
     13 * @since 6.3.0 Added support for text-columns.
    1314 * @access private
    1415 *
     
    3132    $has_letter_spacing_support  = _wp_array_get( $typography_supports, array( '__experimentalLetterSpacing' ), false );
    3233    $has_line_height_support     = _wp_array_get( $typography_supports, array( 'lineHeight' ), false );
     34    $has_text_columns_support    = _wp_array_get( $typography_supports, array( 'textColumns' ), false );
    3335    $has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false );
    3436    $has_text_transform_support  = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false );
     
    4042        || $has_letter_spacing_support
    4143        || $has_line_height_support
     44        || $has_text_columns_support
    4245        || $has_text_decoration_support
    4346        || $has_text_transform_support;
     
    7376 * @since 5.6.0
    7477 * @since 6.1.0 Used the style engine to generate CSS and classnames.
     78 * @since 6.3.0 Added support for text-columns.
    7579 * @access private
    7680 *
     
    99103    $has_letter_spacing_support  = _wp_array_get( $typography_supports, array( '__experimentalLetterSpacing' ), false );
    100104    $has_line_height_support     = _wp_array_get( $typography_supports, array( 'lineHeight' ), false );
     105    $has_text_columns_support    = _wp_array_get( $typography_supports, array( 'textColumns' ), false );
    101106    $has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false );
    102107    $has_text_transform_support  = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false );
     
    108113    $should_skip_font_weight     = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontWeight' );
    109114    $should_skip_line_height     = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'lineHeight' );
     115    $should_skip_text_columns    = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textColumns' );
    110116    $should_skip_text_decoration = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textDecoration' );
    111117    $should_skip_text_transform  = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textTransform' );
     
    163169    }
    164170
     171    if ( $has_text_columns_support && ! $should_skip_text_columns && isset( $block_attributes['style']['typography']['textColumns'] ) ) {
     172        $typography_block_styles['textColumns'] = _wp_array_get( $block_attributes, array( 'style', 'typography', 'textColumns' ), null );
     173    }
     174
    165175    if (
    166176        $has_text_decoration_support &&
Note: See TracChangeset for help on using the changeset viewer.