froala / angular-froala

Angular.js bindings for Froala WYSIWYG HTML Rich Text Editor.
https://froala.com/wysiwyg-editor
MIT License
306 stars 123 forks source link

Check if element exists before updating model view #175

Closed joostbaptist closed 5 years ago

joostbaptist commented 6 years ago

Hi,

We found a small issue with the model view update. Right now, when the contentChanged event fires, the model view is updated asynchronously. However, in come cases the update is performed after the element is destroyed, leading to the following error:

TypeError: Cannot read property 'froalaEditor' of null

(caused here: https://github.com/froala/angular-froala/blob/master/src/angular-froala.js#L172)

In our case, this error happens when the user activates code view and then presses the back button of their browser.

I implemented a simple fix by checking if the element still exists before updating.

It would be great if this gets merged. Thanks!

theroymind commented 5 years ago

why wouldn't this be merged, it's been causing Sentry errors for us and it's a simple fix instead of forking and adding it ourselves

lukewaite commented 5 years ago

@stefanneculai Any chance of getting this merged and released?