diff --git a/HISTORY.md b/HISTORY.md index bd09136..bee446e 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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 diff --git a/src/js/textmode.js b/src/js/textmode.js index 7be0728..f505dca 100644 --- a/src/js/textmode.js +++ b/src/js/textmode.js @@ -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