diff --git a/HISTORY.md b/HISTORY.md index 4502f7b..0db492e 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,6 +2,12 @@ https://github.com/josdejong/jsoneditor +## not yet publised, version 6.2.2 + +- Fixed #755: JSONEditor throwing an exception in mode `code`, `text`, and + `preview` when `statusBar: false`. + + ## 2019-08-01, version 6.2.1 - Updated Chinese translation. Thanks @SargerasWang. diff --git a/src/js/previewmode.js b/src/js/previewmode.js index b096dd8..7880709 100644 --- a/src/js/previewmode.js +++ b/src/js/previewmode.js @@ -236,7 +236,8 @@ previewmode.create = function (container, options) { onFocusLine: null, onChangeHeight: function (height) { // TODO: change CSS to using flex box, remove setting height using JavaScript - var totalHeight = height + me.dom.statusBar.clientHeight + 1; + var statusBarHeight = me.dom.statusBar ? me.dom.statusBar.clientHeight : 0; + var totalHeight = height + statusBarHeight + 1; me.content.style.marginBottom = (-totalHeight) + 'px'; me.content.style.paddingBottom = totalHeight + 'px'; } diff --git a/src/js/textmode.js b/src/js/textmode.js index 883181d..641dfeb 100644 --- a/src/js/textmode.js +++ b/src/js/textmode.js @@ -296,7 +296,8 @@ textmode.create = function (container, options) { }, onChangeHeight: function (height) { // TODO: change CSS to using flex box, remove setting height using JavaScript - var totalHeight = height + me.dom.statusBar.clientHeight + 1; + var statusBarHeight = me.dom.statusBar ? me.dom.statusBar.clientHeight : 0; + var totalHeight = height + statusBarHeight + 1; me.content.style.marginBottom = (-totalHeight) + 'px'; me.content.style.paddingBottom = totalHeight + 'px'; }