修复合并对话消息导致的右键菜单报错问题

This commit is contained in:
CrescentLeaf
2026-01-09 22:46:14 +08:00
parent 922791a0f5
commit 687088a284
4 changed files with 11 additions and 6 deletions

View File

@@ -84,7 +84,7 @@ export default function DialogContextWrapper({ children, useRef }: { children: R
setCurrentSelectedChatId('')
}
}}>
{<ChatFragmentDialog chatId={currentSelectedChatId} useRef={chatFragmentDialogRef} />}
<ChatFragmentDialog chatId={currentSelectedChatId} useRef={chatFragmentDialogRef} />
<UserOrChatInfoDialog chat={userOrChatInfoDialogState[userOrChatInfoDialogState.length - 1] || lastUserOrChatInfoDialogStateRef.current} useRef={userOrChatInfoDialogRef} />
<EditMyProfileDialog useRef={editMyProfileDialogRef} />
<AddFavourtieChatDialog useRef={addFavouriteChatDialogRef} />

View File

@@ -77,13 +77,13 @@ export default function ChatFragment({
display: "flex",
flexDirection: "column",
}}>
{/* {
{
openedInDialog && <mdui-button-icon icon="arrow_back" onClick={() => AppState.closeChat()} style={{
alignSelf: 'center',
marginLeft: '5px',
marginRight: '5px',
}}></mdui-button-icon>
} */}
}
<mdui-tabs ref={tabRef} value={tabItemSelected} style={{
position: 'sticky',
display: "flex",
@@ -105,6 +105,8 @@ export default function ChatFragment({
<div style={{
flexGrow: '1',
}}></div>
{
/*
<mdui-button-icon icon="open_in_new" onClick={() => {
window.open('/chat?id=' + chatInfo.getId(), '_blank')
}} style={{
@@ -112,6 +114,8 @@ export default function ChatFragment({
marginLeft: '5px',
marginRight: '5px',
}}></mdui-button-icon>
*/
}
<mdui-button-icon icon="refresh" onClick={() => {
}} style={{

View File

@@ -170,10 +170,9 @@ export default function ChatMessage({ message, noUserDisplay, avatarMenuItems, m
flexDirection: "column"
}}>
{
!noUserDisplay &&
<div
style={{
display: "flex",
display: noUserDisplay ? "none" : "flex",
justifyContent: isAtRight ? "flex-end" : "flex-start",
}}>
{

View File

@@ -1,7 +1,9 @@
import * as React from 'react'
export default function useEventListener<T extends HTMLElement | undefined | null>(ref: React.MutableRefObject<T>, eventName: string, callback: (event: Event) => void) {
// console.error(ref, eventName, callback)
React.useEffect(() => {
// console.warn(ref, eventName, callback)
ref.current!.addEventListener(eventName, callback)
return () => ref.current?.removeEventListener(eventName, callback)
}, [ref, eventName, callback])