fix(ref): 网络图保留 URL 输入行(缓存成 localRef 后仍可改链接)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m5s

This commit is contained in:
qiqi committed 2026-12-04 15:25:09 +08:00
1 parent ab15ea3a93
commit c8a332fdac
3 files changed
+15 -7

No files matched your search

+4 -1
View File
@@ -11,6 +11,7 @@ const fs = require('fs')
const path = require('path')
const root = path.resolve(__dirname, '..')
const read = (p) => fs.readFileSync(path.join(root, p), 'utf8')
const body = read('src/ui-node-bodies.js')
let fail = 0
const ok = (cond, msg) => { if (cond) console.log(' PASS ' + msg); else { fail++; console.error(' FAIL ' + msg) } }
@@ -36,7 +37,9 @@ ok(read('src/image-display-thumb.js').indexOf('^https?:') >= 0 && read('src/imag
ok(/上传到图库(转成在线链接)/.test(app) && /IWBRefUpload/.test(app), 'ref 气泡提供「上传到图库」')
ok(/aria-label': '替换'[\s\S]{0,200}I\('ref'\)/.test(app) && /aria-label': '上传到图库'[\s\S]{0,400}I\('upload'\)/.test(app), '气泡图标已对调:替换=ref(图片+号)、上传图库=upload(箭头)')
ok(!/'aria-label': '改名'/.test(app), '气泡不再显示改名按钮(F2/双击标题/右键仍可改名)')
ok(/d\.localName\) \? null : el\('div', \{ className: 'iwb-ref-url-row'/.test(read('src/ui-node-bodies.js')), '本地图片完全不渲染 URL 输入行(仅空节点/纯网络图有)')
ok(body.indexOf("const showUrlRow = remoteUrl || !(d.data || d.localRef || d.localName)") >= 0, '网络图即使已被缓存成 localRef 也保留 URL 输入行;本地图不渲染')
ok(body.indexOf("showUrlRow ? el('div', { className: 'iwb-ref-url-row' }") >= 0, 'URL 输入行由 showUrlRow 决定(不再是「有本地数据就藏」)')
ok(body.indexOf("/^https?:\\/\\//i.test(d.url)") >= 0, '来源判定:url 以 http(s) 开头即网络图')
ok(/runtime-ref-upload\.js/.test(read('scripts/build.js')), 'ref-upload 模块已进构建清单')
ok(/async function wRustFetchBlob \(url\)/.test(app), '宿主提供统一 Rust 取字节入口 wRustFetchBlob')
ok(/wRustFetchBlob\(fkEarly\)/.test(app) && /wRustFetchBlob\(su\)/.test(app), 'storeOutputThumb / downloadUrl 走系统网络栈兜底')