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 youknowriad committed Mar 6, 2019
1 parent bade2e1 commit 966fc6e
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 966fc6e

Please sign in to comment.