From a75e63c3129b6e9be04f86320358935efa3fa6f5 Mon Sep 17 00:00:00 2001
From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com>
Date: Fri, 13 Aug 2021 15:12:42 +1000
Subject: [PATCH 1/3] Move min height into the dimensions block support panel
---
packages/block-library/src/cover/edit.js | 39 +++++++++++++++---------
1 file changed, 25 insertions(+), 14 deletions(-)
diff --git a/packages/block-library/src/cover/edit.js b/packages/block-library/src/cover/edit.js
index 244390fd3a9ac8..d10d874a25dc42 100644
--- a/packages/block-library/src/cover/edit.js
+++ b/packages/block-library/src/cover/edit.js
@@ -24,6 +24,7 @@ import {
withNotices,
__experimentalUseCustomUnits as useCustomUnits,
__experimentalBoxControl as BoxControl,
+ __experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';
import { compose, withInstanceId, useInstanceId } from '@wordpress/compose';
import {
@@ -536,20 +537,6 @@ function CoverEdit( {
) }
-
-
- setAttributes( { minHeight: newMinHeight } )
- }
- onUnitChange={ ( nextUnit ) =>
- setAttributes( {
- minHeightUnit: nextUnit,
- } )
- }
- />
-
+
+ !! minHeight }
+ label={ __( 'Minimum height' ) }
+ onDeselect={ () =>
+ setAttributes( { minHeight: undefined } )
+ }
+ resetAllFilter={ () => ( { minHeight: undefined } ) }
+ isShownByDefault={ true }
+ >
+
+ setAttributes( { minHeight: newMinHeight } )
+ }
+ onUnitChange={ ( nextUnit ) =>
+ setAttributes( {
+ minHeightUnit: nextUnit,
+ } )
+ }
+ />
+
+
>
);
From df368950b936e0e91ebd3fa55dd94bb4188c0c2a Mon Sep 17 00:00:00 2001
From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com>
Date: Fri, 20 Aug 2021 16:32:11 +1000
Subject: [PATCH 2/3] Clear the min height unit attribute
---
packages/block-library/src/cover/edit.js | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/packages/block-library/src/cover/edit.js b/packages/block-library/src/cover/edit.js
index d10d874a25dc42..bbcae8fad7e02d 100644
--- a/packages/block-library/src/cover/edit.js
+++ b/packages/block-library/src/cover/edit.js
@@ -572,9 +572,15 @@ function CoverEdit( {
hasValue={ () => !! minHeight }
label={ __( 'Minimum height' ) }
onDeselect={ () =>
- setAttributes( { minHeight: undefined } )
+ setAttributes( {
+ minHeight: undefined,
+ minHeightUnit: undefined,
+ } )
}
- resetAllFilter={ () => ( { minHeight: undefined } ) }
+ resetAllFilter={ () => ( {
+ minHeight: undefined,
+ minHeightUnit: undefined,
+ } ) }
isShownByDefault={ true }
>
Date: Wed, 25 Aug 2021 20:40:16 +1000
Subject: [PATCH 3/3] Add panelId to injected ToolsPanelItem
---
packages/block-library/src/cover/edit.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/packages/block-library/src/cover/edit.js b/packages/block-library/src/cover/edit.js
index bbcae8fad7e02d..500cdd37838a82 100644
--- a/packages/block-library/src/cover/edit.js
+++ b/packages/block-library/src/cover/edit.js
@@ -582,6 +582,7 @@ function CoverEdit( {
minHeightUnit: undefined,
} ) }
isShownByDefault={ true }
+ panelId={ clientId }
>