Skip to content

Commit

Permalink
Use regex (temporary)
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed Jun 11, 2024
1 parent a877c56 commit 54f3eb1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/compat/wordpress-6.5/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function gutenberg_block_bindings_replace_html( $block_content, $block_name, str
foreach ( $selector_attrs as $attribute_key => $attribute_value ) {
$amended_content->set_attribute( $attribute_key, $attribute_value );
}
if ( 'core/paragraph' === $block_name || 'core/heading' === $block_name || ( 'core/image' === $block_name && 'caption' === $attribute_name ) ) {
if ( 'core/paragraph' === $block_name || 'core/heading' === $block_name ) {
return $amended_content->get_updated_html();
}
if ( 'core/button' === $block_name ) {
Expand All @@ -123,6 +123,10 @@ function gutenberg_block_bindings_replace_html( $block_content, $block_name, str
}
return $amended_button->get_updated_html();
}
if ( 'core/image' === $block_name && 'caption' === $attribute_name ) {
// TODO: Don't use regex.
return preg_replace( '/(<figcaption[^>]*>)(.*?)(<\/figcaption>)/i', $amended_content->get_updated_html(), $block_content );
}
} else {
$block_reader->seek( 'iterate-selectors' );
}
Expand Down

0 comments on commit 54f3eb1

Please sign in to comment.