Editor: Add id to the supported Image's binding attributes

Syncs changes from the Gutenberg plugin: https://github.com/WordPress/gutenberg/pull/59194.

Fixes #60577.
Props kevin940726, ankit-k-gupta, sonali844, harshalkadu, gziolo.



git-svn-id: https://develop.svn.wordpress.org/trunk@57700 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Greg Ziółkowski 2024-02-23 09:18:34 +00:00
parent 367157bb35
commit f720cdc942

View File

@ -236,7 +236,7 @@ class WP_Block {
$supported_block_attributes = array(
'core/paragraph' => array( 'content' ),
'core/heading' => array( 'content' ),
'core/image' => array( 'url', 'title', 'alt' ),
'core/image' => array( 'id', 'url', 'title', 'alt' ),
'core/button' => array( 'url', 'text', 'linkTarget', 'rel' ),
);
@ -289,7 +289,7 @@ class WP_Block {
*/
private function replace_html( string $block_content, string $attribute_name, $source_value ) {
$block_type = $this->block_type;
if ( ! isset( $block_type->attributes[ $attribute_name ] ) ) {
if ( ! isset( $block_type->attributes[ $attribute_name ]['source'] ) ) {
return $block_content;
}