Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit b3e9daf

Browse files
coderkevinryelle
authored andcommitted
Category block: select categories when none selected (#458)
* Category block: open category panel when no categories When no categories are selected, open the category panel on initial render. * Add check for editMode Don't open categories if in edit mode because the block itself has a category selection.
1 parent 0b00060 commit b3e9daf

File tree

1 file changed

+2
-2
lines changed
  • assets/js/blocks/product-category

1 file changed

+2
-2
lines changed

assets/js/blocks/product-category/block.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ class ProductByCategoryBlock extends Component {
8585

8686
getInspectorControls() {
8787
const { attributes, setAttributes } = this.props;
88-
const { columns, catOperator, contentVisibility, orderby, rows } = attributes;
88+
const { columns, catOperator, contentVisibility, editMode, orderby, rows } = attributes;
8989

9090
return (
9191
<InspectorControls key="inspector">
9292
<PanelBody
9393
title={ __( 'Product Category', 'woo-gutenberg-products-block' ) }
94-
initialOpen={ false }
94+
initialOpen={ ! attributes.categories.length && ! editMode }
9595
>
9696
<ProductCategoryControl
9797
selected={ attributes.categories }

0 commit comments

Comments
 (0)