Fixed `editor.get()` manipulating the code when containing an error (see #191)
This commit is contained in:
parent
a7f41b8ef5
commit
8416944f5c
|
@ -10,7 +10,7 @@ https://github.com/josdejong/jsoneditor
|
||||||
- Implemented option `ace`, which allows to pass a custom instance of the Ace
|
- Implemented option `ace`, which allows to pass a custom instance of the Ace
|
||||||
instead of the embedded version.
|
instead of the embedded version.
|
||||||
- Fixed #186: binding issue to `jsonlint.parse`.
|
- Fixed #186: binding issue to `jsonlint.parse`.
|
||||||
|
- Fixed `editor.get()` manipulating the code when containing an error.
|
||||||
|
|
||||||
## 2015-03-15, version 4.1.1
|
## 2015-03-15, version 4.1.1
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,8 @@ textmode.create = function (container, options) {
|
||||||
'Falling back to plain text editor');
|
'Falling back to plain text editor');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// determine theme
|
||||||
this.theme = options.theme || 'ace/theme/jsoneditor';
|
this.theme = options.theme || 'ace/theme/jsoneditor';
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
|
@ -300,7 +302,6 @@ textmode.get = function() {
|
||||||
catch (err) {
|
catch (err) {
|
||||||
// try to sanitize json, replace JavaScript notation with JSON notation
|
// try to sanitize json, replace JavaScript notation with JSON notation
|
||||||
text = util.sanitize(text);
|
text = util.sanitize(text);
|
||||||
this.setText(text);
|
|
||||||
|
|
||||||
// try to parse again
|
// try to parse again
|
||||||
json = util.parse(text); // this can throw an error
|
json = util.parse(text); // this can throw an error
|
||||||
|
|
Loading…
Reference in New Issue