论坛首页 Web前端技术论坛

extjs htmleditor readOnly无效解决方法

浏览 3887 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2010-01-07   最后修改:2010-01-07
Ext 里的Ext.form.HtmlEditor里readOnly是无效的,俺的解决方法如下,希望对大家有用,另外有不同意见的或者更好的建议的可以提出来.

Ext.override(Ext.form.HtmlEditor, {  
    	 onResize : function(w, h){
	        Ext.form.HtmlEditor.superclass.onResize.apply(this, arguments);
	        if(this.el && this.iframe){
	            if(typeof w == 'number'){
	                var aw = w - this.wrap.getFrameWidth('lr');
	                this.el.setWidth(this.adjustWidth('textarea', aw));
	                this.iframe.style.width = aw + 'px';
	                if(Ext.isIE){
	                	this.wrap.setWidth(aw);
	                }
	                if(this.readOnly){
        				this.onReadOnly();
        			}
	            }
	            if(typeof h == 'number'){
	                var ah = h - this.wrap.getFrameWidth('tb') - this.tb.el.getHeight();
	                this.el.setHeight(this.adjustWidth('textarea', ah));
	                this.iframe.style.height = ah + 'px';
	                if(this.doc){
	                    this.getEditorBody().style.height = (ah - (this.iframePad*2)) + 'px';
	                }
	            }
	        }
	    },
	    // private
    	onReadOnly : function(){
    		this.unMaskWrap();
			this.maskWrap(0);
		},
//        onDisable : function(){
//        	this.maskWrap(99);
//        	Ext.form.HtmlEditor.superclass.onDisable.call(this);
//        },
//        onEnable: function(){  
//           this.unMaskWrap();
//           Ext.form.HtmlEditor.superclass.onEnable.call(this);  
//       },
       maskWrap : function(opacity){
	       if(this.rendered){
	       	 var mask= this.wrap.mask(); 
	       	 mask.dom.style.zIndex = "0";
	       	 if(Ext.isIE){
		     	mask.dom.style.filter = "alpha(opacity="+opacity||0+");"; 
	       	 }else{
		     	 mask.dom.style.opacity = opacity ? '"' + opacity/100 + '"' : "0";  
		     }
	       }
       },
       unMaskWrap : function(){
       	 if(this.rendered){  
            this.wrap.unmask();  
         }  
       }
   });  



   发表时间:2010-01-13  
在chrome里是好好的
0 请登录后投票
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics