Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions includes/class-coblocks-block-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,11 @@ public function coblocks_enqueue_scripts_for_core_blocks( $block_content, $block
);
}

// Enqueue frontend styles when a core block uses the uppercase rich-text format.
if ( false !== strpos( $block_content, 'class="uppercase"' ) ) {
wp_enqueue_style( 'coblocks-frontend' );
}

return $block_content;
}

Expand Down Expand Up @@ -641,6 +646,8 @@ public function has_coblocks_block( WP_Post $post_object ) {
array_filter(
array(
false !== strpos( $post_object->post_content, '<!-- wp:coblocks/' ),
// Detect CoBlocks rich-text format marks on core blocks (e.g. uppercase on core/paragraph) so frontend styles load when the format is in use.
false !== strpos( $post_object->post_content, 'class="uppercase"' ),
// Having core blocks here, ensures that enqueues from block_assets are loaded.
has_block( 'core/block', $post_object ),
has_block( 'core/button', $post_object ),
Expand Down