Fixed #824: Parse errors not displayed with bottom right error icon in modes `code` and `text`

This commit is contained in:
jos 2019-10-23 14:19:43 +02:00
parent 73214b6985
commit 626d3959c9
3 changed files with 4 additions and 1 deletions

View File

@ -8,6 +8,8 @@ https://github.com/josdejong/jsoneditor
- Implemented Japanese translation (`ja`). Thanks @yutakiyama. - Implemented Japanese translation (`ja`). Thanks @yutakiyama.
- Implemented French translation (`fr-FR`), and some improvements in the - Implemented French translation (`fr-FR`), and some improvements in the
translation. Thanks @yannickyvin. translation. Thanks @yannickyvin.
- Fixed #824: Parse errors not displayed with bottom right error icon in modes
`code` and `text`.
## 2019-10-13, version 7.1.0 ## 2019-10-13, version 7.1.0

View File

@ -161,6 +161,7 @@ export class ErrorTable {
this.dom.parseErrorIndication.title = !isNaN(line) this.dom.parseErrorIndication.title = !isNaN(line)
? ('parse error on line ' + line) ? ('parse error on line ' + line)
: 'parse error - check that the json is valid' : 'parse error - check that the json is valid'
this.dom.parseErrorIndication.onclick = this.toggleTableVisibility.bind(this)
} else { } else {
this.dom.parseErrorIndication.style.display = 'none' this.dom.parseErrorIndication.style.display = 'none'
} }

View File

@ -806,7 +806,7 @@ textmode._renderErrors = function (errors) {
const jsonText = this.getText() const jsonText = this.getText()
const errorPaths = [] const errorPaths = []
errors.reduce((acc, curr) => { errors.reduce((acc, curr) => {
if (acc.indexOf(curr.dataPath) === -1) { if (typeof curr.dataPath === 'string' && acc.indexOf(curr.dataPath) === -1) {
acc.push(curr.dataPath) acc.push(curr.dataPath)
} }
return acc return acc