Skip to content

Commit cb2a8c1

Browse files
committed
Block editor: Conditionally enqueue front end assets for fitText.
Introduces a new fitText block support that enables automatic font size adjustment to fit text within its container boundaries. Props jorgefilipecosta, mukesh27, wildworks. Fixes #64119. git-svn-id: https://develop.svn.wordpress.org/trunk@61015 602fd350-edb4-49c9-b593-d223f7449a82
1 parent f0dc55b commit cb2a8c1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/wp-includes/block-supports/typography.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ function wp_typography_get_preset_inline_style_value( $style_value, $css_propert
306306
* @return string Filtered block content.
307307
*/
308308
function wp_render_typography_support( $block_content, $block ) {
309+
if ( ! empty( $block['attrs']['fitText'] ) ) {
310+
wp_enqueue_script_module( '@wordpress/block-editor/utils/fit-text-frontend' );
311+
}
309312
if ( ! isset( $block['attrs']['style']['typography']['fontSize'] ) ) {
310313
return $block_content;
311314
}

0 commit comments

Comments
 (0)