diff --git a/packages/block-library/src/gallery/edit.js b/packages/block-library/src/gallery/edit.js index 5fee7758973d5..a376d50245b12 100644 --- a/packages/block-library/src/gallery/edit.js +++ b/packages/block-library/src/gallery/edit.js @@ -109,8 +109,10 @@ class GalleryEdit extends Component { } onSelectImages( images ) { + const { columns } = this.props.attributes; this.setAttributes( { images: images.map( ( image ) => pickRelevantMediaFiles( image ) ), + columns: columns ? Math.min( images.length, columns ) : columns, } ); }