Commit 91029d43bf for wordpress.org

commit 91029d43bf0d74427088a92a5a7958d9048f3005
Author: wildworks <wildworks@git.wordpress.org>
Date:   Mon Oct 5 07:05:51 2026 +0000

    Editor: Add text-shadow block support.

    Blocks can now opt in to text shadow support under typography supports, and themes can define text shadow presets in theme.json. The `text-shadow` property is also added to the list of CSS properties allowed in inline styles.

    Developed in https://github.com/WordPress/wordpress-develop/pull/13035

    Props wildworks, peterwilsoncc.
    Fixes #65869.

    Built from https://develop.svn.wordpress.org/trunk@64093


    git-svn-id: http://core.svn.wordpress.org/trunk@63252 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/block-supports/typography.php b/wp-includes/block-supports/typography.php
index 8e80d0e60b..b0d2de2aed 100644
--- a/wp-includes/block-supports/typography.php
+++ b/wp-includes/block-supports/typography.php
@@ -37,6 +37,7 @@ function wp_register_typography_support( $block_type ) {
 	$has_text_decoration_support = $typography_supports['__experimentalTextDecoration'] ?? false;
 	$has_text_transform_support  = $typography_supports['__experimentalTextTransform'] ?? false;
 	$has_text_indent_support     = $typography_supports['textIndent'] ?? false;
+	$has_text_shadow_support     = $typography_supports['textShadow'] ?? false;
 	$has_writing_mode_support    = $typography_supports['__experimentalWritingMode'] ?? false;

 	$has_typography_support = $has_font_family_support
@@ -50,6 +51,7 @@ function wp_register_typography_support( $block_type ) {
 		|| $has_text_decoration_support
 		|| $has_text_transform_support
 		|| $has_text_indent_support
+		|| $has_text_shadow_support
 		|| $has_writing_mode_support;

 	if ( ! $block_type->attributes ) {
@@ -73,6 +75,12 @@ function wp_register_typography_support( $block_type ) {
 			'type' => 'string',
 		);
 	}
+
+	if ( $has_text_shadow_support && ! array_key_exists( 'textShadow', $block_type->attributes ) ) {
+		$block_type->attributes['textShadow'] = array(
+			'type' => 'string',
+		);
+	}
 }

 /**
@@ -115,6 +123,7 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
 	$has_text_decoration_support = $typography_supports['__experimentalTextDecoration'] ?? false;
 	$has_text_transform_support  = $typography_supports['__experimentalTextTransform'] ?? false;
 	$has_text_indent_support     = $typography_supports['textIndent'] ?? false;
+	$has_text_shadow_support     = $typography_supports['textShadow'] ?? false;
 	$has_writing_mode_support    = $typography_supports['__experimentalWritingMode'] ?? false;

 	// Whether to skip individual block support features.
@@ -129,6 +138,7 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
 	$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_text_indent     = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textIndent' );
+	$should_skip_text_shadow     = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textShadow' );
 	$should_skip_writing_mode    = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'writingMode' );

 	$typography_block_styles = array();
@@ -232,6 +242,12 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
 		$typography_block_styles['textIndent'] = $block_attributes['style']['typography']['textIndent'] ?? null;
 	}

+	if ( $has_text_shadow_support && ! $should_skip_text_shadow ) {
+		$preset_text_shadow                    = array_key_exists( 'textShadow', $block_attributes ) ? "var:preset|text-shadow|{$block_attributes['textShadow']}" : null;
+		$custom_text_shadow                    = $block_attributes['style']['typography']['textShadow'] ?? null;
+		$typography_block_styles['textShadow'] = $preset_text_shadow ? $preset_text_shadow : $custom_text_shadow;
+	}
+
 	$attributes = array();
 	$classnames = array();
 	$styles     = wp_style_engine_get_styles(
diff --git a/wp-includes/class-wp-theme-json.php b/wp-includes/class-wp-theme-json.php
index 704405af2b..9be92d1fcc 100644
--- a/wp-includes/class-wp-theme-json.php
+++ b/wp-includes/class-wp-theme-json.php
@@ -127,6 +127,7 @@ class WP_Theme_JSON {
 	 *              Updated the 'prevent_override' value for font size presets to use 'typography.defaultFontSizes'
 	 *              and spacing size presets to use `spacing.defaultSpacingSizes`.
 	 * @since 6.9.0 Added `border.radiusSizes`.
+	 * @since 7.2.0 Added `typography.textShadowPresets`.
 	 * @var array
 	 */
 	const PRESETS_METADATA = array(
@@ -188,6 +189,15 @@ class WP_Theme_JSON {
 			'classes'           => array( '.has-$slug-font-family' => 'font-family' ),
 			'properties'        => array( 'font-family' ),
 		),
+		array(
+			'path'              => array( 'typography', 'textShadowPresets' ),
+			'prevent_override'  => array( 'typography', 'defaultTextShadowPresets' ),
+			'use_default_names' => false,
+			'value_key'         => 'textShadow',
+			'css_vars'          => '--wp--preset--text-shadow--$slug',
+			'classes'           => array( '.has-$slug-text-shadow' => 'text-shadow' ),
+			'properties'        => array( 'text-shadow' ),
+		),
 		array(
 			'path'              => array( 'spacing', 'spacingSizes' ),
 			'prevent_override'  => array( 'spacing', 'defaultSpacingSizes' ),
@@ -419,6 +429,8 @@ class WP_Theme_JSON {
 	 *              Added support for `typography.textIndent`.
 	 * @since 7.1.0 Added `viewport` property.
 	 *              Added support for `background.gradient`, `dimensions.minWidth` and `blockVisibility.allowEditing`.
+	 * @since 7.2.0 Added support for `typography.textShadow`, `typography.textShadowPresets`,
+	 *              and `typography.defaultTextShadowPresets`.
 	 * @var array
 	 */
 	const VALID_SETTINGS = array(
@@ -496,22 +508,25 @@ class WP_Theme_JSON {
 			'defaultPresets' => null,
 		),
 		'typography'                    => array(
-			'fluid'            => null,
-			'customFontSize'   => null,
-			'defaultFontSizes' => null,
-			'dropCap'          => null,
-			'fontFamilies'     => null,
-			'fontSizes'        => null,
-			'fontStyle'        => null,
-			'fontWeight'       => null,
-			'letterSpacing'    => null,
-			'lineHeight'       => null,
-			'textAlign'        => null,
-			'textColumns'      => null,
-			'textDecoration'   => null,
-			'textIndent'       => null,
-			'textTransform'    => null,
-			'writingMode'      => null,
+			'fluid'                    => null,
+			'customFontSize'           => null,
+			'defaultFontSizes'         => null,
+			'dropCap'                  => null,
+			'fontFamilies'             => null,
+			'fontSizes'                => null,
+			'fontStyle'                => null,
+			'fontWeight'               => null,
+			'letterSpacing'            => null,
+			'lineHeight'               => null,
+			'textAlign'                => null,
+			'textColumns'              => null,
+			'textDecoration'           => null,
+			'textIndent'               => null,
+			'textTransform'            => null,
+			'textShadow'               => null,
+			'defaultTextShadowPresets' => null,
+			'textShadowPresets'        => null,
+			'writingMode'              => null,
 		),
 		'viewport'                      => array(
 			'mobile' => null,
diff --git a/wp-includes/kses.php b/wp-includes/kses.php
index ea7db4f9c4..fe0ce97317 100644
--- a/wp-includes/kses.php
+++ b/wp-includes/kses.php
@@ -2624,7 +2624,7 @@ function kses_init() {
  * @since 7.1.0 Extended gradient support to allow any single-level nested function.
  *              Added support for transform functions, `clip-path` basic shapes,
  *              and URLs in the SVG element reference properties.
- * @since 7.2.0 Added support for CSS anchor positioning properties.
+ * @since 7.2.0 Added support for CSS anchor positioning properties and `text-shadow`.
  *
  * @param string $css        A string of CSS rules, decoded from an HTML `style` attribute.
  * @param string $deprecated Not used.
@@ -2720,6 +2720,7 @@ function safecss_filter_attr( $css, $deprecated = '' ) {
 			'text-align',
 			'text-decoration',
 			'text-indent',
+			'text-shadow',
 			'text-transform',
 			'white-space',

diff --git a/wp-includes/style-engine/class-wp-style-engine.php b/wp-includes/style-engine/class-wp-style-engine.php
index 5d393b3782..b2988c7140 100644
--- a/wp-includes/style-engine/class-wp-style-engine.php
+++ b/wp-includes/style-engine/class-wp-style-engine.php
@@ -27,6 +27,7 @@
  *              background.backgroundRepeat and dimensions.aspectRatio.
  * @since 6.7.0 Added support for typography.writingMode.
  * @since 7.0.0 Added support for typography.textIndent.
+ * @since 7.2.0 Added support for typography.textShadow.
  */
 #[AllowDynamicProperties]
 final class WP_Style_Engine {
@@ -350,6 +351,18 @@ final class WP_Style_Engine {
 				),
 				'path'          => array( 'typography', 'textIndent' ),
 			),
+			'textShadow'     => array(
+				'property_keys' => array(
+					'default' => 'text-shadow',
+				),
+				'css_vars'      => array(
+					'text-shadow' => '--wp--preset--text-shadow--$slug',
+				),
+				'path'          => array( 'typography', 'textShadow' ),
+				'classnames'    => array(
+					'has-$slug-text-shadow' => 'text-shadow',
+				),
+			),
 			'textTransform'  => array(
 				'property_keys' => array(
 					'default' => 'text-transform',
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 5f86109a7b..52e6ba1d9b 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-alpha-64092';
+$wp_version = '7.2-alpha-64093';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.