Fixed #850: make autocomplete options robust against non-string inputs

This commit is contained in:
jos 2019-12-01 11:54:56 +01:00
parent eb9fb32038
commit 0d4525d3d2
3 changed files with 8 additions and 2 deletions

View File

@ -3,6 +3,12 @@
https://github.com/josdejong/jsoneditor https://github.com/josdejong/jsoneditor
## not yet published, version 7.3.2
- Fixed #850: make autocomplete options robust against non-string inputs
like `null`, `123`, `true`, `false`.
## 2019-12-01, version 7.3.1 ## 2019-12-01, version 7.3.1
- Fixed #855: `onFocus` and `onBlur` not working in modes `text` and `code` - Fixed #855: `onFocus` and `onBlur` not working in modes `text` and `code`

View File

@ -32,7 +32,7 @@
const options = { const options = {
autocomplete: { autocomplete: {
getOptions: function () { getOptions: function () {
return ['apple', 'cranberry', 'raspberry', 'pie', 'mango', 'mandarine', 'melon', 'appleton']; return ['apple', 'cranberry', 'raspberry', 'pie', 'mango', 'mandarine', 'melon', 'appleton', null, "nothing", false, true, 1234, 123];
} }
} }
} }

View File

@ -191,7 +191,7 @@ export function autocomplete (config) {
dropDown.style.marginLeft = '0' dropDown.style.marginLeft = '0'
dropDown.style.marginTop = element.getBoundingClientRect().height + 'px' dropDown.style.marginTop = element.getBoundingClientRect().height + 'px'
this.options = options this.options = options.map(String)
if (this.element !== element) { if (this.element !== element) {
this.element = element this.element = element