From f77ba1d178e3dbf73a2c349809e2dcd00054f9b3 Mon Sep 17 00:00:00 2001 From: etoledom Date: Fri, 12 Apr 2019 17:30:49 +0200 Subject: [PATCH] [Mobile]: Fix broken imports on native rich-text. (#14948) * Fix broken imports on native rich-text. * RichText: Replace insertLineBreak() with insert(); --- .../src/components/rich-text/index.native.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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 e6826e80dc0877..aa87e1fadea3aa 100644 --- a/packages/block-editor/src/components/rich-text/index.native.js +++ b/packages/block-editor/src/components/rich-text/index.native.js @@ -19,9 +19,8 @@ import { split, toHTMLString, insert, - insertLineSeparator, - insertLineBreak, - isEmptyLine, + __unstableInsertLineSeparator as insertLineSeparator, + __unstableIsEmptyLine as isEmptyLine, isCollapsed, getTextContent, } from '@wordpress/rich-text'; @@ -295,7 +294,7 @@ export class RichText extends Component { if ( this.multilineTag ) { if ( event.shiftKey ) { - const insertedLineBreak = { needsSelectionUpdate: true, ...insertLineBreak( currentRecord ) }; + const insertedLineBreak = { needsSelectionUpdate: true, ...insert( currentRecord, '\n' ) }; this.onFormatChangeForceChild( insertedLineBreak ); } else if ( this.onSplit && isEmptyLine( currentRecord ) ) { this.setState( { @@ -307,7 +306,7 @@ export class RichText extends Component { this.onFormatChangeForceChild( insertedLineSeparator ); } } else if ( event.shiftKey || ! this.onSplit ) { - const insertedLineBreak = { needsSelectionUpdate: true, ...insertLineBreak( currentRecord ) }; + const insertedLineBreak = { needsSelectionUpdate: true, ...insert( currentRecord, '\n' ) }; this.onFormatChangeForceChild( insertedLineBreak ); } else { this.splitContent( currentRecord );