MentionNode: truncate Nostr usernames

This commit is contained in:
Alex Gleason 2023-10-13 17:37:11 -05:00
parent f6d60c243a
commit 622692fe4d
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -9,6 +9,7 @@ import { $applyNodeReplacement, DecoratorNode } from 'lexical';
import React from 'react';
import { Tooltip } from 'soapbox/components/ui';
import { isPubkey } from 'soapbox/utils/nostr';
import type {
EditorConfig,
@ -87,7 +88,7 @@ class MentionNode extends DecoratorNode<JSX.Element> {
type='button'
dir='ltr'
>
@{username}
@{isPubkey(username) ? username.slice(0, 8) : username}
</button>
</Tooltip>
);