From f628cd73b0b828832aa0cd99bf9cabb917f360c0 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 25 Sep 2023 13:30:52 -0500 Subject: [PATCH] MentionPlugin: use a simpler regex, fix double-@ mentions Fixes https://gitlab.com/soapbox-pub/soapbox/-/issues/1530 --- src/features/compose/editor/plugins/mention-plugin.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/compose/editor/plugins/mention-plugin.tsx b/src/features/compose/editor/plugins/mention-plugin.tsx index 51c7b98b6..4a9df94d0 100644 --- a/src/features/compose/editor/plugins/mention-plugin.tsx +++ b/src/features/compose/editor/plugins/mention-plugin.tsx @@ -12,7 +12,7 @@ import { $createMentionNode, MentionNode } from '../nodes/mention-node'; import type { TextNode } from 'lexical'; -const MENTION_REGEX = /(?:^|\s)@(?:[a-z\d_-]+(?:@[^@\s]+)?)/i; +const MENTION_REGEX = /(?:^|\s)@[^\s]+/i; const MentionPlugin = (): JSX.Element | null => { const [editor] = useLexicalComposerContext();