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();
}
}
});