Skip to content

Commit

Permalink
Limit columns to 8
Browse files Browse the repository at this point in the history
  • Loading branch information
nb committed Jun 11, 2017
1 parent c42cf12 commit d4eb05a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion blocks/library/gallery/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import GalleryImage from './gallery-image';

const { query, attr } = hpq;

const MAX_COLUMNS = 8;

const editMediaLibrary = ( attributes, setAttributes ) => {
const frameConfig = {
frame: 'post',
Expand Down Expand Up @@ -146,7 +148,7 @@ registerBlockType( 'core/gallery', {
{ focus && images.length > 1 &&
<InspectorControls>
<label className="blocks-text-control__label">{ __( 'Columns' ) }</label>
<input type="range" min="1" max={ images.length } value={ columns } onChange={ setColumnsNumber } />
<input type="range" min="1" max={ Math.min( MAX_COLUMNS, images.length ) } value={ columns } onChange={ setColumnsNumber } />
<span>{columns}</span>
</InspectorControls> }
</div>
Expand Down

0 comments on commit d4eb05a

Please sign in to comment.