fix: v3.26.179 无缩略图时直接显示原图(空 src 触发 onError 被永久标失效);onLoad 清除失效标记
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m49s

This commit is contained in:
qiqi committed 2026-12-01 21:20:31 +08:00
1 parent c3227ce0d5
commit 7ca372efec
6 files changed
+20 -10

No files matched your search

+11 -1
View File
@@ -717,7 +717,17 @@
return el('div', { className: 'iwb-node-body iwb-ref-body' },
hasImg
? el('div', { className: 'iwb-ref-show' },
el('img', { className: 'iwb-ref-single', decoding: 'async', fetchPriority: 'low', src: wPreviewUrlOf((typeof wImgSrcForNode === 'function' ? wImgSrcForNode : wDisplayThumbOf)(wThumbSrc(src), Math.min(320, (props.node && props.node.w) || 280))), alt: '图片', draggable: false, onLoad: (e) => { fitRefNodeOnce(e, props.node, onUpdate) }, onError: (e) => {
el('img', { className: 'iwb-ref-single', decoding: 'async', fetchPriority: 'low', src: wPreviewUrlOf((typeof wImgSrcForNode === 'function' ? wImgSrcForNode : wDisplayThumbOf)(wThumbSrc(src), Math.min(320, (props.node && props.node.w) || 280))), alt: '图片', draggable: false, onLoad: (e) => {
// v3.26.179:图片恢复可读时清掉「源已失效」标记 —— 之前 is-broken 是命令式加的,
// 换图后没有任何地方移除,遮罩会一直盖在新图上。
try {
const img = e.currentTarget
if (img && img.dataset) img.dataset.fb = ''
const host = img && img.closest ? img.closest('.iwb-ref-show') : null
if (host) host.classList.remove('is-broken')
} catch (err0) { /* ignore */ }
fitRefNodeOnce(e, props.node, onUpdate)
}, onError: (e) => {
// 第一次失败先退回原图;第二次仍失败 → 标记容器,换成「源已失效 · 双击重新导入」占位
// (用户 2026-11-29:破图图标会被误当成渲染 bug,必须明确告知是图片源丢了)
try {