From 2026a2c7e6583c38b37683f20baffb77cf6a8c99 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 13 Nov 2023 17:02:35 +0100 Subject: [PATCH] picto field: only add close button once --- umap/static/umap/js/umap.forms.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/umap/static/umap/js/umap.forms.js b/umap/static/umap/js/umap.forms.js index c4c82fee..87b8d0ab 100644 --- a/umap/static/umap/js/umap.forms.js +++ b/umap/static/umap/js/umap.forms.js @@ -669,18 +669,6 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({ for (let [category, items] of sorted) { this.addCategory(category, items) } - const closeButton = L.DomUtil.createButton( - 'button action-button', - this.pictogramsContainer, - L._('Close'), - function (e) { - this.pictogramsContainer.innerHTML = '' - this.tabsContainer.innerHTML = '' - if (this.isDefault()) this.undefine(e) - else this.udpatePreview() - }, - this - ) }, isDefault: function () { @@ -704,6 +692,18 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({ this.searchInput.placeholder = L._('Search') this.gridContainer = L.DomUtil.create('div', '', this.pictogramsContainer) L.DomEvent.on(this.searchInput, 'input', this.buildSymbolsList, this) + const closeButton = L.DomUtil.createButton( + 'button action-button', + this.pictogramsContainer, + L._('Close'), + function (e) { + this.pictogramsContainer.innerHTML = '' + this.tabsContainer.innerHTML = '' + if (this.isDefault()) this.undefine(e) + else this.udpatePreview() + }, + this + ) if (this.pictogram_list) { this.buildSymbolsList() } else {