@wordpress/editor 14.33.8 → 14.33.9
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/build/components/collab-sidebar/comments.js +67 -16
- package/build/components/collab-sidebar/comments.js.map +2 -2
- package/build-module/components/collab-sidebar/comments.js +67 -16
- package/build-module/components/collab-sidebar/comments.js.map +2 -2
- package/build-types/components/collab-sidebar/comments.d.ts +1 -1
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/bindings/test/post-data.js +199 -0
- package/src/components/collab-sidebar/comments.js +76 -11
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -272,7 +272,15 @@ function Comments({
|
|
|
272
272
|
};
|
|
273
273
|
const hasThreads = Array.isArray(threads) && threads.length > 0;
|
|
274
274
|
if (!hasThreads && !isFloating) {
|
|
275
|
-
return
|
|
275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
276
|
+
import_add_comment.AddComment,
|
|
277
|
+
{
|
|
278
|
+
onSubmit: onAddReply,
|
|
279
|
+
newNoteFormState,
|
|
280
|
+
setNewNoteFormState,
|
|
281
|
+
commentSidebarRef
|
|
282
|
+
}
|
|
283
|
+
);
|
|
276
284
|
}
|
|
277
285
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
278
286
|
!isFloating && newNoteFormState === "open" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -348,18 +356,40 @@ function Thread({
|
|
|
348
356
|
selectedThread,
|
|
349
357
|
commentLastUpdated
|
|
350
358
|
});
|
|
359
|
+
const isKeyboardTabbingRef = (0, import_element.useRef)(false);
|
|
351
360
|
const onMouseEnter = () => {
|
|
352
361
|
debouncedToggleBlockHighlight(thread.blockClientId, true);
|
|
353
362
|
};
|
|
354
363
|
const onMouseLeave = () => {
|
|
355
364
|
debouncedToggleBlockHighlight(thread.blockClientId, false);
|
|
356
365
|
};
|
|
366
|
+
const onFocus = () => {
|
|
367
|
+
toggleBlockHighlight(thread.blockClientId, true);
|
|
368
|
+
};
|
|
369
|
+
const onBlur = (event) => {
|
|
370
|
+
const isNoteFocused = event.relatedTarget?.closest(
|
|
371
|
+
".editor-collab-sidebar-panel__thread"
|
|
372
|
+
);
|
|
373
|
+
const isDialogFocused = event.relatedTarget?.closest('[role="dialog"]');
|
|
374
|
+
const isTabbing = isKeyboardTabbingRef.current;
|
|
375
|
+
if (isNoteFocused && !isTabbing) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
if (isDialogFocused) {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
if (isTabbing && event.currentTarget.contains(event.relatedTarget)) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
toggleBlockHighlight(thread.blockClientId, false);
|
|
385
|
+
unselectThread();
|
|
386
|
+
};
|
|
357
387
|
const handleCommentSelect = () => {
|
|
358
388
|
setNewNoteFormState("closed");
|
|
359
389
|
setSelectedThread(thread.id);
|
|
390
|
+
toggleBlockSpotlight(thread.blockClientId, true);
|
|
360
391
|
if (!!thread.blockClientId) {
|
|
361
392
|
selectBlock(thread.blockClientId, null);
|
|
362
|
-
toggleBlockSpotlight(thread.blockClientId, true);
|
|
363
393
|
}
|
|
364
394
|
};
|
|
365
395
|
const unselectThread = () => {
|
|
@@ -410,9 +440,20 @@ function Thread({
|
|
|
410
440
|
onClick: handleCommentSelect,
|
|
411
441
|
onMouseEnter,
|
|
412
442
|
onMouseLeave,
|
|
413
|
-
onFocus
|
|
414
|
-
onBlur
|
|
415
|
-
|
|
443
|
+
onFocus,
|
|
444
|
+
onBlur,
|
|
445
|
+
onKeyUp: (event) => {
|
|
446
|
+
if (event.key === "Tab") {
|
|
447
|
+
isKeyboardTabbingRef.current = false;
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
onKeyDown: (event) => {
|
|
451
|
+
if (event.key === "Tab") {
|
|
452
|
+
isKeyboardTabbingRef.current = true;
|
|
453
|
+
} else {
|
|
454
|
+
onKeyDown(event);
|
|
455
|
+
}
|
|
456
|
+
},
|
|
416
457
|
tabIndex: 0,
|
|
417
458
|
role: "treeitem",
|
|
418
459
|
"aria-label": ariaLabel,
|
|
@@ -433,7 +474,7 @@ function Thread({
|
|
|
433
474
|
"textarea"
|
|
434
475
|
);
|
|
435
476
|
},
|
|
436
|
-
children: (0, import_i18n.__)("Add new
|
|
477
|
+
children: (0, import_i18n.__)("Add new reply")
|
|
437
478
|
}
|
|
438
479
|
),
|
|
439
480
|
!thread.blockClientId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { as: "p", weight: 500, variant: "muted", children: (0, import_i18n.__)("Original block deleted.") }),
|
|
@@ -614,6 +655,12 @@ const CommentBoard = ({
|
|
|
614
655
|
];
|
|
615
656
|
const canResolve = thread.parent === 0;
|
|
616
657
|
const moreActions = parent?.status !== "approved" ? actions.filter((item) => item.isEligible(thread)) : [];
|
|
658
|
+
const deleteConfirmMessage = (
|
|
659
|
+
// When deleting a top level note, descendants will also be deleted.
|
|
660
|
+
thread.parent === 0 ? (0, import_i18n.__)(
|
|
661
|
+
"Are you sure you want to delete this note? This will also delete all of this note's replies."
|
|
662
|
+
) : (0, import_i18n.__)("Are you sure you want to delete this reply?")
|
|
663
|
+
);
|
|
617
664
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
618
665
|
import_components.__experimentalVStack,
|
|
619
666
|
{
|
|
@@ -674,14 +721,20 @@ const CommentBoard = ({
|
|
|
674
721
|
)
|
|
675
722
|
}
|
|
676
723
|
),
|
|
677
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
678
|
-
Menu.
|
|
724
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
725
|
+
Menu.Popover,
|
|
679
726
|
{
|
|
680
|
-
|
|
681
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
727
|
+
modal: false,
|
|
728
|
+
children: moreActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
729
|
+
Menu.Item,
|
|
730
|
+
{
|
|
731
|
+
onClick: () => action.onClick(),
|
|
732
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Menu.ItemLabel, { children: action.title })
|
|
733
|
+
},
|
|
734
|
+
action.id
|
|
735
|
+
))
|
|
736
|
+
}
|
|
737
|
+
)
|
|
685
738
|
] })
|
|
686
739
|
] })
|
|
687
740
|
}
|
|
@@ -740,9 +793,7 @@ const CommentBoard = ({
|
|
|
740
793
|
onConfirm: handleConfirmDelete,
|
|
741
794
|
onCancel: handleCancel,
|
|
742
795
|
confirmButtonText: (0, import_i18n.__)("Delete"),
|
|
743
|
-
children:
|
|
744
|
-
"Are you sure you want to delete this note? This will also delete all of this note's replies."
|
|
745
|
-
)
|
|
796
|
+
children: deleteConfirmMessage
|
|
746
797
|
}
|
|
747
798
|
)
|
|
748
799
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collab-sidebar/comments.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tRawHTML,\n\tuseEffect,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n} from '@wordpress/element';\nimport {\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tButton,\n\tFlexItem,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useDebounce } from '@wordpress/compose';\n\nimport { published, moreVertical } from '@wordpress/icons';\nimport { __, _x, sprintf, _n } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport CommentAuthorInfo from './comment-author-info';\nimport CommentForm from './comment-form';\nimport { focusCommentThread, getCommentExcerpt } from './utils';\nimport { useFloatingThread } from './hooks';\nimport { AddComment } from './add-comment';\nimport { store as editorStore } from '../../store';\n\nconst { useBlockElement } = unlock( blockEditorPrivateApis );\nconst { Menu } = unlock( componentsPrivateApis );\n\nexport function Comments( {\n\tthreads: noteThreads,\n\tonEditComment,\n\tonAddReply,\n\tonCommentDelete,\n\tnewNoteFormState,\n\tsetNewNoteFormState,\n\tcommentSidebarRef,\n\treflowComments,\n\tisFloating = false,\n\tcommentLastUpdated,\n} ) {\n\tconst [ heights, setHeights ] = useState( {} );\n\tconst [ selectedThread, setSelectedThread ] = useState( null );\n\tconst [ boardOffsets, setBoardOffsets ] = useState( {} );\n\tconst [ blockRefs, setBlockRefs ] = useState( {} );\n\n\tconst { setCanvasMinHeight } = unlock( useDispatch( editorStore ) );\n\tconst { selectBlock, toggleBlockSpotlight } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst { blockCommentId, selectedBlockClientId, orderedBlockIds } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetClientIdsWithDescendants,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\treturn {\n\t\t\t\tblockCommentId: clientId\n\t\t\t\t\t? getBlockAttributes( clientId )?.metadata?.noteId\n\t\t\t\t\t: null,\n\t\t\t\tselectedBlockClientId: clientId,\n\t\t\t\torderedBlockIds: getClientIdsWithDescendants(),\n\t\t\t};\n\t\t}, [] );\n\n\tconst relatedBlockElement = useBlockElement( selectedBlockClientId );\n\n\tconst threads = useMemo( () => {\n\t\tconst t = [ ...noteThreads ];\n\t\tconst orderedThreads = [];\n\t\t// In floating mode, when the note board is shown, and as long\n\t\t// as the selected block doesn't have an existing note attached -\n\t\t// add a \"new note\" entry to the threads. This special thread type\n\t\t// gets sorted and floated like regular threads, but shows an AddComment\n\t\t// component instead of a regular comment thread.\n\t\tif ( isFloating && newNoteFormState === 'open' ) {\n\t\t\t// Insert the new note entry at the correct location for its blockId.\n\t\t\tconst newNoteThread = {\n\t\t\t\tid: 'new-note-thread',\n\t\t\t\tblockClientId: selectedBlockClientId,\n\t\t\t\tcontent: { rendered: '' },\n\t\t\t};\n\t\t\t// Insert the new comment block at the right order within the threads.\n\t\t\torderedBlockIds.forEach( ( blockId ) => {\n\t\t\t\tif ( blockId === selectedBlockClientId ) {\n\t\t\t\t\torderedThreads.push( newNoteThread );\n\t\t\t\t} else {\n\t\t\t\t\tconst threadForBlock = t.find(\n\t\t\t\t\t\t( thread ) => thread.blockClientId === blockId\n\t\t\t\t\t);\n\t\t\t\t\tif ( threadForBlock ) {\n\t\t\t\t\t\torderedThreads.push( threadForBlock );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t\treturn orderedThreads;\n\t\t}\n\t\treturn t;\n\t}, [\n\t\tnoteThreads,\n\t\tisFloating,\n\t\tnewNoteFormState,\n\t\tselectedBlockClientId,\n\t\torderedBlockIds,\n\t] );\n\n\tconst handleDelete = async ( comment ) => {\n\t\tconst currentIndex = threads.findIndex( ( t ) => t.id === comment.id );\n\t\tconst nextThread = threads[ currentIndex + 1 ];\n\t\tconst prevThread = threads[ currentIndex - 1 ];\n\n\t\tawait onCommentDelete( comment );\n\n\t\tif ( comment.parent !== 0 ) {\n\t\t\t// Move focus to the parent thread when a reply was deleted.\n\t\t\tsetSelectedThread( comment.parent );\n\t\t\tfocusCommentThread( comment.parent, commentSidebarRef.current );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( nextThread ) {\n\t\t\tsetSelectedThread( nextThread.id );\n\t\t\tfocusCommentThread( nextThread.id, commentSidebarRef.current );\n\t\t} else if ( prevThread ) {\n\t\t\tsetSelectedThread( prevThread.id );\n\t\t\tfocusCommentThread( prevThread.id, commentSidebarRef.current );\n\t\t} else {\n\t\t\tsetSelectedThread( null );\n\t\t\tsetNewNoteFormState( 'closed' );\n\t\t\t// Move focus to the related block.\n\t\t\trelatedBlockElement?.focus();\n\t\t}\n\t};\n\n\t// Auto-select the related comment thread when a block is selected.\n\tuseEffect( () => {\n\t\t// Fallback to 'new-note-thread' when showing the comment board for a new note.\n\t\tsetSelectedThread(\n\t\t\tnewNoteFormState === 'open' ? 'new-note-thread' : blockCommentId\n\t\t);\n\t}, [ blockCommentId, newNoteFormState ] );\n\n\tconst setBlockRef = useCallback( ( id, blockRef ) => {\n\t\tsetBlockRefs( ( prev ) => ( { ...prev, [ id ]: blockRef } ) );\n\t}, [] );\n\n\t// Recalculate floating comment thread offsets whenever the heights change.\n\tuseEffect( () => {\n\t\t/**\n\t\t * Calculate the y offsets for all comment threads. Account for potentially\n\t\t * overlapping threads and adjust their positions accordingly.\n\t\t */\n\t\tconst calculateAllOffsets = () => {\n\t\t\tconst offsets = {};\n\n\t\t\tif ( ! isFloating ) {\n\t\t\t\treturn { offsets, minHeight: 0 };\n\t\t\t}\n\n\t\t\t// Find the index of the selected thread.\n\t\t\tconst selectedThreadIndex = threads.findIndex(\n\t\t\t\t( t ) => t.id === selectedThread\n\t\t\t);\n\n\t\t\tconst breakIndex =\n\t\t\t\tselectedThreadIndex === -1 ? 0 : selectedThreadIndex;\n\n\t\t\t// If there is a selected thread, push threads above up and threads below down.\n\t\t\tconst selectedThreadData = threads[ breakIndex ];\n\n\t\t\tif (\n\t\t\t\t! selectedThreadData ||\n\t\t\t\t! blockRefs[ selectedThreadData.id ]\n\t\t\t) {\n\t\t\t\treturn { offsets, minHeight: 0 };\n\t\t\t}\n\n\t\t\tlet blockElement = blockRefs[ selectedThreadData.id ];\n\t\t\tlet blockRect = blockElement?.getBoundingClientRect();\n\t\t\tconst selectedThreadTop = blockRect?.top || 0;\n\t\t\tconst selectedThreadHeight = heights[ selectedThreadData.id ] || 0;\n\n\t\t\toffsets[ selectedThreadData.id ] = -16;\n\n\t\t\tlet previousThreadData = {\n\t\t\t\tthreadTop: selectedThreadTop - 16,\n\t\t\t\tthreadHeight: selectedThreadHeight,\n\t\t\t};\n\n\t\t\t// Process threads after the selected thread, offsetting any overlapping\n\t\t\t// threads downward.\n\t\t\tfor ( let i = breakIndex + 1; i < threads.length; i++ ) {\n\t\t\t\tconst thread = threads[ i ];\n\t\t\t\tif ( ! blockRefs[ thread.id ] ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tblockElement = blockRefs[ thread.id ];\n\t\t\t\tblockRect = blockElement?.getBoundingClientRect();\n\t\t\t\tconst threadTop = blockRect?.top || 0;\n\t\t\t\tconst threadHeight = heights[ thread.id ] || 0;\n\n\t\t\t\tlet additionalOffset = -16;\n\n\t\t\t\t// Check if the thread overlaps with the previous one.\n\t\t\t\tconst previousBottom =\n\t\t\t\t\tpreviousThreadData.threadTop +\n\t\t\t\t\tpreviousThreadData.threadHeight;\n\t\t\t\tif ( threadTop < previousBottom + 16 ) {\n\t\t\t\t\t// Shift down by the difference plus a margin to avoid overlap.\n\t\t\t\t\tadditionalOffset = previousBottom - threadTop + 20;\n\t\t\t\t}\n\n\t\t\t\toffsets[ thread.id ] = additionalOffset;\n\n\t\t\t\t// Update for next iteration.\n\t\t\t\tpreviousThreadData = {\n\t\t\t\t\tthreadTop: threadTop + additionalOffset,\n\t\t\t\t\tthreadHeight,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Process threads before the selected thread, offsetting any overlapping\n\t\t\t// threads upward.\n\t\t\tlet nextThreadData = {\n\t\t\t\tthreadTop: selectedThreadTop - 16,\n\t\t\t};\n\n\t\t\tfor ( let i = selectedThreadIndex - 1; i >= 0; i-- ) {\n\t\t\t\tconst thread = threads[ i ];\n\t\t\t\tif ( ! blockRefs[ thread.id ] ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tblockElement = blockRefs[ thread.id ];\n\t\t\t\tblockRect = blockElement?.getBoundingClientRect();\n\t\t\t\tconst threadTop = blockRect?.top || 0;\n\t\t\t\tconst threadHeight = heights[ thread.id ] || 0;\n\n\t\t\t\tlet additionalOffset = -16;\n\n\t\t\t\t// Calculate the bottom position of this thread with default offset.\n\t\t\t\tconst threadBottom = threadTop + threadHeight;\n\n\t\t\t\t// Check if this thread's bottom would overlap with the next thread's top.\n\t\t\t\tif ( threadBottom > nextThreadData.threadTop ) {\n\t\t\t\t\t// Shift up by the difference plus a margin to avoid overlap.\n\t\t\t\t\tadditionalOffset =\n\t\t\t\t\t\tnextThreadData.threadTop -\n\t\t\t\t\t\tthreadTop -\n\t\t\t\t\t\tthreadHeight -\n\t\t\t\t\t\t20;\n\t\t\t\t}\n\n\t\t\t\toffsets[ thread.id ] = additionalOffset;\n\n\t\t\t\t// Update for next iteration (going upward).\n\t\t\t\tnextThreadData = {\n\t\t\t\t\tthreadTop: threadTop + additionalOffset,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tlet editorMinHeight = 0;\n\t\t\t// Take the calculated top of the final note plus its height as the editor min height.\n\t\t\tconst lastThread = threads[ threads.length - 1 ];\n\t\t\tif ( blockRefs[ lastThread.id ] ) {\n\t\t\t\tconst lastBlockElement = blockRefs[ lastThread.id ];\n\t\t\t\tconst lastBlockRect = lastBlockElement?.getBoundingClientRect();\n\t\t\t\tconst lastThreadTop = lastBlockRect?.top || 0;\n\t\t\t\tconst lastThreadHeight = heights[ lastThread.id ] || 0;\n\t\t\t\tconst lastThreadOffset = offsets[ lastThread.id ] || 0;\n\t\t\t\teditorMinHeight =\n\t\t\t\t\tlastThreadTop + lastThreadHeight + lastThreadOffset + 32;\n\t\t\t}\n\n\t\t\treturn { offsets, minHeight: editorMinHeight };\n\t\t};\n\t\tconst { offsets: newOffsets, minHeight } = calculateAllOffsets();\n\t\tif ( Object.keys( newOffsets ).length > 0 ) {\n\t\t\tsetBoardOffsets( newOffsets );\n\t\t}\n\t\t// Ensure the editor has enough height to scroll to all notes.\n\t\tsetCanvasMinHeight( minHeight );\n\t}, [\n\t\theights,\n\t\tblockRefs,\n\t\tisFloating,\n\t\tthreads,\n\t\tselectedThread,\n\t\tsetCanvasMinHeight,\n\t] );\n\n\tconst handleThreadNavigation = ( event, thread, isSelected ) => {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentIndex = threads.findIndex( ( t ) => t.id === thread.id );\n\n\t\tif (\n\t\t\t( event.key === 'Enter' || event.key === 'ArrowRight' ) &&\n\t\t\tevent.currentTarget === event.target &&\n\t\t\t! isSelected\n\t\t) {\n\t\t\t// Expand thread.\n\t\t\tsetNewNoteFormState( 'closed' );\n\t\t\tsetSelectedThread( thread.id );\n\t\t\tif ( !! thread.blockClientId ) {\n\t\t\t\t// Pass `null` as the second parameter to prevent focusing the block.\n\t\t\t\tselectBlock( thread.blockClientId, null );\n\t\t\t\ttoggleBlockSpotlight( thread.blockClientId, true );\n\t\t\t}\n\t\t} else if (\n\t\t\t( ( event.key === 'Enter' || event.key === 'ArrowLeft' ) &&\n\t\t\t\tevent.currentTarget === event.target &&\n\t\t\t\tisSelected ) ||\n\t\t\tevent.key === 'Escape'\n\t\t) {\n\t\t\t// Collapse thread.\n\t\t\tsetSelectedThread( null );\n\t\t\tsetNewNoteFormState( 'closed' );\n\t\t\tif ( thread.blockClientId ) {\n\t\t\t\ttoggleBlockSpotlight( thread.blockClientId, false );\n\t\t\t}\n\t\t\tfocusCommentThread( thread.id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'ArrowDown' &&\n\t\t\tcurrentIndex < threads.length - 1 &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the next thread.\n\t\t\tconst nextThread = threads[ currentIndex + 1 ];\n\t\t\tfocusCommentThread( nextThread.id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'ArrowUp' &&\n\t\t\tcurrentIndex > 0 &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the previous thread.\n\t\t\tconst prevThread = threads[ currentIndex - 1 ];\n\t\t\tfocusCommentThread( prevThread.id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'Home' &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the first thread.\n\t\t\tfocusCommentThread( threads[ 0 ].id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'End' &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the last thread.\n\t\t\tfocusCommentThread(\n\t\t\t\tthreads[ threads.length - 1 ].id,\n\t\t\t\tcommentSidebarRef.current\n\t\t\t);\n\t\t}\n\t};\n\n\tconst hasThreads = Array.isArray( threads ) && threads.length > 0;\n\t// This should no longer happen since https://github.com/WordPress/gutenberg/pull/72872.\n\tif ( ! hasThreads && ! isFloating ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ ! isFloating && newNoteFormState === 'open' && (\n\t\t\t\t<AddComment\n\t\t\t\t\tonSubmit={ onAddReply }\n\t\t\t\t\tnewNoteFormState={ newNoteFormState }\n\t\t\t\t\tsetNewNoteFormState={ setNewNoteFormState }\n\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ threads.map( ( thread ) => (\n\t\t\t\t<Thread\n\t\t\t\t\tkey={ thread.id }\n\t\t\t\t\tthread={ thread }\n\t\t\t\t\tonAddReply={ onAddReply }\n\t\t\t\t\tonCommentDelete={ handleDelete }\n\t\t\t\t\tonEditComment={ onEditComment }\n\t\t\t\t\tisSelected={ selectedThread === thread.id }\n\t\t\t\t\tsetSelectedThread={ setSelectedThread }\n\t\t\t\t\tsetNewNoteFormState={ setNewNoteFormState }\n\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\tisFloating={ isFloating }\n\t\t\t\t\tcalculatedOffset={ boardOffsets[ thread.id ] ?? 0 }\n\t\t\t\t\tsetHeights={ setHeights }\n\t\t\t\t\tsetBlockRef={ setBlockRef }\n\t\t\t\t\tselectedThread={ selectedThread }\n\t\t\t\t\tcommentLastUpdated={ commentLastUpdated }\n\t\t\t\t\tnewNoteFormState={ newNoteFormState }\n\t\t\t\t\tonKeyDown={ ( event ) =>\n\t\t\t\t\t\thandleThreadNavigation(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\tthread,\n\t\t\t\t\t\t\tselectedThread === thread.id\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction Thread( {\n\tthread,\n\tonEditComment,\n\tonAddReply,\n\tonCommentDelete,\n\tisSelected,\n\tsetNewNoteFormState,\n\tcommentSidebarRef,\n\treflowComments,\n\tisFloating,\n\tcalculatedOffset,\n\tsetHeights,\n\tsetBlockRef,\n\tsetSelectedThread,\n\tselectedThread,\n\tcommentLastUpdated,\n\tnewNoteFormState,\n\tonKeyDown,\n} ) {\n\tconst { toggleBlockHighlight, selectBlock, toggleBlockSpotlight } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst relatedBlockElement = useBlockElement( thread.blockClientId );\n\tconst debouncedToggleBlockHighlight = useDebounce(\n\t\ttoggleBlockHighlight,\n\t\t50\n\t);\n\tconst { y, refs } = useFloatingThread( {\n\t\tthread,\n\t\tcalculatedOffset,\n\t\tsetHeights,\n\t\tsetBlockRef,\n\t\tselectedThread,\n\t\tcommentLastUpdated,\n\t} );\n\n\tconst onMouseEnter = () => {\n\t\tdebouncedToggleBlockHighlight( thread.blockClientId, true );\n\t};\n\n\tconst onMouseLeave = () => {\n\t\tdebouncedToggleBlockHighlight( thread.blockClientId, false );\n\t};\n\n\tconst handleCommentSelect = () => {\n\t\tsetNewNoteFormState( 'closed' );\n\t\tsetSelectedThread( thread.id );\n\t\tif ( !! thread.blockClientId ) {\n\t\t\t// Pass `null` as the second parameter to prevent focusing the block.\n\t\t\tselectBlock( thread.blockClientId, null );\n\t\t\ttoggleBlockSpotlight( thread.blockClientId, true );\n\t\t}\n\t};\n\n\tconst unselectThread = () => {\n\t\tsetSelectedThread( null );\n\t\tsetNewNoteFormState( 'closed' );\n\t\ttoggleBlockSpotlight( thread.blockClientId, false );\n\t};\n\n\tconst allReplies = thread?.reply || [];\n\n\tconst lastReply =\n\t\tallReplies.length > 0 ? allReplies[ allReplies.length - 1 ] : undefined;\n\tconst restReplies = allReplies.length > 0 ? allReplies.slice( 0, -1 ) : [];\n\n\tconst commentExcerpt = getCommentExcerpt(\n\t\tstripHTML( thread.content?.rendered ),\n\t\t10\n\t);\n\tconst ariaLabel = !! thread.blockClientId\n\t\t? sprintf(\n\t\t\t\t// translators: %s: note excerpt\n\t\t\t\t__( 'Note: %s' ),\n\t\t\t\tcommentExcerpt\n\t\t )\n\t\t: sprintf(\n\t\t\t\t// translators: %s: note excerpt\n\t\t\t\t__( 'Original block deleted. Note: %s' ),\n\t\t\t\tcommentExcerpt\n\t\t );\n\n\tif (\n\t\tthread.id === 'new-note-thread' &&\n\t\tnewNoteFormState === 'open' &&\n\t\tisFloating\n\t) {\n\t\treturn (\n\t\t\t<AddComment\n\t\t\t\tonSubmit={ onAddReply }\n\t\t\t\tnewNoteFormState={ newNoteFormState }\n\t\t\t\tsetNewNoteFormState={ setNewNoteFormState }\n\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t\tisFloating={ isFloating }\n\t\t\t\ty={ y }\n\t\t\t\trefs={ refs }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<VStack\n\t\t\tclassName={ clsx( 'editor-collab-sidebar-panel__thread', {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-floating': isFloating,\n\t\t\t} ) }\n\t\t\tid={ `comment-thread-${ thread.id }` }\n\t\t\tspacing=\"3\"\n\t\t\tonClick={ handleCommentSelect }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onMouseEnter }\n\t\t\tonBlur={ onMouseLeave }\n\t\t\tonKeyDown={ onKeyDown }\n\t\t\ttabIndex={ 0 }\n\t\t\trole=\"treeitem\"\n\t\t\taria-label={ ariaLabel }\n\t\t\taria-expanded={ isSelected }\n\t\t\tref={ isFloating ? refs.setFloating : undefined }\n\t\t\tstyle={ isFloating ? { top: y } : undefined }\n\t\t>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-collab-sidebar-panel__skip-to-comment\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tsize=\"compact\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\tcommentSidebarRef.current,\n\t\t\t\t\t\t'textarea'\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Add new note' ) }\n\t\t\t</Button>\n\t\t\t{ ! thread.blockClientId && (\n\t\t\t\t<Text as=\"p\" weight={ 500 } variant=\"muted\">\n\t\t\t\t\t{ __( 'Original block deleted.' ) }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t\t<CommentBoard\n\t\t\t\tthread={ thread }\n\t\t\t\tisExpanded={ isSelected }\n\t\t\t\tonEdit={ ( params = {} ) => {\n\t\t\t\t\tonEditComment( params );\n\t\t\t\t\tif ( params.status === 'approved' ) {\n\t\t\t\t\t\tunselectThread();\n\t\t\t\t\t\tif ( isFloating ) {\n\t\t\t\t\t\t\trelatedBlockElement?.focus();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\tcommentSidebarRef.current\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tonDelete={ onCommentDelete }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t/>\n\t\t\t{ isSelected &&\n\t\t\t\tallReplies.map( ( reply ) => (\n\t\t\t\t\t<CommentBoard\n\t\t\t\t\t\tkey={ reply.id }\n\t\t\t\t\t\tthread={ reply }\n\t\t\t\t\t\tparent={ thread }\n\t\t\t\t\t\tisExpanded={ isSelected }\n\t\t\t\t\t\tonEdit={ onEditComment }\n\t\t\t\t\t\tonDelete={ onCommentDelete }\n\t\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t{ ! isSelected && restReplies.length > 0 && (\n\t\t\t\t<HStack className=\"editor-collab-sidebar-panel__more-reply-separator\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__more-reply-button\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetSelectedThread( thread.id );\n\t\t\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\tcommentSidebarRef.current\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: number of replies.\n\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t'%s more reply',\n\t\t\t\t\t\t\t\t'%s more replies',\n\t\t\t\t\t\t\t\trestReplies.length\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\trestReplies.length\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t\t{ ! isSelected && lastReply && (\n\t\t\t\t<CommentBoard\n\t\t\t\t\tthread={ lastReply }\n\t\t\t\t\tparent={ thread }\n\t\t\t\t\tisExpanded={ isSelected }\n\t\t\t\t\tonEdit={ onEditComment }\n\t\t\t\t\tonDelete={ onCommentDelete }\n\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isSelected && (\n\t\t\t\t<VStack spacing=\"2\" role=\"treeitem\">\n\t\t\t\t\t<HStack alignment=\"left\" spacing=\"3\" justify=\"flex-start\">\n\t\t\t\t\t\t<CommentAuthorInfo />\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<VStack spacing=\"2\">\n\t\t\t\t\t\t<CommentForm\n\t\t\t\t\t\t\tonSubmit={ ( inputComment ) => {\n\t\t\t\t\t\t\t\tif ( 'approved' === thread.status ) {\n\t\t\t\t\t\t\t\t\t// For reopening, include the content in the reopen action.\n\t\t\t\t\t\t\t\t\tonEditComment( {\n\t\t\t\t\t\t\t\t\t\tid: thread.id,\n\t\t\t\t\t\t\t\t\t\tstatus: 'hold',\n\t\t\t\t\t\t\t\t\t\tcontent: inputComment,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// For regular replies, add as separate comment.\n\t\t\t\t\t\t\t\t\tonAddReply( {\n\t\t\t\t\t\t\t\t\t\tcontent: inputComment,\n\t\t\t\t\t\t\t\t\t\tparent: thread.id,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonCancel={ ( event ) => {\n\t\t\t\t\t\t\t\t// Prevent the parent onClick from being triggered.\n\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\tunselectThread();\n\t\t\t\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\t\tcommentSidebarRef.current\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsubmitButtonText={\n\t\t\t\t\t\t\t\t'approved' === thread.status\n\t\t\t\t\t\t\t\t\t? __( 'Reopen & Reply' )\n\t\t\t\t\t\t\t\t\t: __( 'Reply' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\trows={ 'approved' === thread.status ? 2 : 4 }\n\t\t\t\t\t\t\tlabelText={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %1$s: note identifier, %2$s: author name\n\t\t\t\t\t\t\t\t__( 'Reply to note %1$s by %2$s' ),\n\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\tthread.author_name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t\t{ !! thread.blockClientId && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__skip-to-block\"\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\trelatedBlockElement?.focus();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Back to block' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nconst CommentBoard = ( {\n\tthread,\n\tparent,\n\tisExpanded,\n\tonEdit,\n\tonDelete,\n\treflowComments,\n} ) => {\n\tconst [ actionState, setActionState ] = useState( false );\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\tconst actionButtonRef = useRef( null );\n\tconst handleConfirmDelete = () => {\n\t\tonDelete( thread );\n\t\tsetActionState( false );\n\t\tsetShowConfirmDialog( false );\n\t};\n\n\tconst handleCancel = () => {\n\t\tsetActionState( false );\n\t\tsetShowConfirmDialog( false );\n\t\tactionButtonRef.current?.focus();\n\t};\n\n\t// Check if this is a resolution comment by checking metadata.\n\tconst isResolutionComment =\n\t\tthread.type === 'note' &&\n\t\tthread.meta &&\n\t\t( thread.meta._wp_note_status === 'resolved' ||\n\t\t\tthread.meta._wp_note_status === 'reopen' );\n\n\tconst actions = [\n\t\t{\n\t\t\tid: 'edit',\n\t\t\ttitle: __( 'Edit' ),\n\t\t\tisEligible: ( { status } ) => status !== 'approved',\n\t\t\tonClick: () => {\n\t\t\t\tsetActionState( 'edit' );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'reopen',\n\t\t\ttitle: _x( 'Reopen', 'Reopen note' ),\n\t\t\tisEligible: ( { status } ) => status === 'approved',\n\t\t\tonClick: () => {\n\t\t\t\tonEdit( { id: thread.id, status: 'hold' } );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'delete',\n\t\t\ttitle: __( 'Delete' ),\n\t\t\tisEligible: () => true,\n\t\t\tonClick: () => {\n\t\t\t\tsetActionState( 'delete' );\n\t\t\t\tsetShowConfirmDialog( true );\n\t\t\t},\n\t\t},\n\t];\n\n\tconst canResolve = thread.parent === 0;\n\tconst moreActions =\n\t\tparent?.status !== 'approved'\n\t\t\t? actions.filter( ( item ) => item.isEligible( thread ) )\n\t\t\t: [];\n\n\treturn (\n\t\t<VStack\n\t\t\tspacing=\"2\"\n\t\t\trole={ thread.parent !== 0 ? 'treeitem' : undefined }\n\t\t>\n\t\t\t<HStack alignment=\"left\" spacing=\"3\" justify=\"flex-start\">\n\t\t\t\t<CommentAuthorInfo\n\t\t\t\t\tavatar={ thread?.author_avatar_urls?.[ 48 ] }\n\t\t\t\t\tname={ thread?.author_name }\n\t\t\t\t\tdate={ thread?.date }\n\t\t\t\t\tuserId={ thread?.author }\n\t\t\t\t/>\n\t\t\t\t{ isExpanded && (\n\t\t\t\t\t<FlexItem\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__comment-status\"\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t// Prevent the thread from being selected.\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<HStack spacing=\"0\">\n\t\t\t\t\t\t\t{ canResolve && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t\t'Resolve',\n\t\t\t\t\t\t\t\t\t\t'Mark note as resolved'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\ticon={ published }\n\t\t\t\t\t\t\t\t\tdisabled={ thread.status === 'approved' }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled={\n\t\t\t\t\t\t\t\t\t\tthread.status === 'approved'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonEdit( {\n\t\t\t\t\t\t\t\t\t\t\tid: thread.id,\n\t\t\t\t\t\t\t\t\t\t\tstatus: 'approved',\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<Menu placement=\"bottom-end\">\n\t\t\t\t\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tref={ actionButtonRef }\n\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\t\t\t\t\tdisabled={ ! moreActions.length }\n\t\t\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<Menu.Popover>\n\t\t\t\t\t\t\t\t\t{ moreActions.map( ( action ) => (\n\t\t\t\t\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => action.onClick() }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t{ action.title }\n\t\t\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t</Menu.Popover>\n\t\t\t\t\t\t\t</Menu>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t\t{ 'edit' === actionState ? (\n\t\t\t\t<CommentForm\n\t\t\t\t\tonSubmit={ ( value ) => {\n\t\t\t\t\t\tonEdit( {\n\t\t\t\t\t\t\tid: thread.id,\n\t\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetActionState( false );\n\t\t\t\t\t\tactionButtonRef.current?.focus();\n\t\t\t\t\t} }\n\t\t\t\t\tonCancel={ () => handleCancel() }\n\t\t\t\t\tthread={ thread }\n\t\t\t\t\tsubmitButtonText={ _x( 'Update', 'verb' ) }\n\t\t\t\t\tlabelText={ sprintf(\n\t\t\t\t\t\t// translators: %1$s: note identifier, %2$s: author name.\n\t\t\t\t\t\t__( 'Edit note %1$s by %2$s' ),\n\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\tthread.author_name\n\t\t\t\t\t) }\n\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<RawHTML\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'editor-collab-sidebar-panel__user-comment',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'editor-collab-sidebar-panel__resolution-text':\n\t\t\t\t\t\t\t\tisResolutionComment,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ isResolutionComment\n\t\t\t\t\t\t? ( () => {\n\t\t\t\t\t\t\t\tconst actionText =\n\t\t\t\t\t\t\t\t\tthread.meta._wp_note_status === 'resolved'\n\t\t\t\t\t\t\t\t\t\t? __( 'Marked as resolved' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Reopened' );\n\t\t\t\t\t\t\t\tconst content = thread?.content?.raw;\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tcontent &&\n\t\t\t\t\t\t\t\t\ttypeof content === 'string' &&\n\t\t\t\t\t\t\t\t\tcontent.trim() !== ''\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %1$s: action label (\"Marked as resolved\" or \"Reopened\"); %2$s: note text.\n\t\t\t\t\t\t\t\t\t\t__( '%1$s: %2$s' ),\n\t\t\t\t\t\t\t\t\t\tactionText,\n\t\t\t\t\t\t\t\t\t\tcontent\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// If no content, just show the action.\n\t\t\t\t\t\t\t\treturn actionText;\n\t\t\t\t\t\t } )()\n\t\t\t\t\t\t: thread?.content?.rendered }\n\t\t\t\t</RawHTML>\n\t\t\t) }\n\t\t\t{ 'delete' === actionState && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\t\tonConfirm={ handleConfirmDelete }\n\t\t\t\t\tonCancel={ handleCancel }\n\t\t\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t\"Are you sure you want to delete this note? This will also delete all of this note's replies.\"\n\t\t\t\t\t) }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</VSt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SAAS,MAAM;AAAA,YAChC;AAAA,YACA,UAAW,MAAM,aAAa;AAAA,YAC9B;AAAA,YACA,sBAAmB,gBAAI,UAAU,MAAO;AAAA,YACxC,eAAY;AAAA;AAAA,kBAEX,gBAAI,wBAAyB;AAAA,cAC7B,OAAO;AAAA,cACP,OAAO;AAAA,YACR;AAAA,YACA;AAAA;AAAA,QACD,IAEA;AAAA,UAAC;AAAA;AAAA,YACA,eAAY,YAAAJ;AAAA,cACX;AAAA,cACA;AAAA,gBACC,gDACC;AAAA,cACF;AAAA,YACD;AAAA,YAEE,iCACG,MAAM;AACR,oBAAM,aACL,OAAO,KAAK,oBAAoB,iBAC7B,gBAAI,oBAAqB,QACzB,gBAAI,UAAW;AACnB,oBAAM,UAAU,QAAQ,SAAS;AAEjC,kBACC,WACA,OAAO,YAAY,YACnB,QAAQ,KAAK,MAAM,IAClB;AACD,2BAAO;AAAA;AAAA,sBAEN,gBAAI,YAAa;AAAA,kBACjB;AAAA,kBACA;AAAA,gBACD;AAAA,cACD;AAEA,qBAAO;AAAA,YACP,GAAI,IACJ,QAAQ,SAAS;AAAA;AAAA,QACrB;AAAA,QAEC,aAAa,eACd;AAAA,UAAC,kBAAAK;AAAA,UAAA;AAAA,YACA,QAAS;AAAA,YACT,WAAY;AAAA,YACZ,UAAW;AAAA,YACX,uBAAoB,gBAAI,QAAS;AAAA,YAE/B;AAAA,cACD;AAAA,YACD;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF;AAEF;AAEA,IAAO,mBAAQ;",
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tRawHTML,\n\tuseEffect,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n} from '@wordpress/element';\nimport {\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tButton,\n\tFlexItem,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useDebounce } from '@wordpress/compose';\n\nimport { published, moreVertical } from '@wordpress/icons';\nimport { __, _x, sprintf, _n } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport CommentAuthorInfo from './comment-author-info';\nimport CommentForm from './comment-form';\nimport { focusCommentThread, getCommentExcerpt } from './utils';\nimport { useFloatingThread } from './hooks';\nimport { AddComment } from './add-comment';\nimport { store as editorStore } from '../../store';\n\nconst { useBlockElement } = unlock( blockEditorPrivateApis );\nconst { Menu } = unlock( componentsPrivateApis );\n\nexport function Comments( {\n\tthreads: noteThreads,\n\tonEditComment,\n\tonAddReply,\n\tonCommentDelete,\n\tnewNoteFormState,\n\tsetNewNoteFormState,\n\tcommentSidebarRef,\n\treflowComments,\n\tisFloating = false,\n\tcommentLastUpdated,\n} ) {\n\tconst [ heights, setHeights ] = useState( {} );\n\tconst [ selectedThread, setSelectedThread ] = useState( null );\n\tconst [ boardOffsets, setBoardOffsets ] = useState( {} );\n\tconst [ blockRefs, setBlockRefs ] = useState( {} );\n\n\tconst { setCanvasMinHeight } = unlock( useDispatch( editorStore ) );\n\tconst { selectBlock, toggleBlockSpotlight } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst { blockCommentId, selectedBlockClientId, orderedBlockIds } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetClientIdsWithDescendants,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\treturn {\n\t\t\t\tblockCommentId: clientId\n\t\t\t\t\t? getBlockAttributes( clientId )?.metadata?.noteId\n\t\t\t\t\t: null,\n\t\t\t\tselectedBlockClientId: clientId,\n\t\t\t\torderedBlockIds: getClientIdsWithDescendants(),\n\t\t\t};\n\t\t}, [] );\n\n\tconst relatedBlockElement = useBlockElement( selectedBlockClientId );\n\n\tconst threads = useMemo( () => {\n\t\tconst t = [ ...noteThreads ];\n\t\tconst orderedThreads = [];\n\t\t// In floating mode, when the note board is shown, and as long\n\t\t// as the selected block doesn't have an existing note attached -\n\t\t// add a \"new note\" entry to the threads. This special thread type\n\t\t// gets sorted and floated like regular threads, but shows an AddComment\n\t\t// component instead of a regular comment thread.\n\t\tif ( isFloating && newNoteFormState === 'open' ) {\n\t\t\t// Insert the new note entry at the correct location for its blockId.\n\t\t\tconst newNoteThread = {\n\t\t\t\tid: 'new-note-thread',\n\t\t\t\tblockClientId: selectedBlockClientId,\n\t\t\t\tcontent: { rendered: '' },\n\t\t\t};\n\t\t\t// Insert the new comment block at the right order within the threads.\n\t\t\torderedBlockIds.forEach( ( blockId ) => {\n\t\t\t\tif ( blockId === selectedBlockClientId ) {\n\t\t\t\t\torderedThreads.push( newNoteThread );\n\t\t\t\t} else {\n\t\t\t\t\tconst threadForBlock = t.find(\n\t\t\t\t\t\t( thread ) => thread.blockClientId === blockId\n\t\t\t\t\t);\n\t\t\t\t\tif ( threadForBlock ) {\n\t\t\t\t\t\torderedThreads.push( threadForBlock );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t\treturn orderedThreads;\n\t\t}\n\t\treturn t;\n\t}, [\n\t\tnoteThreads,\n\t\tisFloating,\n\t\tnewNoteFormState,\n\t\tselectedBlockClientId,\n\t\torderedBlockIds,\n\t] );\n\n\tconst handleDelete = async ( comment ) => {\n\t\tconst currentIndex = threads.findIndex( ( t ) => t.id === comment.id );\n\t\tconst nextThread = threads[ currentIndex + 1 ];\n\t\tconst prevThread = threads[ currentIndex - 1 ];\n\n\t\tawait onCommentDelete( comment );\n\n\t\tif ( comment.parent !== 0 ) {\n\t\t\t// Move focus to the parent thread when a reply was deleted.\n\t\t\tsetSelectedThread( comment.parent );\n\t\t\tfocusCommentThread( comment.parent, commentSidebarRef.current );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( nextThread ) {\n\t\t\tsetSelectedThread( nextThread.id );\n\t\t\tfocusCommentThread( nextThread.id, commentSidebarRef.current );\n\t\t} else if ( prevThread ) {\n\t\t\tsetSelectedThread( prevThread.id );\n\t\t\tfocusCommentThread( prevThread.id, commentSidebarRef.current );\n\t\t} else {\n\t\t\tsetSelectedThread( null );\n\t\t\tsetNewNoteFormState( 'closed' );\n\t\t\t// Move focus to the related block.\n\t\t\trelatedBlockElement?.focus();\n\t\t}\n\t};\n\n\t// Auto-select the related comment thread when a block is selected.\n\tuseEffect( () => {\n\t\t// Fallback to 'new-note-thread' when showing the comment board for a new note.\n\t\tsetSelectedThread(\n\t\t\tnewNoteFormState === 'open' ? 'new-note-thread' : blockCommentId\n\t\t);\n\t}, [ blockCommentId, newNoteFormState ] );\n\n\tconst setBlockRef = useCallback( ( id, blockRef ) => {\n\t\tsetBlockRefs( ( prev ) => ( { ...prev, [ id ]: blockRef } ) );\n\t}, [] );\n\n\t// Recalculate floating comment thread offsets whenever the heights change.\n\tuseEffect( () => {\n\t\t/**\n\t\t * Calculate the y offsets for all comment threads. Account for potentially\n\t\t * overlapping threads and adjust their positions accordingly.\n\t\t */\n\t\tconst calculateAllOffsets = () => {\n\t\t\tconst offsets = {};\n\n\t\t\tif ( ! isFloating ) {\n\t\t\t\treturn { offsets, minHeight: 0 };\n\t\t\t}\n\n\t\t\t// Find the index of the selected thread.\n\t\t\tconst selectedThreadIndex = threads.findIndex(\n\t\t\t\t( t ) => t.id === selectedThread\n\t\t\t);\n\n\t\t\tconst breakIndex =\n\t\t\t\tselectedThreadIndex === -1 ? 0 : selectedThreadIndex;\n\n\t\t\t// If there is a selected thread, push threads above up and threads below down.\n\t\t\tconst selectedThreadData = threads[ breakIndex ];\n\n\t\t\tif (\n\t\t\t\t! selectedThreadData ||\n\t\t\t\t! blockRefs[ selectedThreadData.id ]\n\t\t\t) {\n\t\t\t\treturn { offsets, minHeight: 0 };\n\t\t\t}\n\n\t\t\tlet blockElement = blockRefs[ selectedThreadData.id ];\n\t\t\tlet blockRect = blockElement?.getBoundingClientRect();\n\t\t\tconst selectedThreadTop = blockRect?.top || 0;\n\t\t\tconst selectedThreadHeight = heights[ selectedThreadData.id ] || 0;\n\n\t\t\toffsets[ selectedThreadData.id ] = -16;\n\n\t\t\tlet previousThreadData = {\n\t\t\t\tthreadTop: selectedThreadTop - 16,\n\t\t\t\tthreadHeight: selectedThreadHeight,\n\t\t\t};\n\n\t\t\t// Process threads after the selected thread, offsetting any overlapping\n\t\t\t// threads downward.\n\t\t\tfor ( let i = breakIndex + 1; i < threads.length; i++ ) {\n\t\t\t\tconst thread = threads[ i ];\n\t\t\t\tif ( ! blockRefs[ thread.id ] ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tblockElement = blockRefs[ thread.id ];\n\t\t\t\tblockRect = blockElement?.getBoundingClientRect();\n\t\t\t\tconst threadTop = blockRect?.top || 0;\n\t\t\t\tconst threadHeight = heights[ thread.id ] || 0;\n\n\t\t\t\tlet additionalOffset = -16;\n\n\t\t\t\t// Check if the thread overlaps with the previous one.\n\t\t\t\tconst previousBottom =\n\t\t\t\t\tpreviousThreadData.threadTop +\n\t\t\t\t\tpreviousThreadData.threadHeight;\n\t\t\t\tif ( threadTop < previousBottom + 16 ) {\n\t\t\t\t\t// Shift down by the difference plus a margin to avoid overlap.\n\t\t\t\t\tadditionalOffset = previousBottom - threadTop + 20;\n\t\t\t\t}\n\n\t\t\t\toffsets[ thread.id ] = additionalOffset;\n\n\t\t\t\t// Update for next iteration.\n\t\t\t\tpreviousThreadData = {\n\t\t\t\t\tthreadTop: threadTop + additionalOffset,\n\t\t\t\t\tthreadHeight,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Process threads before the selected thread, offsetting any overlapping\n\t\t\t// threads upward.\n\t\t\tlet nextThreadData = {\n\t\t\t\tthreadTop: selectedThreadTop - 16,\n\t\t\t};\n\n\t\t\tfor ( let i = selectedThreadIndex - 1; i >= 0; i-- ) {\n\t\t\t\tconst thread = threads[ i ];\n\t\t\t\tif ( ! blockRefs[ thread.id ] ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tblockElement = blockRefs[ thread.id ];\n\t\t\t\tblockRect = blockElement?.getBoundingClientRect();\n\t\t\t\tconst threadTop = blockRect?.top || 0;\n\t\t\t\tconst threadHeight = heights[ thread.id ] || 0;\n\n\t\t\t\tlet additionalOffset = -16;\n\n\t\t\t\t// Calculate the bottom position of this thread with default offset.\n\t\t\t\tconst threadBottom = threadTop + threadHeight;\n\n\t\t\t\t// Check if this thread's bottom would overlap with the next thread's top.\n\t\t\t\tif ( threadBottom > nextThreadData.threadTop ) {\n\t\t\t\t\t// Shift up by the difference plus a margin to avoid overlap.\n\t\t\t\t\tadditionalOffset =\n\t\t\t\t\t\tnextThreadData.threadTop -\n\t\t\t\t\t\tthreadTop -\n\t\t\t\t\t\tthreadHeight -\n\t\t\t\t\t\t20;\n\t\t\t\t}\n\n\t\t\t\toffsets[ thread.id ] = additionalOffset;\n\n\t\t\t\t// Update for next iteration (going upward).\n\t\t\t\tnextThreadData = {\n\t\t\t\t\tthreadTop: threadTop + additionalOffset,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tlet editorMinHeight = 0;\n\t\t\t// Take the calculated top of the final note plus its height as the editor min height.\n\t\t\tconst lastThread = threads[ threads.length - 1 ];\n\t\t\tif ( blockRefs[ lastThread.id ] ) {\n\t\t\t\tconst lastBlockElement = blockRefs[ lastThread.id ];\n\t\t\t\tconst lastBlockRect = lastBlockElement?.getBoundingClientRect();\n\t\t\t\tconst lastThreadTop = lastBlockRect?.top || 0;\n\t\t\t\tconst lastThreadHeight = heights[ lastThread.id ] || 0;\n\t\t\t\tconst lastThreadOffset = offsets[ lastThread.id ] || 0;\n\t\t\t\teditorMinHeight =\n\t\t\t\t\tlastThreadTop + lastThreadHeight + lastThreadOffset + 32;\n\t\t\t}\n\n\t\t\treturn { offsets, minHeight: editorMinHeight };\n\t\t};\n\t\tconst { offsets: newOffsets, minHeight } = calculateAllOffsets();\n\t\tif ( Object.keys( newOffsets ).length > 0 ) {\n\t\t\tsetBoardOffsets( newOffsets );\n\t\t}\n\t\t// Ensure the editor has enough height to scroll to all notes.\n\t\tsetCanvasMinHeight( minHeight );\n\t}, [\n\t\theights,\n\t\tblockRefs,\n\t\tisFloating,\n\t\tthreads,\n\t\tselectedThread,\n\t\tsetCanvasMinHeight,\n\t] );\n\n\tconst handleThreadNavigation = ( event, thread, isSelected ) => {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentIndex = threads.findIndex( ( t ) => t.id === thread.id );\n\n\t\tif (\n\t\t\t( event.key === 'Enter' || event.key === 'ArrowRight' ) &&\n\t\t\tevent.currentTarget === event.target &&\n\t\t\t! isSelected\n\t\t) {\n\t\t\t// Expand thread.\n\t\t\tsetNewNoteFormState( 'closed' );\n\t\t\tsetSelectedThread( thread.id );\n\t\t\tif ( !! thread.blockClientId ) {\n\t\t\t\t// Pass `null` as the second parameter to prevent focusing the block.\n\t\t\t\tselectBlock( thread.blockClientId, null );\n\t\t\t\ttoggleBlockSpotlight( thread.blockClientId, true );\n\t\t\t}\n\t\t} else if (\n\t\t\t( ( event.key === 'Enter' || event.key === 'ArrowLeft' ) &&\n\t\t\t\tevent.currentTarget === event.target &&\n\t\t\t\tisSelected ) ||\n\t\t\tevent.key === 'Escape'\n\t\t) {\n\t\t\t// Collapse thread.\n\t\t\tsetSelectedThread( null );\n\t\t\tsetNewNoteFormState( 'closed' );\n\t\t\tif ( thread.blockClientId ) {\n\t\t\t\ttoggleBlockSpotlight( thread.blockClientId, false );\n\t\t\t}\n\t\t\tfocusCommentThread( thread.id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'ArrowDown' &&\n\t\t\tcurrentIndex < threads.length - 1 &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the next thread.\n\t\t\tconst nextThread = threads[ currentIndex + 1 ];\n\t\t\tfocusCommentThread( nextThread.id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'ArrowUp' &&\n\t\t\tcurrentIndex > 0 &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the previous thread.\n\t\t\tconst prevThread = threads[ currentIndex - 1 ];\n\t\t\tfocusCommentThread( prevThread.id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'Home' &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the first thread.\n\t\t\tfocusCommentThread( threads[ 0 ].id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'End' &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the last thread.\n\t\t\tfocusCommentThread(\n\t\t\t\tthreads[ threads.length - 1 ].id,\n\t\t\t\tcommentSidebarRef.current\n\t\t\t);\n\t\t}\n\t};\n\n\tconst hasThreads = Array.isArray( threads ) && threads.length > 0;\n\t// A special case for `template-locked` mode - https://github.com/WordPress/gutenberg/pull/72646.\n\tif ( ! hasThreads && ! isFloating ) {\n\t\treturn (\n\t\t\t<AddComment\n\t\t\t\tonSubmit={ onAddReply }\n\t\t\t\tnewNoteFormState={ newNoteFormState }\n\t\t\t\tsetNewNoteFormState={ setNewNoteFormState }\n\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ ! isFloating && newNoteFormState === 'open' && (\n\t\t\t\t<AddComment\n\t\t\t\t\tonSubmit={ onAddReply }\n\t\t\t\t\tnewNoteFormState={ newNoteFormState }\n\t\t\t\t\tsetNewNoteFormState={ setNewNoteFormState }\n\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ threads.map( ( thread ) => (\n\t\t\t\t<Thread\n\t\t\t\t\tkey={ thread.id }\n\t\t\t\t\tthread={ thread }\n\t\t\t\t\tonAddReply={ onAddReply }\n\t\t\t\t\tonCommentDelete={ handleDelete }\n\t\t\t\t\tonEditComment={ onEditComment }\n\t\t\t\t\tisSelected={ selectedThread === thread.id }\n\t\t\t\t\tsetSelectedThread={ setSelectedThread }\n\t\t\t\t\tsetNewNoteFormState={ setNewNoteFormState }\n\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\tisFloating={ isFloating }\n\t\t\t\t\tcalculatedOffset={ boardOffsets[ thread.id ] ?? 0 }\n\t\t\t\t\tsetHeights={ setHeights }\n\t\t\t\t\tsetBlockRef={ setBlockRef }\n\t\t\t\t\tselectedThread={ selectedThread }\n\t\t\t\t\tcommentLastUpdated={ commentLastUpdated }\n\t\t\t\t\tnewNoteFormState={ newNoteFormState }\n\t\t\t\t\tonKeyDown={ ( event ) =>\n\t\t\t\t\t\thandleThreadNavigation(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\tthread,\n\t\t\t\t\t\t\tselectedThread === thread.id\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction Thread( {\n\tthread,\n\tonEditComment,\n\tonAddReply,\n\tonCommentDelete,\n\tisSelected,\n\tsetNewNoteFormState,\n\tcommentSidebarRef,\n\treflowComments,\n\tisFloating,\n\tcalculatedOffset,\n\tsetHeights,\n\tsetBlockRef,\n\tsetSelectedThread,\n\tselectedThread,\n\tcommentLastUpdated,\n\tnewNoteFormState,\n\tonKeyDown,\n} ) {\n\tconst { toggleBlockHighlight, selectBlock, toggleBlockSpotlight } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst relatedBlockElement = useBlockElement( thread.blockClientId );\n\tconst debouncedToggleBlockHighlight = useDebounce(\n\t\ttoggleBlockHighlight,\n\t\t50\n\t);\n\tconst { y, refs } = useFloatingThread( {\n\t\tthread,\n\t\tcalculatedOffset,\n\t\tsetHeights,\n\t\tsetBlockRef,\n\t\tselectedThread,\n\t\tcommentLastUpdated,\n\t} );\n\tconst isKeyboardTabbingRef = useRef( false );\n\n\tconst onMouseEnter = () => {\n\t\tdebouncedToggleBlockHighlight( thread.blockClientId, true );\n\t};\n\n\tconst onMouseLeave = () => {\n\t\tdebouncedToggleBlockHighlight( thread.blockClientId, false );\n\t};\n\n\tconst onFocus = () => {\n\t\ttoggleBlockHighlight( thread.blockClientId, true );\n\t};\n\n\tconst onBlur = ( event ) => {\n\t\tconst isNoteFocused = event.relatedTarget?.closest(\n\t\t\t'.editor-collab-sidebar-panel__thread'\n\t\t);\n\t\tconst isDialogFocused =\n\t\t\tevent.relatedTarget?.closest( '[role=\"dialog\"]' );\n\t\tconst isTabbing = isKeyboardTabbingRef.current;\n\n\t\t// When another note is clicked, do nothing because the current note is automatically closed.\n\t\tif ( isNoteFocused && ! isTabbing ) {\n\t\t\treturn;\n\t\t}\n\t\t// When deleting a note, a dialog appears, but the note should not be collapsed.\n\t\tif ( isDialogFocused ) {\n\t\t\treturn;\n\t\t}\n\t\t// When tabbing, do nothing if the focus is within the current note.\n\t\tif (\n\t\t\tisTabbing &&\n\t\t\tevent.currentTarget.contains( event.relatedTarget )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Closes a note that has lost focus when any of the following conditions are met:\n\t\t// - An element other than a note is clicked.\n\t\t// - Focus was lost by tabbing.\n\t\ttoggleBlockHighlight( thread.blockClientId, false );\n\t\tunselectThread();\n\t};\n\n\tconst handleCommentSelect = () => {\n\t\tsetNewNoteFormState( 'closed' );\n\t\tsetSelectedThread( thread.id );\n\t\ttoggleBlockSpotlight( thread.blockClientId, true );\n\t\tif ( !! thread.blockClientId ) {\n\t\t\t// Pass `null` as the second parameter to prevent focusing the block.\n\t\t\tselectBlock( thread.blockClientId, null );\n\t\t}\n\t};\n\n\tconst unselectThread = () => {\n\t\tsetSelectedThread( null );\n\t\tsetNewNoteFormState( 'closed' );\n\t\ttoggleBlockSpotlight( thread.blockClientId, false );\n\t};\n\n\tconst allReplies = thread?.reply || [];\n\n\tconst lastReply =\n\t\tallReplies.length > 0 ? allReplies[ allReplies.length - 1 ] : undefined;\n\tconst restReplies = allReplies.length > 0 ? allReplies.slice( 0, -1 ) : [];\n\n\tconst commentExcerpt = getCommentExcerpt(\n\t\tstripHTML( thread.content?.rendered ),\n\t\t10\n\t);\n\tconst ariaLabel = !! thread.blockClientId\n\t\t? sprintf(\n\t\t\t\t// translators: %s: note excerpt\n\t\t\t\t__( 'Note: %s' ),\n\t\t\t\tcommentExcerpt\n\t\t )\n\t\t: sprintf(\n\t\t\t\t// translators: %s: note excerpt\n\t\t\t\t__( 'Original block deleted. Note: %s' ),\n\t\t\t\tcommentExcerpt\n\t\t );\n\n\tif (\n\t\tthread.id === 'new-note-thread' &&\n\t\tnewNoteFormState === 'open' &&\n\t\tisFloating\n\t) {\n\t\treturn (\n\t\t\t<AddComment\n\t\t\t\tonSubmit={ onAddReply }\n\t\t\t\tnewNoteFormState={ newNoteFormState }\n\t\t\t\tsetNewNoteFormState={ setNewNoteFormState }\n\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t\tisFloating={ isFloating }\n\t\t\t\ty={ y }\n\t\t\t\trefs={ refs }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<VStack\n\t\t\tclassName={ clsx( 'editor-collab-sidebar-panel__thread', {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-floating': isFloating,\n\t\t\t} ) }\n\t\t\tid={ `comment-thread-${ thread.id }` }\n\t\t\tspacing=\"3\"\n\t\t\tonClick={ handleCommentSelect }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onFocus }\n\t\t\tonBlur={ onBlur }\n\t\t\tonKeyUp={ ( event ) => {\n\t\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\t\tisKeyboardTabbingRef.current = false;\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\t\tisKeyboardTabbingRef.current = true;\n\t\t\t\t} else {\n\t\t\t\t\tonKeyDown( event );\n\t\t\t\t}\n\t\t\t} }\n\t\t\ttabIndex={ 0 }\n\t\t\trole=\"treeitem\"\n\t\t\taria-label={ ariaLabel }\n\t\t\taria-expanded={ isSelected }\n\t\t\tref={ isFloating ? refs.setFloating : undefined }\n\t\t\tstyle={ isFloating ? { top: y } : undefined }\n\t\t>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-collab-sidebar-panel__skip-to-comment\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tsize=\"compact\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\tcommentSidebarRef.current,\n\t\t\t\t\t\t'textarea'\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Add new reply' ) }\n\t\t\t</Button>\n\t\t\t{ ! thread.blockClientId && (\n\t\t\t\t<Text as=\"p\" weight={ 500 } variant=\"muted\">\n\t\t\t\t\t{ __( 'Original block deleted.' ) }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t\t<CommentBoard\n\t\t\t\tthread={ thread }\n\t\t\t\tisExpanded={ isSelected }\n\t\t\t\tonEdit={ ( params = {} ) => {\n\t\t\t\t\tonEditComment( params );\n\t\t\t\t\tif ( params.status === 'approved' ) {\n\t\t\t\t\t\tunselectThread();\n\t\t\t\t\t\tif ( isFloating ) {\n\t\t\t\t\t\t\trelatedBlockElement?.focus();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\tcommentSidebarRef.current\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tonDelete={ onCommentDelete }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t/>\n\t\t\t{ isSelected &&\n\t\t\t\tallReplies.map( ( reply ) => (\n\t\t\t\t\t<CommentBoard\n\t\t\t\t\t\tkey={ reply.id }\n\t\t\t\t\t\tthread={ reply }\n\t\t\t\t\t\tparent={ thread }\n\t\t\t\t\t\tisExpanded={ isSelected }\n\t\t\t\t\t\tonEdit={ onEditComment }\n\t\t\t\t\t\tonDelete={ onCommentDelete }\n\t\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t{ ! isSelected && restReplies.length > 0 && (\n\t\t\t\t<HStack className=\"editor-collab-sidebar-panel__more-reply-separator\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__more-reply-button\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetSelectedThread( thread.id );\n\t\t\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\tcommentSidebarRef.current\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: number of replies.\n\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t'%s more reply',\n\t\t\t\t\t\t\t\t'%s more replies',\n\t\t\t\t\t\t\t\trestReplies.length\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\trestReplies.length\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t\t{ ! isSelected && lastReply && (\n\t\t\t\t<CommentBoard\n\t\t\t\t\tthread={ lastReply }\n\t\t\t\t\tparent={ thread }\n\t\t\t\t\tisExpanded={ isSelected }\n\t\t\t\t\tonEdit={ onEditComment }\n\t\t\t\t\tonDelete={ onCommentDelete }\n\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isSelected && (\n\t\t\t\t<VStack spacing=\"2\" role=\"treeitem\">\n\t\t\t\t\t<HStack alignment=\"left\" spacing=\"3\" justify=\"flex-start\">\n\t\t\t\t\t\t<CommentAuthorInfo />\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<VStack spacing=\"2\">\n\t\t\t\t\t\t<CommentForm\n\t\t\t\t\t\t\tonSubmit={ ( inputComment ) => {\n\t\t\t\t\t\t\t\tif ( 'approved' === thread.status ) {\n\t\t\t\t\t\t\t\t\t// For reopening, include the content in the reopen action.\n\t\t\t\t\t\t\t\t\tonEditComment( {\n\t\t\t\t\t\t\t\t\t\tid: thread.id,\n\t\t\t\t\t\t\t\t\t\tstatus: 'hold',\n\t\t\t\t\t\t\t\t\t\tcontent: inputComment,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// For regular replies, add as separate comment.\n\t\t\t\t\t\t\t\t\tonAddReply( {\n\t\t\t\t\t\t\t\t\t\tcontent: inputComment,\n\t\t\t\t\t\t\t\t\t\tparent: thread.id,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonCancel={ ( event ) => {\n\t\t\t\t\t\t\t\t// Prevent the parent onClick from being triggered.\n\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\tunselectThread();\n\t\t\t\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\t\tcommentSidebarRef.current\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsubmitButtonText={\n\t\t\t\t\t\t\t\t'approved' === thread.status\n\t\t\t\t\t\t\t\t\t? __( 'Reopen & Reply' )\n\t\t\t\t\t\t\t\t\t: __( 'Reply' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\trows={ 'approved' === thread.status ? 2 : 4 }\n\t\t\t\t\t\t\tlabelText={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %1$s: note identifier, %2$s: author name\n\t\t\t\t\t\t\t\t__( 'Reply to note %1$s by %2$s' ),\n\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\tthread.author_name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t\t{ !! thread.blockClientId && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__skip-to-block\"\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\trelatedBlockElement?.focus();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Back to block' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nconst CommentBoard = ( {\n\tthread,\n\tparent,\n\tisExpanded,\n\tonEdit,\n\tonDelete,\n\treflowComments,\n} ) => {\n\tconst [ actionState, setActionState ] = useState( false );\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\tconst actionButtonRef = useRef( null );\n\tconst handleConfirmDelete = () => {\n\t\tonDelete( thread );\n\t\tsetActionState( false );\n\t\tsetShowConfirmDialog( false );\n\t};\n\n\tconst handleCancel = () => {\n\t\tsetActionState( false );\n\t\tsetShowConfirmDialog( false );\n\t\tactionButtonRef.current?.focus();\n\t};\n\n\t// Check if this is a resolution comment by checking metadata.\n\tconst isResolutionComment =\n\t\tthread.type === 'note' &&\n\t\tthread.meta &&\n\t\t( thread.meta._wp_note_status === 'resolved' ||\n\t\t\tthread.meta._wp_note_status === 'reopen' );\n\n\tconst actions = [\n\t\t{\n\t\t\tid: 'edit',\n\t\t\ttitle: __( 'Edit' ),\n\t\t\tisEligible: ( { status } ) => status !== 'approved',\n\t\t\tonClick: () => {\n\t\t\t\tsetActionState( 'edit' );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'reopen',\n\t\t\ttitle: _x( 'Reopen', 'Reopen note' ),\n\t\t\tisEligible: ( { status } ) => status === 'approved',\n\t\t\tonClick: () => {\n\t\t\t\tonEdit( { id: thread.id, status: 'hold' } );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'delete',\n\t\t\ttitle: __( 'Delete' ),\n\t\t\tisEligible: () => true,\n\t\t\tonClick: () => {\n\t\t\t\tsetActionState( 'delete' );\n\t\t\t\tsetShowConfirmDialog( true );\n\t\t\t},\n\t\t},\n\t];\n\n\tconst canResolve = thread.parent === 0;\n\tconst moreActions =\n\t\tparent?.status !== 'approved'\n\t\t\t? actions.filter( ( item ) => item.isEligible( thread ) )\n\t\t\t: [];\n\n\tconst deleteConfirmMessage =\n\t\t// When deleting a top level note, descendants will also be deleted.\n\t\tthread.parent === 0\n\t\t\t? __(\n\t\t\t\t\t\"Are you sure you want to delete this note? This will also delete all of this note's replies.\"\n\t\t\t )\n\t\t\t: __( 'Are you sure you want to delete this reply?' );\n\n\treturn (\n\t\t<VStack\n\t\t\tspacing=\"2\"\n\t\t\trole={ thread.parent !== 0 ? 'treeitem' : undefined }\n\t\t>\n\t\t\t<HStack alignment=\"left\" spacing=\"3\" justify=\"flex-start\">\n\t\t\t\t<CommentAuthorInfo\n\t\t\t\t\tavatar={ thread?.author_avatar_urls?.[ 48 ] }\n\t\t\t\t\tname={ thread?.author_name }\n\t\t\t\t\tdate={ thread?.date }\n\t\t\t\t\tuserId={ thread?.author }\n\t\t\t\t/>\n\t\t\t\t{ isExpanded && (\n\t\t\t\t\t<FlexItem\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__comment-status\"\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t// Prevent the thread from being selected.\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<HStack spacing=\"0\">\n\t\t\t\t\t\t\t{ canResolve && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t\t'Resolve',\n\t\t\t\t\t\t\t\t\t\t'Mark note as resolved'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\ticon={ published }\n\t\t\t\t\t\t\t\t\tdisabled={ thread.status === 'approved' }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled={\n\t\t\t\t\t\t\t\t\t\tthread.status === 'approved'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonEdit( {\n\t\t\t\t\t\t\t\t\t\t\tid: thread.id,\n\t\t\t\t\t\t\t\t\t\t\tstatus: 'approved',\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<Menu placement=\"bottom-end\">\n\t\t\t\t\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tref={ actionButtonRef }\n\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\t\t\t\t\tdisabled={ ! moreActions.length }\n\t\t\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<Menu.Popover\n\t\t\t\t\t\t\t\t\t// The menu popover is rendered in a portal, which causes focus to be\n\t\t\t\t\t\t\t\t\t// lost and the note to be collapsed unintentionally. To prevent this,\n\t\t\t\t\t\t\t\t\t// the popover should be rendered as an inline.\n\t\t\t\t\t\t\t\t\tmodal={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ moreActions.map( ( action ) => (\n\t\t\t\t\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => action.onClick() }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t{ action.title }\n\t\t\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t</Menu.Popover>\n\t\t\t\t\t\t\t</Menu>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t\t{ 'edit' === actionState ? (\n\t\t\t\t<CommentForm\n\t\t\t\t\tonSubmit={ ( value ) => {\n\t\t\t\t\t\tonEdit( {\n\t\t\t\t\t\t\tid: thread.id,\n\t\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetActionState( false );\n\t\t\t\t\t\tactionButtonRef.current?.focus();\n\t\t\t\t\t} }\n\t\t\t\t\tonCancel={ () => handleCancel() }\n\t\t\t\t\tthread={ thread }\n\t\t\t\t\tsubmitButtonText={ _x( 'Update', 'verb' ) }\n\t\t\t\t\tlabelText={ sprintf(\n\t\t\t\t\t\t// translators: %1$s: note identifier, %2$s: author name.\n\t\t\t\t\t\t__( 'Edit note %1$s by %2$s' ),\n\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\tthread.author_name\n\t\t\t\t\t) }\n\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<RawHTML\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'editor-collab-sidebar-panel__user-comment',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'editor-collab-sidebar-panel__resolution-text':\n\t\t\t\t\t\t\t\tisResolutionComment,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ isResolutionComment\n\t\t\t\t\t\t? ( () => {\n\t\t\t\t\t\t\t\tconst actionText =\n\t\t\t\t\t\t\t\t\tthread.meta._wp_note_status === 'resolved'\n\t\t\t\t\t\t\t\t\t\t? __( 'Marked as resolved' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Reopened' );\n\t\t\t\t\t\t\t\tconst content = thread?.content?.raw;\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tcontent &&\n\t\t\t\t\t\t\t\t\ttypeof content === 'string' &&\n\t\t\t\t\t\t\t\t\tcontent.trim() !== ''\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %1$s: action label (\"Marked as resolved\" or \"Reopened\"); %2$s: note text.\n\t\t\t\t\t\t\t\t\t\t__( '%1$s: %2$s' ),\n\t\t\t\t\t\t\t\t\t\tactionText,\n\t\t\t\t\t\t\t\t\t\tcontent\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// If no content, just show the action.\n\t\t\t\t\t\t\t\treturn actionText;\n\t\t\t\t\t\t } )()\n\t\t\t\t\t\t: thread?.content?.rendered }\n\t\t\t\t</RawHTML>\n\t\t\t) }\n\t\t\t{ 'delete' === actionState && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\t\tonConfirm={ handleConfirmDelete }\n\t\t\t\t\tonCancel={ handleCancel }\n\t\t\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t\t\t>\n\t\t\t\t\t{ deleteConfirmMessage }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</VStack>\n\t);\n};\n\nexport default Comments;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkYG;AA/XH,kBAAiB;AAKjB,qBAOO;AACP,wBAQO;AACP,qBAA4B;AAE5B,mBAAwC;AACxC,kBAAoC;AACpC,kBAAuC;AACvC,iBAAiD;AACjD,0BAGO;AAKP,yBAAuB;AACvB,iCAA8B;AAC9B,0BAAwB;AACxB,mBAAsD;AACtD,mBAAkC;AAClC,yBAA2B;AAC3B,mBAAqC;AAErC,MAAM,EAAE,gBAAgB,QAAI,2BAAQ,oBAAAA,WAAuB;AAC3D,MAAM,EAAE,KAAK,QAAI,2BAAQ,kBAAAC,WAAsB;AAExC,SAAS,SAAU;AAAA,EACzB,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AACD,GAAI;AACH,QAAM,CAAE,SAAS,UAAW,QAAI,yBAAU,CAAC,CAAE;AAC7C,QAAM,CAAE,gBAAgB,iBAAkB,QAAI,yBAAU,IAAK;AAC7D,QAAM,CAAE,cAAc,eAAgB,QAAI,yBAAU,CAAC,CAAE;AACvD,QAAM,CAAE,WAAW,YAAa,Q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AE,UAAW;AACvB,qBAAQ;AAAA,gBACP,IAAI,OAAO;AAAA,gBACX,SAAS;AAAA,cACV,CAAE;AACF,6BAAgB,KAAM;AACtB,8BAAgB,SAAS,MAAM;AAAA,YAChC;AAAA,YACA,UAAW,MAAM,aAAa;AAAA,YAC9B;AAAA,YACA,sBAAmB,gBAAI,UAAU,MAAO;AAAA,YACxC,eAAY;AAAA;AAAA,kBAEX,gBAAI,wBAAyB;AAAA,cAC7B,OAAO;AAAA,cACP,OAAO;AAAA,YACR;AAAA,YACA;AAAA;AAAA,QACD,IAEA;AAAA,UAAC;AAAA;AAAA,YACA,eAAY,YAAAJ;AAAA,cACX;AAAA,cACA;AAAA,gBACC,gDACC;AAAA,cACF;AAAA,YACD;AAAA,YAEE,iCACG,MAAM;AACR,oBAAM,aACL,OAAO,KAAK,oBAAoB,iBAC7B,gBAAI,oBAAqB,QACzB,gBAAI,UAAW;AACnB,oBAAM,UAAU,QAAQ,SAAS;AAEjC,kBACC,WACA,OAAO,YAAY,YACnB,QAAQ,KAAK,MAAM,IAClB;AACD,2BAAO;AAAA;AAAA,sBAEN,gBAAI,YAAa;AAAA,kBACjB;AAAA,kBACA;AAAA,gBACD;AAAA,cACD;AAEA,qBAAO;AAAA,YACP,GAAI,IACJ,QAAQ,SAAS;AAAA;AAAA,QACrB;AAAA,QAEC,aAAa,eACd;AAAA,UAAC,kBAAAK;AAAA,UAAA;AAAA,YACA,QAAS;AAAA,YACT,WAAY;AAAA,YACZ,UAAW;AAAA,YACX,uBAAoB,gBAAI,QAAS;AAAA,YAE/B;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EAEF;AAEF;AAEA,IAAO,mBAAQ;",
|
|
6
6
|
"names": ["blockEditorPrivateApis", "componentsPrivateApis", "editorStore", "blockEditorStore", "stripHTML", "VStack", "clsx", "Text", "HStack", "CommentAuthorInfo", "CommentForm", "ConfirmDialog"]
|
|
7
7
|
}
|
|
@@ -256,7 +256,15 @@ function Comments({
|
|
|
256
256
|
};
|
|
257
257
|
const hasThreads = Array.isArray(threads) && threads.length > 0;
|
|
258
258
|
if (!hasThreads && !isFloating) {
|
|
259
|
-
return
|
|
259
|
+
return /* @__PURE__ */ jsx(
|
|
260
|
+
AddComment,
|
|
261
|
+
{
|
|
262
|
+
onSubmit: onAddReply,
|
|
263
|
+
newNoteFormState,
|
|
264
|
+
setNewNoteFormState,
|
|
265
|
+
commentSidebarRef
|
|
266
|
+
}
|
|
267
|
+
);
|
|
260
268
|
}
|
|
261
269
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
262
270
|
!isFloating && newNoteFormState === "open" && /* @__PURE__ */ jsx(
|
|
@@ -332,18 +340,40 @@ function Thread({
|
|
|
332
340
|
selectedThread,
|
|
333
341
|
commentLastUpdated
|
|
334
342
|
});
|
|
343
|
+
const isKeyboardTabbingRef = useRef(false);
|
|
335
344
|
const onMouseEnter = () => {
|
|
336
345
|
debouncedToggleBlockHighlight(thread.blockClientId, true);
|
|
337
346
|
};
|
|
338
347
|
const onMouseLeave = () => {
|
|
339
348
|
debouncedToggleBlockHighlight(thread.blockClientId, false);
|
|
340
349
|
};
|
|
350
|
+
const onFocus = () => {
|
|
351
|
+
toggleBlockHighlight(thread.blockClientId, true);
|
|
352
|
+
};
|
|
353
|
+
const onBlur = (event) => {
|
|
354
|
+
const isNoteFocused = event.relatedTarget?.closest(
|
|
355
|
+
".editor-collab-sidebar-panel__thread"
|
|
356
|
+
);
|
|
357
|
+
const isDialogFocused = event.relatedTarget?.closest('[role="dialog"]');
|
|
358
|
+
const isTabbing = isKeyboardTabbingRef.current;
|
|
359
|
+
if (isNoteFocused && !isTabbing) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
if (isDialogFocused) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
if (isTabbing && event.currentTarget.contains(event.relatedTarget)) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
toggleBlockHighlight(thread.blockClientId, false);
|
|
369
|
+
unselectThread();
|
|
370
|
+
};
|
|
341
371
|
const handleCommentSelect = () => {
|
|
342
372
|
setNewNoteFormState("closed");
|
|
343
373
|
setSelectedThread(thread.id);
|
|
374
|
+
toggleBlockSpotlight(thread.blockClientId, true);
|
|
344
375
|
if (!!thread.blockClientId) {
|
|
345
376
|
selectBlock(thread.blockClientId, null);
|
|
346
|
-
toggleBlockSpotlight(thread.blockClientId, true);
|
|
347
377
|
}
|
|
348
378
|
};
|
|
349
379
|
const unselectThread = () => {
|
|
@@ -394,9 +424,20 @@ function Thread({
|
|
|
394
424
|
onClick: handleCommentSelect,
|
|
395
425
|
onMouseEnter,
|
|
396
426
|
onMouseLeave,
|
|
397
|
-
onFocus
|
|
398
|
-
onBlur
|
|
399
|
-
|
|
427
|
+
onFocus,
|
|
428
|
+
onBlur,
|
|
429
|
+
onKeyUp: (event) => {
|
|
430
|
+
if (event.key === "Tab") {
|
|
431
|
+
isKeyboardTabbingRef.current = false;
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
onKeyDown: (event) => {
|
|
435
|
+
if (event.key === "Tab") {
|
|
436
|
+
isKeyboardTabbingRef.current = true;
|
|
437
|
+
} else {
|
|
438
|
+
onKeyDown(event);
|
|
439
|
+
}
|
|
440
|
+
},
|
|
400
441
|
tabIndex: 0,
|
|
401
442
|
role: "treeitem",
|
|
402
443
|
"aria-label": ariaLabel,
|
|
@@ -417,7 +458,7 @@ function Thread({
|
|
|
417
458
|
"textarea"
|
|
418
459
|
);
|
|
419
460
|
},
|
|
420
|
-
children: __("Add new
|
|
461
|
+
children: __("Add new reply")
|
|
421
462
|
}
|
|
422
463
|
),
|
|
423
464
|
!thread.blockClientId && /* @__PURE__ */ jsx(Text, { as: "p", weight: 500, variant: "muted", children: __("Original block deleted.") }),
|
|
@@ -598,6 +639,12 @@ const CommentBoard = ({
|
|
|
598
639
|
];
|
|
599
640
|
const canResolve = thread.parent === 0;
|
|
600
641
|
const moreActions = parent?.status !== "approved" ? actions.filter((item) => item.isEligible(thread)) : [];
|
|
642
|
+
const deleteConfirmMessage = (
|
|
643
|
+
// When deleting a top level note, descendants will also be deleted.
|
|
644
|
+
thread.parent === 0 ? __(
|
|
645
|
+
"Are you sure you want to delete this note? This will also delete all of this note's replies."
|
|
646
|
+
) : __("Are you sure you want to delete this reply?")
|
|
647
|
+
);
|
|
601
648
|
return /* @__PURE__ */ jsxs(
|
|
602
649
|
VStack,
|
|
603
650
|
{
|
|
@@ -658,14 +705,20 @@ const CommentBoard = ({
|
|
|
658
705
|
)
|
|
659
706
|
}
|
|
660
707
|
),
|
|
661
|
-
/* @__PURE__ */ jsx(
|
|
662
|
-
Menu.
|
|
708
|
+
/* @__PURE__ */ jsx(
|
|
709
|
+
Menu.Popover,
|
|
663
710
|
{
|
|
664
|
-
|
|
665
|
-
children: /* @__PURE__ */ jsx(
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
711
|
+
modal: false,
|
|
712
|
+
children: moreActions.map((action) => /* @__PURE__ */ jsx(
|
|
713
|
+
Menu.Item,
|
|
714
|
+
{
|
|
715
|
+
onClick: () => action.onClick(),
|
|
716
|
+
children: /* @__PURE__ */ jsx(Menu.ItemLabel, { children: action.title })
|
|
717
|
+
},
|
|
718
|
+
action.id
|
|
719
|
+
))
|
|
720
|
+
}
|
|
721
|
+
)
|
|
669
722
|
] })
|
|
670
723
|
] })
|
|
671
724
|
}
|
|
@@ -724,9 +777,7 @@ const CommentBoard = ({
|
|
|
724
777
|
onConfirm: handleConfirmDelete,
|
|
725
778
|
onCancel: handleCancel,
|
|
726
779
|
confirmButtonText: __("Delete"),
|
|
727
|
-
children:
|
|
728
|
-
"Are you sure you want to delete this note? This will also delete all of this note's replies."
|
|
729
|
-
)
|
|
780
|
+
children: deleteConfirmMessage
|
|
730
781
|
}
|
|
731
782
|
)
|
|
732
783
|
]
|