From ea315471134f2d00e5a15d8b94f29b39d1d9656e Mon Sep 17 00:00:00 2001 From: Matt Chowning Date: Sat, 13 Apr 2019 16:04:48 -0400 Subject: [PATCH] Alternative implementation - no onBlurCaption function --- packages/block-library/src/image/edit.native.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/packages/block-library/src/image/edit.native.js b/packages/block-library/src/image/edit.native.js index 83d0c34126a00..1560b78323ea6 100644 --- a/packages/block-library/src/image/edit.native.js +++ b/packages/block-library/src/image/edit.native.js @@ -75,7 +75,6 @@ class ImageEdit extends React.Component { this.onImagePressed = this.onImagePressed.bind( this ); this.onClearSettings = this.onClearSettings.bind( this ); this.onFocusCaption = this.onFocusCaption.bind( this ); - this.onBlurCaption = this.onBlurCaption.bind( this ); } componentDidMount() { @@ -121,6 +120,9 @@ class ImageEdit extends React.Component { } this._caption.blur(); + this.setState( { + isCaptionSelected: false, + } ); } mediaUpload( payload ) { @@ -233,17 +235,6 @@ class ImageEdit extends React.Component { } } - onBlurCaption() { - if ( this.props.onBlur ) { - this.props.onBlur(); - } - if ( this.state.isCaptionSelected ) { - this.setState( { - isCaptionSelected: false, - } ); - } - } - render() { const { attributes, isSelected, setAttributes } = this.props; const { url, caption, height, width, alt, href } = attributes; @@ -430,7 +421,7 @@ class ImageEdit extends React.Component { value={ caption } onChange={ ( newCaption ) => setAttributes( { caption: newCaption } ) } onFocus={ this.onFocusCaption } - onBlur={ this.onBlurCaption } + //onBlur={ this.props.onBlur } // always assign onBlur as props (??) isSelected={ this.state.isCaptionSelected } fontSize={ 14 } underlineColorAndroid="transparent"