From 64772d44932471bcd52b64daa93da9020d21a30e Mon Sep 17 00:00:00 2001 From: Danilo Ercoli Date: Tue, 27 Nov 2018 19:06:46 +0100 Subject: [PATCH] Wire onBlur on mobile ported blocks and components. --- packages/block-library/src/code/edit.native.js | 3 ++- packages/block-library/src/heading/edit.native.js | 1 + packages/block-library/src/more/edit.native.js | 3 ++- packages/block-library/src/paragraph/edit.native.js | 1 + packages/editor/src/components/plain-text/index.native.js | 1 + packages/editor/src/components/rich-text/index.native.js | 1 + 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/code/edit.native.js b/packages/block-library/src/code/edit.native.js index 5433481fcfb2fb..d4ee2c8071c691 100644 --- a/packages/block-library/src/code/edit.native.js +++ b/packages/block-library/src/code/edit.native.js @@ -21,7 +21,7 @@ import styles from './theme.scss'; // Note: styling is applied directly to the (nested) PlainText component. Web-side components // apply it to the container 'div' but we don't have a proper proposal for cascading styling yet. export default function CodeEdit( props ) { - const { attributes, setAttributes, style, onFocus } = props; + const { attributes, setAttributes, style, onFocus, onBlur } = props; return ( @@ -35,6 +35,7 @@ export default function CodeEdit( props ) { aria-label={ __( 'Code' ) } isSelected={ props.isSelected } onFocus={ onFocus } + onBlur={ onBlur } /> ); diff --git a/packages/block-library/src/heading/edit.native.js b/packages/block-library/src/heading/edit.native.js index afb2fca0eaa281..e613b9156b824a 100644 --- a/packages/block-library/src/heading/edit.native.js +++ b/packages/block-library/src/heading/edit.native.js @@ -57,6 +57,7 @@ class HeadingEdit extends Component { value={ content } isSelected={ this.props.isSelected } onFocus={ this.props.onFocus } // always assign onFocus as a props + onBlur={ this.props.onBlur } // always assign onBlur as a props style={ { minHeight: Math.max( minHeight, this.state.aztecHeight ), } } diff --git a/packages/block-library/src/more/edit.native.js b/packages/block-library/src/more/edit.native.js index afbfc5973b9036..5b85da44359d50 100644 --- a/packages/block-library/src/more/edit.native.js +++ b/packages/block-library/src/more/edit.native.js @@ -15,7 +15,7 @@ import { PlainText } from '@wordpress/editor'; import styles from './editor.scss'; export default function MoreEdit( props ) { - const { attributes, setAttributes, onFocus } = props; + const { attributes, setAttributes, onFocus, onBlur } = props; const { customText } = attributes; const defaultText = __( 'Read more' ); const value = customText !== undefined ? customText : defaultText; @@ -33,6 +33,7 @@ export default function MoreEdit( props ) { placeholder={ defaultText } isSelected={ props.isSelected } onFocus={ onFocus } + onBlur={ onBlur } /> --> diff --git a/packages/block-library/src/paragraph/edit.native.js b/packages/block-library/src/paragraph/edit.native.js index ce3c390715e1c1..ecb075bca8003e 100644 --- a/packages/block-library/src/paragraph/edit.native.js +++ b/packages/block-library/src/paragraph/edit.native.js @@ -93,6 +93,7 @@ class ParagraphEdit extends Component { value={ content } isSelected={ this.props.isSelected } onFocus={ this.props.onFocus } // always assign onFocus as a props + onBlur={ this.props.onBlur } // always assign onBlur as a props style={ { ...style, minHeight: Math.max( minHeight, this.state.aztecHeight ), diff --git a/packages/editor/src/components/plain-text/index.native.js b/packages/editor/src/components/plain-text/index.native.js index e8155a062e25a1..e94f1939040f54 100644 --- a/packages/editor/src/components/plain-text/index.native.js +++ b/packages/editor/src/components/plain-text/index.native.js @@ -32,6 +32,7 @@ export default class PlainText extends Component { className={ [ styles[ 'editor-plain-text' ], this.props.className ] } onChangeText={ ( text ) => this.props.onChange( text ) } onFocus={ this.props.onFocus } // always assign onFocus as a props + onBlur={ this.props.onBlur } // always assign onBlur as a props { ...this.props } /> ); diff --git a/packages/editor/src/components/rich-text/index.native.js b/packages/editor/src/components/rich-text/index.native.js index e2cbecad952682..ba6a4673e101c2 100644 --- a/packages/editor/src/components/rich-text/index.native.js +++ b/packages/editor/src/components/rich-text/index.native.js @@ -357,6 +357,7 @@ export class RichText extends Component { text={ { text: html, eventCount: this.lastEventCount } } onChange={ this.onChange } onFocus={ this.props.onFocus } + onBlur={ this.props.onBlur } onEnter={ this.onEnter } onBackspace={ this.onBackspace } onContentSizeChange={ this.onContentSizeChange }