picto field: only add close button once

This commit is contained in:
Yohan Boniface 2023-11-13 17:02:35 +01:00
parent 00a13acb83
commit 2026a2c7e6

View file

@ -669,18 +669,6 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({
for (let [category, items] of sorted) { for (let [category, items] of sorted) {
this.addCategory(category, items) 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 () { isDefault: function () {
@ -704,6 +692,18 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({
this.searchInput.placeholder = L._('Search') this.searchInput.placeholder = L._('Search')
this.gridContainer = L.DomUtil.create('div', '', this.pictogramsContainer) this.gridContainer = L.DomUtil.create('div', '', this.pictogramsContainer)
L.DomEvent.on(this.searchInput, 'input', this.buildSymbolsList, this) 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) { if (this.pictogram_list) {
this.buildSymbolsList() this.buildSymbolsList()
} else { } else {