@liveblocks/react-ui 3.9.2 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AiChat.cjs +11 -2
- package/dist/components/AiChat.cjs.map +1 -1
- package/dist/components/AiChat.js +11 -2
- package/dist/components/AiChat.js.map +1 -1
- package/dist/components/Comment.cjs +345 -340
- package/dist/components/Comment.cjs.map +1 -1
- package/dist/components/Comment.js +346 -341
- package/dist/components/Comment.js.map +1 -1
- package/dist/components/Thread.cjs +26 -11
- package/dist/components/Thread.cjs.map +1 -1
- package/dist/components/Thread.js +29 -14
- package/dist/components/Thread.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -2
- package/dist/index.d.ts +29 -2
- package/dist/index.js.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +4 -4
|
@@ -356,385 +356,390 @@ function AutoMarkReadThreadIdHandler({
|
|
|
356
356
|
);
|
|
357
357
|
return null;
|
|
358
358
|
}
|
|
359
|
-
const
|
|
360
|
-
(
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
showActions = "hover",
|
|
365
|
-
showReactions = true,
|
|
366
|
-
showAttachments = true,
|
|
367
|
-
showComposerFormattingControls = true,
|
|
368
|
-
onAuthorClick,
|
|
369
|
-
onMentionClick,
|
|
370
|
-
onAttachmentClick,
|
|
371
|
-
onCommentEdit,
|
|
372
|
-
onCommentDelete,
|
|
373
|
-
overrides: overrides$1,
|
|
374
|
-
components: components$1,
|
|
375
|
-
className,
|
|
376
|
-
additionalActions,
|
|
377
|
-
additionalActionsClassName,
|
|
378
|
-
additionalDropdownItemsBefore,
|
|
379
|
-
additionalDropdownItemsAfter,
|
|
380
|
-
autoMarkReadThreadId,
|
|
381
|
-
...props
|
|
382
|
-
}, forwardedRef) => {
|
|
383
|
-
const ref = react.useRef(null);
|
|
384
|
-
const mergedRefs = useRefs.useRefs(forwardedRef, ref);
|
|
385
|
-
const currentUserId = shared.useCurrentUserId();
|
|
386
|
-
const deleteComment = _private.useDeleteRoomComment(comment.roomId);
|
|
387
|
-
const editComment = _private.useEditRoomComment(comment.roomId);
|
|
388
|
-
const addReaction = _private.useAddRoomCommentReaction(comment.roomId);
|
|
389
|
-
const removeReaction = _private.useRemoveRoomCommentReaction(comment.roomId);
|
|
390
|
-
const $ = overrides.useOverrides(overrides$1);
|
|
391
|
-
const [isEditing, setEditing] = react.useState(false);
|
|
392
|
-
const [isTarget, setTarget] = react.useState(false);
|
|
393
|
-
const [isMoreActionOpen, setMoreActionOpen] = react.useState(false);
|
|
394
|
-
const [isReactionActionOpen, setReactionActionOpen] = react.useState(false);
|
|
395
|
-
const { mediaAttachments, fileAttachments } = react.useMemo(() => {
|
|
396
|
-
return Attachment.separateMediaAttachments(comment.attachments);
|
|
397
|
-
}, [comment.attachments]);
|
|
398
|
-
const permissions = _private.useRoomPermissions(comment.roomId);
|
|
399
|
-
const canComment = permissions.size > 0 ? permissions.has(core.Permission.CommentsWrite) || permissions.has(core.Permission.Write) : true;
|
|
400
|
-
const stopPropagation = react.useCallback((event) => {
|
|
401
|
-
event.stopPropagation();
|
|
402
|
-
}, []);
|
|
403
|
-
const handleEdit = react.useCallback(() => {
|
|
404
|
-
setEditing(true);
|
|
405
|
-
}, []);
|
|
406
|
-
const handleEditCancel = react.useCallback(
|
|
407
|
-
(event) => {
|
|
359
|
+
const CommentDropdownItem = react.forwardRef(({ children, icon, onSelect, onClick, ...props }, forwardedRef) => {
|
|
360
|
+
const handleClick = react.useCallback(
|
|
361
|
+
(event) => {
|
|
362
|
+
onClick?.(event);
|
|
363
|
+
if (!event.isDefaultPrevented()) {
|
|
408
364
|
event.stopPropagation();
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
[onClick]
|
|
368
|
+
);
|
|
369
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
370
|
+
Dropdown.DropdownItem,
|
|
371
|
+
{
|
|
372
|
+
icon,
|
|
373
|
+
onSelect,
|
|
374
|
+
onClick: handleClick,
|
|
375
|
+
...props,
|
|
376
|
+
ref: forwardedRef,
|
|
377
|
+
children
|
|
378
|
+
}
|
|
379
|
+
);
|
|
380
|
+
});
|
|
381
|
+
const Comment = Object.assign(
|
|
382
|
+
react.forwardRef(
|
|
383
|
+
({
|
|
384
|
+
comment,
|
|
385
|
+
indentContent = true,
|
|
386
|
+
showDeleted,
|
|
387
|
+
showActions = "hover",
|
|
388
|
+
showReactions = true,
|
|
389
|
+
showAttachments = true,
|
|
390
|
+
showComposerFormattingControls = true,
|
|
391
|
+
onAuthorClick,
|
|
392
|
+
onMentionClick,
|
|
393
|
+
onAttachmentClick,
|
|
394
|
+
onCommentEdit,
|
|
395
|
+
onCommentDelete,
|
|
396
|
+
dropdownItems,
|
|
397
|
+
overrides: overrides$1,
|
|
398
|
+
components: components$1,
|
|
399
|
+
className,
|
|
400
|
+
actions,
|
|
401
|
+
actionsClassName,
|
|
402
|
+
autoMarkReadThreadId,
|
|
403
|
+
...props
|
|
404
|
+
}, forwardedRef) => {
|
|
405
|
+
const ref = react.useRef(null);
|
|
406
|
+
const mergedRefs = useRefs.useRefs(forwardedRef, ref);
|
|
407
|
+
const currentUserId = shared.useCurrentUserId();
|
|
408
|
+
const deleteComment = _private.useDeleteRoomComment(comment.roomId);
|
|
409
|
+
const editComment = _private.useEditRoomComment(comment.roomId);
|
|
410
|
+
const addReaction = _private.useAddRoomCommentReaction(comment.roomId);
|
|
411
|
+
const removeReaction = _private.useRemoveRoomCommentReaction(comment.roomId);
|
|
412
|
+
const $ = overrides.useOverrides(overrides$1);
|
|
413
|
+
const [isEditing, setEditing] = react.useState(false);
|
|
414
|
+
const [isTarget, setTarget] = react.useState(false);
|
|
415
|
+
const [isMoreActionOpen, setMoreActionOpen] = react.useState(false);
|
|
416
|
+
const [isReactionActionOpen, setReactionActionOpen] = react.useState(false);
|
|
417
|
+
const { mediaAttachments, fileAttachments } = react.useMemo(() => {
|
|
418
|
+
return Attachment.separateMediaAttachments(comment.attachments);
|
|
419
|
+
}, [comment.attachments]);
|
|
420
|
+
const permissions = _private.useRoomPermissions(comment.roomId);
|
|
421
|
+
const canComment = permissions.size > 0 ? permissions.has(core.Permission.CommentsWrite) || permissions.has(core.Permission.Write) : true;
|
|
422
|
+
const stopPropagation = react.useCallback((event) => {
|
|
419
423
|
event.stopPropagation();
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
},
|
|
442
|
-
[comment.userId, onAuthorClick]
|
|
443
|
-
);
|
|
444
|
-
const handleReactionSelect = react.useCallback(
|
|
445
|
-
(emoji) => {
|
|
446
|
-
const reactionIndex = comment.reactions.findIndex(
|
|
447
|
-
(reaction) => reaction.emoji === emoji
|
|
448
|
-
);
|
|
449
|
-
if (reactionIndex >= 0 && currentUserId && comment.reactions[reactionIndex]?.users.some(
|
|
450
|
-
(user) => user.id === currentUserId
|
|
451
|
-
)) {
|
|
452
|
-
removeReaction({
|
|
453
|
-
threadId: comment.threadId,
|
|
424
|
+
}, []);
|
|
425
|
+
const handleEdit = react.useCallback(() => {
|
|
426
|
+
setEditing(true);
|
|
427
|
+
}, []);
|
|
428
|
+
const handleEditCancel = react.useCallback(
|
|
429
|
+
(event) => {
|
|
430
|
+
event.stopPropagation();
|
|
431
|
+
setEditing(false);
|
|
432
|
+
},
|
|
433
|
+
[]
|
|
434
|
+
);
|
|
435
|
+
const handleEditSubmit = react.useCallback(
|
|
436
|
+
({ body, attachments }, event) => {
|
|
437
|
+
onCommentEdit?.(comment);
|
|
438
|
+
if (event.isDefaultPrevented()) {
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
event.stopPropagation();
|
|
442
|
+
event.preventDefault();
|
|
443
|
+
setEditing(false);
|
|
444
|
+
editComment({
|
|
454
445
|
commentId: comment.id,
|
|
455
|
-
emoji
|
|
456
|
-
});
|
|
457
|
-
} else {
|
|
458
|
-
addReaction({
|
|
459
446
|
threadId: comment.threadId,
|
|
460
|
-
|
|
461
|
-
|
|
447
|
+
body,
|
|
448
|
+
attachments
|
|
462
449
|
});
|
|
450
|
+
},
|
|
451
|
+
[comment, editComment, onCommentEdit]
|
|
452
|
+
);
|
|
453
|
+
const handleDelete = react.useCallback(() => {
|
|
454
|
+
onCommentDelete?.(comment);
|
|
455
|
+
deleteComment({
|
|
456
|
+
commentId: comment.id,
|
|
457
|
+
threadId: comment.threadId
|
|
458
|
+
});
|
|
459
|
+
}, [comment, deleteComment, onCommentDelete]);
|
|
460
|
+
const handleAuthorClick = react.useCallback(
|
|
461
|
+
(event) => {
|
|
462
|
+
onAuthorClick?.(comment.userId, event);
|
|
463
|
+
},
|
|
464
|
+
[comment.userId, onAuthorClick]
|
|
465
|
+
);
|
|
466
|
+
const handleReactionSelect = react.useCallback(
|
|
467
|
+
(emoji) => {
|
|
468
|
+
const reactionIndex = comment.reactions.findIndex(
|
|
469
|
+
(reaction) => reaction.emoji === emoji
|
|
470
|
+
);
|
|
471
|
+
if (reactionIndex >= 0 && currentUserId && comment.reactions[reactionIndex]?.users.some(
|
|
472
|
+
(user) => user.id === currentUserId
|
|
473
|
+
)) {
|
|
474
|
+
removeReaction({
|
|
475
|
+
threadId: comment.threadId,
|
|
476
|
+
commentId: comment.id,
|
|
477
|
+
emoji
|
|
478
|
+
});
|
|
479
|
+
} else {
|
|
480
|
+
addReaction({
|
|
481
|
+
threadId: comment.threadId,
|
|
482
|
+
commentId: comment.id,
|
|
483
|
+
emoji
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
[
|
|
488
|
+
addReaction,
|
|
489
|
+
comment.id,
|
|
490
|
+
comment.reactions,
|
|
491
|
+
comment.threadId,
|
|
492
|
+
removeReaction,
|
|
493
|
+
currentUserId
|
|
494
|
+
]
|
|
495
|
+
);
|
|
496
|
+
react.useEffect(() => {
|
|
497
|
+
const isWindowDefined = typeof window !== "undefined";
|
|
498
|
+
if (!isWindowDefined)
|
|
499
|
+
return;
|
|
500
|
+
const hash = window.location.hash;
|
|
501
|
+
const commentId = hash.slice(1);
|
|
502
|
+
if (commentId === comment.id) {
|
|
503
|
+
setTarget(true);
|
|
463
504
|
}
|
|
464
|
-
},
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
comment.id,
|
|
468
|
-
comment.reactions,
|
|
469
|
-
comment.threadId,
|
|
470
|
-
removeReaction,
|
|
471
|
-
currentUserId
|
|
472
|
-
]
|
|
473
|
-
);
|
|
474
|
-
react.useEffect(() => {
|
|
475
|
-
const isWindowDefined = typeof window !== "undefined";
|
|
476
|
-
if (!isWindowDefined)
|
|
477
|
-
return;
|
|
478
|
-
const hash = window.location.hash;
|
|
479
|
-
const commentId = hash.slice(1);
|
|
480
|
-
if (commentId === comment.id) {
|
|
481
|
-
setTarget(true);
|
|
505
|
+
}, []);
|
|
506
|
+
if (!showDeleted && !comment.body) {
|
|
507
|
+
return null;
|
|
482
508
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
(
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
userId: comment.userId,
|
|
521
|
-
onClick: handleAuthorClick
|
|
522
|
-
}
|
|
523
|
-
),
|
|
524
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "lb-comment-details-labels", children: [
|
|
509
|
+
const defaultDropdownItems = comment.userId === currentUserId ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
510
|
+
/* @__PURE__ */ jsxRuntime.jsx(CommentDropdownItem, { onSelect: handleEdit, icon: /* @__PURE__ */ jsxRuntime.jsx(Edit.EditIcon, {}), children: $.COMMENT_EDIT }),
|
|
511
|
+
/* @__PURE__ */ jsxRuntime.jsx(CommentDropdownItem, { onSelect: handleDelete, icon: /* @__PURE__ */ jsxRuntime.jsx(Delete.DeleteIcon, {}), children: $.COMMENT_DELETE })
|
|
512
|
+
] }) : null;
|
|
513
|
+
const dropdownContent = typeof dropdownItems === "function" ? dropdownItems({ children: defaultDropdownItems, comment }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
514
|
+
defaultDropdownItems,
|
|
515
|
+
dropdownItems
|
|
516
|
+
] });
|
|
517
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(components.ComponentsProvider, { components: components$1, children: [
|
|
518
|
+
autoMarkReadThreadId && /* @__PURE__ */ jsxRuntime.jsx(
|
|
519
|
+
AutoMarkReadThreadIdHandler,
|
|
520
|
+
{
|
|
521
|
+
commentRef: ref,
|
|
522
|
+
threadId: autoMarkReadThreadId,
|
|
523
|
+
roomId: comment.roomId
|
|
524
|
+
}
|
|
525
|
+
),
|
|
526
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
527
|
+
"div",
|
|
528
|
+
{
|
|
529
|
+
id: comment.id,
|
|
530
|
+
className: cn.cn(
|
|
531
|
+
"lb-root lb-comment",
|
|
532
|
+
indentContent && "lb-comment:indent-content",
|
|
533
|
+
showActions === "hover" && "lb-comment:show-actions-hover",
|
|
534
|
+
(isMoreActionOpen || isReactionActionOpen) && "lb-comment:action-open",
|
|
535
|
+
className
|
|
536
|
+
),
|
|
537
|
+
"data-deleted": !comment.body ? "" : void 0,
|
|
538
|
+
"data-editing": isEditing ? "" : void 0,
|
|
539
|
+
"data-target": isTarget ? "" : void 0,
|
|
540
|
+
dir: $.dir,
|
|
541
|
+
...props,
|
|
542
|
+
ref: mergedRefs,
|
|
543
|
+
children: [
|
|
544
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lb-comment-header", children: [
|
|
545
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lb-comment-details", children: [
|
|
525
546
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
526
|
-
|
|
547
|
+
Avatar.Avatar,
|
|
527
548
|
{
|
|
528
|
-
className: "lb-comment-
|
|
549
|
+
className: "lb-comment-avatar",
|
|
529
550
|
userId: comment.userId,
|
|
530
551
|
onClick: handleAuthorClick
|
|
531
552
|
}
|
|
532
553
|
),
|
|
533
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "lb-comment-
|
|
554
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "lb-comment-details-labels", children: [
|
|
534
555
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
535
|
-
|
|
556
|
+
User.User,
|
|
536
557
|
{
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
558
|
+
className: "lb-comment-author",
|
|
559
|
+
userId: comment.userId,
|
|
560
|
+
onClick: handleAuthorClick
|
|
540
561
|
}
|
|
541
562
|
),
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
563
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "lb-comment-date", children: [
|
|
564
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
565
|
+
Timestamp.Timestamp,
|
|
566
|
+
{
|
|
567
|
+
locale: $.locale,
|
|
568
|
+
date: comment.createdAt,
|
|
569
|
+
className: "lb-date lb-comment-date-created"
|
|
570
|
+
}
|
|
571
|
+
),
|
|
572
|
+
comment.editedAt && comment.body && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
573
|
+
" ",
|
|
574
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "lb-comment-date-edited", children: $.COMMENT_EDITED })
|
|
575
|
+
] })
|
|
545
576
|
] })
|
|
546
577
|
] })
|
|
578
|
+
] }),
|
|
579
|
+
showActions && !isEditing && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn.cn("lb-comment-actions", actionsClassName), children: [
|
|
580
|
+
actions ?? null,
|
|
581
|
+
showReactions && canComment ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
582
|
+
EmojiPicker.EmojiPicker,
|
|
583
|
+
{
|
|
584
|
+
onEmojiSelect: handleReactionSelect,
|
|
585
|
+
onOpenChange: setReactionActionOpen,
|
|
586
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, { content: $.COMMENT_ADD_REACTION, children: /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
587
|
+
Button.Button,
|
|
588
|
+
{
|
|
589
|
+
className: "lb-comment-action",
|
|
590
|
+
onClick: stopPropagation,
|
|
591
|
+
"aria-label": $.COMMENT_ADD_REACTION,
|
|
592
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(EmojiPlus.EmojiPlusIcon, {})
|
|
593
|
+
}
|
|
594
|
+
) }) })
|
|
595
|
+
}
|
|
596
|
+
) : null,
|
|
597
|
+
dropdownContent ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
598
|
+
Dropdown.Dropdown,
|
|
599
|
+
{
|
|
600
|
+
open: isMoreActionOpen,
|
|
601
|
+
onOpenChange: setMoreActionOpen,
|
|
602
|
+
align: "end",
|
|
603
|
+
content: dropdownContent,
|
|
604
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, { content: $.COMMENT_MORE, children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
605
|
+
Button.Button,
|
|
606
|
+
{
|
|
607
|
+
className: "lb-comment-action",
|
|
608
|
+
disabled: !comment.body,
|
|
609
|
+
onClick: stopPropagation,
|
|
610
|
+
"aria-label": $.COMMENT_MORE,
|
|
611
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Ellipsis.EllipsisIcon, {})
|
|
612
|
+
}
|
|
613
|
+
) }) })
|
|
614
|
+
}
|
|
615
|
+
) : null
|
|
547
616
|
] })
|
|
548
617
|
] }),
|
|
549
|
-
|
|
550
|
-
|
|
618
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "lb-comment-content", children: isEditing ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
619
|
+
Composer.Composer,
|
|
551
620
|
{
|
|
552
|
-
className:
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
621
|
+
className: "lb-comment-composer",
|
|
622
|
+
onComposerSubmit: handleEditSubmit,
|
|
623
|
+
defaultValue: comment.body,
|
|
624
|
+
defaultAttachments: comment.attachments,
|
|
625
|
+
autoFocus: true,
|
|
626
|
+
showAttribution: false,
|
|
627
|
+
showAttachments,
|
|
628
|
+
showFormattingControls: showComposerFormattingControls,
|
|
629
|
+
actions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
630
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
631
|
+
Tooltip.Tooltip,
|
|
560
632
|
{
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
633
|
+
content: $.COMMENT_EDIT_COMPOSER_CANCEL,
|
|
634
|
+
"aria-label": $.COMMENT_EDIT_COMPOSER_CANCEL,
|
|
635
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
564
636
|
Button.Button,
|
|
565
637
|
{
|
|
566
|
-
className: "lb-
|
|
567
|
-
onClick:
|
|
568
|
-
|
|
569
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(EmojiPlus.EmojiPlusIcon, {})
|
|
638
|
+
className: "lb-composer-action",
|
|
639
|
+
onClick: handleEditCancel,
|
|
640
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Cross.CrossIcon, {})
|
|
570
641
|
}
|
|
571
|
-
)
|
|
642
|
+
)
|
|
572
643
|
}
|
|
573
|
-
)
|
|
574
|
-
|
|
575
|
-
|
|
644
|
+
),
|
|
645
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
646
|
+
Tooltip.ShortcutTooltip,
|
|
576
647
|
{
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
content: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
581
|
-
additionalDropdownItemsBefore,
|
|
582
|
-
comment.userId === currentUserId && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
583
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
584
|
-
Dropdown.DropdownItem,
|
|
585
|
-
{
|
|
586
|
-
onSelect: handleEdit,
|
|
587
|
-
onClick: stopPropagation,
|
|
588
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(Edit.EditIcon, {}),
|
|
589
|
-
children: $.COMMENT_EDIT
|
|
590
|
-
}
|
|
591
|
-
),
|
|
592
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
593
|
-
Dropdown.DropdownItem,
|
|
594
|
-
{
|
|
595
|
-
onSelect: handleDelete,
|
|
596
|
-
onClick: stopPropagation,
|
|
597
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(Delete.DeleteIcon, {}),
|
|
598
|
-
children: $.COMMENT_DELETE
|
|
599
|
-
}
|
|
600
|
-
)
|
|
601
|
-
] }),
|
|
602
|
-
additionalDropdownItemsAfter
|
|
603
|
-
] }),
|
|
604
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, { content: $.COMMENT_MORE, children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
648
|
+
content: $.COMMENT_EDIT_COMPOSER_SAVE,
|
|
649
|
+
shortcut: "Enter",
|
|
650
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Submit, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
605
651
|
Button.Button,
|
|
606
652
|
{
|
|
607
|
-
|
|
608
|
-
|
|
653
|
+
variant: "primary",
|
|
654
|
+
className: "lb-composer-action",
|
|
609
655
|
onClick: stopPropagation,
|
|
610
|
-
"aria-label": $.
|
|
611
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
656
|
+
"aria-label": $.COMMENT_EDIT_COMPOSER_SAVE,
|
|
657
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Check.CheckIcon, {})
|
|
612
658
|
}
|
|
613
|
-
) })
|
|
659
|
+
) })
|
|
614
660
|
}
|
|
615
|
-
)
|
|
616
|
-
]
|
|
661
|
+
)
|
|
662
|
+
] }),
|
|
663
|
+
overrides: {
|
|
664
|
+
COMPOSER_PLACEHOLDER: $.COMMENT_EDIT_COMPOSER_PLACEHOLDER
|
|
665
|
+
},
|
|
666
|
+
roomId: comment.roomId
|
|
617
667
|
}
|
|
618
|
-
)
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
autoFocus: true,
|
|
628
|
-
showAttribution: false,
|
|
629
|
-
showAttachments,
|
|
630
|
-
showFormattingControls: showComposerFormattingControls,
|
|
631
|
-
actions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
632
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
633
|
-
Tooltip.Tooltip,
|
|
634
|
-
{
|
|
635
|
-
content: $.COMMENT_EDIT_COMPOSER_CANCEL,
|
|
636
|
-
"aria-label": $.COMMENT_EDIT_COMPOSER_CANCEL,
|
|
637
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
638
|
-
Button.Button,
|
|
668
|
+
) : comment.body ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
669
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
670
|
+
index.Body,
|
|
671
|
+
{
|
|
672
|
+
className: "lb-comment-body",
|
|
673
|
+
body: comment.body,
|
|
674
|
+
components: {
|
|
675
|
+
Mention: ({ mention }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
676
|
+
CommentMention,
|
|
639
677
|
{
|
|
640
|
-
|
|
641
|
-
onClick:
|
|
642
|
-
|
|
678
|
+
mention,
|
|
679
|
+
onClick: (event) => onMentionClick?.(mention, event),
|
|
680
|
+
overrides: overrides$1
|
|
643
681
|
}
|
|
644
|
-
)
|
|
682
|
+
),
|
|
683
|
+
Link: CommentLink
|
|
645
684
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
685
|
+
}
|
|
686
|
+
),
|
|
687
|
+
showAttachments && (mediaAttachments.length > 0 || fileAttachments.length > 0) ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lb-comment-attachments", children: [
|
|
688
|
+
mediaAttachments.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lb-attachments", children: mediaAttachments.map((attachment) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
689
|
+
CommentMediaAttachment,
|
|
649
690
|
{
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
691
|
+
attachment,
|
|
692
|
+
overrides: overrides$1,
|
|
693
|
+
onAttachmentClick,
|
|
694
|
+
roomId: comment.roomId
|
|
695
|
+
},
|
|
696
|
+
attachment.id
|
|
697
|
+
)) }) : null,
|
|
698
|
+
fileAttachments.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lb-attachments", children: fileAttachments.map((attachment) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
699
|
+
CommentFileAttachment,
|
|
700
|
+
{
|
|
701
|
+
attachment,
|
|
702
|
+
overrides: overrides$1,
|
|
703
|
+
onAttachmentClick,
|
|
704
|
+
roomId: comment.roomId
|
|
705
|
+
},
|
|
706
|
+
attachment.id
|
|
707
|
+
)) }) : null
|
|
708
|
+
] }) : null,
|
|
709
|
+
showReactions && comment.reactions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lb-comment-reactions", children: [
|
|
710
|
+
comment.reactions.map((reaction) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
711
|
+
CommentReaction,
|
|
712
|
+
{
|
|
713
|
+
comment,
|
|
714
|
+
reaction,
|
|
715
|
+
overrides: overrides$1,
|
|
716
|
+
disabled: !canComment
|
|
717
|
+
},
|
|
718
|
+
reaction.emoji
|
|
719
|
+
)),
|
|
720
|
+
canComment ? /* @__PURE__ */ jsxRuntime.jsx(EmojiPicker.EmojiPicker, { onEmojiSelect: handleReactionSelect, children: /* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, { content: $.COMMENT_ADD_REACTION, children: /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
721
|
+
Button.Button,
|
|
722
|
+
{
|
|
723
|
+
className: "lb-comment-reaction lb-comment-reaction-add",
|
|
724
|
+
variant: "outline",
|
|
725
|
+
onClick: stopPropagation,
|
|
726
|
+
"aria-label": $.COMMENT_ADD_REACTION,
|
|
727
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(EmojiPlus.EmojiPlusIcon, {})
|
|
662
728
|
}
|
|
663
|
-
)
|
|
664
|
-
] })
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
Mention: ({ mention }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
678
|
-
CommentMention,
|
|
679
|
-
{
|
|
680
|
-
mention,
|
|
681
|
-
onClick: (event) => onMentionClick?.(mention, event),
|
|
682
|
-
overrides: overrides$1
|
|
683
|
-
}
|
|
684
|
-
),
|
|
685
|
-
Link: CommentLink
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
),
|
|
689
|
-
showAttachments && (mediaAttachments.length > 0 || fileAttachments.length > 0) ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lb-comment-attachments", children: [
|
|
690
|
-
mediaAttachments.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lb-attachments", children: mediaAttachments.map((attachment) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
691
|
-
CommentMediaAttachment,
|
|
692
|
-
{
|
|
693
|
-
attachment,
|
|
694
|
-
overrides: overrides$1,
|
|
695
|
-
onAttachmentClick,
|
|
696
|
-
roomId: comment.roomId
|
|
697
|
-
},
|
|
698
|
-
attachment.id
|
|
699
|
-
)) }) : null,
|
|
700
|
-
fileAttachments.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lb-attachments", children: fileAttachments.map((attachment) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
701
|
-
CommentFileAttachment,
|
|
702
|
-
{
|
|
703
|
-
attachment,
|
|
704
|
-
overrides: overrides$1,
|
|
705
|
-
onAttachmentClick,
|
|
706
|
-
roomId: comment.roomId
|
|
707
|
-
},
|
|
708
|
-
attachment.id
|
|
709
|
-
)) }) : null
|
|
710
|
-
] }) : null,
|
|
711
|
-
showReactions && comment.reactions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lb-comment-reactions", children: [
|
|
712
|
-
comment.reactions.map((reaction) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
713
|
-
CommentReaction,
|
|
714
|
-
{
|
|
715
|
-
comment,
|
|
716
|
-
reaction,
|
|
717
|
-
overrides: overrides$1,
|
|
718
|
-
disabled: !canComment
|
|
719
|
-
},
|
|
720
|
-
reaction.emoji
|
|
721
|
-
)),
|
|
722
|
-
canComment ? /* @__PURE__ */ jsxRuntime.jsx(EmojiPicker.EmojiPicker, { onEmojiSelect: handleReactionSelect, children: /* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, { content: $.COMMENT_ADD_REACTION, children: /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
723
|
-
Button.Button,
|
|
724
|
-
{
|
|
725
|
-
className: "lb-comment-reaction lb-comment-reaction-add",
|
|
726
|
-
variant: "outline",
|
|
727
|
-
onClick: stopPropagation,
|
|
728
|
-
"aria-label": $.COMMENT_ADD_REACTION,
|
|
729
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(EmojiPlus.EmojiPlusIcon, {})
|
|
730
|
-
}
|
|
731
|
-
) }) }) }) : null
|
|
732
|
-
] })
|
|
733
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lb-comment-body", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lb-comment-deleted", children: $.COMMENT_DELETED }) }) })
|
|
734
|
-
]
|
|
735
|
-
}
|
|
736
|
-
)
|
|
737
|
-
] }) });
|
|
729
|
+
) }) }) }) : null
|
|
730
|
+
] })
|
|
731
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lb-comment-body", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lb-comment-deleted", children: $.COMMENT_DELETED }) }) })
|
|
732
|
+
]
|
|
733
|
+
}
|
|
734
|
+
)
|
|
735
|
+
] }) });
|
|
736
|
+
}
|
|
737
|
+
),
|
|
738
|
+
{
|
|
739
|
+
/**
|
|
740
|
+
* Displays a dropdown item in the comment's dropdown.
|
|
741
|
+
*/
|
|
742
|
+
DropdownItem: CommentDropdownItem
|
|
738
743
|
}
|
|
739
744
|
);
|
|
740
745
|
|