mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-27 14:53:08 +02:00
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. Built from https://develop.svn.wordpress.org/trunk@56605 git-svn-id: http://core.svn.wordpress.org/trunk@56117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
305ccb98e0
commit
df3137aca1
@ -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_columns_support = _wp_array_get( $typography_supports, array( 'textColumns' ), false );
|
||||||
$has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), 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_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_typography_support = $has_font_family_support
|
||||||
|| $has_font_size_support
|
|| $has_font_size_support
|
||||||
@ -43,7 +44,8 @@ function wp_register_typography_support( $block_type ) {
|
|||||||
|| $has_line_height_support
|
|| $has_line_height_support
|
||||||
|| $has_text_columns_support
|
|| $has_text_columns_support
|
||||||
|| $has_text_decoration_support
|
|| $has_text_decoration_support
|
||||||
|| $has_text_transform_support;
|
|| $has_text_transform_support
|
||||||
|
|| $has_writing_mode_support;
|
||||||
|
|
||||||
if ( ! $block_type->attributes ) {
|
if ( ! $block_type->attributes ) {
|
||||||
$block_type->attributes = array();
|
$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_columns_support = _wp_array_get( $typography_supports, array( 'textColumns' ), false );
|
||||||
$has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), 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_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.
|
// Whether to skip individual block support features.
|
||||||
$should_skip_font_size = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontSize' );
|
$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_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_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_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();
|
$typography_block_styles = array();
|
||||||
if ( $has_font_size_support && ! $should_skip_font_size ) {
|
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();
|
$attributes = array();
|
||||||
$styles = wp_style_engine_get_styles(
|
$styles = wp_style_engine_get_styles(
|
||||||
array( 'typography' => $typography_block_styles ),
|
array( 'typography' => $typography_block_styles ),
|
||||||
|
@ -203,6 +203,7 @@ class WP_Theme_JSON {
|
|||||||
* removed the `--wp--style--block-gap` property.
|
* removed the `--wp--style--block-gap` property.
|
||||||
* @since 6.2.0 Added `outline-*`, and `min-height` properties.
|
* @since 6.2.0 Added `outline-*`, and `min-height` properties.
|
||||||
* @since 6.3.0 Added `column-count` property.
|
* @since 6.3.0 Added `column-count` property.
|
||||||
|
* @since 6.4.0 Added `writing-mode` property.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
@ -261,6 +262,7 @@ class WP_Theme_JSON {
|
|||||||
'text-transform' => array( 'typography', 'textTransform' ),
|
'text-transform' => array( 'typography', 'textTransform' ),
|
||||||
'filter' => array( 'filter', 'duotone' ),
|
'filter' => array( 'filter', 'duotone' ),
|
||||||
'box-shadow' => array( 'shadow' ),
|
'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',
|
* @since 6.2.0 Added `dimensions.minHeight`, 'shadow.presets', 'shadow.defaultPresets',
|
||||||
* `position.fixed` and `position.sticky`.
|
* `position.fixed` and `position.sticky`.
|
||||||
* @since 6.3.0 Added support for `typography.textColumns`, removed `layout.definitions`.
|
* @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
|
* @var array
|
||||||
*/
|
*/
|
||||||
@ -409,6 +411,7 @@ class WP_Theme_JSON {
|
|||||||
'textColumns' => null,
|
'textColumns' => null,
|
||||||
'textDecoration' => null,
|
'textDecoration' => null,
|
||||||
'textTransform' => null,
|
'textTransform' => null,
|
||||||
|
'writingMode' => null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -471,6 +474,7 @@ class WP_Theme_JSON {
|
|||||||
'textColumns' => null,
|
'textColumns' => null,
|
||||||
'textDecoration' => null,
|
'textDecoration' => null,
|
||||||
'textTransform' => null,
|
'textTransform' => null,
|
||||||
|
'writingMode' => null,
|
||||||
),
|
),
|
||||||
'css' => null,
|
'css' => null,
|
||||||
);
|
);
|
||||||
|
@ -263,7 +263,8 @@
|
|||||||
"letterSpacing": true,
|
"letterSpacing": true,
|
||||||
"lineHeight": false,
|
"lineHeight": false,
|
||||||
"textDecoration": true,
|
"textDecoration": true,
|
||||||
"textTransform": true
|
"textTransform": true,
|
||||||
|
"writingMode": false
|
||||||
},
|
},
|
||||||
"blocks": {
|
"blocks": {
|
||||||
"core/button": {
|
"core/button": {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.4-alpha-56604';
|
$wp_version = '6.4-alpha-56605';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user