Skip to content

Commit 0e19583

Browse files
Revert "Image size fix in lightbox"
This reverts commit 63f81c1.
1 parent 63f81c1 commit 0e19583

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/block-supports/layout.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -1106,14 +1106,15 @@ function gutenberg_restore_image_outer_container( $block_content, $block ) {
11061106

11071107
$wrapper_classnames = array( 'wp-block-image' );
11081108

1109-
// If the block has a classNames attribute these classnames need to be added back
1109+
// If the block has a classNames attribute these classnames need to be removed from the content and added back
11101110
// to the new wrapper div also.
11111111
if ( ! empty( $block['attrs']['className'] ) ) {
11121112
$wrapper_classnames = array_merge( $wrapper_classnames, explode( ' ', $block['attrs']['className'] ) );
11131113
}
1114+
$content_classnames = explode( ' ', $matches[2] );
1115+
$filtered_content_classnames = array_diff( $content_classnames, $wrapper_classnames );
11141116

1115-
// Wrap the existing content with the new wrapper div.
1116-
return '<div class="' . implode( ' ', $wrapper_classnames ) . '">' . $block_content . '</div>';
1117+
return '<div class="' . implode( ' ', $wrapper_classnames ) . '">' . $matches[1] . implode( ' ', $filtered_content_classnames ) . $matches[3] . '</div>';
11171118
}
11181119

11191120
if ( function_exists( 'wp_restore_image_outer_container' ) ) {

0 commit comments

Comments
 (0)