Merge pull request #1306 from umap-project/popup-img-width

Use css width for img custom width
This commit is contained in:
Yohan Boniface 2023-09-08 15:09:53 +02:00 committed by GitHub
commit a9cd424f05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -129,7 +129,7 @@ L.Util.toHTML = (r, options) => {
// images
r = r.replace(/{{([^\]|]*?)}}/g, '<img src="$1">')
r = r.replace(/{{([^|]*?)\|(\d*?)}}/g, '<img src="$1" width="$2">')
r = r.replace(/{{([^|]*?)\|(\d*?)(px)?}}/g, '<img src="$1" style="width:$2px;min-width:$2px;">')
//Unescape http
r = r.replace(/(h_t_t_p)/g, 'http')

View file

@ -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: <img width="100" src="http://osm.org/pouet.png">'
'A simple image: <img style="width:100px;min-width:100px;" src="http://osm.org/pouet.png">'
)
})