Skip to content

Commit

Permalink
Allow the column block in the inserter (#20502)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored May 6, 2020
1 parent 76d7127 commit 245e21b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 0 additions & 1 deletion packages/block-library/src/column/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const settings = {
icon,
description: __( 'A single column within a columns block.' ),
supports: {
inserter: false,
reusable: false,
html: false,
lightBlockWrapper: true,
Expand Down
12 changes: 10 additions & 2 deletions packages/block-library/src/columns/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { dropRight, get, map, times } from 'lodash';
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { PanelBody, RangeControl } from '@wordpress/components';
import { PanelBody, RangeControl, Notice } from '@wordpress/components';

import {
InspectorControls,
Expand Down Expand Up @@ -78,8 +78,15 @@ function ColumnsEditContainer( {
value={ count }
onChange={ ( value ) => updateColumns( count, value ) }
min={ 2 }
max={ 6 }
max={ Math.max( 6, count ) }
/>
{ count > 6 && (
<Notice status="warning" isDismissible={ false }>
{ __(
'This column count exceeds the recommended amount and may cause visual breakage.'
) }
</Notice>
) }
</PanelBody>
</InspectorControls>
<InnerBlocks
Expand All @@ -89,6 +96,7 @@ function ColumnsEditContainer( {
__experimentalPassedProps={ {
className: classes,
} }
renderAppender={ false }
/>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/specs/editor/blocks/columns.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ describe( 'Columns', () => {
)[ 0 ];
await columnBlockMenuItem.click();
await openGlobalBlockInserter();
expect( await getAllBlockInserterItemTitles() ).toHaveLength( 0 );
expect( await getAllBlockInserterItemTitles() ).toHaveLength( 1 );
} );
} );

0 comments on commit 245e21b

Please sign in to comment.