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

[RNMobile] Wire onBlur on mobile blocks and components #12370

Merged
merged 1 commit into from
Nov 28, 2018
Merged
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
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