Block Processor: Fix is_block_type() for inner HTML

Previously, the WP_Block_Processor class was making a mistake in
mis-reporting whether a token matches a block type when #innerHTML spans
are involved.

This patch fixes the logic, which was originally written before a
distinction between inner HTML and top-level freeform content was built.

Developed in https://github.com/WordPress/wordpress-develop/pull/10701
Discussed in https://core.trac.wordpress.org/ticket/64485

Fixes #64485.

Built from https://develop.svn.wordpress.org/trunk@61452


git-svn-id: http://core.svn.wordpress.org/trunk@60764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dmsnell
2026-01-08 23:45:59 +00:00
parent 23eeccaf38
commit 653082d744
4 changed files with 36 additions and 31 deletions

View File

@@ -1440,12 +1440,17 @@ class WP_Block_Processor {
return true;
}
// This is a core/freeform text block, its special.
if ( $this->is_html() && 0 === ( $this->open_blocks_length[0] ?? null ) ) {
return (
'core/freeform' === $block_type ||
'freeform' === $block_type
);
if ( $this->is_html() ) {
// This is a core/freeform text block, its special.
if ( 0 === ( $this->open_blocks_length[0] ?? null ) ) {
return (
'core/freeform' === $block_type ||
'freeform' === $block_type
);
}
// Otherwise this is innerHTML and not a block.
return false;
}
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 ) );

View File

@@ -7,6 +7,11 @@
*/
return array(
array(
'handle' => 'wp-list-reusable-blocks',
'path' => 'list-reusable-blocks/style',
'dependencies' => array('wp-components'),
),
array(
'handle' => 'wp-nux',
'path' => 'nux/style',
@@ -17,11 +22,6 @@ return array(
'path' => 'preferences/style',
'dependencies' => array('wp-components'),
),
array(
'handle' => 'wp-list-reusable-blocks',
'path' => 'list-reusable-blocks/style',
'dependencies' => array('wp-components'),
),
array(
'handle' => 'wp-commands',
'path' => 'commands/style',
@@ -33,13 +33,13 @@ return array(
'dependencies' => array('wp-block-editor', 'wp-components'),
),
array(
'handle' => 'wp-patterns',
'path' => 'patterns/style',
'handle' => 'wp-widgets',
'path' => 'widgets/style',
'dependencies' => array('wp-block-editor', 'wp-components'),
),
array(
'handle' => 'wp-widgets',
'path' => 'widgets/style',
'handle' => 'wp-patterns',
'path' => 'patterns/style',
'dependencies' => array('wp-block-editor', 'wp-components'),
),
array(

View File

@@ -22,21 +22,6 @@ return array(
'path' => 'interactivity-router/full-page',
'asset' => 'interactivity-router/full-page.min.asset.php',
),
array(
'id' => '@wordpress/a11y',
'path' => 'a11y/index',
'asset' => 'a11y/index.min.asset.php',
),
array(
'id' => '@wordpress/route',
'path' => 'route/index',
'asset' => 'route/index.min.asset.php',
),
array(
'id' => '@wordpress/abilities',
'path' => 'abilities/index',
'asset' => 'abilities/index.min.asset.php',
),
array(
'id' => '@wordpress/latex-to-mathml',
'path' => 'latex-to-mathml/index',
@@ -47,11 +32,26 @@ return array(
'path' => 'latex-to-mathml/loader',
'asset' => 'latex-to-mathml/loader.min.asset.php',
),
array(
'id' => '@wordpress/a11y',
'path' => 'a11y/index',
'asset' => 'a11y/index.min.asset.php',
),
array(
'id' => '@wordpress/abilities',
'path' => 'abilities/index',
'asset' => 'abilities/index.min.asset.php',
),
array(
'id' => '@wordpress/core-abilities',
'path' => 'core-abilities/index',
'asset' => 'core-abilities/index.min.asset.php',
),
array(
'id' => '@wordpress/route',
'path' => 'route/index',
'asset' => 'route/index.min.asset.php',
),
array(
'id' => '@wordpress/edit-site-init',
'path' => 'edit-site-init/index',

View File

@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '7.0-alpha-61451';
$wp_version = '7.0-alpha-61452';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.