From 4b2dd9ef5e4077fae49a00832c5263cd62d63652 Mon Sep 17 00:00:00 2001 From: seaislee1209 Date: Sat, 4 Apr 2026 22:17:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=9F=B3=E9=A2=91=20=E2=99=AB=20?= =?UTF-8?q?=E7=AC=A6=E5=8F=B7=E6=BA=A2=E5=87=BA=E5=88=B0=20prompt=20?= =?UTF-8?q?=E6=96=87=E6=9C=AC=20=E2=80=94=20=E6=94=B9=E7=94=A8=20CSS=20::b?= =?UTF-8?q?efore=20=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit createMentionSpan 里音频的 ♫ 之前用 textContent 设置, 被 extractText() 的 el.textContent 读进了 prompt 纯文本, 导致 renderPromptWithMentions 匹配后留下额外的 ♫ 字符。 改用 CSS ::before content 渲染,不参与 textContent, prompt 里不再有多余的 ♫。 Co-Authored-By: Claude Opus 4.6 (1M context) --- web/src/components/PromptInput.module.css | 12 ++++++++++++ web/src/components/PromptInput.tsx | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/web/src/components/PromptInput.module.css b/web/src/components/PromptInput.module.css index 4cc6023..a1dbaec 100644 --- a/web/src/components/PromptInput.module.css +++ b/web/src/components/PromptInput.module.css @@ -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; diff --git a/web/src/components/PromptInput.tsx b/web/src/components/PromptInput.tsx index 21d1ea0..834e016 100644 --- a/web/src/components/PromptInput.tsx +++ b/web/src/components/PromptInput.tsx @@ -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');