diff --git a/src/app/components/message/RenderBody.tsx b/src/app/components/message/RenderBody.tsx index c06e86cf..67b90522 100644 --- a/src/app/components/message/RenderBody.tsx +++ b/src/app/components/message/RenderBody.tsx @@ -1,4 +1,4 @@ -import { MouseEventHandler, ReactNode, useEffect, useState } from 'react'; +import { MouseEventHandler, useEffect, useState } from 'react'; import parse, { HTMLReactParserOptions } from 'html-react-parser'; import Linkify from 'linkify-react'; import { Opts } from 'linkifyjs'; @@ -66,9 +66,9 @@ function AbbreviationTerm({ text, definition }: AbbreviationTermProps) { */ export function buildAbbrReplaceTextNode( abbrMap: Map -): ((text: string) => ReactNode | undefined) | undefined { +): ((text: string) => JSX.Element | undefined) | undefined { if (abbrMap.size === 0) return undefined; - return (text: string) => { + return function replaceTextNode(text: string) { const segments = splitByAbbreviations(text, abbrMap); if (!segments.some((s) => s.termKey !== undefined)) return undefined; return ( diff --git a/src/app/features/room/ThreadDrawer.tsx b/src/app/features/room/ThreadDrawer.tsx index 6a25109f..b662d2ab 100644 --- a/src/app/features/room/ThreadDrawer.tsx +++ b/src/app/features/room/ThreadDrawer.tsx @@ -408,7 +408,16 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra nicknames, replaceTextNode: buildAbbrReplaceTextNode(abbrMap), }), - [mx, room, linkifyOpts, spoilerClickHandler, mentionClickHandler, useAuthentication, nicknames, abbrMap] + [ + mx, + room, + linkifyOpts, + spoilerClickHandler, + mentionClickHandler, + useAuthentication, + nicknames, + abbrMap, + ] ); // Power levels & permissions diff --git a/src/app/plugins/react-custom-html-parser.tsx b/src/app/plugins/react-custom-html-parser.tsx index 8cc10197..96885048 100644 --- a/src/app/plugins/react-custom-html-parser.tsx +++ b/src/app/plugins/react-custom-html-parser.tsx @@ -351,7 +351,7 @@ export const getReactCustomHtmlParser = ( useAuthentication?: boolean; nicknames?: Nicknames; autoplayEmojis?: boolean; - replaceTextNode?: (text: string) => ReactNode | undefined; + replaceTextNode?: (text: string) => JSX.Element | undefined; } ): HTMLReactParserOptions => { const { replaceTextNode } = params;