Open Robban1980 opened 5 years ago
And also found, one reason why froala has bad performance is most likely because of the lack of cleanup when the controller is destroyed.
Yes, I reported this back in #211, but nothing was done to it. AngularJS froala has been in an unusable state for the past three months or so.
@mikkoSarapelto
@Robban1980
I also encountered this issue - did anyone of you find a workaround for this?
I ended up adding this commit: https://github.com/DigiExam/angular-froala/pull/4/commits/538ed12cca88aa139e9790d80ddf5a3e7ea05b87
Not an especially nice solution - but have spent a few hours too many on this so I was just glad to get rid of the errors.
@robinwassen did not try to do any other workaround than the ones provided above. We currently use the controller in location where the impact can be limited at the moment.
In a normal scenario where you go from edit mode to presentation mode and then back to edit mode, the second time you go to edit mode by using ng-if. You will get an
error showing in the console, this is because the options used to create a new froala editor the second time around has a reference to the previous editor create in the ctrl.options.froalaEditor. To fix it it must be cleared when the editor is destroyed on initialized.
Then you might experience the next issue which is element is null when reaching
element.bind('$destroy'
to work around this issue pass the element as an argument to the ctrl.initListeners function and it seems to be working.And also found, one reason why froala has bad performance is most likely because of the lack of cleanup when the controller is destroyed. Second time the controller is initlized the
ctrl.options.events.initialized
is called twice, third time three times etc.I would say that angular-froala is not production ready and should be used with care until these basic issues have been solved.