TylerGarlick / angular-redactor

Redactor WYSIWYG directives for redactor editor
MIT License
208 stars 83 forks source link

Appended elements not removed from the DOM when changing application states #61

Open ElliottRoche opened 8 years ago

ElliottRoche commented 8 years ago

I'm unsure where/why this error is happening and it may be unrelated to angular-redactor but I'm not sure where else to start.

When I'm in an application state that has redactor in the view and I navigate away from that state to a different part of the app, the redactor-toolbar-tooltip remains in the DOM. It's got a style attribute of 'display: none;' so it doesn't actually remain visible, but it persists nonetheless.

If I go back to that state with redactor in the view (or to any state with redactor for that matter) it sticks another set of redactor-toolbar-tooltips into the DOM.

So if the app isn't refreshed for sometime, there could a huge number of these tooltips still stuck in the DOM.

Here's an example:

2016-02-03 at 10 54 am

Any idea why this might be happening?

willkramer commented 8 years ago

Are you destroying redactor on view change? This should cleanup the DOM.

https://imperavi.com/redactor/docs/api/core/#api-destroy

ElliottRoche commented 8 years ago

Not manually no.

I was under the impression that this part of angular-redactor.js would destroy it if it was loaded again.

                    $timeout(function() {
                        editor = element.redactor(options);
                        ngModel.$render();
                        element.on('remove',function(){
                            element.off('remove');
                            element.redactor('core.destroy');
                        });
                    });