display room mention text as they were sent

This commit is contained in:
Ajay Bura 2023-10-19 10:58:48 +05:30
parent 11ba1808a2
commit 2492bfa956
2 changed files with 2 additions and 5 deletions
src/app
components/editor
plugins

View file

@ -74,7 +74,7 @@ const elementToInlineNode = (node: Element): MentionElement | EmoticonElement |
if (typeof href !== 'string') return undefined; if (typeof href !== 'string') return undefined;
const [mxId] = parseMatrixToUrl(href); const [mxId] = parseMatrixToUrl(href);
if (mxId) { if (mxId) {
return createMentionElement(mxId, mxId, false); return createMentionElement(mxId, parseNodeText(node) || mxId, false);
} }
} }
return undefined; return undefined;

View file

@ -180,10 +180,7 @@ export const getReactCustomHtmlParser = (
mentionPrefix === '#' mentionPrefix === '#'
? getRoomWithCanonicalAlias(mx, mentionId) ? getRoomWithCanonicalAlias(mx, mentionId)
: mx.getRoom(mentionId); : mx.getRoom(mentionId);
const mentionName = mentionRoom?.name;
const mentionDisplayName =
mentionName && (mentionName.startsWith('#') ? mentionName : `#${mentionName}`);
return ( return (
<span <span
{...props} {...props}
@ -198,7 +195,7 @@ export const getReactCustomHtmlParser = (
onClick={params.handleMentionClick} onClick={params.handleMentionClick}
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer' }}
> >
{mentionDisplayName ?? mentionId} {domToReact(children, opts)}
</span> </span>
); );
} }