From e7708f57b1efb8a3ceb7373c7d5c6df623cc9859 Mon Sep 17 00:00:00 2001 From: Mikhaela Tapia <98727316+mxkae@users.noreply.github.com> Date: Wed, 15 Jan 2025 18:15:54 +0800 Subject: [PATCH] fix (icon popover): clear icon button should revert to the correct default icon (#3359) --- src/block-components/icon/index.js | 2 ++ src/block/icon/edit.js | 2 +- src/components/icon-control/index.js | 2 ++ src/components/icon-search-popover/index.js | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/block-components/icon/index.js b/src/block-components/icon/index.js index 206baa9c5..8ff86ef79 100644 --- a/src/block-components/icon/index.js +++ b/src/block-components/icon/index.js @@ -62,6 +62,7 @@ export const Icon = props => { attrNameTemplate = '%s', hasLinearGradient = true, value = '', + defaultValue = '', onChange = NOOP, openEvenIfUnselected = false, } = props @@ -177,6 +178,7 @@ export const Icon = props => { } setIsOpen( false ) } } + defaultValue={ defaultValue } /> ) } { getAttribute( 'icon2' ) && ( diff --git a/src/block/icon/edit.js b/src/block/icon/edit.js index f8c4cfd4f..9c522a597 100644 --- a/src/block/icon/edit.js +++ b/src/block/icon/edit.js @@ -84,7 +84,7 @@ const Edit = props => { className={ blockClassNames } > - + { props.isHovered && } diff --git a/src/components/icon-control/index.js b/src/components/icon-control/index.js index 2588bcd75..617f5ee98 100644 --- a/src/components/icon-control/index.js +++ b/src/components/icon-control/index.js @@ -31,6 +31,7 @@ const IconControl = props => { { ...omit( props, [ 'onChange', 'value' ] ) } allowReset={ true } value={ props.value } + defaultValue={ props.defaultValue } onChange={ props.onChange } hasPanelModifiedIndicator={ props.hasPanelModifiedIndicator } > @@ -54,6 +55,7 @@ const IconControl = props => { onClose={ onClose } returnSVGValue={ props.returnSVGValue } onChange={ props.onChange } + defaultValue={ props.defaultValue } /> ) } /> diff --git a/src/components/icon-search-popover/index.js b/src/components/icon-search-popover/index.js index 272e81302..1d59f9cb7 100644 --- a/src/components/icon-search-popover/index.js +++ b/src/components/icon-search-popover/index.js @@ -231,7 +231,7 @@ const IconSearchPopover = props => { { props.allowReset &&