Fixed #755: JSONEditor throwing an exception in mode `code`, `text`, and

`preview` when `statusBar: false`
This commit is contained in:
jos 2019-08-03 11:08:00 +02:00
parent f0097afcc0
commit 9892249e49
3 changed files with 10 additions and 2 deletions

View File

@ -2,6 +2,12 @@
https://github.com/josdejong/jsoneditor 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 ## 2019-08-01, version 6.2.1
- Updated Chinese translation. Thanks @SargerasWang. - Updated Chinese translation. Thanks @SargerasWang.

View File

@ -236,7 +236,8 @@ previewmode.create = function (container, options) {
onFocusLine: null, onFocusLine: null,
onChangeHeight: function (height) { onChangeHeight: function (height) {
// TODO: change CSS to using flex box, remove setting height using JavaScript // 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.marginBottom = (-totalHeight) + 'px';
me.content.style.paddingBottom = totalHeight + 'px'; me.content.style.paddingBottom = totalHeight + 'px';
} }

View File

@ -296,7 +296,8 @@ textmode.create = function (container, options) {
}, },
onChangeHeight: function (height) { onChangeHeight: function (height) {
// TODO: change CSS to using flex box, remove setting height using JavaScript // 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.marginBottom = (-totalHeight) + 'px';
me.content.style.paddingBottom = totalHeight + 'px'; me.content.style.paddingBottom = totalHeight + 'px';
} }