Fix CSS class for default/non-default schema values not applied to enums, see (#666)
This commit is contained in:
parent
ff8be9635a
commit
b279ed3069
|
@ -8,6 +8,8 @@ https://github.com/josdejong/jsoneditor
|
|||
- Fixed #416: Clipped action menu for append nodes.
|
||||
- Improve detection of value type in transform modal.
|
||||
- Styling improvements in the transform modal.
|
||||
- Fix CSS class for default/non-default schema values not applied to enums,
|
||||
see (#666).
|
||||
|
||||
|
||||
## 2018-03-28, version 5.32.1
|
||||
|
|
|
@ -1921,18 +1921,23 @@ Node.prototype._updateDomDefault = function () {
|
|||
return;
|
||||
}
|
||||
|
||||
// select either enum dropdown (select) or input value
|
||||
const inputElement = this.dom.select
|
||||
? this.dom.select
|
||||
: this.dom.value;
|
||||
|
||||
if (!inputElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.value === this.schema.default) {
|
||||
if (this.dom.select) {
|
||||
this.dom.value.removeAttribute('title');
|
||||
} else {
|
||||
this.dom.value.title = translate('default');
|
||||
this.dom.value.classList.add('jsoneditor-is-default');
|
||||
this.dom.value.classList.remove('jsoneditor-is-not-default');
|
||||
}
|
||||
inputElement.title = translate('default');
|
||||
util.addClassName(inputElement, 'jsoneditor-is-default');
|
||||
util.removeClassName(inputElement, 'jsoneditor-is-not-default');
|
||||
} else {
|
||||
this.dom.value.removeAttribute('title');
|
||||
this.dom.value.classList.remove('jsoneditor-is-default');
|
||||
this.dom.value.classList.add('jsoneditor-is-not-default');
|
||||
inputElement.removeAttribute('title');
|
||||
util.removeClassName(inputElement, 'jsoneditor-is-default');
|
||||
util.addClassName(inputElement, 'jsoneditor-is-not-default');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue