Fixed #590: validation failing in code and text mode when status bar is disabled
This commit is contained in:
parent
37e609d4d8
commit
7d2d669191
|
@ -5,8 +5,10 @@ https://github.com/josdejong/jsoneditor
|
|||
|
||||
## not yet released, version 5.24.8
|
||||
|
||||
- Fixed #589: when deleting or moving a node, the navigation bar
|
||||
is not updated with the correct path.
|
||||
- Fixed #590: validation failing in code and text mode when status
|
||||
bar is disabled.
|
||||
- Fixed #589: the path in the navigation bar is not updated
|
||||
when deleting a node.
|
||||
|
||||
|
||||
## 2018-10-08, version 5.24.7
|
||||
|
|
|
@ -725,19 +725,25 @@ textmode.validate = function () {
|
|||
var json;
|
||||
try {
|
||||
json = this.get(); // this can fail when there is no valid json
|
||||
this.parseErrorIndication.style.display = 'none';
|
||||
if (this.parseErrorIndication) {
|
||||
this.parseErrorIndication.style.display = 'none';
|
||||
}
|
||||
doValidate = true;
|
||||
}
|
||||
catch (err) {
|
||||
if (this.getText()) {
|
||||
this.parseErrorIndication.style.display = 'block';
|
||||
if (this.parseErrorIndication) {
|
||||
this.parseErrorIndication.style.display = 'block';
|
||||
}
|
||||
// try to extract the line number from the jsonlint error message
|
||||
var match = /\w*line\s*(\d+)\w*/g.exec(err.message);
|
||||
var line;
|
||||
if (match) {
|
||||
line = +match[1];
|
||||
}
|
||||
this.parseErrorIndication.title = !isNaN(line) ? ('parse error on line ' + line) : 'parse error - check that the json is valid';
|
||||
if (this.parseErrorIndication) {
|
||||
this.parseErrorIndication.title = !isNaN(line) ? ('parse error on line ' + line) : 'parse error - check that the json is valid';
|
||||
}
|
||||
parseErrors.push({
|
||||
type: 'error',
|
||||
message: err.message.replace(/\n/g, '<br>'),
|
||||
|
|
Loading…
Reference in New Issue