diff --git a/ts/components/conversation/AtMention.tsx b/ts/components/conversation/AtMention.tsx index 873dcbe32b20..7129e5d59461 100644 --- a/ts/components/conversation/AtMention.tsx +++ b/ts/components/conversation/AtMention.tsx @@ -10,6 +10,7 @@ export function AtMention({ direction, id, isInvisible, + isStrikethrough, name, onClick, onKeyUp, @@ -17,10 +18,23 @@ export function AtMention({ direction: 'incoming' | 'outgoing' | undefined; id: string; isInvisible: boolean; + isStrikethrough?: boolean; name: string; onClick: () => void; onKeyUp: KeyboardEventHandler; }): JSX.Element { + const textElement = ( + <> + @ + + + ); + const formattedTextElement = isStrikethrough ? ( + {textElement} + ) : ( + textElement + ); + if (isInvisible) { return ( - - @ - - + {formattedTextElement} ); } @@ -52,10 +63,7 @@ export function AtMention({ data-id={id} data-title={name} > - - @ - - + {formattedTextElement} ); } diff --git a/ts/components/conversation/MessageTextRenderer.tsx b/ts/components/conversation/MessageTextRenderer.tsx index f815a66bb48e..bb233ead86b2 100644 --- a/ts/components/conversation/MessageTextRenderer.tsx +++ b/ts/components/conversation/MessageTextRenderer.tsx @@ -240,7 +240,7 @@ function renderNode({ isInvisible, mentions: node.mentions, onMentionTrigger, - text: node.text, + node, }); // We use separate elements for these because we want screenreaders to understand them @@ -287,18 +287,19 @@ function renderMentions({ emojiSizeClass, isInvisible, mentions, + node, onMentionTrigger, - text, }: { + direction: 'incoming' | 'outgoing' | undefined; + disableLinks: boolean; emojiSizeClass: SizeClassType | undefined; isInvisible: boolean; mentions: ReadonlyArray; - text: string; - disableLinks: boolean; - direction: 'incoming' | 'outgoing' | undefined; + node: DisplayNode; onMentionTrigger: ((conversationId: string) => void) | undefined; }): ReactElement { const result: Array = []; + const { text } = node; let offset = 0; @@ -323,6 +324,7 @@ function renderMentions({ disableLinks, direction, name: mention.replacementText, + node, onMentionTrigger, }) ); @@ -345,19 +347,21 @@ function renderMentions({ function renderMention({ conversationId, - name, + direction, + disableLinks, isInvisible, key, - disableLinks, - direction, + name, + node, onMentionTrigger, }: { conversationId: string; - name: string; + direction: 'incoming' | 'outgoing' | undefined; + disableLinks: boolean; isInvisible: boolean; key: string; - disableLinks: boolean; - direction: 'incoming' | 'outgoing' | undefined; + name: string; + node: DisplayNode; onMentionTrigger: ((conversationId: string) => void) | undefined; }): ReactElement { if (disableLinks) { @@ -374,6 +378,7 @@ function renderMention({ key={key} id={conversationId} isInvisible={isInvisible} + isStrikethrough={node.isStrikethrough} name={name} direction={direction} onClick={() => {