Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On $destroy does not clean up the 3.0.5 editor #218

Open
Robban1980 opened this issue Sep 11, 2019 · 4 comments
Open

On $destroy does not clean up the 3.0.5 editor #218

Robban1980 opened this issue Sep 11, 2019 · 4 comments

Comments

@Robban1980
Copy link

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

Converting circular structure to JSON
    --> starting at object with constructor 'Window'
    --- property 'parent' closes the circle

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.

@mikkoSarapelto
Copy link

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.

@robinwassen
Copy link

@mikkoSarapelto
@Robban1980

I also encountered this issue - did anyone of you find a workaround for this?

robinwassen added a commit to DigiExam/angular-froala that referenced this issue Dec 5, 2019
…rs (froala#218)

The scope will still be kept alive for reasons unknown - but will not throw errors.
robinwassen added a commit to DigiExam/angular-froala that referenced this issue Dec 5, 2019
Dirty workaround for scope not getting cleaned up and generating errors (froala#218)
robinwassen added a commit to DigiExam/angular-froala that referenced this issue Dec 5, 2019
Dirty workaround for scope not getting cleaned up and generating errors (froala#218)
@robinwassen
Copy link

I ended up adding this commit: DigiExam@538ed12

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.

@Robban1980
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants