Log a clear error in the console when the returned value of `onEditable` is invalid. See #1112
This commit is contained in:
parent
223b78542e
commit
58f460a383
|
@ -3,6 +3,12 @@
|
|||
https://github.com/josdejong/jsoneditor
|
||||
|
||||
|
||||
## not yet published, version 9.1.2
|
||||
|
||||
- Log a clear error in the console when the returned value of `onEditable` is
|
||||
invalid. See #1112.
|
||||
|
||||
|
||||
## 2020-09-23, version 9.1.1
|
||||
|
||||
- Fix #1111: Enum dropdown not showing when using patternProperties for schema.
|
||||
|
|
|
@ -104,9 +104,16 @@ export class Node {
|
|||
if (typeof editable === 'boolean') {
|
||||
this.editable.field = editable
|
||||
this.editable.value = editable
|
||||
} else {
|
||||
} else if (typeof editable === 'object' && editable !== null) {
|
||||
if (typeof editable.field === 'boolean') this.editable.field = editable.field
|
||||
if (typeof editable.value === 'boolean') this.editable.value = editable.value
|
||||
} else {
|
||||
console.error( 'Invalid return value for function onEditable. ' +
|
||||
'Actual value:', editable, '.',
|
||||
'Either a boolean or object { field: boolean, value: boolean } expected.')
|
||||
|
||||
this.editable.field = false
|
||||
this.editable.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue