@wordpress/editor 14.31.1-next.f56bd8138.0 → 14.32.0

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 (83) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/collab-sidebar/add-comment.js +10 -4
  3. package/build/components/collab-sidebar/add-comment.js.map +1 -1
  4. package/build/components/collab-sidebar/comment-author-info.js +39 -11
  5. package/build/components/collab-sidebar/comment-author-info.js.map +1 -1
  6. package/build/components/collab-sidebar/comment-form.js +23 -19
  7. package/build/components/collab-sidebar/comment-form.js.map +1 -1
  8. package/build/components/collab-sidebar/comment-indicator-toolbar.js +7 -4
  9. package/build/components/collab-sidebar/comment-indicator-toolbar.js.map +1 -1
  10. package/build/components/collab-sidebar/comments.js +220 -169
  11. package/build/components/collab-sidebar/comments.js.map +1 -1
  12. package/build/components/collab-sidebar/hooks.js +96 -0
  13. package/build/components/collab-sidebar/hooks.js.map +1 -0
  14. package/build/components/collab-sidebar/index.js +79 -169
  15. package/build/components/collab-sidebar/index.js.map +1 -1
  16. package/build/components/collab-sidebar/utils.js +72 -25
  17. package/build/components/collab-sidebar/utils.js.map +1 -1
  18. package/build/components/header/index.js +5 -1
  19. package/build/components/header/index.js.map +1 -1
  20. package/build/components/provider/use-block-editor-settings.js +1 -1
  21. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  22. package/build/dataviews/store/private-actions.js +1 -1
  23. package/build/dataviews/store/private-actions.js.map +1 -1
  24. package/build/store/actions.js +63 -2
  25. package/build/store/actions.js.map +1 -1
  26. package/build-module/components/collab-sidebar/add-comment.js +11 -5
  27. package/build-module/components/collab-sidebar/add-comment.js.map +1 -1
  28. package/build-module/components/collab-sidebar/comment-author-info.js +42 -14
  29. package/build-module/components/collab-sidebar/comment-author-info.js.map +1 -1
  30. package/build-module/components/collab-sidebar/comment-form.js +26 -22
  31. package/build-module/components/collab-sidebar/comment-form.js.map +1 -1
  32. package/build-module/components/collab-sidebar/comment-indicator-toolbar.js +8 -5
  33. package/build-module/components/collab-sidebar/comment-indicator-toolbar.js.map +1 -1
  34. package/build-module/components/collab-sidebar/comments.js +223 -172
  35. package/build-module/components/collab-sidebar/comments.js.map +1 -1
  36. package/build-module/components/collab-sidebar/hooks.js +89 -0
  37. package/build-module/components/collab-sidebar/hooks.js.map +1 -0
  38. package/build-module/components/collab-sidebar/index.js +82 -172
  39. package/build-module/components/collab-sidebar/index.js.map +1 -1
  40. package/build-module/components/collab-sidebar/utils.js +70 -24
  41. package/build-module/components/collab-sidebar/utils.js.map +1 -1
  42. package/build-module/components/header/index.js +5 -1
  43. package/build-module/components/header/index.js.map +1 -1
  44. package/build-module/components/provider/use-block-editor-settings.js +1 -1
  45. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  46. package/build-module/dataviews/store/private-actions.js +2 -2
  47. package/build-module/dataviews/store/private-actions.js.map +1 -1
  48. package/build-module/store/actions.js +63 -2
  49. package/build-module/store/actions.js.map +1 -1
  50. package/build-style/style-rtl.css +60 -19
  51. package/build-style/style.css +60 -19
  52. package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -1
  53. package/build-types/components/collab-sidebar/comment-author-info.d.ts +3 -1
  54. package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +1 -1
  55. package/build-types/components/collab-sidebar/comment-form.d.ts +3 -5
  56. package/build-types/components/collab-sidebar/comment-form.d.ts.map +1 -1
  57. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +1 -1
  58. package/build-types/components/collab-sidebar/comments.d.ts +1 -7
  59. package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
  60. package/build-types/components/collab-sidebar/hooks.d.ts +6 -0
  61. package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -0
  62. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  63. package/build-types/components/collab-sidebar/utils.d.ts +11 -6
  64. package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
  65. package/build-types/components/header/index.d.ts.map +1 -1
  66. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  67. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  68. package/build-types/store/actions.d.ts.map +1 -1
  69. package/package.json +37 -37
  70. package/src/components/collab-sidebar/add-comment.js +9 -4
  71. package/src/components/collab-sidebar/comment-author-info.js +51 -28
  72. package/src/components/collab-sidebar/comment-form.js +25 -24
  73. package/src/components/collab-sidebar/comment-indicator-toolbar.js +16 -5
  74. package/src/components/collab-sidebar/comments.js +271 -210
  75. package/src/components/collab-sidebar/hooks.js +95 -0
  76. package/src/components/collab-sidebar/index.js +107 -218
  77. package/src/components/collab-sidebar/style.scss +34 -20
  78. package/src/components/collab-sidebar/utils.js +73 -30
  79. package/src/components/header/index.js +6 -3
  80. package/src/components/provider/use-block-editor-settings.js +1 -0
  81. package/src/dataviews/store/private-actions.ts +6 -0
  82. package/src/store/actions.js +93 -2
  83. package/tsconfig.tsbuildinfo +1 -1
@@ -8,13 +8,16 @@ exports.Comments = Comments;
8
8
  var _clsx = _interopRequireDefault(require("clsx"));
9
9
  var _element = require("@wordpress/element");
10
10
  var _components = require("@wordpress/components");
11
+ var _compose = require("@wordpress/compose");
11
12
  var _icons = require("@wordpress/icons");
12
13
  var _i18n = require("@wordpress/i18n");
13
14
  var _data = require("@wordpress/data");
15
+ var _dom = require("@wordpress/dom");
14
16
  var _blockEditor = require("@wordpress/block-editor");
15
17
  var _lockUnlock = require("../../lock-unlock");
16
18
  var _commentAuthorInfo = _interopRequireDefault(require("./comment-author-info"));
17
19
  var _commentForm = _interopRequireDefault(require("./comment-form"));
20
+ var _utils = require("./utils");
18
21
  var _jsxRuntime = require("react/jsx-runtime");
19
22
  /**
20
23
  * External dependencies
@@ -31,28 +34,9 @@ var _jsxRuntime = require("react/jsx-runtime");
31
34
  const {
32
35
  useBlockElement
33
36
  } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
34
-
35
- /**
36
- * Finds the first block that has the specified comment ID.
37
- *
38
- * @param {string} commentId - The comment ID to search for.
39
- * @param {Array} blockList - The list of blocks to search through.
40
- * @return {string|null} The client ID of the found block, or null if not found.
41
- */
42
- const findBlockByCommentId = (commentId, blockList) => {
43
- for (const block of blockList) {
44
- if (block.attributes?.blockCommentId === commentId) {
45
- return block.clientId;
46
- }
47
- if (block.innerBlocks) {
48
- const found = findBlockByCommentId(commentId, block.innerBlocks);
49
- if (found) {
50
- return found;
51
- }
52
- }
53
- }
54
- return null;
55
- };
37
+ const {
38
+ Menu
39
+ } = (0, _lockUnlock.unlock)(_components.privateApis);
56
40
 
57
41
  /**
58
42
  * Renders the Comments component.
@@ -62,9 +46,6 @@ const findBlockByCommentId = (commentId, blockList) => {
62
46
  * @param {Function} props.onEditComment - The function to handle comment editing.
63
47
  * @param {Function} props.onAddReply - The function to add a reply to a comment.
64
48
  * @param {Function} props.onCommentDelete - The function to delete a comment.
65
- * @param {Function} props.onCommentResolve - The function to mark a comment as resolved.
66
- * @param {Function} props.onCommentReopen - The function to reopen a resolved comment.
67
- * @param {boolean} props.showCommentBoard - Whether to show the comment board.
68
49
  * @param {Function} props.setShowCommentBoard - The function to set the comment board visibility.
69
50
  * @return {React.ReactNode} The rendered Comments component.
70
51
  */
@@ -73,170 +54,208 @@ function Comments({
73
54
  onEditComment,
74
55
  onAddReply,
75
56
  onCommentDelete,
76
- onCommentResolve,
77
- onCommentReopen,
78
- showCommentBoard,
79
57
  setShowCommentBoard
80
58
  }) {
81
- const {
82
- blockCommentId,
83
- blocks
84
- } = (0, _data.useSelect)(select => {
59
+ const blockCommentId = (0, _data.useSelect)(select => {
85
60
  const {
86
61
  getBlockAttributes,
87
- getSelectedBlockClientId,
88
- getBlocks
62
+ getSelectedBlockClientId
89
63
  } = select(_blockEditor.store);
90
- const _clientId = getSelectedBlockClientId();
91
- return {
92
- blockCommentId: _clientId ? getBlockAttributes(_clientId)?.blockCommentId : null,
93
- blocks: getBlocks()
94
- };
64
+ const clientId = getSelectedBlockClientId();
65
+ return clientId ? getBlockAttributes(clientId)?.metadata?.commentId : null;
95
66
  }, []);
96
- const {
97
- flashBlock
98
- } = (0, _data.useDispatch)(_blockEditor.store);
99
- const clearThreadFocus = () => {
100
- setFocusThread(null);
101
- setShowCommentBoard(false);
102
- };
103
- const [focusThread, setFocusThread] = (0, _element.useState)(showCommentBoard && blockCommentId ? blockCommentId : null);
104
- (0, _element.useEffect)(() => {
105
- // Highlight comment when block is selected.
106
- if (blockCommentId && !focusThread) {
107
- setFocusThread(blockCommentId);
108
- }
109
- }, [blockCommentId, focusThread, blocks, setFocusThread]);
110
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
111
- children: [
112
- // If there are no comments, show a message indicating no comments are available.
113
- (!Array.isArray(threads) || threads.length === 0) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalVStack, {
67
+ const [selectedThread = blockCommentId, setSelectedThread] = (0, _element.useState)();
68
+ const hasThreads = Array.isArray(threads) && threads.length > 0;
69
+ if (!hasThreads) {
70
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalVStack, {
114
71
  alignment: "left",
115
72
  className: "editor-collab-sidebar-panel__thread",
116
73
  justify: "flex-start",
117
- spacing: "3",
74
+ spacing: "2",
118
75
  children:
119
76
  // translators: message displayed when there are no comments available
120
77
  (0, _i18n.__)('No comments available')
121
- }), Array.isArray(threads) && threads.length > 0 && threads.map(thread => /*#__PURE__*/(0, _jsxRuntime.jsx)(Thread, {
122
- thread: thread,
123
- onAddReply: onAddReply,
124
- onCommentDelete: onCommentDelete,
125
- onCommentResolve: onCommentResolve,
126
- onCommentReopen: onCommentReopen,
127
- onEditComment: onEditComment,
128
- isFocused: focusThread === thread.id,
129
- clearThreadFocus: clearThreadFocus,
130
- setFocusThread: setFocusThread,
131
- blockCommentId: blockCommentId,
132
- blocks: blocks,
133
- flashBlock: flashBlock,
134
- setShowCommentBoard: setShowCommentBoard
135
- }, thread.id))]
136
- });
78
+ });
79
+ }
80
+ return threads.map(thread => /*#__PURE__*/(0, _jsxRuntime.jsx)(Thread, {
81
+ thread: thread,
82
+ onAddReply: onAddReply,
83
+ onCommentDelete: onCommentDelete,
84
+ onEditComment: onEditComment,
85
+ isSelected: selectedThread === thread.id,
86
+ setSelectedThread: setSelectedThread,
87
+ setShowCommentBoard: setShowCommentBoard
88
+ }, thread.id));
137
89
  }
138
90
  function Thread({
139
91
  thread,
140
92
  onEditComment,
141
93
  onAddReply,
142
94
  onCommentDelete,
143
- onCommentResolve,
144
- onCommentReopen,
145
- isFocused,
146
- clearThreadFocus,
147
- setFocusThread,
148
- blocks,
149
- flashBlock,
95
+ isSelected,
96
+ setSelectedThread,
150
97
  setShowCommentBoard
151
98
  }) {
152
- // Find first block that has this comment ID - run at component root level.
153
- const relatedBlock = (0, _element.useMemo)(() => {
154
- if (!thread.id || !blocks) {
155
- return null;
156
- }
157
- return findBlockByCommentId(thread.id, blocks);
158
- }, [thread.id, blocks]);
159
- const relatedBlockElement = useBlockElement(relatedBlock);
160
- const handleCommentSelect = threadId => {
99
+ const threadRef = (0, _element.useRef)(null);
100
+ const {
101
+ toggleBlockHighlight
102
+ } = (0, _data.useDispatch)(_blockEditor.store);
103
+ const relatedBlockElement = useBlockElement(thread.blockClientId);
104
+ const debouncedToggleBlockHighlight = (0, _compose.useDebounce)(toggleBlockHighlight, 50);
105
+ const onMouseEnter = () => {
106
+ debouncedToggleBlockHighlight(thread.blockClientId, true);
107
+ };
108
+ const onMouseLeave = () => {
109
+ debouncedToggleBlockHighlight(thread.blockClientId, false);
110
+ };
111
+ const handleCommentSelect = ({
112
+ id,
113
+ blockClientId
114
+ }) => {
161
115
  setShowCommentBoard(false);
162
- setFocusThread(threadId);
163
- if (relatedBlock && relatedBlockElement) {
116
+ setSelectedThread(id);
117
+ if (blockClientId && relatedBlockElement) {
164
118
  relatedBlockElement.scrollIntoView({
165
119
  behavior: 'instant',
166
120
  block: 'center'
167
121
  });
168
- flashBlock(relatedBlock);
169
122
  }
170
123
  };
171
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
172
- className: (0, _clsx.default)('editor-collab-sidebar-panel__thread', {
173
- 'editor-collab-sidebar-panel__focus-thread': isFocused
174
- }),
175
- id: thread.id,
176
- spacing: "3",
177
- onClick: () => handleCommentSelect(thread.id),
178
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(CommentBoard, {
179
- thread: thread,
180
- onResolve: onCommentResolve,
181
- onReopen: onCommentReopen,
182
- onEdit: onEditComment,
183
- onDelete: onCommentDelete,
184
- status: thread.status
185
- }), 0 < thread?.reply?.length && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
186
- children: [!isFocused && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
187
- __next40pxDefaultSize: true,
188
- variant: "link",
189
- className: "editor-collab-sidebar-panel__show-more-reply",
190
- onClick: () => setFocusThread(thread.id),
191
- children: (0, _i18n.sprintf)(
192
- // translators: %s: number of replies.
193
- (0, _i18n._n)('%s more reply', '%s more replies', thread?.reply?.length), thread?.reply?.length)
194
- }), isFocused && thread.reply.map(reply => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
124
+ const focusThread = () => {
125
+ threadRef.current?.focus();
126
+ };
127
+ const unselectThread = () => {
128
+ setSelectedThread(null);
129
+ setShowCommentBoard(false);
130
+ };
131
+ const replies = thread?.reply;
132
+ const lastReply = !!replies.length ? replies[replies.length - 1] : undefined;
133
+ const restReplies = !!replies.length ? replies.slice(0, -1) : [];
134
+ const commentExcerpt = (0, _utils.getCommentExcerpt)((0, _dom.__unstableStripHTML)(thread.content.rendered), 10);
135
+ const ariaLabel = relatedBlockElement ? (0, _i18n.sprintf)(
136
+ // translators: %s: comment excerpt
137
+ (0, _i18n.__)('Comment: %s'), commentExcerpt) : (0, _i18n.sprintf)(
138
+ // translators: %s: comment excerpt
139
+ (0, _i18n.__)('Original block deleted. Comment: %s'), commentExcerpt);
140
+ return (
141
+ /*#__PURE__*/
142
+ // Disable reason: role="listitem" does in fact support aria-expanded.
143
+ // eslint-disable-next-line jsx-a11y/role-supports-aria-props
144
+ (0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
145
+ className: (0, _clsx.default)('editor-collab-sidebar-panel__thread', {
146
+ 'is-selected': isSelected
147
+ }),
148
+ id: `thread-${thread.id}`,
149
+ spacing: "2",
150
+ onClick: () => handleCommentSelect(thread),
151
+ onMouseEnter: onMouseEnter,
152
+ onMouseLeave: onMouseLeave,
153
+ onFocus: onMouseEnter,
154
+ onBlur: onMouseLeave,
155
+ onKeyDown: event => {
156
+ // Expand or Collapse thread.
157
+ if (event.key === 'Enter' && event.currentTarget === event.target) {
158
+ if (isSelected) {
159
+ unselectThread();
160
+ } else {
161
+ handleCommentSelect(thread);
162
+ }
163
+ }
164
+ // Collapse thread and focus the thread.
165
+ if (event.key === 'Escape') {
166
+ unselectThread();
167
+ focusThread();
168
+ }
169
+ },
170
+ tabIndex: 0,
171
+ role: "listitem",
172
+ ref: threadRef,
173
+ "aria-label": ariaLabel,
174
+ "aria-expanded": isSelected,
175
+ children: [!relatedBlockElement && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
176
+ as: "p",
177
+ weight: 500,
178
+ variant: "muted",
179
+ children: (0, _i18n.__)('Original block deleted.')
180
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CommentBoard, {
181
+ thread: thread,
182
+ onEdit: (params = {}) => {
183
+ const {
184
+ status
185
+ } = params;
186
+ onEditComment(params);
187
+ if (status === 'approved') {
188
+ unselectThread();
189
+ focusThread();
190
+ }
191
+ },
192
+ onDelete: onCommentDelete,
193
+ status: thread.status
194
+ }), isSelected && replies.map(reply => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalVStack, {
195
195
  className: "editor-collab-sidebar-panel__child-thread",
196
196
  id: reply.id,
197
197
  spacing: "2",
198
- children: ['approved' !== thread.status && /*#__PURE__*/(0, _jsxRuntime.jsx)(CommentBoard, {
198
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(CommentBoard, {
199
199
  thread: reply,
200
- onEdit: onEditComment,
201
- onDelete: onCommentDelete
202
- }), 'approved' === thread.status && /*#__PURE__*/(0, _jsxRuntime.jsx)(CommentBoard, {
203
- thread: reply
204
- })]
205
- }, reply.id))]
206
- }), isFocused && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
207
- className: "editor-collab-sidebar-panel__child-thread",
208
- spacing: "2",
209
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalHStack, {
210
- alignment: "left",
211
- spacing: "3",
212
- justify: "flex-start",
213
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_commentAuthorInfo.default, {})
214
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalVStack, {
215
- spacing: "3",
216
- className: "editor-collab-sidebar-panel__comment-field",
217
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_commentForm.default, {
218
- onSubmit: inputComment => {
219
- if ('approved' === thread.status) {
220
- onCommentReopen(thread.id);
221
- }
222
- onAddReply(inputComment, thread.id);
223
- },
224
- onCancel: event => {
225
- event.stopPropagation(); // Prevent the parent onClick from being triggered
226
- clearThreadFocus();
227
- },
228
- placeholderText: 'approved' === thread.status && (0, _i18n.__)('Adding a comment will re-open this discussion….'),
229
- submitButtonText: 'approved' === thread.status ? (0, _i18n._x)('Reopen & Reply', 'Reopen comment and add reply') : (0, _i18n._x)('Reply', 'Add reply comment'),
230
- rows: 'approved' === thread.status ? 2 : 4
200
+ onEdit: 'approved' !== thread.status ? onEditComment : undefined,
201
+ onDelete: 'approved' !== thread.status ? onCommentDelete : undefined
231
202
  })
203
+ }, reply.id)), !isSelected && restReplies.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalHStack, {
204
+ className: "editor-collab-sidebar-panel__more-reply-separator",
205
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
206
+ size: "compact",
207
+ variant: "tertiary",
208
+ className: "editor-collab-sidebar-panel__more-reply-button",
209
+ onClick: () => setSelectedThread(thread.id),
210
+ children: (0, _i18n.sprintf)(
211
+ // translators: %s: number of replies.
212
+ (0, _i18n._n)('%s more reply', '%s more replies', restReplies.length), restReplies.length)
213
+ })
214
+ }), !isSelected && lastReply && /*#__PURE__*/(0, _jsxRuntime.jsx)(CommentBoard, {
215
+ thread: lastReply,
216
+ onEdit: 'approved' !== thread.status ? onEditComment : undefined,
217
+ onDelete: 'approved' !== thread.status ? onCommentDelete : undefined
218
+ }), isSelected && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
219
+ className: "editor-collab-sidebar-panel__child-thread",
220
+ spacing: "2",
221
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalHStack, {
222
+ alignment: "left",
223
+ spacing: "3",
224
+ justify: "flex-start",
225
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_commentAuthorInfo.default, {})
226
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalVStack, {
227
+ spacing: "2",
228
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_commentForm.default, {
229
+ onSubmit: inputComment => {
230
+ if ('approved' === thread.status) {
231
+ onEditComment({
232
+ id: thread.id,
233
+ status: 'hold'
234
+ });
235
+ }
236
+ onAddReply({
237
+ content: inputComment,
238
+ parent: thread.id
239
+ });
240
+ },
241
+ onCancel: event => {
242
+ threadRef.current?.focus();
243
+ event.stopPropagation(); // Prevent the parent onClick from being triggered
244
+ unselectThread();
245
+ },
246
+ submitButtonText: 'approved' === thread.status ? (0, _i18n.__)('Reopen & Reply') : (0, _i18n.__)('Reply'),
247
+ rows: 'approved' === thread.status ? 2 : 4,
248
+ labelText: (0, _i18n.sprintf)(
249
+ // translators: %1$s: comment identifier, %2$s: author name
250
+ (0, _i18n.__)('Reply to Comment %1$s by %2$s'), thread.id, thread?.author_name || 'Unknown')
251
+ })
252
+ })]
232
253
  })]
233
- })]
234
- });
254
+ })
255
+ );
235
256
  }
236
257
  const CommentBoard = ({
237
258
  thread,
238
- onResolve,
239
- onReopen,
240
259
  onEdit,
241
260
  onDelete,
242
261
  status
@@ -244,7 +263,7 @@ const CommentBoard = ({
244
263
  const [actionState, setActionState] = (0, _element.useState)(false);
245
264
  const [showConfirmDialog, setShowConfirmDialog] = (0, _element.useState)(false);
246
265
  const handleConfirmDelete = () => {
247
- onDelete(thread.id);
266
+ onDelete(thread);
248
267
  setActionState(false);
249
268
  setShowConfirmDialog(false);
250
269
  };
@@ -253,22 +272,29 @@ const CommentBoard = ({
253
272
  setShowConfirmDialog(false);
254
273
  };
255
274
  const actions = [onEdit && status !== 'approved' && {
275
+ id: 'edit',
256
276
  title: (0, _i18n._x)('Edit', 'Edit comment'),
257
277
  onClick: () => {
258
278
  setActionState('edit');
259
279
  }
260
280
  }, onDelete && {
281
+ id: 'delete',
261
282
  title: (0, _i18n._x)('Delete', 'Delete comment'),
262
283
  onClick: () => {
263
284
  setActionState('delete');
264
285
  setShowConfirmDialog(true);
265
286
  }
266
- }, onReopen && status === 'approved' && {
287
+ }, onEdit && status === 'approved' && {
288
+ id: 'reopen',
267
289
  title: (0, _i18n._x)('Reopen', 'Reopen comment'),
268
290
  onClick: () => {
269
- onReopen(thread.id);
291
+ onEdit({
292
+ id: thread.id,
293
+ status: 'hold'
294
+ });
270
295
  }
271
296
  }];
297
+ const canResolve = thread?.parent === 0;
272
298
  const moreActions = actions.filter(item => item?.onClick);
273
299
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
274
300
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
@@ -278,38 +304,63 @@ const CommentBoard = ({
278
304
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_commentAuthorInfo.default, {
279
305
  avatar: thread?.author_avatar_urls?.[48],
280
306
  name: thread?.author_name,
281
- date: thread?.date
282
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
307
+ date: thread?.date,
308
+ userId: thread?.author
309
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
283
310
  className: "editor-collab-sidebar-panel__comment-status",
311
+ onClick: event => {
312
+ // Prevent the thread from being selected.
313
+ event.stopPropagation();
314
+ },
284
315
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
285
- alignment: "right",
286
- justify: "flex-end",
287
316
  spacing: "0",
288
- children: [0 === thread?.parent && onResolve && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
317
+ children: [canResolve && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
289
318
  label: (0, _i18n._x)('Resolve', 'Mark comment as resolved'),
290
319
  size: "small",
291
320
  icon: _icons.published,
292
321
  disabled: status === 'approved',
293
322
  accessibleWhenDisabled: status === 'approved',
294
323
  onClick: () => {
295
- onResolve(thread.id);
324
+ onEdit({
325
+ id: thread.id,
326
+ status: 'approved'
327
+ });
296
328
  }
297
- }), 0 < moreActions.length && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, {
298
- icon: _icons.moreVertical,
299
- label: (0, _i18n._x)('Select an action', 'Select comment action'),
300
- className: "editor-collab-sidebar-panel__comment-dropdown-menu",
301
- controls: moreActions
329
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(Menu, {
330
+ placement: "bottom-end",
331
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.TriggerButton, {
332
+ render: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
333
+ size: "small",
334
+ icon: _icons.moreVertical,
335
+ label: (0, _i18n.__)('Actions'),
336
+ disabled: !moreActions.length,
337
+ accessibleWhenDisabled: true
338
+ })
339
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.Popover, {
340
+ children: moreActions.map(action => /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.Item, {
341
+ onClick: () => action.onClick(),
342
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.ItemLabel, {
343
+ children: action.title
344
+ })
345
+ }, action.id))
346
+ })]
302
347
  })]
303
348
  })
304
349
  })]
305
350
  }), 'edit' === actionState ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_commentForm.default, {
306
351
  onSubmit: value => {
307
- onEdit(thread.id, value);
352
+ onEdit({
353
+ id: thread.id,
354
+ content: value
355
+ });
308
356
  setActionState(false);
309
357
  },
310
358
  onCancel: () => handleCancel(),
311
359
  thread: thread,
312
- submitButtonText: (0, _i18n._x)('Update', 'verb')
360
+ submitButtonText: (0, _i18n._x)('Update', 'verb'),
361
+ labelText: (0, _i18n.sprintf)(
362
+ // translators: %1$s: comment identifier, %2$s: author name.
363
+ (0, _i18n.__)('Edit Comment %1$s by %2$s'), thread.id, thread?.author_name || 'Unknown')
313
364
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_element.RawHTML, {
314
365
  className: "editor-collab-sidebar-panel__user-comment",
315
366
  children: thread?.content?.rendered
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_components","_icons","_i18n","_data","_blockEditor","_lockUnlock","_commentAuthorInfo","_commentForm","_jsxRuntime","useBlockElement","unlock","blockEditorPrivateApis","findBlockByCommentId","commentId","blockList","block","attributes","blockCommentId","clientId","innerBlocks","found","Comments","threads","onEditComment","onAddReply","onCommentDelete","onCommentResolve","onCommentReopen","showCommentBoard","setShowCommentBoard","blocks","useSelect","select","getBlockAttributes","getSelectedBlockClientId","getBlocks","blockEditorStore","_clientId","flashBlock","useDispatch","clearThreadFocus","setFocusThread","focusThread","useState","useEffect","jsxs","Fragment","children","Array","isArray","length","jsx","__experimentalVStack","alignment","className","justify","spacing","__","map","thread","Thread","isFocused","id","relatedBlock","useMemo","relatedBlockElement","handleCommentSelect","threadId","scrollIntoView","behavior","clsx","onClick","CommentBoard","onResolve","onReopen","onEdit","onDelete","status","reply","Button","__next40pxDefaultSize","variant","sprintf","_n","__experimentalHStack","default","onSubmit","inputComment","onCancel","event","stopPropagation","placeholderText","submitButtonText","_x","rows","actionState","setActionState","showConfirmDialog","setShowConfirmDialog","handleConfirmDelete","handleCancel","actions","title","moreActions","filter","item","avatar","author_avatar_urls","name","author_name","date","parent","label","size","icon","published","disabled","accessibleWhenDisabled","DropdownMenu","moreVertical","controls","value","RawHTML","content","rendered","__experimentalConfirmDialog","isOpen","onConfirm","confirmButtonText"],"sources":["@wordpress/editor/src/components/collab-sidebar/comments.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState, RawHTML, useEffect, useMemo } from '@wordpress/element';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tButton,\n\tDropdownMenu,\n} from '@wordpress/components';\n\nimport { published, moreVertical } from '@wordpress/icons';\nimport { __, _x, sprintf, _n } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\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';\n\nconst { useBlockElement } = unlock( blockEditorPrivateApis );\n\n/**\n * Finds the first block that has the specified comment ID.\n *\n * @param {string} commentId - The comment ID to search for.\n * @param {Array} blockList - The list of blocks to search through.\n * @return {string|null} The client ID of the found block, or null if not found.\n */\nconst findBlockByCommentId = ( commentId, blockList ) => {\n\tfor ( const block of blockList ) {\n\t\tif ( block.attributes?.blockCommentId === commentId ) {\n\t\t\treturn block.clientId;\n\t\t}\n\t\tif ( block.innerBlocks ) {\n\t\t\tconst found = findBlockByCommentId( commentId, block.innerBlocks );\n\t\t\tif ( found ) {\n\t\t\t\treturn found;\n\t\t\t}\n\t\t}\n\t}\n\treturn null;\n};\n\n/**\n * Renders the Comments component.\n *\n * @param {Object} props - The component props.\n * @param {Array} props.threads - The array of comment threads.\n * @param {Function} props.onEditComment - The function to handle comment editing.\n * @param {Function} props.onAddReply - The function to add a reply to a comment.\n * @param {Function} props.onCommentDelete - The function to delete a comment.\n * @param {Function} props.onCommentResolve - The function to mark a comment as resolved.\n * @param {Function} props.onCommentReopen - The function to reopen a resolved comment.\n * @param {boolean} props.showCommentBoard - Whether to show the comment board.\n * @param {Function} props.setShowCommentBoard - The function to set the comment board visibility.\n * @return {React.ReactNode} The rendered Comments component.\n */\nexport function Comments( {\n\tthreads,\n\tonEditComment,\n\tonAddReply,\n\tonCommentDelete,\n\tonCommentResolve,\n\tonCommentReopen,\n\tshowCommentBoard,\n\tsetShowCommentBoard,\n} ) {\n\tconst { blockCommentId, blocks } = useSelect( ( select ) => {\n\t\tconst { getBlockAttributes, getSelectedBlockClientId, getBlocks } =\n\t\t\tselect( blockEditorStore );\n\t\tconst _clientId = getSelectedBlockClientId();\n\t\treturn {\n\t\t\tblockCommentId: _clientId\n\t\t\t\t? getBlockAttributes( _clientId )?.blockCommentId\n\t\t\t\t: null,\n\t\t\tblocks: getBlocks(),\n\t\t};\n\t}, [] );\n\n\tconst { flashBlock } = useDispatch( blockEditorStore );\n\n\tconst clearThreadFocus = () => {\n\t\tsetFocusThread( null );\n\t\tsetShowCommentBoard( false );\n\t};\n\n\tconst [ focusThread, setFocusThread ] = useState(\n\t\tshowCommentBoard && blockCommentId ? blockCommentId : null\n\t);\n\n\tuseEffect( () => {\n\t\t// Highlight comment when block is selected.\n\t\tif ( blockCommentId && ! focusThread ) {\n\t\t\tsetFocusThread( blockCommentId );\n\t\t}\n\t}, [ blockCommentId, focusThread, blocks, setFocusThread ] );\n\n\treturn (\n\t\t<>\n\t\t\t{\n\t\t\t\t// If there are no comments, show a message indicating no comments are available.\n\t\t\t\t( ! Array.isArray( threads ) || threads.length === 0 ) && (\n\t\t\t\t\t<VStack\n\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__thread\"\n\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\tspacing=\"3\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// translators: message displayed when there are no comments available\n\t\t\t\t\t\t\t__( 'No comments available' )\n\t\t\t\t\t\t}\n\t\t\t\t\t</VStack>\n\t\t\t\t)\n\t\t\t}\n\t\t\t{ Array.isArray( threads ) &&\n\t\t\t\tthreads.length > 0 &&\n\t\t\t\tthreads.map( ( thread ) => (\n\t\t\t\t\t<Thread\n\t\t\t\t\t\tkey={ thread.id }\n\t\t\t\t\t\tthread={ thread }\n\t\t\t\t\t\tonAddReply={ onAddReply }\n\t\t\t\t\t\tonCommentDelete={ onCommentDelete }\n\t\t\t\t\t\tonCommentResolve={ onCommentResolve }\n\t\t\t\t\t\tonCommentReopen={ onCommentReopen }\n\t\t\t\t\t\tonEditComment={ onEditComment }\n\t\t\t\t\t\tisFocused={ focusThread === thread.id }\n\t\t\t\t\t\tclearThreadFocus={ clearThreadFocus }\n\t\t\t\t\t\tsetFocusThread={ setFocusThread }\n\t\t\t\t\t\tblockCommentId={ blockCommentId }\n\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\tflashBlock={ flashBlock }\n\t\t\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction Thread( {\n\tthread,\n\tonEditComment,\n\tonAddReply,\n\tonCommentDelete,\n\tonCommentResolve,\n\tonCommentReopen,\n\tisFocused,\n\tclearThreadFocus,\n\tsetFocusThread,\n\tblocks,\n\tflashBlock,\n\tsetShowCommentBoard,\n} ) {\n\t// Find first block that has this comment ID - run at component root level.\n\tconst relatedBlock = useMemo( () => {\n\t\tif ( ! thread.id || ! blocks ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn findBlockByCommentId( thread.id, blocks );\n\t}, [ thread.id, blocks ] );\n\n\tconst relatedBlockElement = useBlockElement( relatedBlock );\n\n\tconst handleCommentSelect = ( threadId ) => {\n\t\tsetShowCommentBoard( false );\n\t\tsetFocusThread( threadId );\n\t\tif ( relatedBlock && relatedBlockElement ) {\n\t\t\trelatedBlockElement.scrollIntoView( {\n\t\t\t\tbehavior: 'instant',\n\t\t\t\tblock: 'center',\n\t\t\t} );\n\t\t\tflashBlock( relatedBlock );\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'editor-collab-sidebar-panel__focus-thread': isFocused,\n\t\t\t} ) }\n\t\t\tid={ thread.id }\n\t\t\tspacing=\"3\"\n\t\t\tonClick={ () => handleCommentSelect( thread.id ) }\n\t\t>\n\t\t\t<CommentBoard\n\t\t\t\tthread={ thread }\n\t\t\t\tonResolve={ onCommentResolve }\n\t\t\t\tonReopen={ onCommentReopen }\n\t\t\t\tonEdit={ onEditComment }\n\t\t\t\tonDelete={ onCommentDelete }\n\t\t\t\tstatus={ thread.status }\n\t\t\t/>\n\t\t\t{ 0 < thread?.reply?.length && (\n\t\t\t\t<>\n\t\t\t\t\t{ ! isFocused && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__show-more-reply\"\n\t\t\t\t\t\t\tonClick={ () => setFocusThread( thread.id ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: number of replies.\n\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t'%s more reply',\n\t\t\t\t\t\t\t\t\t'%s more replies',\n\t\t\t\t\t\t\t\t\tthread?.reply?.length\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tthread?.reply?.length\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ isFocused &&\n\t\t\t\t\t\tthread.reply.map( ( reply ) => (\n\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\tkey={ reply.id }\n\t\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__child-thread\"\n\t\t\t\t\t\t\t\tid={ reply.id }\n\t\t\t\t\t\t\t\tspacing=\"2\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ 'approved' !== thread.status && (\n\t\t\t\t\t\t\t\t\t<CommentBoard\n\t\t\t\t\t\t\t\t\t\tthread={ reply }\n\t\t\t\t\t\t\t\t\t\tonEdit={ onEditComment }\n\t\t\t\t\t\t\t\t\t\tonDelete={ onCommentDelete }\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{ 'approved' === thread.status && (\n\t\t\t\t\t\t\t\t\t<CommentBoard thread={ reply } />\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t) ) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ isFocused && (\n\t\t\t\t<VStack\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__child-thread\"\n\t\t\t\t\tspacing=\"2\"\n\t\t\t\t>\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\n\t\t\t\t\t\tspacing=\"3\"\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__comment-field\"\n\t\t\t\t\t>\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\tonCommentReopen( thread.id );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonAddReply( inputComment, thread.id );\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\tevent.stopPropagation(); // Prevent the parent onClick from being triggered\n\t\t\t\t\t\t\t\tclearThreadFocus();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tplaceholderText={\n\t\t\t\t\t\t\t\t'approved' === thread.status &&\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Adding a comment will re-open this discussion….'\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? _x(\n\t\t\t\t\t\t\t\t\t\t\t'Reopen & Reply',\n\t\t\t\t\t\t\t\t\t\t\t'Reopen comment and add reply'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: _x( 'Reply', 'Add reply comment' )\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/>\n\t\t\t\t\t</VStack>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nconst CommentBoard = ( {\n\tthread,\n\tonResolve,\n\tonReopen,\n\tonEdit,\n\tonDelete,\n\tstatus,\n} ) => {\n\tconst [ actionState, setActionState ] = useState( false );\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tconst handleConfirmDelete = () => {\n\t\tonDelete( thread.id );\n\t\tsetActionState( false );\n\t\tsetShowConfirmDialog( false );\n\t};\n\n\tconst handleCancel = () => {\n\t\tsetActionState( false );\n\t\tsetShowConfirmDialog( false );\n\t};\n\n\tconst actions = [\n\t\tonEdit &&\n\t\t\tstatus !== 'approved' && {\n\t\t\t\ttitle: _x( 'Edit', 'Edit comment' ),\n\t\t\t\tonClick: () => {\n\t\t\t\t\tsetActionState( 'edit' );\n\t\t\t\t},\n\t\t\t},\n\t\tonDelete && {\n\t\t\ttitle: _x( 'Delete', 'Delete comment' ),\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\tonReopen &&\n\t\t\tstatus === 'approved' && {\n\t\t\t\ttitle: _x( 'Reopen', 'Reopen comment' ),\n\t\t\t\tonClick: () => {\n\t\t\t\t\tonReopen( thread.id );\n\t\t\t\t},\n\t\t\t},\n\t];\n\n\tconst moreActions = actions.filter( ( item ) => item?.onClick );\n\n\treturn (\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/>\n\t\t\t\t<span className=\"editor-collab-sidebar-panel__comment-status\">\n\t\t\t\t\t<HStack alignment=\"right\" justify=\"flex-end\" spacing=\"0\">\n\t\t\t\t\t\t{ 0 === thread?.parent && onResolve && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Resolve',\n\t\t\t\t\t\t\t\t\t'Mark comment as resolved'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\ticon={ published }\n\t\t\t\t\t\t\t\tdisabled={ status === 'approved' }\n\t\t\t\t\t\t\t\taccessibleWhenDisabled={ status === 'approved' }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonResolve( thread.id );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ 0 < moreActions.length && (\n\t\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Select an action',\n\t\t\t\t\t\t\t\t\t'Select comment action'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__comment-dropdown-menu\"\n\t\t\t\t\t\t\t\tcontrols={ moreActions }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</HStack>\n\t\t\t\t</span>\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( thread.id, value );\n\t\t\t\t\t\tsetActionState( false );\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/>\n\t\t\t) : (\n\t\t\t\t<RawHTML className=\"editor-collab-sidebar-panel__user-comment\">\n\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// translators: message displayed when confirming an action\n\t\t\t\t\t\t__( 'Are you sure you want to delete this comment?' )\n\t\t\t\t\t}\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</>\n\t);\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OA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MACxB,CAAG;MACHR,QAAQ,EAAGA,CAAA,KAAMY,YAAY,CAAC,CAAG;MACjCzC,MAAM,EAAGA,MAAQ;MACjBiC,gBAAgB,EAAG,IAAAC,QAAE,EAAE,QAAQ,EAAE,MAAO;IAAG,CAC3C,CAAC,gBAEF,IAAArF,WAAA,CAAA2C,GAAA,EAACpD,QAAA,CAAA2H,OAAO;MAACpE,SAAS,EAAC,2CAA2C;MAAAP,QAAA,EAC3DY,MAAM,EAAEgE,OAAO,EAAEC;IAAQ,CACnB,CACT,EACC,QAAQ,KAAK7B,WAAW,iBACzB,IAAAvF,WAAA,CAAA2C,GAAA,EAACnD,WAAA,CAAA6H,2BAAa;MACbC,MAAM,EAAG7B,iBAAmB;MAC5B8B,SAAS,EAAG5B,mBAAqB;MACjCX,QAAQ,EAAGY,YAAc;MACzB4B,iBAAiB,EAAG,IAAAvE,QAAE,EAAE,QAAS,CAAG;MAAAV,QAAA;MAGnC;MACA,IAAAU,QAAE,EAAE,+CAAgD;IAAC,CAExC,CACf;EAAA,CACA,CAAC;AAEL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_components","_compose","_icons","_i18n","_data","_dom","_blockEditor","_lockUnlock","_commentAuthorInfo","_commentForm","_utils","_jsxRuntime","useBlockElement","unlock","blockEditorPrivateApis","Menu","componentsPrivateApis","Comments","threads","onEditComment","onAddReply","onCommentDelete","setShowCommentBoard","blockCommentId","useSelect","select","getBlockAttributes","getSelectedBlockClientId","blockEditorStore","clientId","metadata","commentId","selectedThread","setSelectedThread","useState","hasThreads","Array","isArray","length","jsx","__experimentalVStack","alignment","className","justify","spacing","children","__","map","thread","Thread","isSelected","id","threadRef","useRef","toggleBlockHighlight","useDispatch","relatedBlockElement","blockClientId","debouncedToggleBlockHighlight","useDebounce","onMouseEnter","onMouseLeave","handleCommentSelect","scrollIntoView","behavior","block","focusThread","current","focus","unselectThread","replies","reply","lastReply","undefined","restReplies","slice","commentExcerpt","getCommentExcerpt","stripHTML","content","rendered","ariaLabel","sprintf","jsxs","clsx","onClick","onFocus","onBlur","onKeyDown","event","key","currentTarget","target","tabIndex","role","ref","__experimentalText","as","weight","variant","CommentBoard","onEdit","params","status","onDelete","__experimentalHStack","Button","size","_n","default","onSubmit","inputComment","parent","onCancel","stopPropagation","submitButtonText","rows","labelText","author_name","actionState","setActionState","showConfirmDialog","setShowConfirmDialog","handleConfirmDelete","handleCancel","actions","title","_x","canResolve","moreActions","filter","item","Fragment","avatar","author_avatar_urls","name","date","userId","author","FlexItem","label","icon","published","disabled","accessibleWhenDisabled","placement","TriggerButton","render","moreVertical","Popover","action","Item","ItemLabel","value","RawHTML","__experimentalConfirmDialog","isOpen","onConfirm","confirmButtonText"],"sources":["@wordpress/editor/src/components/collab-sidebar/comments.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState, RawHTML, useRef } 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 { getCommentExcerpt } from './utils';\n\nconst { useBlockElement } = unlock( blockEditorPrivateApis );\nconst { Menu } = unlock( componentsPrivateApis );\n\n/**\n * Renders the Comments component.\n *\n * @param {Object} props - The component props.\n * @param {Array} props.threads - The array of comment threads.\n * @param {Function} props.onEditComment - The function to handle comment editing.\n * @param {Function} props.onAddReply - The function to add a reply to a comment.\n * @param {Function} props.onCommentDelete - The function to delete a comment.\n * @param {Function} props.setShowCommentBoard - The function to set the comment board visibility.\n * @return {React.ReactNode} The rendered Comments component.\n */\nexport function Comments( {\n\tthreads,\n\tonEditComment,\n\tonAddReply,\n\tonCommentDelete,\n\tsetShowCommentBoard,\n} ) {\n\tconst blockCommentId = useSelect( ( select ) => {\n\t\tconst { getBlockAttributes, getSelectedBlockClientId } =\n\t\t\tselect( blockEditorStore );\n\t\tconst clientId = getSelectedBlockClientId();\n\t\treturn clientId\n\t\t\t? getBlockAttributes( clientId )?.metadata?.commentId\n\t\t\t: null;\n\t}, [] );\n\tconst [ selectedThread = blockCommentId, setSelectedThread ] = useState();\n\n\tconst hasThreads = Array.isArray( threads ) && threads.length > 0;\n\tif ( ! hasThreads ) {\n\t\treturn (\n\t\t\t<VStack\n\t\t\t\talignment=\"left\"\n\t\t\t\tclassName=\"editor-collab-sidebar-panel__thread\"\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tspacing=\"2\"\n\t\t\t>\n\t\t\t\t{\n\t\t\t\t\t// translators: message displayed when there are no comments available\n\t\t\t\t\t__( 'No comments available' )\n\t\t\t\t}\n\t\t\t</VStack>\n\t\t);\n\t}\n\n\treturn threads.map( ( thread ) => (\n\t\t<Thread\n\t\t\tkey={ thread.id }\n\t\t\tthread={ thread }\n\t\t\tonAddReply={ onAddReply }\n\t\t\tonCommentDelete={ onCommentDelete }\n\t\t\tonEditComment={ onEditComment }\n\t\t\tisSelected={ selectedThread === thread.id }\n\t\t\tsetSelectedThread={ setSelectedThread }\n\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t/>\n\t) );\n}\n\nfunction Thread( {\n\tthread,\n\tonEditComment,\n\tonAddReply,\n\tonCommentDelete,\n\tisSelected,\n\tsetSelectedThread,\n\tsetShowCommentBoard,\n} ) {\n\tconst threadRef = useRef( null );\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\tconst relatedBlockElement = useBlockElement( thread.blockClientId );\n\tconst debouncedToggleBlockHighlight = useDebounce(\n\t\ttoggleBlockHighlight,\n\t\t50\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 = ( { id, blockClientId } ) => {\n\t\tsetShowCommentBoard( false );\n\t\tsetSelectedThread( id );\n\t\tif ( blockClientId && relatedBlockElement ) {\n\t\t\trelatedBlockElement.scrollIntoView( {\n\t\t\t\tbehavior: 'instant',\n\t\t\t\tblock: 'center',\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst focusThread = () => {\n\t\tthreadRef.current?.focus();\n\t};\n\n\tconst unselectThread = () => {\n\t\tsetSelectedThread( null );\n\t\tsetShowCommentBoard( false );\n\t};\n\n\tconst replies = thread?.reply;\n\tconst lastReply = !! replies.length\n\t\t? replies[ replies.length - 1 ]\n\t\t: undefined;\n\tconst restReplies = !! replies.length ? replies.slice( 0, -1 ) : [];\n\n\tconst commentExcerpt = getCommentExcerpt(\n\t\tstripHTML( thread.content.rendered ),\n\t\t10\n\t);\n\tconst ariaLabel = relatedBlockElement\n\t\t? sprintf(\n\t\t\t\t// translators: %s: comment excerpt\n\t\t\t\t__( 'Comment: %s' ),\n\t\t\t\tcommentExcerpt\n\t\t )\n\t\t: sprintf(\n\t\t\t\t// translators: %s: comment excerpt\n\t\t\t\t__( 'Original block deleted. Comment: %s' ),\n\t\t\t\tcommentExcerpt\n\t\t );\n\n\treturn (\n\t\t// Disable reason: role=\"listitem\" does in fact support aria-expanded.\n\t\t// eslint-disable-next-line jsx-a11y/role-supports-aria-props\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} ) }\n\t\t\tid={ `thread-${ thread.id }` }\n\t\t\tspacing=\"2\"\n\t\t\tonClick={ () => handleCommentSelect( thread ) }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onMouseEnter }\n\t\t\tonBlur={ onMouseLeave }\n\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t// Expand or Collapse thread.\n\t\t\t\tif (\n\t\t\t\t\tevent.key === 'Enter' &&\n\t\t\t\t\tevent.currentTarget === event.target\n\t\t\t\t) {\n\t\t\t\t\tif ( isSelected ) {\n\t\t\t\t\t\tunselectThread();\n\t\t\t\t\t} else {\n\t\t\t\t\t\thandleCommentSelect( thread );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Collapse thread and focus the thread.\n\t\t\t\tif ( event.key === 'Escape' ) {\n\t\t\t\t\tunselectThread();\n\t\t\t\t\tfocusThread();\n\t\t\t\t}\n\t\t\t} }\n\t\t\ttabIndex={ 0 }\n\t\t\trole=\"listitem\"\n\t\t\tref={ threadRef }\n\t\t\taria-label={ ariaLabel }\n\t\t\taria-expanded={ isSelected }\n\t\t>\n\t\t\t{ ! relatedBlockElement && (\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\tonEdit={ ( params = {} ) => {\n\t\t\t\t\tconst { status } = params;\n\t\t\t\t\tonEditComment( params );\n\t\t\t\t\tif ( status === 'approved' ) {\n\t\t\t\t\t\tunselectThread();\n\t\t\t\t\t\tfocusThread();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tonDelete={ onCommentDelete }\n\t\t\t\tstatus={ thread.status }\n\t\t\t/>\n\t\t\t{ isSelected &&\n\t\t\t\treplies.map( ( reply ) => (\n\t\t\t\t\t<VStack\n\t\t\t\t\t\tkey={ reply.id }\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__child-thread\"\n\t\t\t\t\t\tid={ reply.id }\n\t\t\t\t\t\tspacing=\"2\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<CommentBoard\n\t\t\t\t\t\t\tthread={ reply }\n\t\t\t\t\t\t\tonEdit={\n\t\t\t\t\t\t\t\t'approved' !== thread.status\n\t\t\t\t\t\t\t\t\t? onEditComment\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonDelete={\n\t\t\t\t\t\t\t\t'approved' !== thread.status\n\t\t\t\t\t\t\t\t\t? onCommentDelete\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\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={ () => setSelectedThread( thread.id ) }\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\tonEdit={\n\t\t\t\t\t\t'approved' !== thread.status ? onEditComment : undefined\n\t\t\t\t\t}\n\t\t\t\t\tonDelete={\n\t\t\t\t\t\t'approved' !== thread.status\n\t\t\t\t\t\t\t? onCommentDelete\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isSelected && (\n\t\t\t\t<VStack\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__child-thread\"\n\t\t\t\t\tspacing=\"2\"\n\t\t\t\t>\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\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} );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonAddReply( {\n\t\t\t\t\t\t\t\t\tcontent: inputComment,\n\t\t\t\t\t\t\t\t\tparent: thread.id,\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\tthreadRef.current?.focus();\n\t\t\t\t\t\t\t\tevent.stopPropagation(); // Prevent the parent onClick from being triggered\n\t\t\t\t\t\t\t\tunselectThread();\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: comment identifier, %2$s: author name\n\t\t\t\t\t\t\t\t__( 'Reply to Comment %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 || 'Unknown'\n\t\t\t\t\t\t\t) }\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</VStack>\n\t);\n}\n\nconst CommentBoard = ( { thread, onEdit, onDelete, status } ) => {\n\tconst [ actionState, setActionState ] = useState( false );\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\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};\n\n\tconst actions = [\n\t\tonEdit &&\n\t\t\tstatus !== 'approved' && {\n\t\t\t\tid: 'edit',\n\t\t\t\ttitle: _x( 'Edit', 'Edit comment' ),\n\t\t\t\tonClick: () => {\n\t\t\t\t\tsetActionState( 'edit' );\n\t\t\t\t},\n\t\t\t},\n\t\tonDelete && {\n\t\t\tid: 'delete',\n\t\t\ttitle: _x( 'Delete', 'Delete comment' ),\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\tonEdit &&\n\t\t\tstatus === 'approved' && {\n\t\t\t\tid: 'reopen',\n\t\t\t\ttitle: _x( 'Reopen', 'Reopen comment' ),\n\t\t\t\tonClick: () => {\n\t\t\t\t\tonEdit( { id: thread.id, status: 'hold' } );\n\t\t\t\t},\n\t\t\t},\n\t];\n\n\tconst canResolve = thread?.parent === 0;\n\tconst moreActions = actions.filter( ( item ) => item?.onClick );\n\n\treturn (\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<FlexItem\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__comment-status\"\n\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t// Prevent the thread from being selected.\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<HStack spacing=\"0\">\n\t\t\t\t\t\t{ canResolve && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Resolve',\n\t\t\t\t\t\t\t\t\t'Mark comment as resolved'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\ticon={ published }\n\t\t\t\t\t\t\t\tdisabled={ status === 'approved' }\n\t\t\t\t\t\t\t\taccessibleWhenDisabled={ status === 'approved' }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonEdit( {\n\t\t\t\t\t\t\t\t\t\tid: thread.id,\n\t\t\t\t\t\t\t\t\t\tstatus: 'approved',\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) }\n\t\t\t\t\t\t<Menu placement=\"bottom-end\">\n\t\t\t\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\t\t\t\tdisabled={ ! moreActions.length }\n\t\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\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.Popover>\n\t\t\t\t\t\t\t\t{ moreActions.map( ( action ) => (\n\t\t\t\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => action.onClick() }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t\t{ action.title }\n\t\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</Menu.Popover>\n\t\t\t\t\t\t</Menu>\n\t\t\t\t\t</HStack>\n\t\t\t\t</FlexItem>\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} }\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: comment identifier, %2$s: author name.\n\t\t\t\t\t\t__( 'Edit Comment %1$s by %2$s' ),\n\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\tthread?.author_name || 'Unknown'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<RawHTML className=\"editor-collab-sidebar-panel__user-comment\">\n\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// translators: message displayed when confirming an action\n\t\t\t\t\t\t__( 'Are you sure you want to delete this comment?' )\n\t\t\t\t\t}\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</>\n\t);\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AAQA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,kBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,YAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAA4C,IAAAa,WAAA,GAAAb,OAAA;AAnC5C;AACA;AACA;;AAGA;AACA;AACA;;AAsBA;AACA;AACA;;AAMA,MAAM;EAAEc;AAAgB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAC5D,MAAM;EAAEC;AAAK,CAAC,GAAG,IAAAF,kBAAM,EAAEG,uBAAsB,CAAC;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQA,CAAE;EACzBC,OAAO;EACPC,aAAa;EACbC,UAAU;EACVC,eAAe;EACfC;AACD,CAAC,EAAG;EACH,MAAMC,cAAc,GAAG,IAA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