提前谢谢你。我正在尝试将CKEditor 4集成到我的extjs4.2项目中。有人能帮我集成一下吗?在搜索网页后,我找到了This example,但它不工作,因为"this.editor“是未定义的。我也试过使用"CKEDITOR.instancesthis.id“,但仍然没有帮助。这引发了另一个错误“无法读取未定义的属性'setData‘”。如果有人能帮我的话,我会很感激的。
发布于 2017-02-09 13:12:25
祝你新年快乐。找到了解决方案。
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集成在一起。
https://stackoverflow.com/questions/42087140
复制相似问题