[feat] memos img.externalLink

This commit is contained in:
xaoxuu 2023-12-14 23:22:43 +08:00
parent df652e12d7
commit 19971bc638
1 changed files with 8 additions and 4 deletions

View File

@ -84,14 +84,18 @@ const MemosJS = {
var imgs = []; var imgs = [];
for (let res of item.resourceList) { for (let res of item.resourceList) {
if (res.type?.includes('image/')) { if (res.type?.includes('image/')) {
imgs.push(res.id); imgs.push(res);
console.log('type', res.type);
} }
} }
if (imgs.length > 0) { if (imgs.length > 0) {
cell += '<div class="tag-plugin image">'; cell += '<div class="tag-plugin image">';
for (let id of imgs) { for (let img of imgs) {
cell += `<div class="image-bg"><img src="https://${cfg.host}/o/r/${id}" fancybox="true"></div>`; if (img.externalLink?.length > 0) {
cell += `<div class="image-bg"><img src="${img.externalLink}" fancybox="true"></div>`;
} else {
cell += `<div class="image-bg"><img src="https://${cfg.host}/o/r/${img.id}" fancybox="true"></div>`;
}
} }
cell += '</div>'; cell += '</div>';
} }