From 50e3e21634b96fbd7e961bc2b1a9c51f83d7ffef Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Fri, 24 Oct 2025 21:21:12 +0800 Subject: [PATCH] =?UTF-8?q?ui:=20=E5=AF=B9=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E7=9A=84=E7=BA=AF=E6=96=87=E4=BB=B6=E6=B6=88=E6=81=AF=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E6=98=BE=E7=A4=BA=E4=BC=98=E5=8C=96=20*=20=E5=94=89?= =?UTF-8?q?=E5=A4=AA=E9=9A=BE=E5=BC=84=E4=BA=86,=20=E9=82=A3=E8=BE=B9?= =?UTF-8?q?=E8=B7=9D=E5=8F=AF=E5=A4=AA=E6=81=90=E6=80=96=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ui/chat/Message.tsx | 17 +++++++++++++++-- client/ui/chat/SystemMessage.tsx | 8 ++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/client/ui/chat/Message.tsx b/client/ui/chat/Message.tsx index f7d29b9..10db6e6 100644 --- a/client/ui/chat/Message.tsx +++ b/client/ui/chat/Message.tsx @@ -44,6 +44,17 @@ export default function Message({ userId, rawData, renderHTML, message, openUser const [isDropDownOpen, setDropDownOpen] = React.useState(false) + const [isUsingFullDisplay, setIsUsingFullDisplay] = React.useState(false) + + React.useEffect(() => { + const text = $(dropDownRef.current as HTMLElement).find('#msg').text().trim() + console.log(renderHTML) + setIsUsingFullDisplay(text == '' || ( + rawData.split("tws:\/\/file\?hash=").length == 2 + && /\<\/chat\-(file|image|video)\>(\<\/span\>)?$/.test(renderHTML.trim()) + )) + }, [renderHTML]) + return (
- + { // @ts-ignore 这是可以正常工作的 diff --git a/client/ui/chat/SystemMessage.tsx b/client/ui/chat/SystemMessage.tsx index d3ada3b..ea87fd6 100644 --- a/client/ui/chat/SystemMessage.tsx +++ b/client/ui/chat/SystemMessage.tsx @@ -11,10 +11,10 @@ export default function SystemMessage({ children }: React.HTMLAttributes {children}