Skip to content

Commit

Permalink
Image size fix in lightbox
Browse files Browse the repository at this point in the history
  • Loading branch information
karthick-murugan committed Dec 3, 2024
1 parent 0e19583 commit f98cf14
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<div class="' . implode( ' ', $wrapper_classnames ) . '">' . $matches[1] . implode( ' ', $filtered_content_classnames ) . $matches[3] . '</div>';
// Wrap the existing content with the new wrapper div.
return '<div class="' . implode( ' ', $wrapper_classnames ) . '">' . $block_content . '</div>';
}

if ( function_exists( 'wp_restore_image_outer_container' ) ) {
Expand Down

0 comments on commit f98cf14

Please sign in to comment.