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
|
## not yet released, version 5.24.8
|
||||||
|
|
||||||
- Fixed #589: when deleting or moving a node, the navigation bar
|
- Fixed #590: validation failing in code and text mode when status
|
||||||
is not updated with the correct path.
|
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
|
## 2018-10-08, version 5.24.7
|
||||||
|
|
|
@ -725,19 +725,25 @@ textmode.validate = function () {
|
||||||
var json;
|
var json;
|
||||||
try {
|
try {
|
||||||
json = this.get(); // this can fail when there is no valid json
|
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;
|
doValidate = true;
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
if (this.getText()) {
|
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
|
// try to extract the line number from the jsonlint error message
|
||||||
var match = /\w*line\s*(\d+)\w*/g.exec(err.message);
|
var match = /\w*line\s*(\d+)\w*/g.exec(err.message);
|
||||||
var line;
|
var line;
|
||||||
if (match) {
|
if (match) {
|
||||||
line = +match[1];
|
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({
|
parseErrors.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: err.message.replace(/\n/g, '<br>'),
|
message: err.message.replace(/\n/g, '<br>'),
|
||||||
|
|
Loading…
Reference in New Issue