From 4857d7c29cc2de31ad8413cc549b6b23f1e17c16 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 7 Sep 2023 07:16:55 +0200 Subject: [PATCH] Use css width for img custom width The width attribute is the intrinsic width of the image, and thus it will not overwrite the default CSS cf https://forum.openstreetmap.fr/t/bugs-divers-relevees-sur-une-umap-absent-sur-une-autre/17254/5 --- umap/static/umap/js/umap.core.js | 2 +- umap/static/umap/test/Util.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/umap/static/umap/js/umap.core.js b/umap/static/umap/js/umap.core.js index fdbf482a..b03979f8 100644 --- a/umap/static/umap/js/umap.core.js +++ b/umap/static/umap/js/umap.core.js @@ -129,7 +129,7 @@ L.Util.toHTML = (r, options) => { // images r = r.replace(/{{([^\]|]*?)}}/g, '') - r = r.replace(/{{([^|]*?)\|(\d*?)}}/g, '') + r = r.replace(/{{([^|]*?)\|(\d*?)(px)?}}/g, '') //Unescape http r = r.replace(/(h_t_t_p)/g, 'http') diff --git a/umap/static/umap/test/Util.js b/umap/static/umap/test/Util.js index a497a459..07d2b284 100644 --- a/umap/static/umap/test/Util.js +++ b/umap/static/umap/test/Util.js @@ -108,7 +108,7 @@ describe('L.Util', function () { it('should handle image with width', function () { assert.equal( L.Util.toHTML('A simple image: {{http://osm.org/pouet.png|100}}'), - 'A simple image: ' + 'A simple image: ' ) })