From 09f00a31a5ae04a8bbf0d43c85e338ff97fdaefc Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Tue, 9 Apr 2013 11:50:14 +0000 Subject: [PATCH] fix ckeditor area --- etemplate/js/et2_widget_htmlarea.js | 35 ++++++++++++++++------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/etemplate/js/et2_widget_htmlarea.js b/etemplate/js/et2_widget_htmlarea.js index c30b511e70..a397a11cbd 100644 --- a/etemplate/js/et2_widget_htmlarea.js +++ b/etemplate/js/et2_widget_htmlarea.js @@ -60,10 +60,8 @@ var et2_htmlarea = et2_inputWidget.extend({ legacyOptions: ['mode','height','width','expand_toolbar','base_href'], - ck_props: {}, 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); // Allow no child widgets @@ -77,13 +75,13 @@ var et2_htmlarea = et2_inputWidget.extend({ doLoadingFinished: function() { this._super.apply(this, arguments); var self = this; + var ckeditor; try { - this.htmlNode.ckeditor(function() { - // If value is set, pass it in here. - this.setData(self.value); - delete self.value; - },this.ck_props); + CKEDITOR.replace(this.id,this.options.config); + ckeditor = CKEDITOR.instances[this.id]; + ckeditor.setData(self.value); + delete self.value; } catch (e) { @@ -93,11 +91,10 @@ var et2_htmlarea = et2_inputWidget.extend({ } if(this.htmlNode.ckeditor) { - this.htmlNode.ckeditor(function() { - // If value is set, pass it in here. - this.setData(self.value); - delete self.value; - },this.ck_props); + CKEDITOR.replace(this.id,this.options.config); + ckeditor = CKEDITOR.instances[this.id]; + ckeditor.setData(self.value); + delete self.value; } } }, @@ -105,7 +102,9 @@ var et2_htmlarea = et2_inputWidget.extend({ destroy: function() { try { - this.htmlNode.ckeditorGet().destroy(true); + //this.htmlNode.ckeditorGet().destroy(true); + ckeditor = CKEDITOR.instances[this.id]; + ckeditor.destroy(true); } catch (e) { @@ -115,7 +114,9 @@ var et2_htmlarea = et2_inputWidget.extend({ }, set_value: function(_value) { try { - this.htmlNode.ckeditorGet().setData(_value); + //this.htmlNode.ckeditorGet().setData(_value); + ckeditor = CKEDITOR.instances[this.id]; + ckeditor.setData(_value); } catch (e) { // CK editor not ready - callback will do it this.value = _value; @@ -125,7 +126,9 @@ var et2_htmlarea = et2_inputWidget.extend({ getValue: function() { try { - return this.htmlNode.ckeditorGet().getData(); + //return this.htmlNode.ckeditorGet().getData(); + ckeditor = CKEDITOR.instances[this.id]; + return ckeditor.getData(); } catch (e) {