Skip to content

Commit

Permalink
Update the columns attribute in onSelectImages so that if images are …
Browse files Browse the repository at this point in the history
…removed via the media modal, the columns can't be higher than the new number of images (#13488)
  • Loading branch information
brentswisher authored and gziolo committed Jan 25, 2019
1 parent edc97d9 commit 033e664
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/block-library/src/gallery/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
} );
}

Expand Down

0 comments on commit 033e664

Please sign in to comment.