Skip to content

Commit

Permalink
Don't cache on input
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Nov 30, 2018
1 parent 01f4c8d commit 2f38940
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2f38940

Please sign in to comment.