fix: 音频 ♫ 符号溢出到 prompt 文本 — 改用 CSS ::before 渲染

createMentionSpan 里音频的 ♫ 之前用 textContent 设置,
被 extractText() 的 el.textContent 读进了 prompt 纯文本,
导致 renderPromptWithMentions 匹配后留下额外的 ♫ 字符。

改用 CSS ::before content 渲染,不参与 textContent,
prompt 里不再有多余的 ♫。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
seaislee1209 2026-04-04 22:17:07 +08:00
parent 5da67435b2
commit 4b2dd9ef5e
2 changed files with 14 additions and 2 deletions

View File

@ -46,6 +46,18 @@
transition: background 0.15s, opacity 0.15s;
}
.mentionAudioIcon {
display: inline-block;
margin-right: 3px;
font-size: 13px;
vertical-align: middle;
pointer-events: none;
}
.mentionAudioIcon::before {
content: '\266B'; /* ♫ rendered via CSS, not textContent — avoids polluting prompt text */
}
.mentionImg {
width: 16px;
height: 16px;

View File

@ -88,8 +88,8 @@ export function PromptInput() {
const isAudio = opts.refType === 'audio' || opts.assetType === 'Audio';
if (isAudio) {
const icon = document.createElement('span');
icon.textContent = '\u266B';
icon.style.cssText = 'margin-right:3px;font-size:13px;vertical-align:middle;pointer-events:none';
icon.className = styles.mentionAudioIcon;
icon.setAttribute('aria-hidden', 'true');
span.appendChild(icon);
} else if (opts.thumbUrl) {
const img = document.createElement('img');