From 8416944f5c02e6e6204525b32a424cb3e50c3e6f Mon Sep 17 00:00:00 2001 From: jos Date: Thu, 14 May 2015 21:18:14 +0200 Subject: [PATCH] Fixed `editor.get()` manipulating the code when containing an error (see #191) --- HISTORY.md | 2 +- src/js/textmode.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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