Prevent reseting height to NaN

[MAILPOET-2835]
This commit is contained in:
Pavel Dohnal
2020-05-04 14:46:42 +02:00
committed by Veljko V
parent f4121d6176
commit 76f7a758e1

View File

@@ -46,15 +46,19 @@ const DividerEdit = ({ attributes, setAttributes }: Props) => {
max={40}
allowReset
onChange={(dividerHeight) => {
let newHeight = attributeHeight;
if (dividerHeight !== undefined) {
newHeight = Math.max(dividerHeight, attributeHeight);
}
setAttributes({
dividerHeight,
height: Math.max(dividerHeight, attributes.height),
height: newHeight,
});
}}
/>
<RangeControl
label={MailPoet.I18n.t('blockDividerDividerWidth')}
value={attributes.dividerWidth}
value={attributeDividerWidth}
min={1}
max={100}
allowReset