Skip to content

Commit

Permalink
fix (icon popover): clear icon button should revert to the correct de…
Browse files Browse the repository at this point in the history
…fault icon (#3359)
  • Loading branch information
mxkae authored Jan 15, 2025
1 parent 65740c8 commit e7708f5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/block-components/icon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const Icon = props => {
attrNameTemplate = '%s',
hasLinearGradient = true,
value = '',
defaultValue = '',
onChange = NOOP,
openEvenIfUnselected = false,
} = props
Expand Down Expand Up @@ -177,6 +178,7 @@ export const Icon = props => {
}
setIsOpen( false )
} }
defaultValue={ defaultValue }
/>
) }
{ getAttribute( 'icon2' ) && (
Expand Down
2 changes: 1 addition & 1 deletion src/block/icon/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const Edit = props => {
className={ blockClassNames }
>
<Link linkTrigger=".stk--inner-svg">
<Icon />
<Icon defaultValue={ defaultIcon } />
</Link>
</BlockDiv>
{ props.isHovered && <MarginBottom /> }
Expand Down
2 changes: 2 additions & 0 deletions src/components/icon-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
>
Expand All @@ -54,6 +55,7 @@ const IconControl = props => {
onClose={ onClose }
returnSVGValue={ props.returnSVGValue }
onChange={ props.onChange }
defaultValue={ props.defaultValue }
/>
) }
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/icon-search-popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ const IconSearchPopover = props => {
{ props.allowReset &&
<Button
onClick={ () => {
props.onChange( '' )
props.onChange( props.defaultValue || '' )
props.onClose()
} }
isSmall
Expand Down

0 comments on commit e7708f5

Please sign in to comment.