From 8cde214849e8706989edfffa83a6a3f18e2b224b Mon Sep 17 00:00:00 2001 From: etoledom Date: Wed, 12 Jun 2019 10:51:34 +0200 Subject: [PATCH 1/2] Add onEnter prop to RichText to allow custom handling of onEnter --- .../block-editor/src/components/rich-text/index.native.js | 6 ++++++ packages/editor/src/components/post-title/index.native.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/rich-text/index.native.js b/packages/block-editor/src/components/rich-text/index.native.js index 0a33ebd32b491a..f63543b0dddaa6 100644 --- a/packages/block-editor/src/components/rich-text/index.native.js +++ b/packages/block-editor/src/components/rich-text/index.native.js @@ -358,6 +358,12 @@ export class RichText extends Component { // eslint-disable-next-line no-unused-vars onEnter( event ) { + let { onEnter } = this.props; + if ( this.props.onEnter ) { + this.props.onEnter(); + return; + } + this.lastEventCount = event.nativeEvent.eventCount; this.comesFromAztec = true; this.firedAfterTextChanged = event.nativeEvent.firedAfterTextChanged; diff --git a/packages/editor/src/components/post-title/index.native.js b/packages/editor/src/components/post-title/index.native.js index c895abcbebc108..2c9435e1ef6b36 100644 --- a/packages/editor/src/components/post-title/index.native.js +++ b/packages/editor/src/components/post-title/index.native.js @@ -102,7 +102,7 @@ class PostTitle extends Component { placeholder={ decodedPlaceholder } value={ title } onSplit={ () => { } } - onReplace={ this.props.onEnterPress } + onEnter={ this.props.onEnterPress } disableEditingMenu={ true } setRef={ ( ref ) => { this.titleViewRef = ref; From 2041620c4716473871e219eff73761ebe6f9b145 Mon Sep 17 00:00:00 2001 From: etoledom Date: Wed, 12 Jun 2019 13:37:59 +0200 Subject: [PATCH 2/2] Remove reduntant line --- packages/block-editor/src/components/rich-text/index.native.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/block-editor/src/components/rich-text/index.native.js b/packages/block-editor/src/components/rich-text/index.native.js index f63543b0dddaa6..489d0a5fbeaa95 100644 --- a/packages/block-editor/src/components/rich-text/index.native.js +++ b/packages/block-editor/src/components/rich-text/index.native.js @@ -358,7 +358,6 @@ export class RichText extends Component { // eslint-disable-next-line no-unused-vars onEnter( event ) { - let { onEnter } = this.props; if ( this.props.onEnter ) { this.props.onEnter(); return;