diff --git a/app/scripts/json-editor/autocomplete.js b/app/scripts/json-editor/autocomplete.js index 9635dbee..9d4464ad 100644 --- a/app/scripts/json-editor/autocomplete.js +++ b/app/scripts/json-editor/autocomplete.js @@ -13,18 +13,22 @@ export default function makeAutocompleteEditor(options = []) { } addDatalist(options) { - this.datalist = document.createElement('datalist'); - this.datalist.id = 'options-datalist'; + const datalistId = 'options-datalist'; + this.input.setAttribute('list', datalistId); - options.forEach((optionValue) => { - const option = document.createElement('option'); - option.value = optionValue; - this.datalist.appendChild(option); - }); + // Since we have autocomplete only for devices it is enough to have only one datalist for multiple similar inputs + if (!this.jsoneditor.element.querySelector(`#${datalistId}`)) { + const datalist = document.createElement('datalist'); + datalist.id = datalistId; - this.input.setAttribute('list', this.datalist.id); + options.forEach((optionValue) => { + const option = document.createElement('option'); + option.value = optionValue; + datalist.appendChild(option); + }); - this.container.appendChild(this.datalist); + this.jsoneditor.element.appendChild(datalist); + } } }; } diff --git a/debian/changelog b/debian/changelog index ab6089e6..fc10ac9c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +wb-mqtt-homeui (2.105.4) stable; urgency=medium + + * Fix multiple datalists for same autocompletes + + -- Victor Vedenin Thu, 28 Nov 2024 08:58:11 +0300 + wb-mqtt-homeui (2.105.3) stable; urgency=medium * Fix device selection on scan page in wb-mqtt-serial config editor @@ -85,7 +91,7 @@ wb-mqtt-homeui (2.102.0) stable; urgency=medium wb-mqtt-homeui (2.101.1) stable; urgency=medium - * Do not collapse white spaces in rules console messages + * Do not collapse white spaces in rules console messages -- Petr Krasnoshchekov Wed, 16 Oct 2024 12:33:18 +0500 @@ -109,7 +115,7 @@ wb-mqtt-homeui (2.100.4) stable; urgency=medium -- Victor Vedenin Fri, 04 Oct 2024 15:55:01 +0300 wb-mqtt-homeui (2.100.3) stable; urgency=medium - + * Remove type filter from widgets -- Victor Vedenin Thu, 03 Oct 2024 16:20:24 +0300