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> ); }