BUG: State changes are keeping the medium toolbars on page
Closed this issue · 4 comments
sergiofilhowz commented
sergiofilhowz commented
Fixed using this:
iElement.on('remove', function () {
ctrl.editor.deactivate();
});
But there's some memory leak on overriding MediumEditors without deactivating existing ones.
rkoberg commented
me too... But the above didn't work for me. In the run of my main module I put:
$rootScope.$on('$routeChangeStart', function(event, next){
var mediumToolbar = angular.element('.medium-editor-toolbar');
if (mediumToolbar.length) {
mediumToolbar.remove();
}
...
diefans commented
I fixed it by deactivating the editor on scope destroy
scope.$on('$destroy', function() {
ctrl.editor.deactivate();
});
rkoberg commented
diefans fix works best. This should get into the code base.
There is still an issue, though. On submit, the toolbar remains active for me. Apparently the button click or tab+enter is not enough to trigger the toolbar removal.
Is there any way to get the medium editor from the angular element object to allow deactivate from outside code?