From 2f38940bd7c35abff1ac22f1ed04860e8b9319e8 Mon Sep 17 00:00:00 2001 From: iseulde Date: Fri, 30 Nov 2018 15:18:39 +0100 Subject: [PATCH] Don't cache on input --- packages/editor/src/components/rich-text/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/editor/src/components/rich-text/index.js b/packages/editor/src/components/rich-text/index.js index b33182c02d080c..fac6b7efb039a8 100644 --- a/packages/editor/src/components/rich-text/index.js +++ b/packages/editor/src/components/rich-text/index.js @@ -174,7 +174,7 @@ export class RichText extends Component { return { formats, text, start, end }; } - createRecord() { + createRecord( { cache } = {} ) { const range = getSelection().getRangeAt( 0 ); // If the range is shallowly equal to the last, return the last @@ -191,7 +191,7 @@ export class RichText extends Component { // > is not empty. // > // > https://w3c.github.io/selection-api/#dom-selection-getrangeat - if ( range === this.createRecord.lastRange ) { + if ( cache && range === this.createRecord.lastRange ) { return this.createRecord.lastRecord; } @@ -419,7 +419,7 @@ export class RichText extends Component { return; } - const { start, end, formats } = this.createRecord(); + const { start, end, formats } = this.createRecord( { cache: true } ); if ( start !== this.state.start || end !== this.state.end ) { const isCaretWithinFormattedText = this.props.isCaretWithinFormattedText;