From a140cd1f2576c807c1c247fce26395db9057a79f Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 20 Mar 2013 20:45:43 +0000 Subject: [PATCH] Make htmlarea more fault tolerant so it doesn't block the rest of the page if something happens --- etemplate/js/et2_widget_htmlarea.js | 36 ++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/etemplate/js/et2_widget_htmlarea.js b/etemplate/js/et2_widget_htmlarea.js index 2507486a1b..e2980b33cf 100644 --- a/etemplate/js/et2_widget_htmlarea.js +++ b/etemplate/js/et2_widget_htmlarea.js @@ -77,11 +77,26 @@ var et2_htmlarea = et2_inputWidget.extend({ doLoadingFinished: function() { this._super.apply(this, arguments); var self = this; - this.htmlNode.ckeditor(function() { - // If value is set, pass it in here. - this.setData(self.value); - delete self.value; - },this.ck_props); + try + { + this.htmlNode.ckeditor(function() { + // If value is set, pass it in here. + this.setData(self.value); + delete self.value; + },this.ck_props); + } + catch (e) + { + if(CKEDITOR.instances[this.id]) + { + CKEDITOR.instances[this.id].destroy(); + } + this.htmlNode.ckeditor(function() { + // If value is set, pass it in here. + this.setData(self.value); + delete self.value; + },this.ck_props); + } }, destroy: function() { @@ -97,7 +112,16 @@ var et2_htmlarea = et2_inputWidget.extend({ }, getValue: function() { - return this.htmlNode.ckeditorGet().getData(); + try + { + return this.htmlNode.ckeditorGet().getData(); + } + catch (e) + { + // CK Error + this.egw().debug("error",e); + return null; + } } });