diff --git a/packages/editor/src/components/rich-text/index.native.js b/packages/editor/src/components/rich-text/index.native.js index 7fe26564cae5e9..a64a3bd422b9f4 100644 --- a/packages/editor/src/components/rich-text/index.native.js +++ b/packages/editor/src/components/rich-text/index.native.js @@ -221,12 +221,6 @@ export class RichText extends Component { const empty = this.isEmpty(); if ( onMerge ) { - // The onMerge event can cause a content update event for this block. Such event should - // definitely be processed by our native components, since they have no knowledge of - // how the split works. Setting lastEventCount to undefined forces the native component to - // always update when provided with new content. - this.lastEventCount = undefined; - onMerge( ! isReverse ); } @@ -274,14 +268,23 @@ export class RichText extends Component { this.lastContent = undefined; return true; } - // The check below allows us to avoid updating the content right after an `onChange` call - // first time the component is drawn with empty content `lastContent` is undefined - if ( nextProps.value && + // The check below allows us to avoid updating the content right after an `onChange` call. + // The first time the component is drawn `lastContent` and `lastEventCount ` are both undefined + if ( this.lastEventCount && + nextProps.value && this.lastContent && - this.lastEventCount ) { + nextProps.value === this.lastContent ) { return false; } + // If the component is changed React side (merging/splitting/custom text actions) we need to make sure + // the native is updated as well + if ( nextProps.value && + this.lastContent && + nextProps.value !== this.lastContent ) { + this.lastEventCount = undefined; // force a refresh on the native side + } + return true; }