论坛首页 AJAX版 AJAX

谁有EXT整合fckeditor的经验?

浏览 2389 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
最后更新时间:2007-10-15 关键字: ext

最近在做个新闻管理,用了EXT2,在将fckeditor整合到form卡壳。

将图片放进form也没有成功,ext1的例子移植到ext2不成功。

那位兄弟有相关经验或建议,请开导开导小弟。

 

 

   
最后更新时间:2007-10-16
弟兄们都没有这么搞过吗?
   
0 请登录后投票
最后更新时间:2007-10-17
formPanel中textarea定义片段:
{
... {
					id : 'docCont',
					name : 'StrHtml',
					xtype : 'textarea',
					fieldLabel : '范本内容',
					width : 500
				},
				...

FCKeditor包装:
var fck = function() {
	var ofck;
	return {
		rendered : false,
        iid : '',
		getInstance : function() {
			return FCKeditorAPI.GetInstance(this.iid);
		},
		render : function(textAreaId,toolBarSet) {
			this.iid = textAreaId;
			ofck = new FCKeditor(textAreaId);
			ofck.BasePath = '/js/fckeditor/';
			ofck.Config['CustomConfigurationsPath'] = '/js/fckeditor/fckconfig_xxx.js' ;
			if(toolBarSet){
				ofck.ToolbarSet = toolBarSet;
			}
			ofck.Height = 400;
			ofck.Width = 750;
			ofck.ReplaceTextarea();
			this.rendered = true;
		}
	}
}();
   
0 请登录后投票
最后更新时间:2007-10-18
沙漠暴雨啊
非常感谢!

btw:兄弟是否很欣赏隆美尔
   
0 请登录后投票
最后更新时间:2007-10-18
不谢,对Ext我也只是入门而已,大家一起交流……
呵呵,看你头像是U571里面的吧……
   
0 请登录后投票
最后更新时间:2007-10-18
das boot(从海底出击)U96艇长莱曼
《das boot》强烈推荐一看
   
0 请登录后投票
最后更新时间:2008-01-18

<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css"/>

<!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<!-- ENDLIBS -->

<script type="text/javascript" src="ext/ext-all.js"></script>
<script type="text/javascript" src="/FCKeditor/fckeditor.js"></script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />



<script language="javascript">
var oFCKeditorOptions = {
    BasePath : '../fckeditor/',
    Config : {
        BaseHref : window.location,
        SkinPath : '/fckeditor/editor/skins/office2003/',
        ProcessHTMLEntities : true,
        ProcessNumericEntities : false,
        StartupShowBlocks : true,
        ToolbarCanCollapse : false
    },
    ToolbarSet : 'Default'
};

Ext.form.FCKeditor = function(config){
    this.config = config;
    Ext.form.FCKeditor.superclass.constructor.call(this, config);
    this.FCKid=0;
    this.MyisLoaded=false;
    this.MyValue='';
};

Ext.extend(Ext.form.FCKeditor, Ext.form.TextArea,  {
    onRender : function(ct, position){
        if(!this.el){
            this.defaultAutoCreate = {
                tag: "textarea",
                style:"width:100px;height:60px;",
                autocomplete: "off"
            };
        }
        Ext.form.TextArea.superclass.onRender.call(this, ct, position);
        if(this.grow){
            this.textSizeEl = Ext.DomHelper.append(document.body, {
                tag: "pre", cls: "x-form-grow-sizer"
            });
            if(this.preventScrollbars){
                this.el.setStyle("overflow", "hidden");
            }
            this.el.setHeight(this.growMin);
        }

        //setTimeout("loadFCKeditor('"+this.name+"',"+ this.config.height +");",100);
		loadFCKeditor(this.name, this.config.height );
    }/*,
    setValue : function(value){
		FCKeditorSetValue(this.name,value);
		Ext.form.TextArea.superclass.setValue.apply(this,value);
    },	
    getValue : function(){
		var value = FCKeditorGetValue(this.name);
		Ext.form.TextArea.superclass.setValue.apply(this,value);
		return Ext.form.TextArea.superclass.getValue(this);
    }*/
});
Ext.reg('fckeditor', Ext.form.FCKeditor);

function loadFCKeditor(element, height){
    oFCKeditor = new FCKeditor( element );
    oFCKeditor.BasePath      = oFCKeditorOptions.BasePath;
    oFCKeditor.ToolbarSet    = oFCKeditorOptions.ToolbarSet;
    oFCKeditor.Config        = oFCKeditorOptions.Config;
    oFCKeditor.Height = height;
    oFCKeditor.ReplaceTextarea();
}/*
function FCKeditorSetValue(name,value){
	var oEditor = FCKeditorAPI.GetInstance(name);
	if(oEditor!=undefined) oEditor.SetData(value);
}
function FCKeditorGetValue(name){
	var data = '';
	var oEditor = FCKeditorAPI.GetInstance(name);
    if(oEditor!=undefined) data=oEditor.GetData();
	return data;
}*/

Ext.onReady(function(){
	var form= new Ext.form.FormPanel({
		labelAlign    : 'right',
		method        : 'GET',
		height        : 700,
		width		: 900	,
		buttonAlign : 'center',
		//url: 'docInsertUpdate.php',
		labelWidth    : 80,
		frame        : true,
		defaultType    : 'textfield',
		items         : [{
				name        : 'alarmCode',
				width         : 450,
				fieldLabel    : 'Alarm Code'
			},{
				name        : 'alarmText',
				width         : 450,
				fieldLabel    : 'Alarm Text'
			},{
				xtype        : 'fckeditor',
				name        	: 'documentBody',
				id            : 'documentBody',
				fieldLabel    : 'Document',
				height        : 400,
				width		: 200
			}
		]
	});  
	form.render(document.body);

});
</script>

   
0 请登录后投票
最后更新时间:2008-05-25
感谢分享。

我现在用时发现有点儿问题,在上传后,提示错误,不知各位遇到没有?
   
0 请登录后投票
最后更新时间:2008-05-25
经过排查,是因为在本地调试的原因导致出错。

本地地址类似192.168.0.88,fckeditor在上传后的处理函数取domain时用“.”分隔,结果取到的是0.88,导致设置document.domani出错,在服务器上调试通过。

再次感谢分享,这是目前找到的extjs+fckeditor最好的整合。
   
0 请登录后投票
最后更新时间:2008-08-21
EXT/FCKEditor 集成 -- AJAX UI -- 一种web开发的新的思维

参考我的
   
0 请登录后投票
论坛首页 AJAX版 AJAX

跳转论坛:
JavaEye推荐