Merge branch 'develop' into feature/custom_query_language
# Conflicts: # src/js/JSONEditor.js
This commit is contained in:
commit
6ece0f9acb
14
HISTORY.md
14
HISTORY.md
|
@ -3,6 +3,20 @@
|
|||
https://github.com/josdejong/jsoneditor
|
||||
|
||||
|
||||
## 2019-12-28, version 8.1.1
|
||||
|
||||
- Fixed the file size reported in `preview` mode show `KB` and `MB` instead
|
||||
of `KiB` and `MiB` in order to match the size reported by filesystems.
|
||||
|
||||
|
||||
## 2019-12-18, version 8.1.0
|
||||
|
||||
- Implemented `popupAnchor` allowing to select a custom anchor element.
|
||||
See #869 and #870.
|
||||
- Fixed #502: CSS rule `* { font-family: ... }` resulting in Ace editor (`code`
|
||||
mode) not having a mono-space font anymore.
|
||||
|
||||
|
||||
## 2019-12-11, version 8.0.0
|
||||
|
||||
- Implemented option `timestampFormat` which allows customizing the formatting
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[![Version](https://img.shields.io/npm/v/jsoneditor.svg)](https://www.npmjs.com/package/jsoneditor)
|
||||
[![Downloads](https://img.shields.io/npm/dm/jsoneditor.svg)](https://www.npmjs.com/package/jsoneditor)
|
||||
![Maintenance](https://img.shields.io/maintenance/yes/2019.svg)
|
||||
![Maintenance](https://img.shields.io/maintenance/yes/2020.svg)
|
||||
[![License](https://img.shields.io/github/license/josdejong/jsoneditor.svg)](https://github.com/josdejong/jsoneditor/blob/master/LICENSE)
|
||||
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fjosdejong%2Fjsoneditor.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fjosdejong%2Fjsoneditor?ref=badge_shield) [![Greenkeeper badge](https://badges.greenkeeper.io/josdejong/jsoneditor.svg)](https://greenkeeper.io/)
|
||||
|
||||
|
|
11
docs/api.md
11
docs/api.md
|
@ -567,6 +567,17 @@ Constructs a new JSONEditor.
|
|||
The container element where modals (like for sorting and filtering) are attached: an overlay will be created on top
|
||||
of this container, and the modal will be created in the center of this container.
|
||||
|
||||
- `{HTMLElement} popupAnchor`
|
||||
|
||||
The container element where popups (for example drop down menus, for JSON Schema error
|
||||
tooltips, and color pickers) will be absolutely positioned.
|
||||
By default, this is the root DIV element of the editor itself.
|
||||
|
||||
When the JSONEditor is inside a DIV element which hides overflowing contents
|
||||
(CSS `overflow: auto` or `overflow: hidden`), tooltips will be visible only partly.
|
||||
In this case, a `popupAnchor` outside of the element without hidden overflow will allow
|
||||
the tooltips to be visible when overflowing the DIV element of the JSONEditor.
|
||||
|
||||
- `{boolean} enableSort`
|
||||
|
||||
Enable sorting of arrays and object properties. Only applicable for mode 'tree'. `true` by default.
|
||||
|
|
|
@ -7965,9 +7965,9 @@
|
|||
}
|
||||
},
|
||||
"jsoneditor": {
|
||||
"version": "7.4.0",
|
||||
"resolved": "https://registry.npmjs.org/jsoneditor/-/jsoneditor-7.4.0.tgz",
|
||||
"integrity": "sha512-Be0BkVhNoyHVOckyAkKc5MyoIIxSOzHneAGgS/VdKukK+CRRDO8WccYtO67cjeoahndtMHft4rjBl9p3r5tu0g==",
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsoneditor/-/jsoneditor-8.0.0.tgz",
|
||||
"integrity": "sha512-uMR/LNBkdaMiX7kKNdqysoQoa7LDzclmguvFUAj89JHqBT84I+BhXHT4qF95BufRFwDP8nFFsjOmATEAtNe+pA==",
|
||||
"requires": {
|
||||
"ace-builds": "^1.4.7",
|
||||
"ajv": "^6.10.2",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"jsoneditor": "^7.4.0",
|
||||
"jsoneditor": "^8.0.0",
|
||||
"lodash": "4.17.15",
|
||||
"react": "16.12.0",
|
||||
"react-dom": "16.12.0",
|
||||
|
|
|
@ -7965,9 +7965,9 @@
|
|||
}
|
||||
},
|
||||
"jsoneditor": {
|
||||
"version": "7.4.0",
|
||||
"resolved": "https://registry.npmjs.org/jsoneditor/-/jsoneditor-7.4.0.tgz",
|
||||
"integrity": "sha512-Be0BkVhNoyHVOckyAkKc5MyoIIxSOzHneAGgS/VdKukK+CRRDO8WccYtO67cjeoahndtMHft4rjBl9p3r5tu0g==",
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsoneditor/-/jsoneditor-8.0.0.tgz",
|
||||
"integrity": "sha512-uMR/LNBkdaMiX7kKNdqysoQoa7LDzclmguvFUAj89JHqBT84I+BhXHT4qF95BufRFwDP8nFFsjOmATEAtNe+pA==",
|
||||
"requires": {
|
||||
"ace-builds": "^1.4.7",
|
||||
"ajv": "^6.10.2",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"jsoneditor": "^7.4.0",
|
||||
"jsoneditor": "^8.0.0",
|
||||
"react": "16.12.0",
|
||||
"react-dom": "16.12.0",
|
||||
"react-scripts": "3.3.0"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "jsoneditor",
|
||||
"version": "8.0.0",
|
||||
"version": "8.1.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -14,15 +14,15 @@
|
|||
}
|
||||
},
|
||||
"@babel/core": {
|
||||
"version": "7.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.7.5.tgz",
|
||||
"integrity": "sha512-M42+ScN4+1S9iB6f+TL7QBpoQETxbclx+KNoKJABghnKYE+fMzSGqst0BZJc8CpI625bwPwYgUyRvxZ+0mZzpw==",
|
||||
"version": "7.7.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.7.7.tgz",
|
||||
"integrity": "sha512-jlSjuj/7z138NLZALxVgrx13AOtqip42ATZP7+kYl53GvDV6+4dCek1mVUo8z8c8Xnw/mx2q3d9HWh3griuesQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.5.5",
|
||||
"@babel/generator": "^7.7.4",
|
||||
"@babel/generator": "^7.7.7",
|
||||
"@babel/helpers": "^7.7.4",
|
||||
"@babel/parser": "^7.7.5",
|
||||
"@babel/parser": "^7.7.7",
|
||||
"@babel/template": "^7.7.4",
|
||||
"@babel/traverse": "^7.7.4",
|
||||
"@babel/types": "^7.7.4",
|
||||
|
@ -47,9 +47,9 @@
|
|||
}
|
||||
},
|
||||
"@babel/generator": {
|
||||
"version": "7.7.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.4.tgz",
|
||||
"integrity": "sha512-m5qo2WgdOJeyYngKImbkyQrnUN1mPceaG5BV+G0E3gWsa4l/jCSryWJdM2x8OuGAOyh+3d5pVYfZWCiNFtynxg==",
|
||||
"version": "7.7.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.7.tgz",
|
||||
"integrity": "sha512-/AOIBpHh/JU1l0ZFS4kiRCBnLi6OTHzh0RPk3h9isBxkkqELtQNFi1Vr/tiG9p1yfoUdKVwISuXWQR+hwwM4VQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/types": "^7.7.4",
|
||||
|
@ -283,9 +283,9 @@
|
|||
}
|
||||
},
|
||||
"@babel/parser": {
|
||||
"version": "7.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.5.tgz",
|
||||
"integrity": "sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig==",
|
||||
"version": "7.7.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.7.tgz",
|
||||
"integrity": "sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==",
|
||||
"dev": true
|
||||
},
|
||||
"@babel/plugin-proposal-async-generator-functions": {
|
||||
|
@ -320,9 +320,9 @@
|
|||
}
|
||||
},
|
||||
"@babel/plugin-proposal-object-rest-spread": {
|
||||
"version": "7.7.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.4.tgz",
|
||||
"integrity": "sha512-rnpnZR3/iWKmiQyJ3LKJpSwLDcX/nSXhdLk4Aq/tXOApIvyu7qoabrige0ylsAJffaUC51WiBu209Q0U+86OWQ==",
|
||||
"version": "7.7.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.7.tgz",
|
||||
"integrity": "sha512-3qp9I8lelgzNedI3hrhkvhaEYree6+WHnyA/q4Dza9z7iEIs1eyhWyJnetk3jJ69RT0AT4G0UhEGwyGFJ7GUuQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-plugin-utils": "^7.0.0",
|
||||
|
@ -340,9 +340,9 @@
|
|||
}
|
||||
},
|
||||
"@babel/plugin-proposal-unicode-property-regex": {
|
||||
"version": "7.7.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.4.tgz",
|
||||
"integrity": "sha512-cHgqHgYvffluZk85dJ02vloErm3Y6xtH+2noOBOJ2kXOJH3aVCDnj5eR/lVNlTnYu4hndAPJD3rTFjW3qee0PA==",
|
||||
"version": "7.7.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.7.tgz",
|
||||
"integrity": "sha512-80PbkKyORBUVm1fbTLrHpYdJxMThzM1UqFGh0ALEhO9TYbG86Ah9zQYAB/84axz2vcxefDLdZwWwZNlYARlu9w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-create-regexp-features-plugin": "^7.7.4",
|
||||
|
@ -477,9 +477,9 @@
|
|||
}
|
||||
},
|
||||
"@babel/plugin-transform-dotall-regex": {
|
||||
"version": "7.7.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.4.tgz",
|
||||
"integrity": "sha512-mk0cH1zyMa/XHeb6LOTXTbG7uIJ8Rrjlzu91pUx/KS3JpcgaTDwMS8kM+ar8SLOvlL2Lofi4CGBAjCo3a2x+lw==",
|
||||
"version": "7.7.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.7.tgz",
|
||||
"integrity": "sha512-b4in+YlTeE/QmTgrllnb3bHA0HntYvjz8O3Mcbx75UBPJA2xhb5A8nle498VhxSXJHQefjtQxpnLPehDJ4TRlg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-create-regexp-features-plugin": "^7.7.4",
|
||||
|
@ -615,9 +615,9 @@
|
|||
}
|
||||
},
|
||||
"@babel/plugin-transform-parameters": {
|
||||
"version": "7.7.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.7.4.tgz",
|
||||
"integrity": "sha512-VJwhVePWPa0DqE9vcfptaJSzNDKrWU/4FbYCjZERtmqEs05g3UMXnYMZoXja7JAJ7Y7sPZipwm/pGApZt7wHlw==",
|
||||
"version": "7.7.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.7.7.tgz",
|
||||
"integrity": "sha512-OhGSrf9ZBrr1fw84oFXj5hgi8Nmg+E2w5L7NhnG0lPvpDtqd7dbyilM2/vR8CKbJ907RyxPh2kj6sBCSSfI9Ew==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-call-delegate": "^7.7.4",
|
||||
|
@ -710,9 +710,9 @@
|
|||
}
|
||||
},
|
||||
"@babel/preset-env": {
|
||||
"version": "7.7.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.7.6.tgz",
|
||||
"integrity": "sha512-k5hO17iF/Q7tR9Jv8PdNBZWYW6RofxhnxKjBMc0nG4JTaWvOTiPoO/RLFwAKcA4FpmuBFm6jkoqaRJLGi0zdaQ==",
|
||||
"version": "7.7.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.7.7.tgz",
|
||||
"integrity": "sha512-pCu0hrSSDVI7kCVUOdcMNQEbOPJ52E+LrQ14sN8uL2ALfSqePZQlKrOy+tM4uhEdYlCHi4imr8Zz2cZe9oSdIg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-module-imports": "^7.7.4",
|
||||
|
@ -720,9 +720,9 @@
|
|||
"@babel/plugin-proposal-async-generator-functions": "^7.7.4",
|
||||
"@babel/plugin-proposal-dynamic-import": "^7.7.4",
|
||||
"@babel/plugin-proposal-json-strings": "^7.7.4",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.7.4",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.7.7",
|
||||
"@babel/plugin-proposal-optional-catch-binding": "^7.7.4",
|
||||
"@babel/plugin-proposal-unicode-property-regex": "^7.7.4",
|
||||
"@babel/plugin-proposal-unicode-property-regex": "^7.7.7",
|
||||
"@babel/plugin-syntax-async-generators": "^7.7.4",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
|
||||
"@babel/plugin-syntax-json-strings": "^7.7.4",
|
||||
|
@ -736,7 +736,7 @@
|
|||
"@babel/plugin-transform-classes": "^7.7.4",
|
||||
"@babel/plugin-transform-computed-properties": "^7.7.4",
|
||||
"@babel/plugin-transform-destructuring": "^7.7.4",
|
||||
"@babel/plugin-transform-dotall-regex": "^7.7.4",
|
||||
"@babel/plugin-transform-dotall-regex": "^7.7.7",
|
||||
"@babel/plugin-transform-duplicate-keys": "^7.7.4",
|
||||
"@babel/plugin-transform-exponentiation-operator": "^7.7.4",
|
||||
"@babel/plugin-transform-for-of": "^7.7.4",
|
||||
|
@ -750,7 +750,7 @@
|
|||
"@babel/plugin-transform-named-capturing-groups-regex": "^7.7.4",
|
||||
"@babel/plugin-transform-new-target": "^7.7.4",
|
||||
"@babel/plugin-transform-object-super": "^7.7.4",
|
||||
"@babel/plugin-transform-parameters": "^7.7.4",
|
||||
"@babel/plugin-transform-parameters": "^7.7.7",
|
||||
"@babel/plugin-transform-property-literals": "^7.7.4",
|
||||
"@babel/plugin-transform-regenerator": "^7.7.5",
|
||||
"@babel/plugin-transform-reserved-words": "^7.7.4",
|
||||
|
@ -762,16 +762,16 @@
|
|||
"@babel/plugin-transform-unicode-regex": "^7.7.4",
|
||||
"@babel/types": "^7.7.4",
|
||||
"browserslist": "^4.6.0",
|
||||
"core-js-compat": "^3.4.7",
|
||||
"core-js-compat": "^3.6.0",
|
||||
"invariant": "^2.2.2",
|
||||
"js-levenshtein": "^1.1.3",
|
||||
"semver": "^5.5.0"
|
||||
}
|
||||
},
|
||||
"@babel/register": {
|
||||
"version": "7.7.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/register/-/register-7.7.4.tgz",
|
||||
"integrity": "sha512-/fmONZqL6ZMl9KJUYajetCrID6m0xmL4odX7v+Xvoxcv0DdbP/oO0TWIeLUCHqczQ6L6njDMqmqHFy2cp3FFsA==",
|
||||
"version": "7.7.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/register/-/register-7.7.7.tgz",
|
||||
"integrity": "sha512-S2mv9a5dc2pcpg/ConlKZx/6wXaEwHeqfo7x/QbXsdCAZm+WJC1ekVvL1TVxNsedTs5y/gG63MhJTEsmwmjtiA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"find-cache-dir": "^2.0.0",
|
||||
|
@ -779,24 +779,6 @@
|
|||
"make-dir": "^2.1.0",
|
||||
"pirates": "^4.0.0",
|
||||
"source-map-support": "^0.5.16"
|
||||
},
|
||||
"dependencies": {
|
||||
"source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true
|
||||
},
|
||||
"source-map-support": {
|
||||
"version": "0.5.16",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz",
|
||||
"integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"buffer-from": "^1.0.0",
|
||||
"source-map": "^0.6.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@babel/template": {
|
||||
|
@ -1804,9 +1786,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"buffer": {
|
||||
"version": "4.9.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz",
|
||||
"integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=",
|
||||
"version": "4.9.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz",
|
||||
"integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"base64-js": "^1.0.2",
|
||||
|
@ -1932,9 +1914,9 @@
|
|||
}
|
||||
},
|
||||
"caniuse-lite": {
|
||||
"version": "1.0.30001015",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001015.tgz",
|
||||
"integrity": "sha512-/xL2AbW/XWHNu1gnIrO8UitBGoFthcsDgU9VLK1/dpsoxbaD5LscHozKze05R6WLsBvLhqv78dAPozMFQBYLbQ==",
|
||||
"version": "1.0.30001017",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001017.tgz",
|
||||
"integrity": "sha512-EDnZyOJ6eYh6lHmCvCdHAFbfV4KJ9lSdfv4h/ppEhrU/Yudkl7jujwMZ1we6RX7DXqBfT04pVMQ4J+1wcTlsKA==",
|
||||
"dev": true
|
||||
},
|
||||
"caseless": {
|
||||
|
@ -2202,13 +2184,10 @@
|
|||
}
|
||||
},
|
||||
"console-browserify": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz",
|
||||
"integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"date-now": "^0.1.4"
|
||||
}
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz",
|
||||
"integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==",
|
||||
"dev": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
|
@ -2268,19 +2247,19 @@
|
|||
}
|
||||
},
|
||||
"core-js-compat": {
|
||||
"version": "3.4.7",
|
||||
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.4.7.tgz",
|
||||
"integrity": "sha512-57+mgz/P/xsGdjwQYkwtBZR3LuISaxD1dEwVDtbk8xJMqAmwqaxLOvnNT7kdJ7jYE/NjNptyzXi+IQFMi/2fCw==",
|
||||
"version": "3.6.1",
|
||||
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.6.1.tgz",
|
||||
"integrity": "sha512-2Tl1EuxZo94QS2VeH28Ebf5g3xbPZG/hj/N5HDDy4XMP/ImR0JIer/nggQRiMN91Q54JVkGbytf42wO29oXVHg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"browserslist": "^4.8.0",
|
||||
"semver": "^6.3.0"
|
||||
"browserslist": "^4.8.2",
|
||||
"semver": "7.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"semver": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz",
|
||||
"integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
|
@ -2451,12 +2430,6 @@
|
|||
"integrity": "sha512-eyTcpKOcamdhWJXj56DpQMo1ylSQpcGtGKXcU0Tb97+K56/CF5amAqqqNj0+KvA0iw2ynxtHWFsPDSClCxe48w==",
|
||||
"dev": true
|
||||
},
|
||||
"date-now": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
|
||||
"integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=",
|
||||
"dev": true
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
|
@ -2598,9 +2571,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"des.js": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz",
|
||||
"integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=",
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz",
|
||||
"integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"inherits": "^2.0.1",
|
||||
|
@ -2693,9 +2666,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"elliptic": {
|
||||
"version": "6.5.1",
|
||||
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.1.tgz",
|
||||
"integrity": "sha512-xvJINNLbTeWQjrl6X+7eQCrIy/YPv5XCpKW6kB5mKvtnGILoLDcySuwomfdzt0BMdLNVnuRNTuzKNHj0bva1Cg==",
|
||||
"version": "6.5.2",
|
||||
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz",
|
||||
"integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bn.js": "^4.4.0",
|
||||
|
@ -6575,9 +6548,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"node-releases": {
|
||||
"version": "1.1.42",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.42.tgz",
|
||||
"integrity": "sha512-OQ/ESmUqGawI2PRX+XIRao44qWYBBfN54ImQYdWVTQqUckuejOg76ysSqDBK8NG3zwySRVnX36JwDQ6x+9GxzA==",
|
||||
"version": "1.1.44",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.44.tgz",
|
||||
"integrity": "sha512-NwbdvJyR7nrcGrXvKAvzc5raj/NkoJudkarh2yIpJ4t0NH4aqjUDz/486P+ynIW5eokKOfzGNRdYoLfBlomruw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"semver": "^6.3.0"
|
||||
|
@ -7583,9 +7556,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"regjsparser": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.0.tgz",
|
||||
"integrity": "sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ==",
|
||||
"version": "0.6.2",
|
||||
"resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.2.tgz",
|
||||
"integrity": "sha512-E9ghzUtoLwDekPT0DYCp+c4h+bvuUpe6rRHCTYn6eGoqj1LgKXxT6I0Il4WbjhQkOghzi/V+y03bPKvbllL93Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"jsesc": "~0.5.0"
|
||||
|
@ -8602,9 +8575,9 @@
|
|||
}
|
||||
},
|
||||
"terser": {
|
||||
"version": "4.4.2",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-4.4.2.tgz",
|
||||
"integrity": "sha512-Uufrsvhj9O1ikwgITGsZ5EZS6qPokUOkCegS7fYOdGTv+OA90vndUbU6PEjr5ePqHfNUbGyMO7xyIZv2MhsALQ==",
|
||||
"version": "4.4.3",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-4.4.3.tgz",
|
||||
"integrity": "sha512-0ikKraVtRDKGzHrzkCv5rUNDzqlhmhowOBqC0XqUHFpW+vJ45+20/IFBcebwKfiS2Z9fJin6Eo+F1zLZsxi8RA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "^2.20.0",
|
||||
|
@ -8871,9 +8844,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"uglify-js": {
|
||||
"version": "3.7.2",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.2.tgz",
|
||||
"integrity": "sha512-uhRwZcANNWVLrxLfNFEdltoPNhECUR3lc+UdJoG9CBpMcSnKyWA94tc3eAujB1GcMY5Uwq8ZMp4qWpxWYDQmaA==",
|
||||
"version": "3.7.3",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.3.tgz",
|
||||
"integrity": "sha512-7tINm46/3puUA4hCkKYo4Xdts+JDaVC9ZPRcG8Xw9R4nhO/gZgUM3TENq8IF4Vatk8qCig4MzP/c8G4u2BkVQg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "~2.20.3",
|
||||
|
@ -9227,9 +9200,9 @@
|
|||
}
|
||||
},
|
||||
"vm-browserify": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.0.tgz",
|
||||
"integrity": "sha512-iq+S7vZJE60yejDYM0ek6zg308+UZsdtPExWP9VZoCFCz1zkJoXFnAX7aZfd/ZwrkidzdUZL0C/ryW+JwAiIGw==",
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz",
|
||||
"integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==",
|
||||
"dev": true
|
||||
},
|
||||
"w3c-hr-time": {
|
||||
|
@ -9270,9 +9243,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"webpack": {
|
||||
"version": "4.41.2",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.41.2.tgz",
|
||||
"integrity": "sha512-Zhw69edTGfbz9/8JJoyRQ/pq8FYUoY0diOXqW0T6yhgdhCv6wr0hra5DwwWexNRns2Z2+gsnrNcbe9hbGBgk/A==",
|
||||
"version": "4.41.5",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.41.5.tgz",
|
||||
"integrity": "sha512-wp0Co4vpyumnp3KlkmpM5LWuzvZYayDwM2n17EHFr4qxBBbRokC7DJawPJC7TfSFZ9HZ6GsdH40EBj4UV0nmpw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@webassemblyjs/ast": "1.8.5",
|
||||
|
@ -9295,15 +9268,15 @@
|
|||
"node-libs-browser": "^2.2.1",
|
||||
"schema-utils": "^1.0.0",
|
||||
"tapable": "^1.1.3",
|
||||
"terser-webpack-plugin": "^1.4.1",
|
||||
"terser-webpack-plugin": "^1.4.3",
|
||||
"watchpack": "^1.6.0",
|
||||
"webpack-sources": "^1.4.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz",
|
||||
"integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==",
|
||||
"version": "6.4.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz",
|
||||
"integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw==",
|
||||
"dev": true
|
||||
},
|
||||
"eslint-scope": {
|
||||
|
|
12
package.json
12
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "jsoneditor",
|
||||
"version": "8.0.0",
|
||||
"version": "8.1.1",
|
||||
"main": "./index",
|
||||
"description": "A web-based tool to view, edit, format, and validate JSON",
|
||||
"tags": [
|
||||
|
@ -36,9 +36,9 @@
|
|||
"vanilla-picker": "^2.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.7.5",
|
||||
"@babel/preset-env": "^7.7.6",
|
||||
"@babel/register": "^7.7.4",
|
||||
"@babel/core": "^7.7.7",
|
||||
"@babel/preset-env": "^7.7.7",
|
||||
"@babel/register": "^7.7.7",
|
||||
"babel-loader": "^8.0.6",
|
||||
"btoa": "^1.2.1",
|
||||
"date-format": "^3.0.0",
|
||||
|
@ -52,8 +52,8 @@
|
|||
"mkdirp": "^0.5.1",
|
||||
"mocha": "^6.2.2",
|
||||
"standard": "^14.3.1",
|
||||
"uglify-js": "^3.7.2",
|
||||
"webpack": "^4.41.2"
|
||||
"uglify-js": "^3.7.3",
|
||||
"webpack": "^4.41.5"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
|
|
|
@ -183,7 +183,9 @@ JSONEditor.VALID_OPTIONS = [
|
|||
'timestampTag', 'timestampFormat',
|
||||
'escapeUnicode', 'history', 'search', 'mode', 'modes', 'name', 'indentation',
|
||||
'sortObjectKeys', 'navigationBar', 'statusBar', 'mainMenuBar', 'languages', 'language', 'enableSort', 'enableTransform',
|
||||
'maxVisibleChilds', 'onValidationError', 'createQuery', 'executeQuery'
|
||||
'maxVisibleChilds', 'onValidationError',
|
||||
'modalAnchor', 'popupAnchor',
|
||||
'createQuery', 'executeQuery'
|
||||
]
|
||||
|
||||
/**
|
||||
|
|
|
@ -302,7 +302,7 @@ export class Node {
|
|||
|
||||
const createPopup = (destroyOnMouseOut) => {
|
||||
const frame = this.editor.frame
|
||||
this.dom.popupAnchor = createAbsoluteAnchor(button, frame, onDestroy, destroyOnMouseOut)
|
||||
this.dom.popupAnchor = createAbsoluteAnchor(button, this.editor.getPopupAnchor(), onDestroy, destroyOnMouseOut)
|
||||
|
||||
const popupWidth = 200 // must correspond to what's configured in the CSS
|
||||
const buttonRect = button.getBoundingClientRect()
|
||||
|
@ -3020,7 +3020,7 @@ export class Node {
|
|||
node._deleteDomColor()
|
||||
node.updateDom()
|
||||
|
||||
const colorAnchor = createAbsoluteAnchor(this.dom.color, this.editor.frame)
|
||||
const colorAnchor = createAbsoluteAnchor(this.dom.color, this.editor.getPopupAnchor())
|
||||
|
||||
this.editor.options.onColorPicker(colorAnchor, this.value, function onChange (value) {
|
||||
if (typeof value === 'string' && value !== node.value) {
|
||||
|
@ -3834,7 +3834,7 @@ export class Node {
|
|||
}
|
||||
|
||||
const menu = new ContextMenu(items, { close: onClose })
|
||||
menu.show(anchor, this.editor.frame)
|
||||
menu.show(anchor, this.editor.getPopupAnchor())
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -207,7 +207,7 @@ export function appendNodeFactory (Node) {
|
|||
}
|
||||
|
||||
const menu = new ContextMenu(items, { close: onClose })
|
||||
menu.show(anchor, this.editor.frame)
|
||||
menu.show(anchor, this.editor.getPopupAnchor())
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,13 +14,13 @@ export function createAbsoluteAnchor (anchor, parent, onDestroy, destroyOnMouseO
|
|||
const eventListeners = {}
|
||||
|
||||
const anchorRect = anchor.getBoundingClientRect()
|
||||
const frameRect = parent.getBoundingClientRect()
|
||||
const parentRect = parent.getBoundingClientRect()
|
||||
|
||||
const absoluteAnchor = document.createElement('div')
|
||||
absoluteAnchor.className = 'jsoneditor-anchor'
|
||||
absoluteAnchor.style.position = 'absolute'
|
||||
absoluteAnchor.style.left = (anchorRect.left - frameRect.left) + 'px'
|
||||
absoluteAnchor.style.top = (anchorRect.top - frameRect.top) + 'px'
|
||||
absoluteAnchor.style.left = (anchorRect.left - parentRect.left) + 'px'
|
||||
absoluteAnchor.style.top = (anchorRect.top - parentRect.top) + 'px'
|
||||
absoluteAnchor.style.width = (anchorRect.width - 2) + 'px'
|
||||
absoluteAnchor.style.height = (anchorRect.height - 2) + 'px'
|
||||
absoluteAnchor.style.boxSizing = 'border-box'
|
||||
|
|
|
@ -136,13 +136,12 @@ treemode._setOptions = function (options) {
|
|||
const pickerHeight = 300 // estimated height of the color picker
|
||||
const top = parent.getBoundingClientRect().top
|
||||
const windowHeight = window.innerHeight
|
||||
const showOnTop = ((windowHeight - top) < pickerHeight && top > pickerHeight)
|
||||
|
||||
new VanillaPicker({
|
||||
parent: parent,
|
||||
color: color,
|
||||
popup: ((windowHeight - top) < pickerHeight && top > pickerHeight)
|
||||
? 'top'
|
||||
: 'bottom',
|
||||
popup: showOnTop ? 'top' : 'bottom',
|
||||
onDone: function (color) {
|
||||
const alpha = color.rgba[3]
|
||||
const hex = (alpha === 1)
|
||||
|
@ -1066,7 +1065,7 @@ treemode._createFrame = function () {
|
|||
this.navBar.className = 'jsoneditor-navigation-bar nav-bar-empty'
|
||||
this.frame.appendChild(this.navBar)
|
||||
|
||||
this.treePath = new TreePath(this.navBar, this.frame)
|
||||
this.treePath = new TreePath(this.navBar, this.getPopupAnchor())
|
||||
this.treePath.onSectionSelected(this._onTreePathSectionSelected.bind(this))
|
||||
this.treePath.onContextMenuItemSelected(this._onTreePathMenuItemSelected.bind(this))
|
||||
}
|
||||
|
@ -1684,7 +1683,11 @@ treemode.showContextMenu = function (anchor, onClose) {
|
|||
}
|
||||
|
||||
const menu = new ContextMenu(items, { close: onClose })
|
||||
menu.show(anchor, this.frame)
|
||||
menu.show(anchor, this.getPopupAnchor())
|
||||
}
|
||||
|
||||
treemode.getPopupAnchor = function () {
|
||||
return this.options.popupAnchor || this.frame
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1371,7 +1371,7 @@ export function isTimestamp (field, value) {
|
|||
|
||||
/**
|
||||
* Return a human readable document size
|
||||
* For example formatSize(7570718) outputs '7.2 MiB'
|
||||
* For example formatSize(7570718) outputs '7.6 MB'
|
||||
* @param {number} size
|
||||
* @return {string} Returns a human readable size
|
||||
*/
|
||||
|
@ -1380,23 +1380,23 @@ export function formatSize (size) {
|
|||
return size.toFixed() + ' B'
|
||||
}
|
||||
|
||||
const KiB = size / 1024
|
||||
if (KiB < 900) {
|
||||
return KiB.toFixed(1) + ' KiB'
|
||||
const KB = size / 1000
|
||||
if (KB < 900) {
|
||||
return KB.toFixed(1) + ' KB'
|
||||
}
|
||||
|
||||
const MiB = KiB / 1024
|
||||
if (MiB < 900) {
|
||||
return MiB.toFixed(1) + ' MiB'
|
||||
const MB = KB / 1000
|
||||
if (MB < 900) {
|
||||
return MB.toFixed(1) + ' MB'
|
||||
}
|
||||
|
||||
const GiB = MiB / 1024
|
||||
if (GiB < 900) {
|
||||
return GiB.toFixed(1) + ' GiB'
|
||||
const GB = MB / 1000
|
||||
if (GB < 900) {
|
||||
return GB.toFixed(1) + ' GB'
|
||||
}
|
||||
|
||||
const TiB = GiB / 1024
|
||||
return TiB.toFixed(1) + ' TiB'
|
||||
const TB = GB / 1000
|
||||
return TB.toFixed(1) + ' TB'
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -80,20 +80,6 @@ div {
|
|||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
div {
|
||||
&.jsoneditor-anchor {
|
||||
cursor: pointer;
|
||||
|
||||
.picker_wrapper {
|
||||
&.popup {
|
||||
&.popup_bottom {
|
||||
top: 28px;
|
||||
left: -10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.busy {
|
||||
pre {
|
||||
&.jsoneditor-preview {
|
||||
|
@ -325,6 +311,10 @@ div.jsoneditor-tree div.jsoneditor-show-more a:focus {
|
|||
textarea.jsoneditor-text,
|
||||
.ace-jsoneditor {
|
||||
min-height: 150px;
|
||||
|
||||
* {
|
||||
font-family: $jse-font-mono;
|
||||
}
|
||||
}
|
||||
textarea {
|
||||
&.jsoneditor-text {
|
||||
|
@ -550,6 +540,19 @@ pre.jsoneditor-preview,
|
|||
}
|
||||
}
|
||||
|
||||
.jsoneditor-anchor {
|
||||
cursor: pointer;
|
||||
|
||||
.picker_wrapper {
|
||||
&.popup {
|
||||
&.popup_bottom {
|
||||
top: 28px;
|
||||
left: -10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fadein {
|
||||
-webkit-animation: fadein 0.3s;
|
||||
animation: fadein 0.3s;
|
||||
|
|
|
@ -0,0 +1,146 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>JSONEditor | JSON schema validation</title>
|
||||
|
||||
<link href="../dist/jsoneditor.css" rel="stylesheet" type="text/css">
|
||||
<script src="../dist/jsoneditor.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
width: 600px;
|
||||
font: 11pt sans-serif;
|
||||
}
|
||||
|
||||
#anchor {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#jsoneditor {
|
||||
width: 320px;
|
||||
height: 300px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* custom bold styling for non-default JSON schema values */
|
||||
.jsoneditor-is-not-default {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test custom tooltip anchor</h1>
|
||||
<p>
|
||||
The JSON Schema error tooltips and the color picker should have correct placing and overflow the editor, also in combination with scrolling.
|
||||
</p>
|
||||
|
||||
<div id="anchor">
|
||||
<div id="jsoneditor"></div>
|
||||
</div>
|
||||
<div style="height: 2000px"></div>
|
||||
|
||||
<script>
|
||||
const schema = {
|
||||
"title": "Employee",
|
||||
"description": "Object containing employee details",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"firstName": {
|
||||
"title": "First Name",
|
||||
"description": "The given name.",
|
||||
"examples": [
|
||||
"John"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"lastName": {
|
||||
"title": "Last Name",
|
||||
"description": "The family name.",
|
||||
"examples": [
|
||||
"Smith"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"gender": {
|
||||
"title": "Gender",
|
||||
"enum": ["male", "female"]
|
||||
},
|
||||
"availableToHire": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"age": {
|
||||
"description": "Age in years",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"examples": [28, 32]
|
||||
},
|
||||
"job": {
|
||||
"$ref": "job"
|
||||
}
|
||||
},
|
||||
"required": ["firstName", "lastName"]
|
||||
}
|
||||
|
||||
const job = {
|
||||
"title": "Job description",
|
||||
"type": "object",
|
||||
"required": ["address"],
|
||||
"properties": {
|
||||
"company": {
|
||||
"type": "string",
|
||||
"examples": [
|
||||
"ACME",
|
||||
"Dexter Industries"
|
||||
]
|
||||
},
|
||||
"role": {
|
||||
"description": "Job title.",
|
||||
"type": "string",
|
||||
"examples": [
|
||||
"Human Resources Coordinator",
|
||||
"Software Developer"
|
||||
],
|
||||
"default": "Software Developer"
|
||||
},
|
||||
"address": {
|
||||
"type": "string"
|
||||
},
|
||||
"salary": {
|
||||
"type": "number",
|
||||
"minimum": 120,
|
||||
"examples": [100, 110, 120]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const json = {
|
||||
firstName: 'John',
|
||||
lastName: 'Doe',
|
||||
gender: null,
|
||||
age: "28",
|
||||
availableToHire: true,
|
||||
favoriteColor: 'red',
|
||||
job: {
|
||||
company: 'freelance',
|
||||
role: 'developer',
|
||||
salary: 100
|
||||
}
|
||||
}
|
||||
|
||||
const options = {
|
||||
schema: schema,
|
||||
schemaRefs: {"job": job},
|
||||
mode: 'tree',
|
||||
modes: ['code', 'text', 'tree', 'preview'],
|
||||
popupAnchor: document.getElementById('anchor')
|
||||
}
|
||||
|
||||
// create the editor
|
||||
const container = document.getElementById('jsoneditor')
|
||||
const editor = new JSONEditor(container, options, json)
|
||||
editor.expandAll()
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>JSONEditor | Load and save</title>
|
||||
<title>JSONEditor | Preview mode load and save</title>
|
||||
|
||||
<link href="../dist/jsoneditor.css" rel="stylesheet" type="text/css">
|
||||
<script src="../dist/jsoneditor.js"></script>
|
||||
|
@ -20,7 +20,7 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Load and save JSON documents</h1>
|
||||
<h1>Load and save JSON documents in Preview mode</h1>
|
||||
<p>
|
||||
This examples uses HTML5 to load/save local files.
|
||||
Powered by <a href="http://bgrins.github.io/filereader.js/">FileReader.js</a> and
|
||||
|
@ -38,7 +38,9 @@
|
|||
|
||||
<script>
|
||||
// create the editor
|
||||
var editor = new JSONEditor(document.getElementById('jsoneditor'));
|
||||
var editor = new JSONEditor(document.getElementById('jsoneditor'), {
|
||||
mode: 'preview'
|
||||
});
|
||||
|
||||
// Load a JSON document
|
||||
FileReaderJS.setupInput(document.getElementById('loadDocument'), {
|
||||
|
|
|
@ -484,13 +484,13 @@ describe('util', () => {
|
|||
|
||||
it('should format a document size in a human readable way', () => {
|
||||
assert.strictEqual(formatSize(500), '500 B')
|
||||
assert.strictEqual(formatSize(900), '0.9 KiB')
|
||||
assert.strictEqual(formatSize(77.89 * 1024), '77.9 KiB')
|
||||
assert.strictEqual(formatSize(950 * 1024), '0.9 MiB')
|
||||
assert.strictEqual(formatSize(7.22 * 1024 * 1024), '7.2 MiB')
|
||||
assert.strictEqual(formatSize(955.4 * 1024 * 1024), '0.9 GiB')
|
||||
assert.strictEqual(formatSize(22.37 * 1024 * 1024 * 1024), '22.4 GiB')
|
||||
assert.strictEqual(formatSize(1024 * 1024 * 1024 * 1024), '1.0 TiB')
|
||||
assert.strictEqual(formatSize(900), '0.9 KB')
|
||||
assert.strictEqual(formatSize(77.89 * 1000), '77.9 KB')
|
||||
assert.strictEqual(formatSize(950 * 1000), '0.9 MB')
|
||||
assert.strictEqual(formatSize(7.22 * 1000 * 1000), '7.2 MB')
|
||||
assert.strictEqual(formatSize(945.4 * 1000 * 1000), '0.9 GB')
|
||||
assert.strictEqual(formatSize(22.37 * 1000 * 1000 * 1000), '22.4 GB')
|
||||
assert.strictEqual(formatSize(1000 * 1000 * 1000 * 1000), '1.0 TB')
|
||||
})
|
||||
|
||||
it('should limit characters', () => {
|
||||
|
|
Loading…
Reference in New Issue