mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 08:46:22 +02:00
feat(web): improve comment editing and mention rendering
This commit is contained in:
parent
f008acecfc
commit
0b675dfc3b
4 changed files with 29 additions and 21 deletions
|
|
@ -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 (
|
||||
<div className="flex flex-col gap-2">
|
||||
<Popover open={mentionState.isActive} onOpenChange={(open) => !open && closeMentionPicker()} modal={false}>
|
||||
<Popover
|
||||
open={mentionState.isActive}
|
||||
onOpenChange={(open) => !open && closeMentionPicker()}
|
||||
modal={false}
|
||||
>
|
||||
<PopoverAnchor asChild>
|
||||
<Textarea
|
||||
ref={textareaRef}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue