diff --git a/surfsense_web/components/chat-comments/comment-composer/comment-composer.tsx b/surfsense_web/components/chat-comments/comment-composer/comment-composer.tsx index 657cfcade..2ddfb300b 100644 --- a/surfsense_web/components/chat-comments/comment-composer/comment-composer.tsx +++ b/surfsense_web/components/chat-comments/comment-composer/comment-composer.tsx @@ -205,11 +205,11 @@ export function CommentComposer({ // Pre-populate insertedMentions from initialValue when members are loaded useEffect(() => { if (mentionsInitialized || !initialValue || members.length === 0) return; - + const mentionPattern = /@([^\s@]+(?:\s+[^\s@]+)*?)(?=\s|$|[.,!?;:]|@)/g; const foundMentions: InsertedMention[] = []; let match: RegExpExecArray | null; - + while ((match = mentionPattern.exec(initialValue)) !== null) { const displayName = match[1]; const member = members.find( @@ -222,7 +222,7 @@ export function CommentComposer({ } } } - + if (foundMentions.length > 0) { setInsertedMentions(foundMentions); } @@ -239,7 +239,11 @@ export function CommentComposer({ return (