Update history. Fix JSON schema default value styling not working for `false` and `null`, and fixed the styling not updating when clicking a boolean checkbox (See #666)
This commit is contained in:
parent
c79bea4eb8
commit
7c398aeef7
|
@ -3,8 +3,10 @@
|
|||
https://github.com/josdejong/jsoneditor
|
||||
|
||||
|
||||
## not yet published, version 5.31.2
|
||||
## not yet published, version 5.32.0
|
||||
|
||||
- Implemented support for reckoning with JSON schema default values: custom
|
||||
styling can be applied for default and non-default values. Thanks @AdamVig.
|
||||
- Fixed #667: resolving JSON Schema examples and descriptions did not always
|
||||
work for referenced schemas. Thanks @AdamVig.
|
||||
|
||||
|
|
|
@ -16,12 +16,16 @@
|
|||
height: 500px;
|
||||
}
|
||||
|
||||
/* custom bold styling for non-default JSON schema values */
|
||||
.jsoneditor-is-not-default {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSON schema validation</h1>
|
||||
<p>
|
||||
This example demonstrates JSON schema validation. The JSON object in this example must contain properties <code>firstName</code> and <code>lastName</code>, can can optionally have a property <code>age</code> which must be a positive integer.
|
||||
This example demonstrates JSON schema validation. The JSON object in this example must contain properties like <code>firstName</code> and <code>lastName</code>, can can optionally have a property <code>age</code> which must be a positive integer.
|
||||
</p>
|
||||
<p>
|
||||
See <a href="http://json-schema.org/" target="_blank">http://json-schema.org/</a> for more information.
|
||||
|
@ -89,7 +93,8 @@
|
|||
"examples": [
|
||||
"Human Resources Coordinator",
|
||||
"Software Developer"
|
||||
]
|
||||
],
|
||||
"default": "Software Developer"
|
||||
},
|
||||
"address": {
|
||||
"type": "string"
|
||||
|
@ -107,7 +112,7 @@
|
|||
lastName: 'Doe',
|
||||
gender: null,
|
||||
age: "28",
|
||||
availableToHire: 1,
|
||||
availableToHire: true,
|
||||
job: {
|
||||
company: 'freelance',
|
||||
role: 'developer',
|
||||
|
|
|
@ -1917,7 +1917,7 @@ Node.prototype._getDomField = function(silent) {
|
|||
*/
|
||||
Node.prototype._updateDomDefault = function () {
|
||||
// Short-circuit if schema is missing, has no default, or if Node has children
|
||||
if (!this.schema || !this.schema.default || this._hasChilds()) {
|
||||
if (!this.schema || this.schema.default === undefined || this._hasChilds()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2891,6 +2891,7 @@ Node.prototype.onEvent = function (event) {
|
|||
if (type == 'change' && target == dom.checkbox) {
|
||||
this.dom.value.innerHTML = !this.value;
|
||||
this._getDomValue();
|
||||
this._updateDomDefault();
|
||||
}
|
||||
|
||||
// update the value of the node based on the selected option
|
||||
|
|
Loading…
Reference in New Issue