froala/aurelia-froala-editor

Potential timing issue when quickly saving changes.

JoshMcCullough opened this issue · 1 comments

(Note that I also commented on an issue in the main repo (froala/wysiwyg-editor#31 (comment)) but I believe this is a separate issue.)

Since it appears that the contentChanged event is only fired at most once per 200ms, there are timing issues if a user is quickly typing and then trying to save changes. We cannot rely on this event to have updated our underlying models because more text could have been added or removed within the last 200ms. So, we have instead decided to listen for the blur event and update our model when that changes.

We wrote our own Froala wrapper for Aurelia before the official one was released, and I did not test this with the official wrapper, but looking at the code, I see that the same issue is likely since value is only updated on contentChanged. I suggest you also update it on blur.

If you want to get immediate model change, you could use the keyup event (see Angular version: https://github.com/froala/angular-froala/blob/master/src/angular-froala.js#L135). However, it might result in slow performance. Thanks for the blur suggestion.