Browse Source

[FIX] reference errors in gecko browsers when

having the ckeditor in a popup and closing it
pull/213/head
Holger Brunn 9 years ago
parent
commit
baf39c849b
  1. 27
      web_ckeditor4/static/src/js/web_ckeditor4.js

27
web_ckeditor4/static/src/js/web_ckeditor4.js

@ -47,6 +47,21 @@ openerp.web_ckeditor4 = function(instance)
} }
return ckeditor_addFunction_org(fn, scope); return ckeditor_addFunction_org(fn, scope);
}; };
var ckeditor_setTimeout_org = CKEDITOR.tools.setTimeout,
ckeditor_timeouts = {};
//we need to collect timeouts in order to cancel them to avoid errors on
//cleaning up
CKEDITOR.tools.setTimeout = function(func, milliseconds, scope, args, ownerWindow)
{
var result = ckeditor_setTimeout_org.apply(this, arguments);
console.log(arguments);
if(!ckeditor_timeouts[scope])
{
ckeditor_timeouts[scope] = [];
}
ckeditor_timeouts[scope].push(result);
return result;
}
CKEDITOR.on('dialogDefinition', function(e) CKEDITOR.on('dialogDefinition', function(e)
{ {
@ -199,8 +214,16 @@ openerp.web_ckeditor4 = function(instance)
{ {
if(this.editor) if(this.editor)
{ {
this.editor.removeAllListeners();
this.editor.destroy();
this.editor._.editable = null;
this.editor.destroy(true);
if(ckeditor_timeouts[this.editor])
{
_.each(ckeditor_timeouts[this.editor], function(timeout)
{
clearTimeout(timeout);
});
delete ckeditor_timeouts[this.editor];
}
this.editor = null; this.editor = null;
} }
}, },

Loading…
Cancel
Save