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

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('') setCurrentSelectedChatId('')
} }
}}> }}>
{<ChatFragmentDialog chatId={currentSelectedChatId} useRef={chatFragmentDialogRef} />} <ChatFragmentDialog chatId={currentSelectedChatId} useRef={chatFragmentDialogRef} />
<UserOrChatInfoDialog chat={userOrChatInfoDialogState[userOrChatInfoDialogState.length - 1] || lastUserOrChatInfoDialogStateRef.current} useRef={userOrChatInfoDialogRef} /> <UserOrChatInfoDialog chat={userOrChatInfoDialogState[userOrChatInfoDialogState.length - 1] || lastUserOrChatInfoDialogStateRef.current} useRef={userOrChatInfoDialogRef} />
<EditMyProfileDialog useRef={editMyProfileDialogRef} /> <EditMyProfileDialog useRef={editMyProfileDialogRef} />
<AddFavourtieChatDialog useRef={addFavouriteChatDialogRef} /> <AddFavourtieChatDialog useRef={addFavouriteChatDialogRef} />

View File

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

View File

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

View File

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