Extjs定义的Fckeditor控件

时间:2023-03-09 00:26:36
Extjs定义的Fckeditor控件
Ext.namespace('CRM.Panels');
//Ext.BoxComponent 这里继承是参考的Ext.form.Field
CRM.Panels.Fckeditor = Ext.extend(Ext.BoxComponent, {
initComponent: function() {
var fckMainBodyId = this.fckMainBodyId == "" ? "fckMainBodyId" : this.fckMainBodyId;
var fckMainBodyConfigId = this.fckMainBodyConfigId == "" ? "fckMainBodyConfigId" : this.fckMainBodyConfigId;
var editorWidth = this.editorWidth == "" ? "100%" : this.editorWidth;
var editorHeight = this.editorHeight == "" ? "300" : this.editorHeight;
this.html = "<div>" +
"<input type='hidden' value='' name='" + fckMainBodyId + "' id='" + fckMainBodyId + "'>" +
"<input type='hidden' value='HtmlEncodeOutput=true' id='" + fckMainBodyConfigId + "'>" +
"<iframe width='" + editorWidth + "' scrolling='no' height='" + editorHeight + "px' frameborder='no' " +
"src='/fckeditor/editor/fckeditor.html?InstanceName=fckMainBody&amp;Channel=EWSOS&amp;" +
"Toolbar=Default' id='fckMainBody___Frame' " +
"style='margin: 0px; padding: 0px; border: 0px none; background-color: transparent; background-image: none; width: " + editorWidth + "; height: " + editorHeight + "px;'>" +
"</iframe>" +
"</div>";
}
});
//把新建的自定义组件注册为一种xtype
Ext.reg('Fckeditor', CRM.Panels.Fckeditor);

/*使用:
items:[
{
xtype: "Fckeditor",
editorHeight: "600",
editorWidth:"100%"
}
]*/

相关文章