mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-02-13 17:10:06 +00:00
display room mention text as they were sent
This commit is contained in:
parent
11ba1808a2
commit
2492bfa956
src/app
|
@ -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;
|
||||||
|
|
|
@ -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>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue