From 03aa3be13214c1e76ae66aa8d7f2b83d1fe994e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BE=84=E6=B2=A8?= Date: Fri, 6 Sep 2024 13:04:44 +0800 Subject: [PATCH] fix Fancybox caption --- scripts/tags/fancybox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tags/fancybox.js b/scripts/tags/fancybox.js index 292dcfe37..40c1b95f3 100644 --- a/scripts/tags/fancybox.js +++ b/scripts/tags/fancybox.js @@ -22,7 +22,7 @@ function buidImgFancybox(content, group) { let imgList = html.match(//g) || []; imgList.forEach(item => { const url = (item.match(/\ssrc=['"](.*?)['"]/) || [])[1]; - const alt = (item.match(/\salt=['"](.*?)['"]/) || [])[1]; + const alt = (item.match(/\salt=['"](.*?)['"]/) || [])[1] || ''; const newItem = item.replace('img', 'img fancybox itemprop="contentUrl"'); // 避免出现重复替换,打个标 const result = `
${buidAlt(imageTags || alt)}
`; html = html.replace(item, result.trim());