From 43e0c129ec83bb92ade2ce7949aed69bfa1cd78c Mon Sep 17 00:00:00 2001 From: jos Date: Sat, 26 Oct 2019 10:51:40 +0200 Subject: [PATCH] Fixed #826: editor not allowing indentation `0` --- HISTORY.md | 1 + src/js/previewmode.js | 2 +- src/js/textmode.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index f3c7b90..6b32f69 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -7,6 +7,7 @@ https://github.com/josdejong/jsoneditor - Fixed #828: do not expand/collapse when clicking the text of a node in modes `view` or `form`. +- Fixed #826: editor not allowing indentation `0`. ## 2019-10-23, version 7.2.0 diff --git a/src/js/previewmode.js b/src/js/previewmode.js index 01b1a24..42330c0 100644 --- a/src/js/previewmode.js +++ b/src/js/previewmode.js @@ -47,7 +47,7 @@ previewmode.create = function (container, options = {}) { this.options = options // indentation - if (options.indentation) { + if (typeof options.indentation === 'number') { this.indentation = Number(options.indentation) } else { this.indentation = 2 // number of spaces diff --git a/src/js/textmode.js b/src/js/textmode.js index 55723ec..cda9ef5 100644 --- a/src/js/textmode.js +++ b/src/js/textmode.js @@ -49,7 +49,7 @@ textmode.create = function (container, options = {}) { this.options = options // indentation - if (options.indentation) { + if (typeof options.indentation === 'number') { this.indentation = Number(options.indentation) } else { this.indentation = 2 // number of spaces