diff --git a/packages/block-library/src/image/edit.native.js b/packages/block-library/src/image/edit.native.js index 77d4ce4438b477..521b143e6c2a21 100644 --- a/packages/block-library/src/image/edit.native.js +++ b/packages/block-library/src/image/edit.native.js @@ -44,6 +44,7 @@ const MEDIA_UPLOAD_STATE_FAILED = 3; const MEDIA_UPLOAD_STATE_RESET = 4; const LINK_DESTINATION_CUSTOM = 'custom'; +const LINK_DESTINATION_NONE = 'none'; class ImageEdit extends React.Component { constructor( props ) { @@ -65,6 +66,7 @@ class ImageEdit extends React.Component { this.updateImageURL = this.updateImageURL.bind( this ); this.onSetLinkDestination = this.onSetLinkDestination.bind( this ); this.onImagePressed = this.onImagePressed.bind( this ); + this.onClearSettings = this.onClearSettings.bind( this ); } componentDidMount() { @@ -163,6 +165,14 @@ class ImageEdit extends React.Component { } ); } + onClearSettings() { + this.props.setAttributes( { + alt: '', + linkDestination: LINK_DESTINATION_NONE, + href: undefined, + } ); + } + render() { const { attributes, isSelected, setAttributes } = this.props; const { url, caption, height, width, alt, href } = attributes; @@ -244,10 +254,10 @@ class ImageEdit extends React.Component { onChangeValue={ this.updateAlt } /> {} } + onPress={ this.onClearSettings } /> ); diff --git a/packages/block-library/src/image/styles.native.scss b/packages/block-library/src/image/styles.native.scss index cc3566080f6665..ec59c4caf0a987 100644 --- a/packages/block-library/src/image/styles.native.scss +++ b/packages/block-library/src/image/styles.native.scss @@ -24,6 +24,6 @@ font-family: $default-regular-font; } -.resetSettingsButton { +.clearSettingsButton { color: $alert-red; }