Skip to content

Commit

Permalink
Don't ignore *all* external updates in the post text editor
Browse files Browse the repository at this point in the history
If the post text editor isn't dirty, update the editor with any external
updates.
  • Loading branch information
noisysocks committed Mar 29, 2018
1 parent c4035be commit af209c2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions editor/components/post-text-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ class PostTextEditor extends Component {
};
}

componentWillReceiveProps( nextProps ) {
// If we receive a new value while we're editing (but before we've made
// changes), go ahead and clobber the local state
if ( this.props.value !== nextProps.value && this.state.value && ! this.state.isDirty ) {
this.setState( { value: nextProps.value } );
}
}

startEditing() {
// Copying the post content into local state ensures that edits won't be
// clobbered by changes to global editor state
Expand Down

0 comments on commit af209c2

Please sign in to comment.