Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix (icon search popover): clear icon button reverts to default icon #3359

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -230,7 +230,7 @@ const IconSearchPopover = props => {
{ props.allowReset &&
<Button
onClick={ () => {
props.onChange( '' )
props.onChange( props.defaultValue || '' )
props.onClose()
} }
isSmall
Expand Down
Loading