Skip to content

Commit

Permalink
RichText: Ensure instance is selected before setting back selection (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored Dec 9, 2018
1 parent e7fb179 commit b44a2f1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -688,9 +688,12 @@ export class RichText extends Component {
if ( shouldReapply ) {
const record = this.formatToValue( value );

// Maintain the previous selection:
record.start = this.state.start;
record.end = this.state.end;
// Maintain the previous selection if the instance is currently
// selected.
if ( isSelected ) {
record.start = this.state.start;
record.end = this.state.end;
}

this.applyRecord( record );
}
Expand Down

0 comments on commit b44a2f1

Please sign in to comment.