Skip to content

Commit

Permalink
Fix #42: Change is always emitted with first blur event
Browse files Browse the repository at this point in the history
  • Loading branch information
lovasoa committed Aug 5, 2018
1 parent 44f6327 commit 2d3db84
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/react-contenteditable.js
Expand Up @@ -4,9 +4,10 @@ import deepEqual from 'fast-deep-equal';
let stripNbsp = str => str && str.replace(/ |\u202F|\u00A0/g, ' ');

export default class ContentEditable extends React.Component {
constructor() {
constructor(props) {
super();
this.emitChange = this.emitChange.bind(this);
this.lastHtml = props.html;
}

render() {
Expand Down Expand Up @@ -54,8 +55,7 @@ export default class ContentEditable extends React.Component {
if (this.htmlEl && this.props.html !== this.htmlEl.innerHTML) {
// Perhaps React (whose VDOM gets outdated because we often prevent
// rerendering) did not update the DOM. So we update it manually now.
this.htmlEl.innerHTML = this.props.html;
this.lastHtml = this.props.html;
this.htmlEl.innerHTML = this.lastHtml = this.props.html;
}
}

Expand Down

0 comments on commit 2d3db84

Please sign in to comment.