首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将CKEditor 4集成到EXT JS 4中

问将CKEditor 4集成到EXT JS 4中
EN

Stack Overflow用户
提问于 2017-02-07 18:15:06
回答 1查看 466关注 0票数 1

提前谢谢你。我正在尝试将CKEditor 4集成到我的extjs4.2项目中。有人能帮我集成一下吗?在搜索网页后,我找到了This example,但它不工作,因为"this.editor“是未定义的。我也试过使用"CKEDITOR.instancesthis.id“,但仍然没有帮助。这引发了另一个错误“无法读取未定义的属性'setData‘”。如果有人能帮我的话,我会很感激的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-02-09 13:12:25

祝你新年快乐。找到了解决方案。

代码语言:javascript
复制
Ext.define('Ext.ux.form.field.CKEditor', {
extend: 'Ext.form.field.TextArea',
alias: 'widget.ckeditor',

constructor: function () {
    this.callParent(arguments);
    this.addEvents("instanceReady");
    this.addEvents("blur");
},

initComponent: function () {
    this.callParent(arguments);
    this.on("afterrender", function () {
        Ext.apply(this.CKConfig, {
            height: this.getHeight(),
            width: this.getWidth()
        });

        this.editor = CKEDITOR.replace(this.inputEl.id, this.CKConfig);
        this.editor.name = this.name;

        this.editor.on("instanceReady", function () {
            this.fireEvent("instanceReady", this, this.editor );
        }, this);

        this.editor.on("blur", function (){
            this.fireEvent("blur", this, this.editor );
        }, this)

    }, this);
},

onRender: function (ct, position) {
    if (!this.el) {
        this.defaultAutoCreate = {
            tag: 'textarea',
            autocomplete: 'off'
        };
    }
    this.callParent(arguments)
},

setValue: function (value) {    
    this.callParent(arguments);
    if (this.editor) {
        this.editor.setData(value);
    }
},

getValue: function () {
    if (this.editor) {
        console.log(this.editor.getData());
        return this.editor.getData();
    } 
    else {
        return ''
    }
}

});

这将ckeditor与EXT jS集成在一起。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42087140

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档