Skip to content

Commit 4fd12af

Browse files
committed
fix: disallow disabling of columns block
1 parent 6944eab commit 4fd12af

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/components/admin-toolbar-setting/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const AdminToolbarSetting = props => {
2121
props.controls.map( option => {
2222
const isSelected = props.value ? props.value === option.value : props.placeholder === option.value
2323
const tabindex = isSelected ? '0' : '-1'
24+
const isDisabled = props.disabledValues ? props.disabledValues.includes( option.value ) : false
2425

2526
return <Button
2627
style={ option.selectedColor && isSelected ? { backgroundColor: option.selectedColor } : {} }
@@ -30,6 +31,7 @@ const AdminToolbarSetting = props => {
3031
tabIndex={ tabindex }
3132
aria-pressed={ isSelected }
3233
isSmall={ props.isSmall }
34+
disabled={ isDisabled }
3335
onClick={ () => {
3436
if ( option.value === props.value ) {
3537
return

src/welcome/admin.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,8 @@ const Blocks = props => {
984984
<div className="s-settings-grid">
985985
{ DERIVED_BLOCKS[ id ].map( ( block, i ) => {
986986
const blockState = disabledBlocks[ block.name ] ?? BLOCK_STATE.ENABLED
987+
// Do not allow the disabling of column
988+
const disabledValues = block.name === 'stackable/columns' ? [ BLOCK_STATE.DISABLED ] : null
987989

988990
return (
989991
<AdminToolbarSetting
@@ -1010,6 +1012,7 @@ const Blocks = props => {
10101012
selectedColor: '#979e95',
10111013
},
10121014
] }
1015+
disabledValues={ disabledValues }
10131016
onChange={ value => {
10141017
toggleBlock( block.name, value )
10151018
} }

0 commit comments

Comments
 (0)