From 0936ca0fec43f631fc05c8e29389a071bc2a03c0 Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Tue, 30 Apr 2019 20:58:36 +0300 Subject: [PATCH] Just use onFormatChange which now defaults to "force" --- .../src/components/rich-text/index.native.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 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 5f63c5948004d..78afefa2f4ef7 100644 --- a/packages/block-editor/src/components/rich-text/index.native.js +++ b/packages/block-editor/src/components/rich-text/index.native.js @@ -104,7 +104,6 @@ export class RichText extends Component { this.onFocus = this.onFocus.bind( this ); this.onBlur = this.onBlur.bind( this ); this.onContentSizeChange = this.onContentSizeChange.bind( this ); - this.onFormatChangeForceChild = this.onFormatChangeForceChild.bind( this ); this.onFormatChange = this.onFormatChange.bind( this ); // This prevents a bug in Aztec which triggers onSelectionChange twice on format change this.onSelectionChange = this.onSelectionChange.bind( this ); @@ -211,10 +210,6 @@ export class RichText extends Component { } ).map( ( name ) => gutenbergFormatNamesToAztec[ name ] ).filter( Boolean ); } - onFormatChangeForceChild( record ) { - this.onFormatChange( record, true ); - } - onFormatChange( record, doUpdateChild = true ) { let newContent; // valueToFormat might throw when converting the record to a tree structure @@ -302,7 +297,7 @@ export class RichText extends Component { if ( this.multilineTag ) { if ( event.shiftKey ) { const insertedLineBreak = { needsSelectionUpdate: true, ...insert( currentRecord, '\n' ) }; - this.onFormatChangeForceChild( insertedLineBreak ); + this.onFormatChange( insertedLineBreak ); } else if ( this.onSplit && isEmptyLine( currentRecord ) ) { this.setState( { needsSelectionUpdate: false, @@ -314,7 +309,7 @@ export class RichText extends Component { } } else if ( event.shiftKey || ! this.onSplit ) { const insertedLineBreak = { needsSelectionUpdate: true, ...insert( currentRecord, '\n' ) }; - this.onFormatChangeForceChild( insertedLineBreak ); + this.onFormatChange( insertedLineBreak ); } else { this.splitContent( currentRecord ); } @@ -713,7 +708,7 @@ export class RichText extends Component { onTagNameChange={ onTagNameChange } tagName={ tagName } value={ record } - onChange={ this.onFormatChangeForceChild } + onChange={ this.onFormatChange } /> ) } { isSelected && (