diff --git a/src/gallery/classroom/hx-chat/fcr-chatroom/container/mobile/components/message-list/index.tsx b/src/gallery/classroom/hx-chat/fcr-chatroom/container/mobile/components/message-list/index.tsx index 3206e9d..689cc7f 100644 --- a/src/gallery/classroom/hx-chat/fcr-chatroom/container/mobile/components/message-list/index.tsx +++ b/src/gallery/classroom/hx-chat/fcr-chatroom/container/mobile/components/message-list/index.tsx @@ -253,14 +253,6 @@ const TextMessage = observer(({ message, lastMsg }: { message: AgoraIMMessageBas const isPrivate = checkIsPrivateMessage(textMessage); - //替换内容中的超链接 - const replaceContentToLink = (text: string | null): string => { - const urlRegex = /((https?:\/\/|www\.)[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*))/g; - return text ? text.replace(urlRegex, (match, url) => { - return `${url}`; - }) : ""; - } - const isHidden = lastMsg?.from == textMessage?.from && ( (checkIsPrivateMessage(textMessage) && (lastMsg?.ext && lastMsg?.ext?.receiverList?.length > 0)) && (lastMsg?.type != 'custom') && (typeof lastMsg !== 'string') || (!checkIsPrivateMessage(textMessage) && ((lastMsg?.ext && lastMsg?.ext?.receiverList?.length == 0) || (message.ext?.role === lastMsg?.ext?.role)) && (lastMsg?.type != 'custom') && (typeof lastMsg !== 'string'))); @@ -294,7 +286,18 @@ const TextMessage = observer(({ message, lastMsg }: { message: AgoraIMMessageBas )} } -
+
+ {splitTextAndUrls(textMessage.msg).map((text) => { + const isUrl = urlRegex.test(text); + return isUrl ? ( + + {text} + + ) : ( + text + ); + })} +
{/* {messageFromAlias}: */} } @@ -316,7 +319,18 @@ const TextMessage = observer(({ message, lastMsg }: { message: AgoraIMMessageBas )} } -
+
+ {splitTextAndUrls(textMessage.msg).map((text) => { + const isUrl = urlRegex.test(text); + return isUrl ? ( + + {text} + + ) : ( + text + ); + })} +
)} {!isSelfMessage && (isPrivate || (!isPrivate && isBreakOutRoomEnabled && isBreakOutRoomIn)) && ( @@ -341,7 +355,18 @@ const TextMessage = observer(({ message, lastMsg }: { message: AgoraIMMessageBas )} } -
+
+ {splitTextAndUrls(textMessage.msg).map((text) => { + const isUrl = urlRegex.test(text); + return isUrl ? ( + + {text} + + ) : ( + text + ); + })} +
)}