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
This commit is contained in:
parent
d8b63974f9
commit
4857d7c29c
2 changed files with 2 additions and 2 deletions
|
@ -129,7 +129,7 @@ L.Util.toHTML = (r, options) => {
|
||||||
|
|
||||||
// images
|
// images
|
||||||
r = r.replace(/{{([^\]|]*?)}}/g, '<img src="$1">')
|
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
|
//Unescape http
|
||||||
r = r.replace(/(h_t_t_p)/g, 'http')
|
r = r.replace(/(h_t_t_p)/g, 'http')
|
||||||
|
|
|
@ -108,7 +108,7 @@ describe('L.Util', function () {
|
||||||
it('should handle image with width', function () {
|
it('should handle image with width', function () {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
L.Util.toHTML('A simple image: {{http://osm.org/pouet.png|100}}'),
|
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">'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue