Fixed JSONEditor picking the first entry of `modes` as initial mode instead of option `mode`

This commit is contained in:
jos 2017-07-10 19:58:34 +02:00
parent 15ed4da608
commit 7ac3f5aee6
2 changed files with 9 additions and 1 deletions

View File

@ -3,6 +3,14 @@
https://github.com/josdejong/jsoneditor https://github.com/josdejong/jsoneditor
## 2017-07-10, version 5.8.3
- Fixed #429: JSONEditor no longer accepting an empty array for option
`modes`. Thanks @trystan2k.
- Fixed JSONEditor picking the first entry of `modes` as initial mode
instead of option `mode`.
## 2017-07-08, version 5.8.2 ## 2017-07-08, version 5.8.2
- Select first option from `modes` instead of `tree` when `mode` is not - Select first option from `modes` instead of `tree` when `mode` is not

View File

@ -130,7 +130,7 @@ JSONEditor.prototype._create = function (container, options, json) {
this.options = options || {}; this.options = options || {};
this.json = json || {}; this.json = json || {};
var mode = this.options.modes && this.options.modes.length > 0 ? this.options.modes[0] : this.options.mode || 'tree'; var mode = this.options.mode || (this.options.modes && this.options.modes[0]) || 'tree';
this.setMode(mode); this.setMode(mode);
}; };