Skip to content

Commit e7708f5

Browse files
authored
fix (icon popover): clear icon button should revert to the correct default icon (#3359)
1 parent 65740c8 commit e7708f5

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

src/block-components/icon/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export const Icon = props => {
6262
attrNameTemplate = '%s',
6363
hasLinearGradient = true,
6464
value = '',
65+
defaultValue = '',
6566
onChange = NOOP,
6667
openEvenIfUnselected = false,
6768
} = props
@@ -177,6 +178,7 @@ export const Icon = props => {
177178
}
178179
setIsOpen( false )
179180
} }
181+
defaultValue={ defaultValue }
180182
/>
181183
) }
182184
{ getAttribute( 'icon2' ) && (

src/block/icon/edit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const Edit = props => {
8484
className={ blockClassNames }
8585
>
8686
<Link linkTrigger=".stk--inner-svg">
87-
<Icon />
87+
<Icon defaultValue={ defaultIcon } />
8888
</Link>
8989
</BlockDiv>
9090
{ props.isHovered && <MarginBottom /> }

src/components/icon-control/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const IconControl = props => {
3131
{ ...omit( props, [ 'onChange', 'value' ] ) }
3232
allowReset={ true }
3333
value={ props.value }
34+
defaultValue={ props.defaultValue }
3435
onChange={ props.onChange }
3536
hasPanelModifiedIndicator={ props.hasPanelModifiedIndicator }
3637
>
@@ -54,6 +55,7 @@ const IconControl = props => {
5455
onClose={ onClose }
5556
returnSVGValue={ props.returnSVGValue }
5657
onChange={ props.onChange }
58+
defaultValue={ props.defaultValue }
5759
/>
5860
) }
5961
/>

src/components/icon-search-popover/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ const IconSearchPopover = props => {
231231
{ props.allowReset &&
232232
<Button
233233
onClick={ () => {
234-
props.onChange( '' )
234+
props.onChange( props.defaultValue || '' )
235235
props.onClose()
236236
} }
237237
isSmall

0 commit comments

Comments
 (0)