@wordpress/editor 14.33.4 → 14.33.6
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/add-comment.js +10 -12
- package/build/components/collab-sidebar/add-comment.js.map +2 -2
- package/build/components/collab-sidebar/comment-menu-item.js +36 -6
- package/build/components/collab-sidebar/comment-menu-item.js.map +3 -3
- package/build/components/collab-sidebar/comments.js +316 -318
- package/build/components/collab-sidebar/comments.js.map +3 -3
- package/build/components/collab-sidebar/index.js +38 -25
- package/build/components/collab-sidebar/index.js.map +3 -3
- package/build/components/collab-sidebar/utils.js +1 -1
- package/build/components/collab-sidebar/utils.js.map +2 -2
- package/build/components/editor/index.js +2 -2
- package/build/components/editor/index.js.map +3 -3
- package/build/components/post-excerpt/panel.js +1 -6
- package/build/components/post-excerpt/panel.js.map +2 -2
- package/build/components/post-template/block-theme.js +4 -32
- package/build/components/post-template/block-theme.js.map +3 -3
- package/build/components/post-template/create-new-template-modal.js +1 -2
- package/build/components/post-template/create-new-template-modal.js.map +2 -2
- package/build/components/post-template/hooks.js +1 -3
- package/build/components/post-template/hooks.js.map +2 -2
- package/build/components/preferences-modal/index.js +1 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/provider/index.js +2 -3
- package/build/components/provider/index.js.map +2 -2
- package/build/components/start-page-options/index.js +4 -5
- package/build/components/start-page-options/index.js.map +2 -2
- package/build/dataviews/store/private-actions.js +3 -9
- package/build/dataviews/store/private-actions.js.map +2 -2
- package/build/store/actions.js +2 -67
- package/build/store/actions.js.map +2 -2
- package/build-module/components/collab-sidebar/add-comment.js +10 -12
- package/build-module/components/collab-sidebar/add-comment.js.map +2 -2
- package/build-module/components/collab-sidebar/comment-menu-item.js +40 -7
- package/build-module/components/collab-sidebar/comment-menu-item.js.map +2 -2
- package/build-module/components/collab-sidebar/comments.js +316 -318
- package/build-module/components/collab-sidebar/comments.js.map +2 -2
- package/build-module/components/collab-sidebar/index.js +38 -25
- package/build-module/components/collab-sidebar/index.js.map +2 -2
- package/build-module/components/collab-sidebar/utils.js +1 -1
- package/build-module/components/collab-sidebar/utils.js.map +2 -2
- package/build-module/components/editor/index.js +2 -2
- package/build-module/components/editor/index.js.map +2 -2
- package/build-module/components/post-excerpt/panel.js +1 -6
- package/build-module/components/post-excerpt/panel.js.map +2 -2
- package/build-module/components/post-template/block-theme.js +4 -32
- package/build-module/components/post-template/block-theme.js.map +2 -2
- package/build-module/components/post-template/create-new-template-modal.js +1 -2
- package/build-module/components/post-template/create-new-template-modal.js.map +2 -2
- package/build-module/components/post-template/hooks.js +1 -3
- package/build-module/components/post-template/hooks.js.map +2 -2
- package/build-module/components/preferences-modal/index.js +1 -1
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/provider/index.js +2 -3
- package/build-module/components/provider/index.js.map +2 -2
- package/build-module/components/start-page-options/index.js +5 -6
- package/build-module/components/start-page-options/index.js.map +2 -2
- package/build-module/dataviews/store/private-actions.js +3 -9
- package/build-module/dataviews/store/private-actions.js.map +2 -2
- package/build-module/store/actions.js +3 -68
- package/build-module/store/actions.js.map +2 -2
- package/build-style/style-rtl.css +14 -2
- package/build-style/style.css +14 -2
- package/build-types/components/collab-sidebar/add-comment.d.ts +3 -3
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comment-menu-item.d.ts +3 -2
- package/build-types/components/collab-sidebar/comment-menu-item.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comments.d.ts +4 -4
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
- package/build-types/components/post-excerpt/panel.d.ts.map +1 -1
- package/build-types/components/post-template/block-theme.d.ts.map +1 -1
- package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
- package/build-types/components/post-template/hooks.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/start-page-options/index.d.ts.map +1 -1
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/components/collab-sidebar/add-comment.js +10 -12
- package/src/components/collab-sidebar/comment-menu-item.js +51 -11
- package/src/components/collab-sidebar/comments.js +53 -56
- package/src/components/collab-sidebar/index.js +66 -46
- package/src/components/collab-sidebar/style.scss +16 -0
- package/src/components/collab-sidebar/utils.js +3 -2
- package/src/components/editor/index.js +1 -1
- package/src/components/post-excerpt/panel.js +1 -11
- package/src/components/post-template/block-theme.js +3 -45
- package/src/components/post-template/create-new-template-modal.js +0 -1
- package/src/components/post-template/hooks.js +1 -3
- package/src/components/preferences-modal/index.js +1 -1
- package/src/components/provider/index.js +2 -5
- package/src/components/start-page-options/index.js +5 -6
- package/src/components/start-page-options/style.scss +1 -1
- package/src/dataviews/store/private-actions.ts +7 -16
- package/src/store/actions.js +3 -100
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -56,8 +56,8 @@ function Comments({
|
|
|
56
56
|
onEditComment,
|
|
57
57
|
onAddReply,
|
|
58
58
|
onCommentDelete,
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
newNoteFormState,
|
|
60
|
+
setNewNoteFormState,
|
|
61
61
|
commentSidebarRef,
|
|
62
62
|
reflowComments,
|
|
63
63
|
isFloating = false,
|
|
@@ -69,19 +69,23 @@ function Comments({
|
|
|
69
69
|
const [blockRefs, setBlockRefs] = (0, import_element.useState)({});
|
|
70
70
|
const { setCanvasMinHeight } = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_store.store));
|
|
71
71
|
const { blockCommentId, selectedBlockClientId, orderedBlockIds } = (0, import_data.useSelect)((select) => {
|
|
72
|
-
const {
|
|
72
|
+
const {
|
|
73
|
+
getBlockAttributes,
|
|
74
|
+
getSelectedBlockClientId,
|
|
75
|
+
getClientIdsWithDescendants
|
|
76
|
+
} = select(import_block_editor.store);
|
|
73
77
|
const clientId = getSelectedBlockClientId();
|
|
74
78
|
return {
|
|
75
79
|
blockCommentId: clientId ? getBlockAttributes(clientId)?.metadata?.noteId : null,
|
|
76
80
|
selectedBlockClientId: clientId,
|
|
77
|
-
orderedBlockIds:
|
|
81
|
+
orderedBlockIds: getClientIdsWithDescendants()
|
|
78
82
|
};
|
|
79
83
|
}, []);
|
|
80
84
|
const relatedBlockElement = useBlockElement(selectedBlockClientId);
|
|
81
85
|
const threads = (0, import_element.useMemo)(() => {
|
|
82
86
|
const t = [...noteThreads];
|
|
83
87
|
const orderedThreads = [];
|
|
84
|
-
if (isFloating &&
|
|
88
|
+
if (isFloating && newNoteFormState === "open") {
|
|
85
89
|
const newNoteThread = {
|
|
86
90
|
id: "new-note-thread",
|
|
87
91
|
blockClientId: selectedBlockClientId,
|
|
@@ -105,8 +109,7 @@ function Comments({
|
|
|
105
109
|
}, [
|
|
106
110
|
noteThreads,
|
|
107
111
|
isFloating,
|
|
108
|
-
|
|
109
|
-
blockCommentId,
|
|
112
|
+
newNoteFormState,
|
|
110
113
|
selectedBlockClientId,
|
|
111
114
|
orderedBlockIds
|
|
112
115
|
]);
|
|
@@ -128,14 +131,15 @@ function Comments({
|
|
|
128
131
|
(0, import_utils.focusCommentThread)(prevThread.id, commentSidebarRef.current);
|
|
129
132
|
} else {
|
|
130
133
|
setSelectedThread(null);
|
|
131
|
-
|
|
134
|
+
setNewNoteFormState("closed");
|
|
132
135
|
relatedBlockElement?.focus();
|
|
133
136
|
}
|
|
134
137
|
};
|
|
135
138
|
(0, import_element.useEffect)(() => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
setSelectedThread(
|
|
140
|
+
newNoteFormState === "open" ? "new-note-thread" : blockCommentId
|
|
141
|
+
);
|
|
142
|
+
}, [blockCommentId, newNoteFormState]);
|
|
139
143
|
const setBlockRef = (0, import_element.useCallback)((id, blockRef) => {
|
|
140
144
|
setBlockRefs((prev) => ({ ...prev, [id]: blockRef }));
|
|
141
145
|
}, []);
|
|
@@ -231,27 +235,15 @@ function Comments({
|
|
|
231
235
|
]);
|
|
232
236
|
const hasThreads = Array.isArray(threads) && threads.length > 0;
|
|
233
237
|
if (!hasThreads && !isFloating) {
|
|
234
|
-
return
|
|
235
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
236
|
-
import_add_comment.AddComment,
|
|
237
|
-
{
|
|
238
|
-
onSubmit: onAddReply,
|
|
239
|
-
showCommentBoard,
|
|
240
|
-
setShowCommentBoard,
|
|
241
|
-
commentSidebarRef
|
|
242
|
-
}
|
|
243
|
-
),
|
|
244
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { as: "p", children: (0, import_i18n.__)("No notes available.") }),
|
|
245
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { as: "p", variant: "muted", children: (0, import_i18n.__)("Only logged in users can see Notes.") })
|
|
246
|
-
] });
|
|
238
|
+
return null;
|
|
247
239
|
}
|
|
248
240
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
249
|
-
!isFloating &&
|
|
241
|
+
!isFloating && newNoteFormState === "open" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
250
242
|
import_add_comment.AddComment,
|
|
251
243
|
{
|
|
252
244
|
onSubmit: onAddReply,
|
|
253
|
-
|
|
254
|
-
|
|
245
|
+
newNoteFormState,
|
|
246
|
+
setNewNoteFormState,
|
|
255
247
|
commentSidebarRef
|
|
256
248
|
}
|
|
257
249
|
),
|
|
@@ -264,7 +256,7 @@ function Comments({
|
|
|
264
256
|
onEditComment,
|
|
265
257
|
isSelected: selectedThread === thread.id,
|
|
266
258
|
setSelectedThread,
|
|
267
|
-
|
|
259
|
+
setNewNoteFormState,
|
|
268
260
|
commentSidebarRef,
|
|
269
261
|
reflowComments,
|
|
270
262
|
isFloating,
|
|
@@ -273,7 +265,7 @@ function Comments({
|
|
|
273
265
|
setBlockRef,
|
|
274
266
|
selectedThread,
|
|
275
267
|
commentLastUpdated,
|
|
276
|
-
|
|
268
|
+
newNoteFormState
|
|
277
269
|
},
|
|
278
270
|
thread.id
|
|
279
271
|
))
|
|
@@ -285,7 +277,7 @@ function Thread({
|
|
|
285
277
|
onAddReply,
|
|
286
278
|
onCommentDelete,
|
|
287
279
|
isSelected,
|
|
288
|
-
|
|
280
|
+
setNewNoteFormState,
|
|
289
281
|
commentSidebarRef,
|
|
290
282
|
reflowComments,
|
|
291
283
|
isFloating,
|
|
@@ -295,7 +287,7 @@ function Thread({
|
|
|
295
287
|
setSelectedThread,
|
|
296
288
|
selectedThread,
|
|
297
289
|
commentLastUpdated,
|
|
298
|
-
|
|
290
|
+
newNoteFormState
|
|
299
291
|
}) {
|
|
300
292
|
const { toggleBlockHighlight, selectBlock, toggleBlockSpotlight } = (0, import_lock_unlock.unlock)(
|
|
301
293
|
(0, import_data.useDispatch)(import_block_editor.store)
|
|
@@ -320,7 +312,7 @@ function Thread({
|
|
|
320
312
|
debouncedToggleBlockHighlight(thread.blockClientId, false);
|
|
321
313
|
};
|
|
322
314
|
const handleCommentSelect = () => {
|
|
323
|
-
|
|
315
|
+
setNewNoteFormState("closed");
|
|
324
316
|
setSelectedThread(thread.id);
|
|
325
317
|
if (!!thread.blockClientId) {
|
|
326
318
|
selectBlock(thread.blockClientId, null);
|
|
@@ -329,7 +321,7 @@ function Thread({
|
|
|
329
321
|
};
|
|
330
322
|
const unselectThread = () => {
|
|
331
323
|
setSelectedThread(null);
|
|
332
|
-
|
|
324
|
+
setNewNoteFormState("closed");
|
|
333
325
|
toggleBlockSpotlight(thread.blockClientId, false);
|
|
334
326
|
};
|
|
335
327
|
const allReplies = thread?.reply || [];
|
|
@@ -348,13 +340,13 @@ function Thread({
|
|
|
348
340
|
(0, import_i18n.__)("Original block deleted. Note: %s"),
|
|
349
341
|
commentExcerpt
|
|
350
342
|
);
|
|
351
|
-
if ("new-note-thread"
|
|
343
|
+
if (thread.id === "new-note-thread" && newNoteFormState === "open" && isFloating) {
|
|
352
344
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
353
345
|
import_add_comment.AddComment,
|
|
354
346
|
{
|
|
355
347
|
onSubmit: onAddReply,
|
|
356
|
-
|
|
357
|
-
|
|
348
|
+
newNoteFormState,
|
|
349
|
+
setNewNoteFormState,
|
|
358
350
|
commentSidebarRef,
|
|
359
351
|
reflowComments,
|
|
360
352
|
isFloating,
|
|
@@ -363,185 +355,184 @@ function Thread({
|
|
|
363
355
|
}
|
|
364
356
|
);
|
|
365
357
|
}
|
|
366
|
-
return (
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
}
|
|
387
|
-
if (event.key === "Enter" && event.currentTarget === event.target) {
|
|
388
|
-
if (isSelected) {
|
|
389
|
-
unselectThread();
|
|
390
|
-
} else {
|
|
391
|
-
handleCommentSelect();
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
if (event.key === "Escape") {
|
|
358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
359
|
+
import_components.__experimentalVStack,
|
|
360
|
+
{
|
|
361
|
+
className: (0, import_clsx.default)("editor-collab-sidebar-panel__thread", {
|
|
362
|
+
"is-selected": isSelected,
|
|
363
|
+
"is-floating": isFloating
|
|
364
|
+
}),
|
|
365
|
+
id: `comment-thread-${thread.id}`,
|
|
366
|
+
spacing: "3",
|
|
367
|
+
onClick: handleCommentSelect,
|
|
368
|
+
onMouseEnter,
|
|
369
|
+
onMouseLeave,
|
|
370
|
+
onFocus: onMouseEnter,
|
|
371
|
+
onBlur: onMouseLeave,
|
|
372
|
+
onKeyDown: (event) => {
|
|
373
|
+
if (event.defaultPrevented) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
if (event.key === "Enter" && event.currentTarget === event.target) {
|
|
377
|
+
if (isSelected) {
|
|
395
378
|
unselectThread();
|
|
396
|
-
|
|
379
|
+
} else {
|
|
380
|
+
handleCommentSelect();
|
|
397
381
|
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
382
|
+
}
|
|
383
|
+
if (event.key === "Escape") {
|
|
384
|
+
unselectThread();
|
|
385
|
+
(0, import_utils.focusCommentThread)(thread.id, commentSidebarRef.current);
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
tabIndex: 0,
|
|
389
|
+
role: "treeitem",
|
|
390
|
+
"aria-label": ariaLabel,
|
|
391
|
+
"aria-expanded": isSelected,
|
|
392
|
+
ref: isFloating ? refs.setFloating : void 0,
|
|
393
|
+
style: isFloating ? { top: y } : void 0,
|
|
394
|
+
children: [
|
|
395
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
396
|
+
import_components.Button,
|
|
397
|
+
{
|
|
398
|
+
className: "editor-collab-sidebar-panel__skip-to-comment",
|
|
399
|
+
variant: "secondary",
|
|
400
|
+
size: "compact",
|
|
401
|
+
onClick: () => {
|
|
402
|
+
(0, import_utils.focusCommentThread)(
|
|
403
|
+
thread.id,
|
|
404
|
+
commentSidebarRef.current,
|
|
405
|
+
"textarea"
|
|
406
|
+
);
|
|
407
|
+
},
|
|
408
|
+
children: (0, import_i18n.__)("Add new note")
|
|
409
|
+
}
|
|
410
|
+
),
|
|
411
|
+
!thread.blockClientId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { as: "p", weight: 500, variant: "muted", children: (0, import_i18n.__)("Original block deleted.") }),
|
|
412
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
413
|
+
CommentBoard,
|
|
414
|
+
{
|
|
415
|
+
thread,
|
|
416
|
+
isExpanded: isSelected,
|
|
417
|
+
onEdit: (params = {}) => {
|
|
418
|
+
onEditComment(params);
|
|
419
|
+
if (params.status === "approved") {
|
|
420
|
+
unselectThread();
|
|
421
|
+
if (isFloating) {
|
|
422
|
+
relatedBlockElement?.focus();
|
|
423
|
+
} else {
|
|
433
424
|
(0, import_utils.focusCommentThread)(
|
|
434
425
|
thread.id,
|
|
435
426
|
commentSidebarRef.current
|
|
436
427
|
);
|
|
437
428
|
}
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
onDelete: onCommentDelete,
|
|
432
|
+
reflowComments
|
|
433
|
+
}
|
|
434
|
+
),
|
|
435
|
+
isSelected && allReplies.map((reply) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
436
|
+
CommentBoard,
|
|
437
|
+
{
|
|
438
|
+
thread: reply,
|
|
439
|
+
parent: thread,
|
|
440
|
+
isExpanded: isSelected,
|
|
441
|
+
onEdit: onEditComment,
|
|
442
|
+
onDelete: onCommentDelete,
|
|
443
|
+
reflowComments
|
|
444
|
+
},
|
|
445
|
+
reply.id
|
|
446
|
+
)),
|
|
447
|
+
!isSelected && restReplies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalHStack, { className: "editor-collab-sidebar-panel__more-reply-separator", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
448
|
+
import_components.Button,
|
|
449
|
+
{
|
|
450
|
+
size: "compact",
|
|
451
|
+
variant: "tertiary",
|
|
452
|
+
className: "editor-collab-sidebar-panel__more-reply-button",
|
|
453
|
+
onClick: () => {
|
|
454
|
+
setSelectedThread(thread.id);
|
|
455
|
+
(0, import_utils.focusCommentThread)(
|
|
456
|
+
thread.id,
|
|
457
|
+
commentSidebarRef.current
|
|
458
|
+
);
|
|
452
459
|
},
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
460
|
+
children: (0, import_i18n.sprintf)(
|
|
461
|
+
// translators: %s: number of replies.
|
|
462
|
+
(0, import_i18n._n)(
|
|
463
|
+
"%s more reply",
|
|
464
|
+
"%s more replies",
|
|
465
|
+
restReplies.length
|
|
466
|
+
),
|
|
467
|
+
restReplies.length
|
|
468
|
+
)
|
|
469
|
+
}
|
|
470
|
+
) }),
|
|
471
|
+
!isSelected && lastReply && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
472
|
+
CommentBoard,
|
|
473
|
+
{
|
|
474
|
+
thread: lastReply,
|
|
475
|
+
parent: thread,
|
|
476
|
+
isExpanded: isSelected,
|
|
477
|
+
onEdit: onEditComment,
|
|
478
|
+
onDelete: onCommentDelete,
|
|
479
|
+
reflowComments
|
|
480
|
+
}
|
|
481
|
+
),
|
|
482
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: "2", role: "treeitem", children: [
|
|
483
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_comment_author_info.default, {}) }),
|
|
484
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalVStack, { spacing: "2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
485
|
+
import_comment_form.default,
|
|
457
486
|
{
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
487
|
+
onSubmit: (inputComment) => {
|
|
488
|
+
if ("approved" === thread.status) {
|
|
489
|
+
onEditComment({
|
|
490
|
+
id: thread.id,
|
|
491
|
+
status: "hold",
|
|
492
|
+
content: inputComment
|
|
493
|
+
});
|
|
494
|
+
} else {
|
|
495
|
+
onAddReply({
|
|
496
|
+
content: inputComment,
|
|
497
|
+
parent: thread.id
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
onCancel: (event) => {
|
|
502
|
+
event.stopPropagation();
|
|
503
|
+
unselectThread();
|
|
463
504
|
(0, import_utils.focusCommentThread)(
|
|
464
505
|
thread.id,
|
|
465
506
|
commentSidebarRef.current
|
|
466
507
|
);
|
|
467
508
|
},
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
)
|
|
477
|
-
}
|
|
478
|
-
) }),
|
|
479
|
-
!isSelected && lastReply && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
480
|
-
CommentBoard,
|
|
481
|
-
{
|
|
482
|
-
thread: lastReply,
|
|
483
|
-
parent: thread,
|
|
484
|
-
isExpanded: isSelected,
|
|
485
|
-
onEdit: onEditComment,
|
|
486
|
-
onDelete: onCommentDelete,
|
|
509
|
+
submitButtonText: "approved" === thread.status ? (0, import_i18n.__)("Reopen & Reply") : (0, import_i18n.__)("Reply"),
|
|
510
|
+
rows: "approved" === thread.status ? 2 : 4,
|
|
511
|
+
labelText: (0, import_i18n.sprintf)(
|
|
512
|
+
// translators: %1$s: note identifier, %2$s: author name
|
|
513
|
+
(0, import_i18n.__)("Reply to note %1$s by %2$s"),
|
|
514
|
+
thread.id,
|
|
515
|
+
thread.author_name
|
|
516
|
+
),
|
|
487
517
|
reflowComments
|
|
488
518
|
}
|
|
489
|
-
)
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
},
|
|
509
|
-
onCancel: (event) => {
|
|
510
|
-
event.stopPropagation();
|
|
511
|
-
unselectThread();
|
|
512
|
-
(0, import_utils.focusCommentThread)(
|
|
513
|
-
thread.id,
|
|
514
|
-
commentSidebarRef.current
|
|
515
|
-
);
|
|
516
|
-
},
|
|
517
|
-
submitButtonText: "approved" === thread.status ? (0, import_i18n.__)("Reopen & Reply") : (0, import_i18n.__)("Reply"),
|
|
518
|
-
rows: "approved" === thread.status ? 2 : 4,
|
|
519
|
-
labelText: (0, import_i18n.sprintf)(
|
|
520
|
-
// translators: %1$s: note identifier, %2$s: author name
|
|
521
|
-
(0, import_i18n.__)("Reply to note %1$s by %2$s"),
|
|
522
|
-
thread.id,
|
|
523
|
-
thread.author_name
|
|
524
|
-
),
|
|
525
|
-
reflowComments
|
|
526
|
-
}
|
|
527
|
-
) })
|
|
528
|
-
] }),
|
|
529
|
-
!!thread.blockClientId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
530
|
-
import_components.Button,
|
|
531
|
-
{
|
|
532
|
-
className: "editor-collab-sidebar-panel__skip-to-block",
|
|
533
|
-
variant: "secondary",
|
|
534
|
-
size: "compact",
|
|
535
|
-
onClick: (event) => {
|
|
536
|
-
event.stopPropagation();
|
|
537
|
-
relatedBlockElement?.focus();
|
|
538
|
-
},
|
|
539
|
-
children: (0, import_i18n.__)("Back to block")
|
|
540
|
-
}
|
|
541
|
-
)
|
|
542
|
-
]
|
|
543
|
-
}
|
|
544
|
-
)
|
|
519
|
+
) })
|
|
520
|
+
] }),
|
|
521
|
+
!!thread.blockClientId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
522
|
+
import_components.Button,
|
|
523
|
+
{
|
|
524
|
+
className: "editor-collab-sidebar-panel__skip-to-block",
|
|
525
|
+
variant: "secondary",
|
|
526
|
+
size: "compact",
|
|
527
|
+
onClick: (event) => {
|
|
528
|
+
event.stopPropagation();
|
|
529
|
+
relatedBlockElement?.focus();
|
|
530
|
+
},
|
|
531
|
+
children: (0, import_i18n.__)("Back to block")
|
|
532
|
+
}
|
|
533
|
+
)
|
|
534
|
+
]
|
|
535
|
+
}
|
|
545
536
|
);
|
|
546
537
|
}
|
|
547
538
|
const CommentBoard = ({
|
|
@@ -595,133 +586,140 @@ const CommentBoard = ({
|
|
|
595
586
|
];
|
|
596
587
|
const canResolve = thread.parent === 0;
|
|
597
588
|
const moreActions = parent?.status !== "approved" ? actions.filter((item) => item.isEligible(thread)) : [];
|
|
598
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
590
|
+
import_components.__experimentalVStack,
|
|
591
|
+
{
|
|
592
|
+
spacing: "2",
|
|
593
|
+
role: thread.parent !== 0 ? "treeitem" : void 0,
|
|
594
|
+
children: [
|
|
595
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", children: [
|
|
596
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
597
|
+
import_comment_author_info.default,
|
|
598
|
+
{
|
|
599
|
+
avatar: thread?.author_avatar_urls?.[48],
|
|
600
|
+
name: thread?.author_name,
|
|
601
|
+
date: thread?.date,
|
|
602
|
+
userId: thread?.author
|
|
603
|
+
}
|
|
604
|
+
),
|
|
605
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
606
|
+
import_components.FlexItem,
|
|
607
|
+
{
|
|
608
|
+
className: "editor-collab-sidebar-panel__comment-status",
|
|
609
|
+
onClick: (event) => {
|
|
610
|
+
event.stopPropagation();
|
|
611
|
+
},
|
|
612
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { spacing: "0", children: [
|
|
613
|
+
canResolve && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
614
|
+
import_components.Button,
|
|
615
|
+
{
|
|
616
|
+
label: (0, import_i18n._x)(
|
|
617
|
+
"Resolve",
|
|
618
|
+
"Mark note as resolved"
|
|
619
|
+
),
|
|
620
|
+
size: "small",
|
|
621
|
+
icon: import_icons.published,
|
|
622
|
+
disabled: thread.status === "approved",
|
|
623
|
+
accessibleWhenDisabled: thread.status === "approved",
|
|
624
|
+
onClick: () => {
|
|
625
|
+
onEdit({
|
|
626
|
+
id: thread.id,
|
|
627
|
+
status: "approved"
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
}
|
|
623
631
|
),
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
accessibleWhenDisabled: thread.status === "approved",
|
|
628
|
-
onClick: () => {
|
|
629
|
-
onEdit({
|
|
630
|
-
id: thread.id,
|
|
631
|
-
status: "approved"
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
),
|
|
636
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Menu, { placement: "bottom-end", children: [
|
|
637
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
638
|
-
Menu.TriggerButton,
|
|
639
|
-
{
|
|
640
|
-
render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
641
|
-
import_components.Button,
|
|
632
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Menu, { placement: "bottom-end", children: [
|
|
633
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
634
|
+
Menu.TriggerButton,
|
|
642
635
|
{
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
636
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
637
|
+
import_components.Button,
|
|
638
|
+
{
|
|
639
|
+
ref: actionButtonRef,
|
|
640
|
+
size: "small",
|
|
641
|
+
icon: import_icons.moreVertical,
|
|
642
|
+
label: (0, import_i18n.__)("Actions"),
|
|
643
|
+
disabled: !moreActions.length,
|
|
644
|
+
accessibleWhenDisabled: true
|
|
645
|
+
}
|
|
646
|
+
)
|
|
649
647
|
}
|
|
650
|
-
)
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
"edit" === actionState ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
667
|
-
import_comment_form.default,
|
|
668
|
-
{
|
|
669
|
-
onSubmit: (value) => {
|
|
670
|
-
onEdit({
|
|
671
|
-
id: thread.id,
|
|
672
|
-
content: value
|
|
673
|
-
});
|
|
674
|
-
setActionState(false);
|
|
675
|
-
actionButtonRef.current?.focus();
|
|
676
|
-
},
|
|
677
|
-
onCancel: () => handleCancel(),
|
|
678
|
-
thread,
|
|
679
|
-
submitButtonText: (0, import_i18n._x)("Update", "verb"),
|
|
680
|
-
labelText: (0, import_i18n.sprintf)(
|
|
681
|
-
// translators: %1$s: note identifier, %2$s: author name.
|
|
682
|
-
(0, import_i18n.__)("Edit note %1$s by %2$s"),
|
|
683
|
-
thread.id,
|
|
684
|
-
thread.author_name
|
|
685
|
-
),
|
|
686
|
-
reflowComments
|
|
687
|
-
}
|
|
688
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
689
|
-
import_element.RawHTML,
|
|
690
|
-
{
|
|
691
|
-
className: (0, import_clsx.default)(
|
|
692
|
-
"editor-collab-sidebar-panel__user-comment",
|
|
648
|
+
),
|
|
649
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Menu.Popover, { children: moreActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
650
|
+
Menu.Item,
|
|
651
|
+
{
|
|
652
|
+
onClick: () => action.onClick(),
|
|
653
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Menu.ItemLabel, { children: action.title })
|
|
654
|
+
},
|
|
655
|
+
action.id
|
|
656
|
+
)) })
|
|
657
|
+
] })
|
|
658
|
+
] })
|
|
659
|
+
}
|
|
660
|
+
)
|
|
661
|
+
] }),
|
|
662
|
+
"edit" === actionState ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
663
|
+
import_comment_form.default,
|
|
693
664
|
{
|
|
694
|
-
|
|
665
|
+
onSubmit: (value) => {
|
|
666
|
+
onEdit({
|
|
667
|
+
id: thread.id,
|
|
668
|
+
content: value
|
|
669
|
+
});
|
|
670
|
+
setActionState(false);
|
|
671
|
+
actionButtonRef.current?.focus();
|
|
672
|
+
},
|
|
673
|
+
onCancel: () => handleCancel(),
|
|
674
|
+
thread,
|
|
675
|
+
submitButtonText: (0, import_i18n._x)("Update", "verb"),
|
|
676
|
+
labelText: (0, import_i18n.sprintf)(
|
|
677
|
+
// translators: %1$s: note identifier, %2$s: author name.
|
|
678
|
+
(0, import_i18n.__)("Edit note %1$s by %2$s"),
|
|
679
|
+
thread.id,
|
|
680
|
+
thread.author_name
|
|
681
|
+
),
|
|
682
|
+
reflowComments
|
|
683
|
+
}
|
|
684
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
685
|
+
import_element.RawHTML,
|
|
686
|
+
{
|
|
687
|
+
className: (0, import_clsx.default)(
|
|
688
|
+
"editor-collab-sidebar-panel__user-comment",
|
|
689
|
+
{
|
|
690
|
+
"editor-collab-sidebar-panel__resolution-text": isResolutionComment
|
|
691
|
+
}
|
|
692
|
+
),
|
|
693
|
+
children: isResolutionComment ? (() => {
|
|
694
|
+
const actionText = thread.meta._wp_note_status === "resolved" ? (0, import_i18n.__)("Marked as resolved") : (0, import_i18n.__)("Reopened");
|
|
695
|
+
const content = thread?.content?.raw;
|
|
696
|
+
if (content && typeof content === "string" && content.trim() !== "") {
|
|
697
|
+
return (0, import_i18n.sprintf)(
|
|
698
|
+
// translators: %1$s: action label ("Marked as resolved" or "Reopened"); %2$s: note text.
|
|
699
|
+
(0, import_i18n.__)("%1$s: %2$s"),
|
|
700
|
+
actionText,
|
|
701
|
+
content
|
|
702
|
+
);
|
|
703
|
+
}
|
|
704
|
+
return actionText;
|
|
705
|
+
})() : thread?.content?.rendered
|
|
695
706
|
}
|
|
696
707
|
),
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
)
|
|
708
|
+
"delete" === actionState && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
709
|
+
import_components.__experimentalConfirmDialog,
|
|
710
|
+
{
|
|
711
|
+
isOpen: showConfirmDialog,
|
|
712
|
+
onConfirm: handleConfirmDelete,
|
|
713
|
+
onCancel: handleCancel,
|
|
714
|
+
confirmButtonText: (0, import_i18n.__)("Delete"),
|
|
715
|
+
children: (0, import_i18n.__)(
|
|
716
|
+
"Are you sure you want to delete this note? This will also delete all of this note's replies."
|
|
717
|
+
)
|
|
707
718
|
}
|
|
708
|
-
return actionText;
|
|
709
|
-
})() : thread?.content?.rendered
|
|
710
|
-
}
|
|
711
|
-
),
|
|
712
|
-
"delete" === actionState && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
713
|
-
import_components.__experimentalConfirmDialog,
|
|
714
|
-
{
|
|
715
|
-
isOpen: showConfirmDialog,
|
|
716
|
-
onConfirm: handleConfirmDelete,
|
|
717
|
-
onCancel: handleCancel,
|
|
718
|
-
confirmButtonText: (0, import_i18n.__)("Delete"),
|
|
719
|
-
children: (0, import_i18n.__)(
|
|
720
|
-
"Are you sure you want to delete this note? This will also delete all of this note's replies."
|
|
721
719
|
)
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
720
|
+
]
|
|
721
|
+
}
|
|
722
|
+
);
|
|
725
723
|
};
|
|
726
724
|
var comments_default = Comments;
|
|
727
725
|
// Annotate the CommonJS export names for ESM import in node:
|