Skip to content

Commit

Permalink
[RMmobile] Add Enter.key detection to the Title block (#13500)
Browse files Browse the repository at this point in the history
* Intercept Enter.key and give the ability to add a new block after

* Remove the custom mobile code, and use the default web implementation
  • Loading branch information
daniloercoli authored Jan 26, 2019
1 parent 096c12c commit acb42fa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/editor/src/components/post-title/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ class PostTitle extends Component {
<TextInput
blurOnSubmit={ true }
textAlignVertical="top"
multiline
numberOfLines={ 0 }
multiline={ false }
onSubmitEditing={ this.props.onEnterPress }
returnKeyType={ 'next' }
onChangeText={ this.onChange }
onFocus={ this.onSelect }
placeholder={ decodedPlaceholder }
Expand All @@ -69,10 +70,14 @@ class PostTitle extends Component {

const applyWithDispatch = withDispatch( ( dispatch ) => {
const {
insertDefaultBlock,
clearSelectedBlock,
} = dispatch( 'core/editor' );

return {
onEnterPress() {
insertDefaultBlock( undefined, undefined, 0 );
},
clearSelectedBlock,
};
} );
Expand Down

0 comments on commit acb42fa

Please sign in to comment.