refresh annotations with error type only (#587)
* Fix #582: parse error annotations not always up to date in code editor * refresh annotations with error type only
This commit is contained in:
parent
68aba366ad
commit
4d7bb3c6e3
|
@ -2,6 +2,11 @@
|
||||||
|
|
||||||
https://github.com/josdejong/jsoneditor
|
https://github.com/josdejong/jsoneditor
|
||||||
|
|
||||||
|
## not yet released, version 5.24.7
|
||||||
|
|
||||||
|
- Fix #582: parse error annotations not always up to date in
|
||||||
|
code editor.
|
||||||
|
|
||||||
|
|
||||||
## 2018-09-12, version 5.24.6
|
## 2018-09-12, version 5.24.6
|
||||||
|
|
||||||
|
|
|
@ -530,8 +530,19 @@ textmode._emitSelectionChange = function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
textmode._refreshAnnotations = function () {
|
/**
|
||||||
this.aceEditor && this.aceEditor.getSession().setAnnotations();
|
* refresh ERROR annotations state
|
||||||
|
* error annotations are handled by the ace json mode (ace/mode/json)
|
||||||
|
* validation annotations are handled by this mode
|
||||||
|
* therefore in order to refresh we send only the annotations of error type in order to maintain its state
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
textmode._refreshAnnotations = function () {
|
||||||
|
var session = this.aceEditor && this.aceEditor.getSession();
|
||||||
|
if (session) {
|
||||||
|
var errEnnotations = session.getAnnotations().filter(function(annotation) {return annotation.type === 'error' });
|
||||||
|
session.setAnnotations(errEnnotations);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue