Skip to content

Commit

Permalink
Wire onBlur on mobile ported blocks and components. (#12370)
Browse files Browse the repository at this point in the history
  • Loading branch information
daniloercoli authored Nov 28, 2018
1 parent 4512195 commit c014e04
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/block-library/src/code/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<View>
Expand All @@ -35,6 +35,7 @@ export default function CodeEdit( props ) {
aria-label={ __( 'Code' ) }
isSelected={ props.isSelected }
onFocus={ onFocus }
onBlur={ onBlur }
/>
</View>
);
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/heading/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ),
} }
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/more/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -33,6 +33,7 @@ export default function MoreEdit( props ) {
placeholder={ defaultText }
isSelected={ props.isSelected }
onFocus={ onFocus }
onBlur={ onBlur }
/>
<Text className={ styles[ 'block-library-more__right-marker' ] }>--&gt;</Text>
</View>
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/paragraph/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ),
Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/components/plain-text/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
/>
);
Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/components/rich-text/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit c014e04

Please sign in to comment.