Fix title being "null"

This commit is contained in:
kolaente 2020-07-12 21:43:07 +02:00
parent a6a50951ff
commit adf35f2376
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 5 additions and 2 deletions

View File

@ -223,13 +223,16 @@
marked.use({
renderer: {
image: (src, title, text) => {
title = title ? ` title="${title}` : ''
// If the url starts with the api url, the image is likely an attachment and
// we'll need to download and parse it properly.
if (src.substr(0, window.API_URL.length + 7) === `${window.API_URL}/tasks/`) {
return `<img data-src="${src}" alt="${text}" title="${title}" class="attachment-image"/>`
return `<img data-src="${src}" alt="${text}" ${title} class="attachment-image"/>`
}
return `<img src="${src}" alt="${text}" title="${title}"/>`
return `<img src="${src}" alt="${text}" ${title}/>`
},
}
})