Add an 'onMode' callback option which is invoked after setMode finishes.

This commit is contained in:
Jason Marshall 2015-09-17 15:05:11 -07:00
parent c6642a7444
commit a41ff76c56
2 changed files with 9 additions and 0 deletions

View File

@ -169,6 +169,13 @@ JSONEditor.prototype.setMode = function (mode) {
}
catch (err) {}
}
if (typeof options.onMode === 'function') {
try {
options.onMode(options.mode);
}
catch (err) {}
}
}
catch (err) {
this._onError(err);

View File

@ -23,6 +23,8 @@ var textmode = {};
* spaces. 2 by default.
* {function} change Callback method
* triggered on change
* {function} onMode Callback method
* triggered after setMode
* {Object} ace A custom instance of
* Ace editor.
* @private