fix(ref): 图库拖入/插入的引用图按本地图处理,不再显示空的 URL 行
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 51s

This commit is contained in:
qiqi committed 2026-12-04 17:55:42 +08:00
1 parent 720ad51d86
commit 3143f3fe40
3 files changed
+9 -5

No files matched your search

+5 -2
View File
@@ -691,9 +691,12 @@
// 直接 String() 会变成 "[object Object]" ⇒ <img> 破图(2026-11-29 实测 45 个节点踩中)。
const src = wResolveImg(d.localRef) || wResolveImg(d.data) || wResolveImg(d.url)
const hasImg = !!src
// 来源判定:url 是 http(s) 就是网络图(缓存出 localRef 也不改变来源);否则是本地图片。
// 来源判定(2026-12-05):只有 url 是 http(s) 才算网络图。url 里放引用对象(图库拖入/批量插入的
// {__blob},见 refArgsOf 的既有设计)或 data: 都是本地图 —— 原来只认 data/localRef/localName,
// 于是图库节点被当成空节点,多出一条永远空着的 URL 行。
const remoteUrl = typeof d.url === 'string' && /^https?:\/\//i.test(d.url)
const showUrlRow = remoteUrl || !(d.data || d.localRef || d.localName)
const hasLocalSrc = !!(d.data || d.localRef || d.localName) || (!!d.url && !remoteUrl)
const showUrlRow = remoteUrl || !hasLocalSrc
const commitRefUrl = (event) => {
const root = event && event.currentTarget && event.currentTarget.closest ? event.currentTarget.closest('.iwb-ref-body') : null
const input = root && root.querySelector('.iwb-ref-url-input')