| @@ -358,22 +358,16 @@ | ||
| 358 | 358 | $attributes = array_merge( $block_instance->attributes, $computed_attributes ); |
| 359 | 359 | |
| 360 | 360 | // Get caption from the markup if there is no binding value. |
| 361 | 361 | if ( ! isset( $computed_attributes['caption'] ) ) { |
| 362 | - $block_reader = new \WP_HTML_Tag_Processor( $block_content ); | |
| 363 | - if ( $block_reader->next_tag( 'figcaption' ) ) { | |
| 364 | - $caption = ''; | |
| 365 | - while ( $block_reader->next_token() ) { | |
| 366 | - if ( '#text' === $block_reader->get_token_name() ) { | |
| 367 | - $caption .= $block_reader->get_modifiable_text(); | |
| 368 | - } | |
| 369 | - } | |
| 370 | - | |
| 371 | - if ( $caption ) { | |
| 372 | - $attributes['caption'] = $caption; | |
| 373 | - } | |
| 362 | + $caption = $this->the_plugin_instance->get_component( CustomStyle::class )->get_element_inner_html( $block_content, 'FIGCAPTION' ); | |
| 363 | + if ( $caption ) { | |
| 364 | + $attributes['caption'] = $caption; | |
| 374 | 365 | } |
| 375 | 366 | } |
| 367 | + | |
| 368 | + // Allow inline tags. | |
| 369 | + $attributes['caption_kses'] = true; | |
| 376 | 370 | |
| 377 | 371 | return better_youtube_embed_block_render_block( $attributes ); |
| 378 | 372 | } |
| 379 | 373 | } elseif ( 'boldblocks/counting-number' === $block_instance->name ) { |