Make htmlarea more fault tolerant so it doesn't block the rest of the page if something happens

This commit is contained in:
Nathan Gray 2013-03-20 20:45:43 +00:00
parent de49fbda1c
commit a140cd1f25

View File

@ -77,11 +77,26 @@ 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;
try
{
this.htmlNode.ckeditor(function() { this.htmlNode.ckeditor(function() {
// If value is set, pass it in here. // If value is set, pass it in here.
this.setData(self.value); this.setData(self.value);
delete self.value; delete self.value;
},this.ck_props); },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() { destroy: function() {
@ -97,8 +112,17 @@ var et2_htmlarea = et2_inputWidget.extend({
}, },
getValue: function() { getValue: function() {
try
{
return this.htmlNode.ckeditorGet().getData(); return this.htmlNode.ckeditorGet().getData();
} }
catch (e)
{
// CK Error
this.egw().debug("error",e);
return null;
}
}
}); });
et2_register_widget(et2_htmlarea, ["htmlarea"]); et2_register_widget(et2_htmlarea, ["htmlarea"]);