Skip to content

Commit

Permalink
[RNMobile] Fix for history stack that's is not empty on a fresh start…
Browse files Browse the repository at this point in the history
… of the editor (#15055)

* Do not reset the content in onSelectionChange

* Make sure there are changes made to the content before upgrading it upward

* Refactor: Introduce a local variable and DRY the code a bit

* Fix lint
  • Loading branch information
daniloercoli authored and hypest committed May 2, 2019
1 parent 6059581 commit e1e6b60
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/block-editor/src/components/rich-text/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,10 +481,15 @@ export class RichText extends Component {
formatPlaceholder,
} );
this.lastEventCount = event.nativeEvent.eventCount;
// we don't want to refresh aztec as no content can have changed from this event
// let's update lastContent to prevent that in shouldComponentUpdate
this.lastContent = this.removeRootTagsProduceByAztec( unescapeSpaces( text ) );
this.props.onChange( this.lastContent );

// Make sure there are changes made to the content before upgrading it upward
const newContent = this.removeRootTagsProduceByAztec( unescapeSpaces( text ) );
if ( this.lastContent !== newContent ) {
// we don't want to refresh aztec native as no content can have changed from this event
// let's update lastContent to prevent that in shouldComponentUpdate
this.lastContent = newContent;
this.props.onChange( this.lastContent );
}
}

isEmpty() {
Expand Down

0 comments on commit e1e6b60

Please sign in to comment.