From 9725320aa6fd72492c13f2e98de44ae842cf10e7 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 4 Mar 2024 21:32:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=BB=9A=E5=8A=A8;=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A2=84=E8=A7=88,=20=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/msgUtils.js | 2 ++ src/views/Conversations/Components/Messages.jsx | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/msgUtils.js b/src/lib/msgUtils.js index de9f751..7106650 100644 --- a/src/lib/msgUtils.js +++ b/src/lib/msgUtils.js @@ -48,6 +48,7 @@ const mediaMsg = { ...(msg.context ? { reply: { + id: msg.message_origin.id, message: msg.message_origin.text, title: msg.message_origin.senderName || 'Reference', titleColor: msg.message_origin?.senderName !== 'me' ? '#a791ff' : '#128c7e', @@ -76,6 +77,7 @@ export const sentMsgTypeMapped = { ...(msg.context ? { reply: { + id: msg.message_origin.id, message: msg.message_origin.text, title: msg.message_origin.senderName || 'Reference', titleColor: msg.message_origin?.senderName !== 'me' ? '#a791ff' : '#128c7e', diff --git a/src/views/Conversations/Components/Messages.jsx b/src/views/Conversations/Components/Messages.jsx index 1f6a3ce..2e64da0 100644 --- a/src/views/Conversations/Components/Messages.jsx +++ b/src/views/Conversations/Components/Messages.jsx @@ -1,5 +1,5 @@ import { useEffect, useState, useRef, useMemo, memo, createRef, forwardRef } from 'react'; -import { Image, Spin, Dropdown } from 'antd'; +import { Image, Spin, Dropdown, Button } from 'antd'; import { DownOutlined } from '@ant-design/icons'; import { MessageBox } from 'react-chat-elements'; import useConversationStore from '@/stores/ConversationStore'; @@ -17,7 +17,7 @@ const Messages = () => { const scrollToMessage = (id, index) => { const _i = index || activeMessages.findIndex((msg) => msg.id === id); if (_i >= 0) { - messageRefs.current[_i].current.scrollIntoView({ behavior: "smooth", block: "start" }); + messageRefs.current[_i].current.scrollIntoView({ behavior: "smooth", block: "center" }); } } @@ -115,13 +115,15 @@ const Messages = () => { } : { replyButton: ['text'].includes(message.whatsapp_msg_type) ? true : false, + className: 'whitespace-pre-wrap', })} /> // ))} - + + ); };