Skip to content

Commit 5ba6bd5

Browse files
committed
Block Processor: Fix is_block_type() for inner HTML
1 parent 5a53b94 commit 5ba6bd5

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

src/wp-includes/class-wp-block-processor.php

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,15 @@ public function __construct( string $source_text ) {
630630
*/
631631
public function next_block( ?string $block_type = null ): bool {
632632
while ( $this->next_delimiter( $block_type ) ) {
633-
if ( self::CLOSER !== $this->get_delimiter_type() ) {
634-
return true;
633+
switch ( $this->get_delimiter_type() ) {
634+
case self::OPENER:
635+
case self::VOID:
636+
return true;
637+
638+
case null:
639+
if ( '*' === $block_type ) {
640+
return true;
641+
}
635642
}
636643
}
637644

@@ -1440,12 +1447,17 @@ public function is_block_type( string $block_type ): bool {
14401447
return true;
14411448
}
14421449

1443-
// This is a core/freeform text block, it’s special.
1444-
if ( $this->is_html() && 0 === ( $this->open_blocks_length[0] ?? null ) ) {
1445-
return (
1446-
'core/freeform' === $block_type ||
1447-
'freeform' === $block_type
1448-
);
1450+
if ( $this->is_html() ) {
1451+
// This is a core/freeform text block, it’s special.
1452+
if ( 0 === ( $this->open_blocks_length[0] ?? null ) ) {
1453+
return (
1454+
'core/freeform' === $block_type ||
1455+
'freeform' === $block_type
1456+
);
1457+
}
1458+
1459+
// Otherwise this is innerHTML and not a block.
1460+
return false;
14491461
}
14501462

14511463
return $this->are_equal_block_types( $this->source_text, $this->namespace_at, $this->name_at - $this->namespace_at + $this->name_length, $block_type, 0, strlen( $block_type ) );

0 commit comments

Comments
 (0)