More robust onError message (see also issue #50)
This commit is contained in:
parent
f90c9f9fc6
commit
d7552b23fa
|
@ -197,7 +197,7 @@ JSONEditor.prototype._onError = function(err) {
|
|||
this.onError(err);
|
||||
}
|
||||
|
||||
if (typeof this.options.error === 'function') {
|
||||
if (this.options && typeof this.options.error === 'function') {
|
||||
this.options.error(err);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -38,10 +38,10 @@ TextEditor.prototype._create = function (container, options, json) {
|
|||
|
||||
// read options
|
||||
options = options || {};
|
||||
this.options = options;
|
||||
if (options.indentation) {
|
||||
this.indentation = Number(options.indentation);
|
||||
}
|
||||
this.options = options || {};
|
||||
this.mode = (options.mode == 'code') ? 'code' : 'text';
|
||||
if (this.mode == 'code') {
|
||||
// verify whether Ace editor is available and supported
|
||||
|
@ -108,7 +108,6 @@ TextEditor.prototype._create = function (container, options, json) {
|
|||
catch (err) {
|
||||
me._onError(err);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.content = document.createElement('div');
|
||||
|
@ -209,7 +208,7 @@ TextEditor.prototype._onError = function(err) {
|
|||
this.onError(err);
|
||||
}
|
||||
|
||||
if (typeof this.options.error === 'function') {
|
||||
if (this.options && typeof this.options.error === 'function') {
|
||||
this.options.error(err);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue