把CKeditor嵌入到EXTJS的WINDOW控件中

buildContentWin : function(grid, rowIndex, fieldName, fieldNameT) {
var win = new Ext.Window({
layout : 'form',
width : 1024,
title : '内容编辑',
height : 506,
autoScroll : true,
// closeAction : 'hide',
border : true,
modal : true,
plain : true,
closable : true,
resizable : false,
margin : '2 0 0 2'
});

var record = grid.getStore().getAt(rowIndex);
var data = record.get(fieldName)
var v = data;

var fckFormObj = new Ext.FormPanel({
frame : true,
items : [{
layout : 'form',
border : false,
items : [{
hideLabel : true,
xtype:"textarea",
id:"fckInstance", //div节点,这里要挂接FCKeditor编辑器
name:"fckInstance",
value:v != null ? v:'',
height:500
}]
}],
buttons:[{
text:"确定" ,
handler: function(){
//获取fckeditor内容赋给textarea

var o = document.getElementById('fckInstance');
var str = EmployeeActivityExt.editor.getData() ;
var _record = grid.getStore().getAt(rowIndex);
_record.set(fieldName, str);
_record.set(fieldNameT, '.......');
win.close();
}
},{
text : '取消',
handler : function() {
win.close();
}
}]
});
win.add(fckFormObj);
win.show();
if(EmployeeActivityExt.isFirst){
if(CompanyNewsInfoExt.editor != null){
CKEDITOR.remove(CompanyNewsInfoExt.editor);
}
if(EmployeeActivityExt.editor != null){
CKEDITOR.remove(EmployeeActivityExt.editor);
}
EmployeeActivityExt.editor = CKEDITOR.replace('fckInstance',{filebrowserUploadUrl : 'ckeditor/uploader?Type=File',
filebrowserImageUploadUrl : 'ckeditor/uploader?Type=Image',
filebrowserFlashUploadUrl : 'ckeditor/uploader?Type=Flash'
});
EmployeeActivityExt.isFirst = false
}else{
CKEDITOR.remove(EmployeeActivityExt.editor);
EmployeeActivityExt.editor = CKEDITOR.replace('fckInstance',{filebrowserUploadUrl : 'ckeditor/uploader?Type=File',
filebrowserImageUploadUrl : 'ckeditor/uploader?Type=Image',
filebrowserFlashUploadUrl : 'ckeditor/uploader?Type=Flash'
});
}
}

你可能感兴趣的:(把CKeditor嵌入到EXTJS的WINDOW控件中)