From 2492bfa95675e84e1f7f684e1b901f69dfc6483c Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Thu, 19 Oct 2023 10:58:48 +0530 Subject: [PATCH] display room mention text as they were sent --- src/app/components/editor/input.ts | 2 +- src/app/plugins/react-custom-html-parser.tsx | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/app/components/editor/input.ts b/src/app/components/editor/input.ts index 37aa7244..91386a87 100644 --- a/src/app/components/editor/input.ts +++ b/src/app/components/editor/input.ts @@ -74,7 +74,7 @@ const elementToInlineNode = (node: Element): MentionElement | EmoticonElement | if (typeof href !== 'string') return undefined; const [mxId] = parseMatrixToUrl(href); if (mxId) { - return createMentionElement(mxId, mxId, false); + return createMentionElement(mxId, parseNodeText(node) || mxId, false); } } return undefined; diff --git a/src/app/plugins/react-custom-html-parser.tsx b/src/app/plugins/react-custom-html-parser.tsx index aba5997d..09f09d8f 100644 --- a/src/app/plugins/react-custom-html-parser.tsx +++ b/src/app/plugins/react-custom-html-parser.tsx @@ -180,10 +180,7 @@ export const getReactCustomHtmlParser = ( mentionPrefix === '#' ? getRoomWithCanonicalAlias(mx, mentionId) : mx.getRoom(mentionId); - const mentionName = mentionRoom?.name; - const mentionDisplayName = - mentionName && (mentionName.startsWith('#') ? mentionName : `#${mentionName}`); return ( <span {...props} @@ -198,7 +195,7 @@ export const getReactCustomHtmlParser = ( onClick={params.handleMentionClick} style={{ cursor: 'pointer' }} > - {mentionDisplayName ?? mentionId} + {domToReact(children, opts)} </span> ); }