mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-20 05:41:36 +00:00
[Glitch] Emoji: Statuses
Port 0c1ca6c969 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -83,14 +83,15 @@ export const HandledLink: FC<HandledLinkProps & ComponentProps<'a'>> = ({
|
||||
|
||||
export const useElementHandledLink = ({
|
||||
hashtagAccountId,
|
||||
mentionAccountId,
|
||||
hrefToMentionAccountId,
|
||||
}: {
|
||||
hashtagAccountId?: string;
|
||||
mentionAccountId?: string;
|
||||
hrefToMentionAccountId?: (href: string) => string | undefined;
|
||||
} = {}) => {
|
||||
const onElement = useCallback<OnElementHandler>(
|
||||
(element, { key, ...props }) => {
|
||||
if (element instanceof HTMLAnchorElement) {
|
||||
const mentionId = hrefToMentionAccountId?.(element.href);
|
||||
return (
|
||||
<HandledLink
|
||||
{...props}
|
||||
@@ -98,13 +99,13 @@ export const useElementHandledLink = ({
|
||||
href={element.href}
|
||||
text={element.innerText}
|
||||
hashtagAccountId={hashtagAccountId}
|
||||
mentionAccountId={mentionAccountId}
|
||||
mentionAccountId={mentionId}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
[hashtagAccountId, mentionAccountId],
|
||||
[hashtagAccountId, hrefToMentionAccountId],
|
||||
);
|
||||
return { onElement };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user