From 4009e759dca62cf384b48e11347eda9710aa1478 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Tue, 5 Sep 2023 11:21:17 +0200 Subject: [PATCH] Prevent HTML blinking when loading icons list --- umap/static/umap/js/umap.forms.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/umap/static/umap/js/umap.forms.js b/umap/static/umap/js/umap.forms.js index 0d54bc5a..587549a5 100644 --- a/umap/static/umap/js/umap.forms.js +++ b/umap/static/umap/js/umap.forms.js @@ -532,7 +532,7 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({ }, isUrl: function () { - return this.value().indexOf('/') !== -1 + return this.value() && this.value().indexOf('/') !== -1 }, udpatePreview: function () { @@ -608,8 +608,6 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({ }, buildIconList: function (data) { - this.pictogramsContainer.innerHTML = '' - this.buttonsContainer.innerHTML = '' this.searchInput = L.DomUtil.create('input', '', this.pictogramsContainer) this.searchInput.type = 'search' this.searchInput.placeholder = L._('Search') @@ -648,6 +646,9 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({ }, fetchIconList: function (e) { + // Clean parent element before calling ajax, to prevent blinking + this.pictogramsContainer.innerHTML = '' + this.buttonsContainer.innerHTML = '' this.builder.map.get(this.builder.map.options.urls.pictogram_list_json, { callback: this.buildIconList, context: this,