|
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
|---|---|
| 作者 | 正文 |
|
最后更新时间:2008-03-13
最近有朋友问我在EXT中使用FCKEditor编辑器遇到的一些问题,于是自己花一点时间写了一个例子,提供给大家学习。
例子已经配置好上传图片/flash/文件到服务器的功能,下载附件ext-fckeditor.rar,布署运行工程下的/ext/examples/form/fckForm.html即可。如:http://localhost:8080/ext/examples/form/fckForm.html 代码如下:
Ext.onReady(function(){
var fckeditorFormPanel = new Ext.FormPanel({
labelWidth: 75,
url:'',
frame:true,
title: 'fckeditor Form',
bodyStyle:'padding:5px 5px 0',
width: 950,
height:450,
defaultType: 'textfield',
items: [{
xtype:'textarea',
fieldLabel:'编辑',
labelSeparator:':',
id:'code',
name:'code',
height:200,
width:300
}
],
buttons: [{
text: 'Save'
},{
text: 'Cancel'
}]
});
fckeditorFormPanel.render(document.body);
/**
* 以下创建在线编辑器
*/
var oFCKeditor = new FCKeditor( 'code',810,350 ) ;
oFCKeditor.BasePath = "/fckeditor/" ;
oFCKeditor.ToolbarSet = 'Default';
oFCKeditor.ReplaceTextarea() ;
});
声明:JavaEye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
|
| 返回顶楼 | |
|
最后更新时间:2008-03-15
最近正好用到,用htmleditor实在是太不方便了,正好想换掉,
我想请问下,在buttons: [{ }]中有没有handler:function(){},可以写提交的方法, 还是在url:里写提交地址。 |
|
| 返回顶楼 | |
|
最后更新时间:2008-03-17
怎么得到不它值啊
我用Ext.getCmp('code').getValue() |
|
| 返回顶楼 | |
|
最后更新时间:2008-03-17
Ext.get('code').dom.value
|
|
| 返回顶楼 | |
|
最后更新时间:2008-03-18
还是取不到
|
|
| 返回顶楼 | |
|
最后更新时间:2008-03-18
对不起!果然获不到值,之前没有测试。使用下面的代码可以获到值。
Ext.onReady(function(){
var fckeditorFormPanel = new Ext.FormPanel({
labelWidth: 75,
url:'',
frame:true,
title: 'fckeditor Form',
bodyStyle:'padding:5px 5px 0',
width: 950,
height:450,
defaultType: 'textfield',
items: [{
xtype:'textarea',
fieldLabel:'编辑',
labelSeparator:':',
id:'code',
name:'code',
height:200,
width:300
}
],
buttons: [{
text: 'Save',
type:'submit',
handler: function() {
Ext.get('code').dom.value=editorInstance.GetXHTML( true );//获取fckeditor内容赋给textarea
alert(Ext.get('code').dom.value);
if(fckeditorFormPanel.form.isValid()){//验证通过
fckeditorFormPanel.form.doAction('submit',{
url:'submit.do',
method:'post',
waitMsg:'正在提交,请稍等...',
success:function(form,action){//成功返回
},
failure:function(form,action){//失败返回
}
});
}
}
},{
text: 'Cancel'
}]
});
fckeditorFormPanel.render(document.body);
/**
* 以下创建在线编辑器
*/
var oFCKeditor = new FCKeditor( 'code',810,350 ) ;
oFCKeditor.BasePath = "/fckeditor/" ;
oFCKeditor.ToolbarSet = 'Default';
oFCKeditor.ReplaceTextarea() ;
});
var editorInstance;
/**
* FCKEditor初始化完成将调用此方法
* @param {Object} editorInstance
*/
function FCKeditor_OnComplete( instance ) {
editorInstance=instance;
};
|
|
| 返回顶楼 | |
|
最后更新时间:2008-03-18
比htmleditor强好多啊
|
|
| 返回顶楼 | |
|
最后更新时间:2008-04-07
图片上传好像不行
|
|
| 返回顶楼 | |
|
最后更新时间:2008-04-09
用纯IE打开试试。有些集成的IE的浏览器会上传不了,这个是fckeditor的一个bug
|
|
| 返回顶楼 | |
|
最后更新时间:2008-04-25
不行啊 哥们你这东西不行啊
|
|
| 返回顶楼 | |





