15m44o 双向同步补全: 管理员回复/完结/驳回同步GitHub + @gh附件渲染修复
This commit is contained in:
+8
-2
@@ -4106,14 +4106,20 @@ if ($currentVersion !== $BUILD_VERSION) {
|
||||
function applyTicketImgs(desc, images) {
|
||||
let out = String(desc || '');
|
||||
if (!images || !images.length) return out;
|
||||
// ★ 15m44n: 渲染项 —— http(s)=真实图床图片; @gh:=GitHub 模式附件占位(只显示文件名,不当图片渲染)
|
||||
const imgItem = function(u) {
|
||||
return (typeof u === 'string' && u.indexOf('@gh:') === 0)
|
||||
? ('📎 ' + u.replace('@gh:', '').replace(/附件图\d+:/, '')) // @gh:附件图1:name.png → 📎 name.png
|
||||
: '';
|
||||
};
|
||||
const used = new Array(images.length).fill(false);
|
||||
out = out.replace(/\[图片(\d+)\]/g, function(m, n) {
|
||||
const i = parseInt(n, 10) - 1;
|
||||
if (i >= 0 && i < images.length && !used[i]) { used[i] = true; return ''; }
|
||||
if (i >= 0 && i < images.length && !used[i]) { used[i] = true; return imgItem(images[i]); }
|
||||
return m;
|
||||
});
|
||||
const left = images.filter(function(u, k) { return !used[k]; });
|
||||
if (left.length) out += (out ? '\n\n' : '') + left.map(function(u) { return ''; }).join('\n\n');
|
||||
if (left.length) out += (out ? '\n\n' : '') + left.map(imgItem).join('\n\n');
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user