PluginProbe
Gutenberg / trunk
Gutenberg vtrunk
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | lib/block-supports/typography.php +16 -0 24.0.0 → trunk View file →
@@ -30,8 +30,9 @@
30 30 $has_text_columns_support = $typography_supports['textColumns'] ?? false;
31 31 $has_text_decoration_support = $typography_supports['__experimentalTextDecoration'] ?? false;
32 32 $has_text_transform_support = $typography_supports['__experimentalTextTransform'] ?? false;
33 33 $has_text_indent_support = $typography_supports['textIndent'] ?? false;
34 + $has_text_shadow_support = $typography_supports['textShadow'] ?? false;
34 35 $has_writing_mode_support = $typography_supports['__experimentalWritingMode'] ?? false;
35 36
36 37 $has_typography_support = $has_font_family_support
37 38 || $has_font_size_support
@@ -43,8 +44,9 @@
43 44 || $has_text_columns_support
44 45 || $has_text_decoration_support
45 46 || $has_text_transform_support
46 47 || $has_text_indent_support
48 + || $has_text_shadow_support
47 49 || $has_writing_mode_support;
48 50
49 51 if ( ! $block_type->attributes ) {
50 52 $block_type->attributes = array();
@@ -66,8 +68,14 @@
66 68 $block_type->attributes['fontFamily'] = array(
67 69 'type' => 'string',
68 70 );
69 71 }
72 +
73 + if ( $has_text_shadow_support && ! array_key_exists( 'textShadow', $block_type->attributes ) ) {
74 + $block_type->attributes['textShadow'] = array(
75 + 'type' => 'string',
76 + );
77 + }
70 78 }
71 79
72 80 /**
73 81 * Add CSS classes and inline styles for typography features such as font sizes
@@ -103,8 +111,9 @@
103 111 $has_text_columns_support = $typography_supports['textColumns'] ?? false;
104 112 $has_text_decoration_support = $typography_supports['__experimentalTextDecoration'] ?? false;
105 113 $has_text_transform_support = $typography_supports['__experimentalTextTransform'] ?? false;
106 114 $has_text_indent_support = $typography_supports['textIndent'] ?? false;
115 + $has_text_shadow_support = $typography_supports['textShadow'] ?? false;
107 116 $has_writing_mode_support = $typography_supports['__experimentalWritingMode'] ?? false;
108 117
109 118 // Whether to skip individual block support features.
110 119 $should_skip_font_size = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontSize' );
@@ -117,8 +126,9 @@
117 126 $should_skip_text_decoration = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textDecoration' );
118 127 $should_skip_text_transform = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textTransform' );
119 128 $should_skip_letter_spacing = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'letterSpacing' );
120 129 $should_skip_text_indent = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textIndent' );
130 + $should_skip_text_shadow = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textShadow' );
121 131 $should_skip_writing_mode = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'writingMode' );
122 132
123 133 $typography_block_styles = array();
124 134 if ( $has_font_size_support && ! $should_skip_font_size ) {
@@ -179,8 +189,14 @@
179 189 }
180 190
181 191 if ( $has_text_indent_support && ! $should_skip_text_indent && isset( $block_attributes['style']['typography']['textIndent'] ) ) {
182 192 $typography_block_styles['textIndent'] = $block_attributes['style']['typography']['textIndent'] ?? null;
193 + }
194 +
195 + if ( $has_text_shadow_support && ! $should_skip_text_shadow ) {
196 + $preset_text_shadow = array_key_exists( 'textShadow', $block_attributes ) ? "var:preset|text-shadow|{$block_attributes['textShadow']}" : null;
197 + $custom_text_shadow = $block_attributes['style']['typography']['textShadow'] ?? null;
198 + $typography_block_styles['textShadow'] = $preset_text_shadow ? $preset_text_shadow : $custom_text_shadow;
183 199 }
184 200
185 201 $attributes = array();
186 202 $classnames = array();