From 0b675dfc3b383e8b1e9873e0bf8d1b1bc85d28b0 Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Mon, 19 Jan 2026 14:37:45 +0200 Subject: [PATCH] feat(web): improve comment editing and mention rendering --- .../comment-composer/comment-composer.tsx | 12 +++++--- .../comment-item/comment-item.tsx | 2 +- .../chat-comments/comment-item/types.ts | 7 ++++- .../comment-thread/comment-thread.tsx | 29 +++++++++---------- 4 files changed, 29 insertions(+), 21 deletions(-) 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 (
- !open && closeMentionPicker()} modal={false}> + !open && closeMentionPicker()} + modal={false} + >