Skip to content
Merged
4 changes: 4 additions & 0 deletions examples/css/darktheme.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ tr.jsoneditor-selected {
}

div.jsoneditor-field[contenteditable=true]:focus,
div.jsoneditor-field[contenteditable=plaintext-only]:focus,
div.jsoneditor-field[contenteditable=true]:hover,
div.jsoneditor-field[contenteditable=plaintext-only]:hover,
div.jsoneditor-value[contenteditable=true]:focus,
div.jsoneditor-value[contenteditable=plaintext-only]:focus,
div.jsoneditor-value[contenteditable=true]:hover,
div.jsoneditor-value[contenteditable=plaintext-only]:hover,
div.jsoneditor-field.jsoneditor-highlight,
div.jsoneditor-value.jsoneditor-highlight {
background-color: #808080;
Expand Down
4 changes: 2 additions & 2 deletions src/js/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2235,7 +2235,7 @@ export class Node {
if (domField) {
if (this.fieldEditable) {
// parent is an object
domField.contentEditable = this.editable.field
domField.contentEditable = this.editable.field ? 'plaintext-only' : false
domField.spellcheck = false
domField.className = 'jsoneditor-field'
} else {
Expand Down Expand Up @@ -2428,7 +2428,7 @@ export class Node {
} else {
// create an editable or read-only div
domValue = document.createElement('div')
domValue.contentEditable = this.editable.value
domValue.contentEditable = this.editable.value ? 'plaintext-only' : false
domValue.spellcheck = false
domValue.innerHTML = this._escapeHTML(this.value)
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/treemode.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ treemode.getName = function () {
* - to the first button in the top menu
*/
treemode.focus = function () {
let input = this.scrollableContent.querySelector('[contenteditable=true]')
let input = this.scrollableContent.querySelector('[contenteditable=true]') || this.scrollableContent.querySelector('[contenteditable=plaintext-only]')
if (input) {
input.focus()
} else if (this.node.dom.expand) {
Expand Down
7 changes: 5 additions & 2 deletions src/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ export function getType (object) {
return 'undefined'
}
if ((object instanceof Number) || (typeof object === 'number')) {
return 'number'
if (object <= Number.MAX_SAFE_INTEGER) {
return 'number'
}
return 'string'
}
if ((object instanceof String) || (typeof object === 'string')) {
return 'string'
Expand Down Expand Up @@ -1144,7 +1147,7 @@ export function parseString (str) {

const num = Number(str) // will nicely fail with '123ab'
const numFloat = parseFloat(str) // will nicely fail with ' '
if (!isNaN(num) && !isNaN(numFloat)) {
if (!isNaN(num) && !isNaN(numFloat) && num <= Number.MAX_SAFE_INTEGER && numFloat <= Number.MAX_SAFE_INTEGER) {
return num
}

Expand Down
4 changes: 4 additions & 0 deletions src/scss/jsoneditor/_editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,13 @@ a.jsoneditor-value.jsoneditor-url:focus {
color: variables.$jse-number;
}
div.jsoneditor-field[contenteditable="true"]:focus,
div.jsoneditor-field[contenteditable="plaintext-only"]:focus,
div.jsoneditor-field[contenteditable="true"]:hover,
div.jsoneditor-field[contenteditable="plaintext-only"]:hover,
div.jsoneditor-value[contenteditable="true"]:focus,
div.jsoneditor-value[contenteditable="plaintext-only"]:focus,
div.jsoneditor-value[contenteditable="true"]:hover,
div.jsoneditor-value[contenteditable="plaintext-only"]:hover,
div.jsoneditor-field.jsoneditor-highlight,
div.jsoneditor-value.jsoneditor-highlight {
background-color: variables.$jse-busy;
Expand Down