@wordpress/editor 14.33.4 → 14.33.5

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.
Files changed (39) hide show
  1. package/build/components/collab-sidebar/add-comment.js +1 -1
  2. package/build/components/collab-sidebar/add-comment.js.map +1 -1
  3. package/build/components/collab-sidebar/comment-menu-item.js +36 -6
  4. package/build/components/collab-sidebar/comment-menu-item.js.map +3 -3
  5. package/build/components/collab-sidebar/comments.js +287 -296
  6. package/build/components/collab-sidebar/comments.js.map +3 -3
  7. package/build/components/collab-sidebar/index.js +23 -10
  8. package/build/components/collab-sidebar/index.js.map +3 -3
  9. package/build/components/collab-sidebar/utils.js +6 -3
  10. package/build/components/collab-sidebar/utils.js.map +2 -2
  11. package/build/components/editor/index.js +2 -2
  12. package/build/components/editor/index.js.map +3 -3
  13. package/build-module/components/collab-sidebar/add-comment.js +1 -1
  14. package/build-module/components/collab-sidebar/add-comment.js.map +1 -1
  15. package/build-module/components/collab-sidebar/comment-menu-item.js +40 -7
  16. package/build-module/components/collab-sidebar/comment-menu-item.js.map +2 -2
  17. package/build-module/components/collab-sidebar/comments.js +287 -296
  18. package/build-module/components/collab-sidebar/comments.js.map +2 -2
  19. package/build-module/components/collab-sidebar/index.js +23 -10
  20. package/build-module/components/collab-sidebar/index.js.map +2 -2
  21. package/build-module/components/collab-sidebar/utils.js +6 -3
  22. package/build-module/components/collab-sidebar/utils.js.map +2 -2
  23. package/build-module/components/editor/index.js +2 -2
  24. package/build-module/components/editor/index.js.map +2 -2
  25. package/build-types/components/collab-sidebar/comment-menu-item.d.ts +3 -2
  26. package/build-types/components/collab-sidebar/comment-menu-item.d.ts.map +1 -1
  27. package/build-types/components/collab-sidebar/comments.d.ts +1 -1
  28. package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
  29. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  30. package/build-types/components/collab-sidebar/utils.d.ts +2 -2
  31. package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
  32. package/package.json +7 -7
  33. package/src/components/collab-sidebar/add-comment.js +1 -1
  34. package/src/components/collab-sidebar/comment-menu-item.js +51 -11
  35. package/src/components/collab-sidebar/comments.js +8 -19
  36. package/src/components/collab-sidebar/index.js +51 -33
  37. package/src/components/collab-sidebar/utils.js +15 -5
  38. package/src/components/editor/index.js +1 -1
  39. package/tsconfig.tsbuildinfo +1 -1
@@ -231,19 +231,7 @@ function Comments({
231
231
  ]);
232
232
  const hasThreads = Array.isArray(threads) && threads.length > 0;
233
233
  if (!hasThreads && !isFloating) {
234
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
235
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
236
- import_add_comment.AddComment,
237
- {
238
- onSubmit: onAddReply,
239
- showCommentBoard,
240
- setShowCommentBoard,
241
- commentSidebarRef
242
- }
243
- ),
244
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { as: "p", children: (0, import_i18n.__)("No notes available.") }),
245
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { as: "p", variant: "muted", children: (0, import_i18n.__)("Only logged in users can see Notes.") })
246
- ] });
234
+ return null;
247
235
  }
248
236
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
249
237
  !isFloating && showCommentBoard && void 0 === blockCommentId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -363,185 +351,181 @@ function Thread({
363
351
  }
364
352
  );
365
353
  }
366
- return (
367
- // Disable reason: role="listitem" does in fact support aria-expanded.
368
- // eslint-disable-next-line jsx-a11y/role-supports-aria-props
369
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
370
- import_components.__experimentalVStack,
371
- {
372
- className: (0, import_clsx.default)("editor-collab-sidebar-panel__thread", {
373
- "is-selected": isSelected,
374
- "is-floating": isFloating
375
- }),
376
- id: `comment-thread-${thread.id}`,
377
- spacing: "3",
378
- onClick: handleCommentSelect,
379
- onMouseEnter,
380
- onMouseLeave,
381
- onFocus: onMouseEnter,
382
- onBlur: onMouseLeave,
383
- onKeyDown: (event) => {
384
- if (event.defaultPrevented) {
385
- return;
386
- }
387
- if (event.key === "Enter" && event.currentTarget === event.target) {
388
- if (isSelected) {
389
- unselectThread();
390
- } else {
391
- handleCommentSelect();
392
- }
393
- }
394
- if (event.key === "Escape") {
354
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
355
+ import_components.__experimentalVStack,
356
+ {
357
+ className: (0, import_clsx.default)("editor-collab-sidebar-panel__thread", {
358
+ "is-selected": isSelected,
359
+ "is-floating": isFloating
360
+ }),
361
+ id: `comment-thread-${thread.id}`,
362
+ spacing: "3",
363
+ onClick: handleCommentSelect,
364
+ onMouseEnter,
365
+ onMouseLeave,
366
+ onFocus: onMouseEnter,
367
+ onBlur: onMouseLeave,
368
+ onKeyDown: (event) => {
369
+ if (event.defaultPrevented) {
370
+ return;
371
+ }
372
+ if (event.key === "Enter" && event.currentTarget === event.target) {
373
+ if (isSelected) {
395
374
  unselectThread();
396
- (0, import_utils.focusCommentThread)(thread.id, commentSidebarRef.current);
375
+ } else {
376
+ handleCommentSelect();
397
377
  }
398
- },
399
- tabIndex: 0,
400
- role: "listitem",
401
- "aria-label": ariaLabel,
402
- "aria-expanded": isSelected,
403
- ref: isFloating ? refs.setFloating : void 0,
404
- style: isFloating ? { top: y } : void 0,
405
- children: [
406
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
407
- import_components.Button,
408
- {
409
- className: "editor-collab-sidebar-panel__skip-to-comment",
410
- variant: "secondary",
411
- size: "compact",
412
- onClick: () => {
378
+ }
379
+ if (event.key === "Escape") {
380
+ unselectThread();
381
+ (0, import_utils.focusCommentThread)(thread.id, commentSidebarRef.current);
382
+ }
383
+ },
384
+ tabIndex: 0,
385
+ role: "treeitem",
386
+ "aria-label": ariaLabel,
387
+ "aria-expanded": isSelected,
388
+ ref: isFloating ? refs.setFloating : void 0,
389
+ style: isFloating ? { top: y } : void 0,
390
+ children: [
391
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
392
+ import_components.Button,
393
+ {
394
+ className: "editor-collab-sidebar-panel__skip-to-comment",
395
+ variant: "secondary",
396
+ size: "compact",
397
+ onClick: () => {
398
+ (0, import_utils.focusCommentThread)(
399
+ thread.id,
400
+ commentSidebarRef.current,
401
+ "textarea"
402
+ );
403
+ },
404
+ children: (0, import_i18n.__)("Add new note")
405
+ }
406
+ ),
407
+ !thread.blockClientId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { as: "p", weight: 500, variant: "muted", children: (0, import_i18n.__)("Original block deleted.") }),
408
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
409
+ CommentBoard,
410
+ {
411
+ thread,
412
+ isExpanded: isSelected,
413
+ onEdit: (params = {}) => {
414
+ const { status } = params;
415
+ onEditComment(params);
416
+ if (status === "approved") {
417
+ unselectThread();
413
418
  (0, import_utils.focusCommentThread)(
414
419
  thread.id,
415
- commentSidebarRef.current,
416
- "textarea"
420
+ commentSidebarRef.current
417
421
  );
418
- },
419
- children: (0, import_i18n.__)("Add new note")
420
- }
421
- ),
422
- !thread.blockClientId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { as: "p", weight: 500, variant: "muted", children: (0, import_i18n.__)("Original block deleted.") }),
423
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
424
- CommentBoard,
422
+ }
423
+ },
424
+ onDelete: onCommentDelete,
425
+ reflowComments
426
+ }
427
+ ),
428
+ isSelected && allReplies.map((reply) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
429
+ CommentBoard,
430
+ {
431
+ thread: reply,
432
+ parent: thread,
433
+ isExpanded: isSelected,
434
+ onEdit: onEditComment,
435
+ onDelete: onCommentDelete,
436
+ reflowComments
437
+ },
438
+ reply.id
439
+ )),
440
+ !isSelected && restReplies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalHStack, { className: "editor-collab-sidebar-panel__more-reply-separator", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
441
+ import_components.Button,
442
+ {
443
+ size: "compact",
444
+ variant: "tertiary",
445
+ className: "editor-collab-sidebar-panel__more-reply-button",
446
+ onClick: () => {
447
+ setSelectedThread(thread.id);
448
+ (0, import_utils.focusCommentThread)(
449
+ thread.id,
450
+ commentSidebarRef.current
451
+ );
452
+ },
453
+ children: (0, import_i18n.sprintf)(
454
+ // translators: %s: number of replies.
455
+ (0, import_i18n._n)(
456
+ "%s more reply",
457
+ "%s more replies",
458
+ restReplies.length
459
+ ),
460
+ restReplies.length
461
+ )
462
+ }
463
+ ) }),
464
+ !isSelected && lastReply && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
465
+ CommentBoard,
466
+ {
467
+ thread: lastReply,
468
+ parent: thread,
469
+ isExpanded: isSelected,
470
+ onEdit: onEditComment,
471
+ onDelete: onCommentDelete,
472
+ reflowComments
473
+ }
474
+ ),
475
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: "2", role: "treeitem", children: [
476
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_comment_author_info.default, {}) }),
477
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalVStack, { spacing: "2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
478
+ import_comment_form.default,
425
479
  {
426
- thread,
427
- isExpanded: isSelected,
428
- onEdit: (params = {}) => {
429
- const { status } = params;
430
- onEditComment(params);
431
- if (status === "approved") {
432
- unselectThread();
433
- (0, import_utils.focusCommentThread)(
434
- thread.id,
435
- commentSidebarRef.current
436
- );
480
+ onSubmit: (inputComment) => {
481
+ if ("approved" === thread.status) {
482
+ onEditComment({
483
+ id: thread.id,
484
+ status: "hold",
485
+ content: inputComment
486
+ });
487
+ } else {
488
+ onAddReply({
489
+ content: inputComment,
490
+ parent: thread.id
491
+ });
437
492
  }
438
493
  },
439
- onDelete: onCommentDelete,
440
- reflowComments
441
- }
442
- ),
443
- isSelected && allReplies.map((reply) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
444
- CommentBoard,
445
- {
446
- thread: reply,
447
- parent: thread,
448
- isExpanded: isSelected,
449
- onEdit: onEditComment,
450
- onDelete: onCommentDelete,
451
- reflowComments
452
- },
453
- reply.id
454
- )),
455
- !isSelected && restReplies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalHStack, { className: "editor-collab-sidebar-panel__more-reply-separator", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
456
- import_components.Button,
457
- {
458
- size: "compact",
459
- variant: "tertiary",
460
- className: "editor-collab-sidebar-panel__more-reply-button",
461
- onClick: () => {
462
- setSelectedThread(thread.id);
494
+ onCancel: (event) => {
495
+ event.stopPropagation();
496
+ unselectThread();
463
497
  (0, import_utils.focusCommentThread)(
464
498
  thread.id,
465
499
  commentSidebarRef.current
466
500
  );
467
501
  },
468
- children: (0, import_i18n.sprintf)(
469
- // translators: %s: number of replies.
470
- (0, import_i18n._n)(
471
- "%s more reply",
472
- "%s more replies",
473
- restReplies.length
474
- ),
475
- restReplies.length
476
- )
477
- }
478
- ) }),
479
- !isSelected && lastReply && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
480
- CommentBoard,
481
- {
482
- thread: lastReply,
483
- parent: thread,
484
- isExpanded: isSelected,
485
- onEdit: onEditComment,
486
- onDelete: onCommentDelete,
502
+ submitButtonText: "approved" === thread.status ? (0, import_i18n.__)("Reopen & Reply") : (0, import_i18n.__)("Reply"),
503
+ rows: "approved" === thread.status ? 2 : 4,
504
+ labelText: (0, import_i18n.sprintf)(
505
+ // translators: %1$s: note identifier, %2$s: author name
506
+ (0, import_i18n.__)("Reply to note %1$s by %2$s"),
507
+ thread.id,
508
+ thread.author_name
509
+ ),
487
510
  reflowComments
488
511
  }
489
- ),
490
- isSelected && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: "2", children: [
491
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_comment_author_info.default, {}) }),
492
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalVStack, { spacing: "2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
493
- import_comment_form.default,
494
- {
495
- onSubmit: (inputComment) => {
496
- if ("approved" === thread.status) {
497
- onEditComment({
498
- id: thread.id,
499
- status: "hold",
500
- content: inputComment
501
- });
502
- } else {
503
- onAddReply({
504
- content: inputComment,
505
- parent: thread.id
506
- });
507
- }
508
- },
509
- onCancel: (event) => {
510
- event.stopPropagation();
511
- unselectThread();
512
- (0, import_utils.focusCommentThread)(
513
- thread.id,
514
- commentSidebarRef.current
515
- );
516
- },
517
- submitButtonText: "approved" === thread.status ? (0, import_i18n.__)("Reopen & Reply") : (0, import_i18n.__)("Reply"),
518
- rows: "approved" === thread.status ? 2 : 4,
519
- labelText: (0, import_i18n.sprintf)(
520
- // translators: %1$s: note identifier, %2$s: author name
521
- (0, import_i18n.__)("Reply to note %1$s by %2$s"),
522
- thread.id,
523
- thread.author_name
524
- ),
525
- reflowComments
526
- }
527
- ) })
528
- ] }),
529
- !!thread.blockClientId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
530
- import_components.Button,
531
- {
532
- className: "editor-collab-sidebar-panel__skip-to-block",
533
- variant: "secondary",
534
- size: "compact",
535
- onClick: (event) => {
536
- event.stopPropagation();
537
- relatedBlockElement?.focus();
538
- },
539
- children: (0, import_i18n.__)("Back to block")
540
- }
541
- )
542
- ]
543
- }
544
- )
512
+ ) })
513
+ ] }),
514
+ !!thread.blockClientId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
515
+ import_components.Button,
516
+ {
517
+ className: "editor-collab-sidebar-panel__skip-to-block",
518
+ variant: "secondary",
519
+ size: "compact",
520
+ onClick: (event) => {
521
+ event.stopPropagation();
522
+ relatedBlockElement?.focus();
523
+ },
524
+ children: (0, import_i18n.__)("Back to block")
525
+ }
526
+ )
527
+ ]
528
+ }
545
529
  );
546
530
  }
547
531
  const CommentBoard = ({
@@ -595,133 +579,140 @@ const CommentBoard = ({
595
579
  ];
596
580
  const canResolve = thread.parent === 0;
597
581
  const moreActions = parent?.status !== "approved" ? actions.filter((item) => item.isEligible(thread)) : [];
598
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: "2", children: [
599
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", children: [
600
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
601
- import_comment_author_info.default,
602
- {
603
- avatar: thread?.author_avatar_urls?.[48],
604
- name: thread?.author_name,
605
- date: thread?.date,
606
- userId: thread?.author
607
- }
608
- ),
609
- isExpanded && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
610
- import_components.FlexItem,
611
- {
612
- className: "editor-collab-sidebar-panel__comment-status",
613
- onClick: (event) => {
614
- event.stopPropagation();
615
- },
616
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { spacing: "0", children: [
617
- canResolve && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
618
- import_components.Button,
619
- {
620
- label: (0, import_i18n._x)(
621
- "Resolve",
622
- "Mark note as resolved"
582
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
583
+ import_components.__experimentalVStack,
584
+ {
585
+ spacing: "2",
586
+ role: thread.parent !== 0 ? "treeitem" : void 0,
587
+ children: [
588
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", children: [
589
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
590
+ import_comment_author_info.default,
591
+ {
592
+ avatar: thread?.author_avatar_urls?.[48],
593
+ name: thread?.author_name,
594
+ date: thread?.date,
595
+ userId: thread?.author
596
+ }
597
+ ),
598
+ isExpanded && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
599
+ import_components.FlexItem,
600
+ {
601
+ className: "editor-collab-sidebar-panel__comment-status",
602
+ onClick: (event) => {
603
+ event.stopPropagation();
604
+ },
605
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { spacing: "0", children: [
606
+ canResolve && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
607
+ import_components.Button,
608
+ {
609
+ label: (0, import_i18n._x)(
610
+ "Resolve",
611
+ "Mark note as resolved"
612
+ ),
613
+ size: "small",
614
+ icon: import_icons.published,
615
+ disabled: thread.status === "approved",
616
+ accessibleWhenDisabled: thread.status === "approved",
617
+ onClick: () => {
618
+ onEdit({
619
+ id: thread.id,
620
+ status: "approved"
621
+ });
622
+ }
623
+ }
623
624
  ),
624
- size: "small",
625
- icon: import_icons.published,
626
- disabled: thread.status === "approved",
627
- accessibleWhenDisabled: thread.status === "approved",
628
- onClick: () => {
629
- onEdit({
630
- id: thread.id,
631
- status: "approved"
632
- });
633
- }
634
- }
635
- ),
636
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Menu, { placement: "bottom-end", children: [
637
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
638
- Menu.TriggerButton,
639
- {
640
- render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
641
- import_components.Button,
625
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Menu, { placement: "bottom-end", children: [
626
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
627
+ Menu.TriggerButton,
642
628
  {
643
- ref: actionButtonRef,
644
- size: "small",
645
- icon: import_icons.moreVertical,
646
- label: (0, import_i18n.__)("Actions"),
647
- disabled: !moreActions.length,
648
- accessibleWhenDisabled: true
629
+ render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
630
+ import_components.Button,
631
+ {
632
+ ref: actionButtonRef,
633
+ size: "small",
634
+ icon: import_icons.moreVertical,
635
+ label: (0, import_i18n.__)("Actions"),
636
+ disabled: !moreActions.length,
637
+ accessibleWhenDisabled: true
638
+ }
639
+ )
649
640
  }
650
- )
651
- }
652
- ),
653
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Menu.Popover, { children: moreActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
654
- Menu.Item,
655
- {
656
- onClick: () => action.onClick(),
657
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Menu.ItemLabel, { children: action.title })
658
- },
659
- action.id
660
- )) })
661
- ] })
662
- ] })
663
- }
664
- )
665
- ] }),
666
- "edit" === actionState ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
667
- import_comment_form.default,
668
- {
669
- onSubmit: (value) => {
670
- onEdit({
671
- id: thread.id,
672
- content: value
673
- });
674
- setActionState(false);
675
- actionButtonRef.current?.focus();
676
- },
677
- onCancel: () => handleCancel(),
678
- thread,
679
- submitButtonText: (0, import_i18n._x)("Update", "verb"),
680
- labelText: (0, import_i18n.sprintf)(
681
- // translators: %1$s: note identifier, %2$s: author name.
682
- (0, import_i18n.__)("Edit note %1$s by %2$s"),
683
- thread.id,
684
- thread.author_name
685
- ),
686
- reflowComments
687
- }
688
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
689
- import_element.RawHTML,
690
- {
691
- className: (0, import_clsx.default)(
692
- "editor-collab-sidebar-panel__user-comment",
641
+ ),
642
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Menu.Popover, { children: moreActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
643
+ Menu.Item,
644
+ {
645
+ onClick: () => action.onClick(),
646
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Menu.ItemLabel, { children: action.title })
647
+ },
648
+ action.id
649
+ )) })
650
+ ] })
651
+ ] })
652
+ }
653
+ )
654
+ ] }),
655
+ "edit" === actionState ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
656
+ import_comment_form.default,
693
657
  {
694
- "editor-collab-sidebar-panel__resolution-text": isResolutionComment
658
+ onSubmit: (value) => {
659
+ onEdit({
660
+ id: thread.id,
661
+ content: value
662
+ });
663
+ setActionState(false);
664
+ actionButtonRef.current?.focus();
665
+ },
666
+ onCancel: () => handleCancel(),
667
+ thread,
668
+ submitButtonText: (0, import_i18n._x)("Update", "verb"),
669
+ labelText: (0, import_i18n.sprintf)(
670
+ // translators: %1$s: note identifier, %2$s: author name.
671
+ (0, import_i18n.__)("Edit note %1$s by %2$s"),
672
+ thread.id,
673
+ thread.author_name
674
+ ),
675
+ reflowComments
676
+ }
677
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
678
+ import_element.RawHTML,
679
+ {
680
+ className: (0, import_clsx.default)(
681
+ "editor-collab-sidebar-panel__user-comment",
682
+ {
683
+ "editor-collab-sidebar-panel__resolution-text": isResolutionComment
684
+ }
685
+ ),
686
+ children: isResolutionComment ? (() => {
687
+ const actionText = thread.meta._wp_note_status === "resolved" ? (0, import_i18n.__)("Marked as resolved") : (0, import_i18n.__)("Reopened");
688
+ const content = thread?.content?.raw;
689
+ if (content && typeof content === "string" && content.trim() !== "") {
690
+ return (0, import_i18n.sprintf)(
691
+ // translators: %1$s: action label ("Marked as resolved" or "Reopened"); %2$s: note text.
692
+ (0, import_i18n.__)("%1$s: %2$s"),
693
+ actionText,
694
+ content
695
+ );
696
+ }
697
+ return actionText;
698
+ })() : thread?.content?.rendered
695
699
  }
696
700
  ),
697
- children: isResolutionComment ? (() => {
698
- const actionText = thread.meta._wp_note_status === "resolved" ? (0, import_i18n.__)("Marked as resolved") : (0, import_i18n.__)("Reopened");
699
- const content = thread?.content?.raw;
700
- if (content && typeof content === "string" && content.trim() !== "") {
701
- return (0, import_i18n.sprintf)(
702
- // translators: %1$s: action label ("Marked as resolved" or "Reopened"); %2$s: note text.
703
- (0, import_i18n.__)("%1$s: %2$s"),
704
- actionText,
705
- content
706
- );
701
+ "delete" === actionState && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
702
+ import_components.__experimentalConfirmDialog,
703
+ {
704
+ isOpen: showConfirmDialog,
705
+ onConfirm: handleConfirmDelete,
706
+ onCancel: handleCancel,
707
+ confirmButtonText: (0, import_i18n.__)("Delete"),
708
+ children: (0, import_i18n.__)(
709
+ "Are you sure you want to delete this note? This will also delete all of this note's replies."
710
+ )
707
711
  }
708
- return actionText;
709
- })() : thread?.content?.rendered
710
- }
711
- ),
712
- "delete" === actionState && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
713
- import_components.__experimentalConfirmDialog,
714
- {
715
- isOpen: showConfirmDialog,
716
- onConfirm: handleConfirmDelete,
717
- onCancel: handleCancel,
718
- confirmButtonText: (0, import_i18n.__)("Delete"),
719
- children: (0, import_i18n.__)(
720
- "Are you sure you want to delete this note? This will also delete all of this note's replies."
721
712
  )
722
- }
723
- )
724
- ] });
713
+ ]
714
+ }
715
+ );
725
716
  };
726
717
  var comments_default = Comments;
727
718
  // Annotate the CommonJS export names for ESM import in node: