mirror of https://github.com/status-im/codimd.git
Escape attributes in lightbox image
Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
This commit is contained in:
parent
381b3ff78e
commit
26a2c746d3
|
@ -1,4 +1,5 @@
|
||||||
import './lightbox.css'
|
import './lightbox.css'
|
||||||
|
import escape from 'lodash/escape'
|
||||||
|
|
||||||
let images = []
|
let images = []
|
||||||
/** @type {HTMLImageElement} */
|
/** @type {HTMLImageElement} */
|
||||||
|
@ -74,7 +75,7 @@ function setImageInner (img, lightBoxContainer) {
|
||||||
const src = img.getAttribute('src')
|
const src = img.getAttribute('src')
|
||||||
const alt = img.getAttribute('alt')
|
const alt = img.getAttribute('alt')
|
||||||
|
|
||||||
lightBoxContainer.querySelector('.lightbox-inner').innerHTML = `<img src="${src}" alt="${alt}" draggable="false">`
|
lightBoxContainer.querySelector('.lightbox-inner').innerHTML = `<img src="${escape(src)}" alt="${escape(alt)}" draggable="false">`
|
||||||
addImageDragListener(lightBoxContainer.querySelector('.lightbox-inner img'))
|
addImageDragListener(lightBoxContainer.querySelector('.lightbox-inner img'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue