Skip to content

Commit

Permalink
Rich Text: Remove updateContent function
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Jun 28, 2018
1 parent 248697a commit 29bcba5
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions editor/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,20 +695,9 @@ export class RichText extends Component {
}
}

updateContent() {
// Do not trigger a change event coming from the TinyMCE undo manager.
// Our global state is already up-to-date.
this.editor.undoManager.ignore( () => {
const bookmark = this.editor.selection.getBookmark( 2, true );

this.savedContent = this.props.value;
this.setContent( this.savedContent );
this.editor.selection.moveToBookmark( bookmark );
} );
}

setContent( content ) {
const { format } = this.props;
this.savedContent = content;
this.editor.setContent( valueToString( content, format ) );
}

Expand Down Expand Up @@ -739,7 +728,7 @@ export class RichText extends Component {
! isEqual( this.props.value, prevProps.value ) &&
! isEqual( this.props.value, this.savedContent )
) {
this.updateContent();
this.setContent( this.props.value );
}

if ( 'development' === process.env.NODE_ENV ) {
Expand Down Expand Up @@ -829,7 +818,7 @@ export class RichText extends Component {
* @param {?Array} blocks blocks to insert at the split position
*/
restoreContentAndSplit( before, after, blocks = [] ) {
this.updateContent();
this.setContent( this.props.value );
this.props.onSplit( before, after, ...blocks );
}

Expand Down

0 comments on commit 29bcba5

Please sign in to comment.