Skip to content

Commit

Permalink
Merge pull request #3450 from WordPress/fix/2829-force-onChange-befor…
Browse files Browse the repository at this point in the history
…e-merge

fix/2829: force onChange to be updated with TinyMCE content before merge
  • Loading branch information
tiny-james authored Nov 15, 2017
2 parents 4312160 + d711a1a commit ceb4e69
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions blocks/editable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,10 @@ export default class Editable extends Component {
}
}

onChange() {
if ( ! this.editor.isDirty() ) {
onChange( shouldForce ) {
// Note that due to efficiency, speed and low cost requirements isDirty may
// not reflect reality for a brief period immediately after a change.
if ( ! shouldForce && ! this.editor.isDirty() ) {
return;
}

Expand Down Expand Up @@ -391,7 +393,7 @@ export default class Editable extends Component {
)
) {
const forward = event.keyCode === DELETE;
this.onChange();
this.onChange( true );
this.props.onMerge( forward );
event.preventDefault();
event.stopImmediatePropagation();
Expand Down

0 comments on commit ceb4e69

Please sign in to comment.