Restore mention link behavior
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
92876dfe02
commit
9de78cb69b
1 changed files with 14 additions and 2 deletions
|
@ -2,6 +2,7 @@ import clsx from 'clsx';
|
||||||
import parse, { Element, type HTMLReactParserOptions, domToReact, type DOMNode } from 'html-react-parser';
|
import parse, { Element, type HTMLReactParserOptions, domToReact, type DOMNode } from 'html-react-parser';
|
||||||
import React, { useState, useRef, useLayoutEffect, useMemo } from 'react';
|
import React, { useState, useRef, useLayoutEffect, useMemo } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import Icon from 'soapbox/components/icon';
|
import Icon from 'soapbox/components/icon';
|
||||||
import { onlyEmoji as isOnlyEmoji } from 'soapbox/utils/rich-content';
|
import { onlyEmoji as isOnlyEmoji } from 'soapbox/utils/rich-content';
|
||||||
|
@ -9,8 +10,8 @@ import { onlyEmoji as isOnlyEmoji } from 'soapbox/utils/rich-content';
|
||||||
import { getTextDirection } from '../utils/rtl';
|
import { getTextDirection } from '../utils/rtl';
|
||||||
|
|
||||||
import HashtagLink from './hashtag-link';
|
import HashtagLink from './hashtag-link';
|
||||||
|
import HoverRefWrapper from './hover-ref-wrapper';
|
||||||
import Markup from './markup';
|
import Markup from './markup';
|
||||||
import Mention from './mention';
|
|
||||||
import Poll from './polls/poll';
|
import Poll from './polls/poll';
|
||||||
|
|
||||||
import type { Sizes } from 'soapbox/components/ui/text/text';
|
import type { Sizes } from 'soapbox/components/ui/text/text';
|
||||||
|
@ -105,7 +106,18 @@ const StatusContent: React.FC<IStatusContent> = React.memo(({
|
||||||
if (classes?.includes('mention')) {
|
if (classes?.includes('mention')) {
|
||||||
const mention = status.mentions.find(({ url }) => domNode.attribs.href === url);
|
const mention = status.mentions.find(({ url }) => domNode.attribs.href === url);
|
||||||
if (mention) {
|
if (mention) {
|
||||||
return <Mention mention={mention} />;
|
return (
|
||||||
|
<HoverRefWrapper accountId={mention.id} inline>
|
||||||
|
<Link
|
||||||
|
to={`/@${mention.acct}`}
|
||||||
|
className='text-primary-600 hover:underline dark:text-accent-blue'
|
||||||
|
dir='ltr'
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
@{mention.username}
|
||||||
|
</Link>
|
||||||
|
</HoverRefWrapper>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue