xiaobudian8611
xiaobudian8611
2011-01-27 16:32

Ext镶嵌ckeditor的问题

已采纳

我再Ext页面中镶嵌了Ckeditor插件但是在Ckeditor下面在声明的其他组件就显示不了了..请各位大侠帮助俺一把
代码是这样的:
[code="java"]


<br> Ext.QuickTips.init();<br> Ext.onReady(function(){<br> new Ext.Viewport({<br> id:&#39;tviewport&#39;,<br> height:500,<br> width:300,<br> items:[<br> {<br> xtype:&#39;textfield&#39;,<br> value:&#39;xiaoqiang&#39;<br> },{<br> width:500,<br> height:400,<br> items:{<br> xtype: &#39;ckeditor&#39;,<br> fieldLabel: &#39;内 容&#39;,<br><br> labelStyle : &quot;text-align:right;width:50;&quot;, <br> id:&#39;neirong&#39;,<br> name: &#39;htmlcode&#39;,<br> CKConfig:{<br> toolbar :&#39;Full&#39;,<br> height : 180,<br> uiColor: &#39;#dede98&#39;,<br> autoWidth:true<br> }<br> }},{<br> xtype:&#39;textfield&#39;,<br> value:&#39;xiaoqiang&#39;<br> }</p> <pre><code> ] }); }); &lt;/script&gt; &lt;/body&gt;[/code] </code></pre> <p>.哦..我用的Ckeditor3.5</p>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • iteye_5075 iteye_5075 10年前

    [code="java"]

    Ext.form.CKEditor = function(config) {
    this.config = config;
    Ext.form.CKEditor.superclass.constructor.call(this, config);
    };

    Ext.extend(Ext.form.CKEditor, Ext.form.TextArea, {
    hideLabel : true,
    constructor : function(config) {
    config = config || {};
    config.listeners = config.listeners || {};
    Ext.applyIf(config.listeners, {
    beforedestroy : this.onBeforeDestroy
    .createDelegate(this),
    scope : this
    });
    Ext.form.CKEditor.superclass.constructor.call(this, config);
    },
    onBeforeDestroy : function() {
    this.ckEditor.destroy();
    },
    onRender : function(ct, position) {
    if (!this.el) {
    this.defaultAutoCreate = {
    tag : "textarea",
    autocomplete : "off"
    };
    }
    Ext.form.TextArea.superclass.onRender.call(this, ct, position);
    this.ckEditor = CKEDITOR.replace(this.id, Ext.apply({
    skin : 'office2003'
    }, this.config.CKConfig));
    },

            setValue : function(value) {
                if (Ext.isEmpty(value)) {
                    value = "";
                }
                Ext.form.TextArea.superclass.setValue.apply(this, [value]);
                CKEDITOR.instances[this.id].setData(value);
            },
    
            getValue : function() {
                CKEDITOR.instances[this.id].updateElement();
                this.value = CKEDITOR.instances[this.id].getData();
                return Ext.form.TextArea.superclass.getValue.apply(this);
            },
    
            getRawValue : function() {
                CKEDITOR.instances[this.id].updateElement();
                this.value = CKEDITOR.instances[this.id].getData();
                return Ext.form.TextArea.superclass.getRawValue.apply(this);
            }
        });
    

    Ext.reg('ckeditor', Ext.form.CKEditor);

    [/code]

    使用
    [code="java"]
    new Ext.form.CKEditor({
    xtype : 'ckeditor',
    name : 'content',
    width : '100%',
    height : 250
    });
    [/code]

    点赞 评论 复制链接分享

相关推荐