Skip to content

Commit

Permalink
[Mobile]: Fix broken imports on native rich-text. (WordPress#14948)
Browse files Browse the repository at this point in the history
* Fix broken imports on native rich-text.

* RichText: Replace insertLineBreak() with insert();
  • Loading branch information
etoledom authored and mchowning committed Apr 15, 2019
1 parent 58618d1 commit f77ba1d
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ import {
split,
toHTMLString,
insert,
insertLineSeparator,
insertLineBreak,
isEmptyLine,
__unstableInsertLineSeparator as insertLineSeparator,
__unstableIsEmptyLine as isEmptyLine,
isCollapsed,
getTextContent,
} from '@wordpress/rich-text';
Expand Down Expand Up @@ -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( {
Expand All @@ -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 );
Expand Down

0 comments on commit f77ba1d

Please sign in to comment.