@@ -12,7 +12,9 @@ import { useTranslationContext } from '../../context/TranslationContext';
1212
1313import type { TranslationLanguages } from 'stream-chat' ;
1414import type { StreamMessage } from '../../context/ChannelStateContext' ;
15+ import type { MessageContextValue } from '../../context' ;
1516import type { DefaultStreamChatGenerics } from '../../types/types' ;
17+ import { renderText as defaultRenderText } from '../Message' ;
1618
1719export const QuotedMessagePreviewHeader = <
1820 StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
@@ -41,12 +43,14 @@ export type QuotedMessagePreviewProps<
4143 StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
4244> = {
4345 quotedMessage : StreamMessage < StreamChatGenerics > ;
46+ renderText ?: MessageContextValue < StreamChatGenerics > [ 'renderText' ] ;
4447} ;
4548
4649export const QuotedMessagePreview = <
4750 StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
4851> ( {
4952 quotedMessage,
53+ renderText = defaultRenderText ,
5054} : QuotedMessagePreviewProps < StreamChatGenerics > ) => {
5155 const { client } = useChatContext ( ) ;
5256 const { Attachment = DefaultAttachment , Avatar = DefaultAvatar } =
@@ -57,6 +61,11 @@ export const QuotedMessagePreview = <
5761 quotedMessage . i18n ?. [ `${ userLanguage } _text` as `${TranslationLanguages } _text`] ||
5862 quotedMessage . text ;
5963
64+ const renderedText = useMemo (
65+ ( ) => renderText ( quotedMessageText , quotedMessage . mentioned_users ) ,
66+ [ quotedMessage . mentioned_users , quotedMessageText , renderText ] ,
67+ ) ;
68+
6069 const quotedMessageAttachment = useMemo ( ( ) => {
6170 const [ attachment ] = quotedMessage . attachments ?? [ ] ;
6271 return attachment ? [ attachment ] : [ ] ;
@@ -91,7 +100,7 @@ export const QuotedMessagePreview = <
91100 className = 'str-chat__quoted-message-text'
92101 data-testid = 'quoted-message-text'
93102 >
94- < p > { quotedMessageText } </ p >
103+ { renderedText }
95104 </ div >
96105 </ >
97106 ) }
0 commit comments