2017-02-07 7 views
1

ありがとうございます。 CKEditor 4をextjs 4.2プロジェクトと統合しようとしています。 誰かが統合をお願いしますか? ウェブを検索した後にThis exampleが見つかりましたが、 "this.editor"が定義されていないため動作していませんでした。 また、 "CKEDITOR.instances [this.id]"を使用しようとしましたが、まだ助けがありません。これにより、「未定義のプロパティ 'setData'を読み取ることができません」という別のエラーが発生しました。 誰かが私を助けてくれるのであれば、それは本当に感謝しています。EXT JS 4にCKEditor 4を統合

+0

既に試したコードを入力してください。http://stackoverflow.com/help/how-to-askよく質問する方法をご覧ください。 –

答えて

1

Happy new。解決策を見つけました。

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を統合します。

関連する問題