Skip to content

Commit

Permalink
Tiled gallery block: fix number of columns too high when removing ima…
Browse files Browse the repository at this point in the history
…ges (#30582)
  • Loading branch information
simison authored Feb 6, 2019
1 parent 38ac976 commit 8ed3aaa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/gutenberg/extensions/tiled-gallery/edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,13 @@ class TiledGalleryEdit extends Component {
}
};

onSelectImages = images =>
this.setAttributes( { images: images.map( image => pickRelevantMediaFiles( image ) ) } );
onSelectImages = images => {
const { columns } = this.props.attributes;
this.setAttributes( {
columns: columns ? Math.min( images.length, columns ) : columns,
images: images.map( image => pickRelevantMediaFiles( image ) ),
} );
};

setColumnsNumber = value => this.setAttributes( { columns: value } );

Expand Down

0 comments on commit 8ed3aaa

Please sign in to comment.