@@ -51,6 +51,11 @@ function __construct() {
5151 }
5252 add_action ( 'enqueue_block_editor_assets ' , array ( $ this , 'register_block_editor_assets_admin ' ) );
5353
54+ if ( is_admin () ) {
55+ // Use enqueue_block_assets so it gets loaded in the editor's iframe <head> tag
56+ add_action ( 'enqueue_block_assets ' , array ( $ this , 'enqueue_style_in_editor ' ), 50 );
57+ }
58+
5459 add_action ( 'plugins_loaded ' , array ( $ this , 'load_plugin_textdomain ' ) );
5560
5661 add_action ( 'wp_footer ' , array ( $ this , 'init_stackable_vars ' ) );
@@ -125,6 +130,13 @@ public function register_frontend_assets() {
125130 wp_add_inline_style ( 'ugb-style-css-nodep ' , $ inline_css );
126131 }
127132
133+ // Register inline frontend styles for theme.json block style inheritance
134+ wp_register_style ( 'ugb-block-style-inheritance-nodep ' , false );
135+ $ block_style_inline_css = apply_filters ( 'stackable_block_style_inheritance_inline_styles_nodep ' , '' );
136+ if ( ! empty ( $ block_style_inline_css ) ) {
137+ wp_add_inline_style ( 'ugb-block-style-inheritance-nodep ' , $ block_style_inline_css );
138+ }
139+
128140 // This is needed for the translation strings in our UI.
129141 if ( is_admin () ) {
130142 stackable_load_js_translations ();
@@ -246,6 +258,9 @@ public function load_frontend_scripts_conditionally( $block_content, $block ) {
246258 public function block_enqueue_frontend_assets () {
247259 $ this ->register_frontend_assets ();
248260 wp_enqueue_style ( 'ugb-style-css ' );
261+ if ( is_frontend () ) {
262+ wp_enqueue_style ( 'ugb-block-style-inheritance-nodep ' );
263+ }
249264 wp_enqueue_style ( 'ugb-style-css-nodep ' );
250265 wp_enqueue_script ( 'ugb-block-frontend-js ' );
251266 do_action ( 'stackable_block_enqueue_frontend_assets ' );
@@ -358,6 +373,12 @@ public function register_block_editor_assets() {
358373 wp_localize_script ( 'wp-blocks ' , 'stackable ' , $ args );
359374 }
360375
376+ // Ensure that block style inheritance styles comes after the editor block styles.
377+ function enqueue_style_in_editor () {
378+ wp_enqueue_style ( 'ugb-block-editor-css ' );
379+ wp_enqueue_style ( 'ugb-block-style-inheritance-nodep ' );
380+ }
381+
361382 /**
362383 * Gets the default/center and wide block widths from the theme if
363384 * possible. We need this so our "Content Width" option can be
@@ -437,6 +458,8 @@ public function add_body_class_theme_compatibility( $classes ) {
437458 $ classes [] = 'stk--is-twentytwentyone-theme ' ;
438459 } else if ( function_exists ( 'twentytwentytwo_support ' ) ) {
439460 $ classes [] = 'stk--is-twentytwentytwo-theme ' ;
461+ } else if ( function_exists ( 'twentytwentyfive_post_format_setup ' ) ) {
462+ $ classes [] = 'stk--is-twentytwentyfive-theme ' ;
440463 } else if ( function_exists ( 'hello_elementor_setup ' ) ) { // Taken from https://github.com/elementor/hello-theme/blob/master/functions.php
441464 $ classes [] = 'stk--is-helloelementor-theme ' ;
442465 }
0 commit comments