I have an editor on a page and save
button. I want save
button only to appear if there are changes (since last save). So, when you save, i set this.setState({hasChanges: false})
and in onChange
function i set hasChanges
to true
.
And that's all working fine. The issue is that editor will fire onChange
event when editor gain focus (but content is not changed yet). And, that is expected behaviour according to their documentation
The event listeners within the component will observe focus changes and propagate them through onChange as expected, so state and DOM will remain correctly in sync.
Is there some way to know if content has changed inside onChange
method, or only selection is changed?