Fixed `editor.get()` manipulating the code when containing an error (see #191)

This commit is contained in:
jos 2015-05-14 21:18:14 +02:00
parent a7f41b8ef5
commit 8416944f5c
2 changed files with 3 additions and 2 deletions

View File

@ -10,7 +10,7 @@ https://github.com/josdejong/jsoneditor
- Implemented option `ace`, which allows to pass a custom instance of the Ace
instead of the embedded version.
- Fixed #186: binding issue to `jsonlint.parse`.
- Fixed `editor.get()` manipulating the code when containing an error.
## 2015-03-15, version 4.1.1

View File

@ -53,6 +53,8 @@ textmode.create = function (container, options) {
'Falling back to plain text editor');
}
}
// determine theme
this.theme = options.theme || 'ace/theme/jsoneditor';
var me = this;
@ -300,7 +302,6 @@ textmode.get = function() {
catch (err) {
// try to sanitize json, replace JavaScript notation with JSON notation
text = util.sanitize(text);
this.setText(text);
// try to parse again
json = util.parse(text); // this can throw an error