Skip to content

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

Open
@Robban1980

Description

@Robban1980

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions