Hybrid View
-
6 May 2011 3:17 AM #1
CKEDITOR with EXTJS 4
CKEDITOR with EXTJS 4
Hello
I´m trying to adapt CKEDITOR in EXTJS 4 but I have the next error CKEDITOR.instances[this.id] is undefined in the line:
CKEDITOR.instances[this.id].setData(value);
In EXTJS 3 it works perfectly!
This is the code:
editorCK = Ext.create('widget.ckeditor',{
id:'editorCK',
CKConfig: {
customConfig : 'ckeditor/config.js',
toolbar: 'Basic',
height : 200,
width: 500
}
});
Ext.define('Ext.ux.CKeditor',{
extend: 'Ext.form.field.TextArea',
alias: 'widget.ckeditor',
initComponent: function(){
this.callParent(arguments);//Ext.ux.CKeditor.superclass.initComponent.apply(this, arguments);
},
onRender : function(ct, position){
if(!this.el){
this.defaultAutoCreate = {
tag: 'textarea',
autocomplete: 'off'
};
}
Ext.form.field.TextArea.superclass.onRender.call(this, ct, position);
CKEDITOR.replace(this.id, this.CKConfig);
},
setValue : function(value){
Ext.form.field.TextArea.superclass.setValue.apply(this,[value]);
CKEDITOR.instances[this.id].setData(value);
CKEDITOR.instances[this.id] is undefined
},
getValue : function(){
CKEDITOR.instances[this.id].updateElement();
var value=CKEDITOR.instances[this.id].getData();
Ext.form.field.TextArea.superclass.setValue.apply(this,[value]);
return Ext.form.field.TextArea.superclass.getValue.apply(this);
},
getRawValue : function(){
CKEDITOR.instances[this.id].updateElement();
return Ext.form.field.TextArea.superclass.getRawValue(this);
}
});
Can anyone help me, please?
Thanks!
-
10 May 2011 1:34 PM #2
It doesnt look like you've instantiated CKEDITOR anywhere. Shouldnt you be
creating CKEDITOR in the initComponent method, ie
this.CKEDITOR = new .....
and then referring to it in the methods as
this.CKEDITOR
also you probably want to be using callParent(arguments) rather than superclass
in the method overrides.
Ian.
-
11 May 2011 1:26 PM #3
I think this code
makes a instance of ckeditor.Code:CKEDITOR.replace(this.id, this.CKConfig);
-
26 May 2011 7:21 AM #4
Did you get this working? I need to explore alternatives to the htmlEditor.
-
26 May 2011 8:59 AM #5
Why explore alternatives?? Why not extend it you can add buttons and custom functionality.
-
26 May 2011 9:30 AM #6
I looked into extending the htmlEditor but I couldn't make sense of it. Specifically I wanted to be able to select h1, h2, h3 tags. As I want to enable text editing but still maintain control over the style.
the other problem I have is pasting. I want to be able to paste as plain text. not only can I not paste as plain text in the htmlEditor if the text is plain text to begin with it's automatically wrapped in font and style tags.
Similar Threads
-
CKEditor Extension
By iosoftgame in forum Ext 3.x: User Extensions and PluginsReplies: 39Last Post: 5 Sep 2012, 9:16 AM -
ExtJs 3.x and CKEditor 3.5 causing problems
By johnmmr in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 26 Apr 2011, 12:03 PM -
CKEditor-GWT FitLayout
By elirov in forum Community DiscussionReplies: 4Last Post: 16 Feb 2011, 3:57 AM -
CkEditor and (Sencha) Extjs
By russall1985 in forum Community DiscussionReplies: 0Last Post: 10 Feb 2011, 7:15 AM -
Initialize panel as disabled with embedded ckeditor
By ChrisR in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 10 Jan 2011, 1:44 PM


Reply With Quote


