From 9e8c9bc5084497a048709ca292f9ad16c35e5178 Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Sun, 16 Nov 2025 22:06:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20chat-mention=20=E8=A2=AB=E6=B6=88?= =?UTF-8?q?=E5=8E=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ui/chat/ChatFragment.tsx | 4 ++-- client/ui/chat/Message.tsx | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/ui/chat/ChatFragment.tsx b/client/ui/chat/ChatFragment.tsx index 9f17fa1..726526c 100644 --- a/client/ui/chat/ChatFragment.tsx +++ b/client/ui/chat/ChatFragment.tsx @@ -85,9 +85,9 @@ const markedInstance = new marked.Marked({ } else switch (type) { case "UserMention": - return `` + return `PH` case "ChatMention": - return `` + return `PH` } return `(不支持的附件语法: ![${text}](${href}))` }, diff --git a/client/ui/chat/Message.tsx b/client/ui/chat/Message.tsx index a4f174c..024b8a8 100644 --- a/client/ui/chat/Message.tsx +++ b/client/ui/chat/Message.tsx @@ -33,8 +33,9 @@ function prettyFlatParsedMessage(html: string) { ] function checkContinuousElement(tagName: string) { if (lastElementType != tagName) { - console.log(lastElementType, ls.map((v) => v.innerHTML)) if (textElementTags.indexOf(lastElementType) != -1) { + // 由于 chat-mention 不是用内部元素实现的, 因此在这个元素的生成中必须放置占位字符串 + // 尽管显示上占位字符串不会显示, 但是在这里依然是会被处理的, 因为本身还是 innerHTML if (ls.map((v) => v.innerHTML).join('').trim() != '') ret += `${ls.map((v) => v.outerHTML).join('')}` } else