//patch for HtmlEditor, both in ExtJS 2.x AND 3.X RC2
Ext.override(Ext.form.HtmlEditor, {
  actionMode: 'wrap'
});

Ext.apply(Ext.form.HtmlEditor.prototype,{
	onDestroy:function(){
        if(this.monitorTask){
            Ext.TaskMgr.stop(this.monitorTask);
        }
        if(this.rendered){
             //add by fog:remove all listeners for this.doc
            Ext.EventManager.un(this.doc, 'mousedown', this.onEditorEvent,this)
            Ext.EventManager.un(this.doc, 'dblclick', this.onEditorEvent,this)
            Ext.EventManager.un(this.doc, 'click', this.onEditorEvent,this)
            Ext.EventManager.un(this.doc, 'keyup', this.onEditorEvent,this)
            if(Ext.isGecko){
                Ext.EventManager.un(this.doc, 'keypress', this.applyCommand, this);
            }
            if(Ext.isIE || Ext.isSafari || Ext.isOpera){
                Ext.EventManager.un(this.doc, 'keydown', this.fixKeys,this)
            }
            

            this.tb.items.each(function(item){
                if(item.menu){
                    item.menu.removeAll();
                    if(item.menu.el){
                        item.menu.el.destroy();
                    }
                }
                item.destroy();
            });
            this.tb.destroy();//add by fog:destroy tollbar
            this.wrap.dom.innerHTML = '';
            this.wrap.remove();
        }
    }	    
});
