fix ckeditor area

This commit is contained in:
Klaus Leithoff 2013-04-09 11:50:14 +00:00
parent 78b2012334
commit 09f00a31a5

View File

@ -60,10 +60,8 @@ var et2_htmlarea = et2_inputWidget.extend({
legacyOptions: ['mode','height','width','expand_toolbar','base_href'], legacyOptions: ['mode','height','width','expand_toolbar','base_href'],
ck_props: {},
init: function(_parent, _attrs) { init: function(_parent, _attrs) {
this.ck_props = _attrs['config'] ? _attrs['config'] : {}; // _super.apply is responsible for the actual setting of the params (some magic)
this._super.apply(this, arguments); this._super.apply(this, arguments);
// Allow no child widgets // Allow no child widgets
@ -77,13 +75,13 @@ var et2_htmlarea = et2_inputWidget.extend({
doLoadingFinished: function() { doLoadingFinished: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
var self = this; var self = this;
var ckeditor;
try try
{ {
this.htmlNode.ckeditor(function() { CKEDITOR.replace(this.id,this.options.config);
// If value is set, pass it in here. ckeditor = CKEDITOR.instances[this.id];
this.setData(self.value); ckeditor.setData(self.value);
delete self.value; delete self.value;
},this.ck_props);
} }
catch (e) catch (e)
{ {
@ -93,11 +91,10 @@ var et2_htmlarea = et2_inputWidget.extend({
} }
if(this.htmlNode.ckeditor) if(this.htmlNode.ckeditor)
{ {
this.htmlNode.ckeditor(function() { CKEDITOR.replace(this.id,this.options.config);
// If value is set, pass it in here. ckeditor = CKEDITOR.instances[this.id];
this.setData(self.value); ckeditor.setData(self.value);
delete self.value; delete self.value;
},this.ck_props);
} }
} }
}, },
@ -105,7 +102,9 @@ var et2_htmlarea = et2_inputWidget.extend({
destroy: function() { destroy: function() {
try try
{ {
this.htmlNode.ckeditorGet().destroy(true); //this.htmlNode.ckeditorGet().destroy(true);
ckeditor = CKEDITOR.instances[this.id];
ckeditor.destroy(true);
} }
catch (e) catch (e)
{ {
@ -115,7 +114,9 @@ var et2_htmlarea = et2_inputWidget.extend({
}, },
set_value: function(_value) { set_value: function(_value) {
try { try {
this.htmlNode.ckeditorGet().setData(_value); //this.htmlNode.ckeditorGet().setData(_value);
ckeditor = CKEDITOR.instances[this.id];
ckeditor.setData(_value);
} catch (e) { } catch (e) {
// CK editor not ready - callback will do it // CK editor not ready - callback will do it
this.value = _value; this.value = _value;
@ -125,7 +126,9 @@ var et2_htmlarea = et2_inputWidget.extend({
getValue: function() { getValue: function() {
try try
{ {
return this.htmlNode.ckeditorGet().getData(); //return this.htmlNode.ckeditorGet().getData();
ckeditor = CKEDITOR.instances[this.id];
return ckeditor.getData();
} }
catch (e) catch (e)
{ {