From 63f81c1e9cbb3b0513abca2b8cb579fef374ed7b Mon Sep 17 00:00:00 2001 From: karthick-murugan Date: Tue, 3 Dec 2024 19:25:14 +0530 Subject: [PATCH] Image size fix in lightbox --- lib/block-supports/layout.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index ddbd1917c30547..ca75f479dd67b5 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -1106,15 +1106,14 @@ function gutenberg_restore_image_outer_container( $block_content, $block ) { $wrapper_classnames = array( 'wp-block-image' ); - // If the block has a classNames attribute these classnames need to be removed from the content and added back + // If the block has a classNames attribute these classnames need to be added back // to the new wrapper div also. if ( ! empty( $block['attrs']['className'] ) ) { $wrapper_classnames = array_merge( $wrapper_classnames, explode( ' ', $block['attrs']['className'] ) ); } - $content_classnames = explode( ' ', $matches[2] ); - $filtered_content_classnames = array_diff( $content_classnames, $wrapper_classnames ); - return '
' . $matches[1] . implode( ' ', $filtered_content_classnames ) . $matches[3] . '
'; + // Wrap the existing content with the new wrapper div. + return '
' . $block_content . '
'; } if ( function_exists( 'wp_restore_image_outer_container' ) ) {