mirror of https://github.com/OCA/web.git
[FIX] reference errors in gecko browsers when
having the ckeditor in a popup and closing itpull/213/head
parent
35e3fb189e
commit
baf39c849b
|
@ -47,6 +47,21 @@ openerp.web_ckeditor4 = function(instance)
|
|||
}
|
||||
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)
|
||||
{
|
||||
|
@ -199,8 +214,16 @@ openerp.web_ckeditor4 = function(instance)
|
|||
{
|
||||
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;
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue