From 0e19583c619fda88a7db00352e2813357281f3ef Mon Sep 17 00:00:00 2001 From: karthick-murugan Date: Tue, 3 Dec 2024 19:56:00 +0530 Subject: [PATCH] Revert "Image size fix in lightbox" This reverts commit 63f81c1e9cbb3b0513abca2b8cb579fef374ed7b. --- lib/block-supports/layout.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index ca75f479dd67b..ddbd1917c3054 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -1106,14 +1106,15 @@ 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 added back + // If the block has a classNames attribute these classnames need to be removed from the content and 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 ); - // Wrap the existing content with the new wrapper div. - return '
' . $block_content . '
'; + return '
' . $matches[1] . implode( ' ', $filtered_content_classnames ) . $matches[3] . '
'; } if ( function_exists( 'wp_restore_image_outer_container' ) ) {