| @@ -206,11 +206,24 @@ | ||
| 206 | 206 | |
| 207 | 207 | $this->print_shared_styles( $block_names ); |
| 208 | 208 | $this->print_table_styles( $table_id, $post->post_content ); |
| 209 | 209 | |
| 210 | + // This widget prints its own table CSS above, so the generic late-CSS | |
| 211 | + // printer (AssetGenerator) must not print it a second time. | |
| 212 | + $asset_generator = class_exists( '\\TableBuilder\\Hooks\\AssetGenerator' ) ? \TableBuilder\Hooks\AssetGenerator::instance() : null; | |
| 213 | + if ( $asset_generator ) { | |
| 214 | + $asset_generator->suspend_late_css(); | |
| 215 | + } | |
| 216 | + | |
| 210 | 217 | echo '<div class="tablekit-elementor-wrap">'; |
| 211 | - foreach ( $blocks_to_render as $block ) { | |
| 212 | - echo ( new WP_Block( $block ) )->render(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- standard core block-rendering output, same as render_block(). | |
| 218 | + try { | |
| 219 | + foreach ( $blocks_to_render as $block ) { | |
| 220 | + echo ( new WP_Block( $block ) )->render(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- standard core block-rendering output, same as render_block(). | |
| 221 | + } | |
| 222 | + } finally { | |
| 223 | + if ( $asset_generator ) { | |
| 224 | + $asset_generator->resume_late_css(); | |
| 225 | + } | |
| 213 | 226 | } |
| 214 | 227 | echo '</div>'; |
| 215 | 228 | |
| 216 | 229 | $this->print_block_scripts( $block_names ); |