@wordpress/editor 14.31.0 → 14.31.1-next.f56bd8138.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.
- package/build/components/collab-sidebar/comment-author-info.js +2 -2
- package/build/components/collab-sidebar/comment-author-info.js.map +1 -1
- package/build/components/collab-sidebar/comments.js +87 -25
- package/build/components/collab-sidebar/comments.js.map +1 -1
- package/build/components/collab-sidebar/index.js +1 -0
- package/build/components/collab-sidebar/index.js.map +1 -1
- package/build/components/post-type-support-check/index.js +12 -1
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/collab-sidebar/comment-author-info.js +3 -3
- package/build-module/components/collab-sidebar/comment-author-info.js.map +1 -1
- package/build-module/components/collab-sidebar/comments.js +91 -30
- package/build-module/components/collab-sidebar/comments.js.map +1 -1
- package/build-module/components/collab-sidebar/index.js +1 -0
- package/build-module/components/collab-sidebar/index.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js +11 -1
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-style/style-rtl.css +13 -0
- package/build-style/style.css +13 -0
- package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +1 -1
- 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/post-type-support-check/index.d.ts.map +1 -1
- package/package.json +37 -37
- package/src/components/collab-sidebar/comment-author-info.js +4 -1
- package/src/components/collab-sidebar/comments.js +97 -39
- package/src/components/collab-sidebar/index.js +1 -0
- package/src/components/collab-sidebar/style.scss +84 -84
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
- package/src/components/post-type-support-check/index.js +18 -1
- package/src/components/post-type-support-check/test/index.js +37 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -6,18 +6,45 @@ import clsx from 'clsx';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useState, RawHTML } from '@wordpress/element';
|
|
9
|
+
import { useState, RawHTML, useEffect, useMemo } from '@wordpress/element';
|
|
10
10
|
import { __experimentalHStack as HStack, __experimentalVStack as VStack, __experimentalConfirmDialog as ConfirmDialog, Button, DropdownMenu } from '@wordpress/components';
|
|
11
11
|
import { published, moreVertical } from '@wordpress/icons';
|
|
12
|
-
import { __, _x,
|
|
13
|
-
import { useSelect } from '@wordpress/data';
|
|
14
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
12
|
+
import { __, _x, sprintf, _n } from '@wordpress/i18n';
|
|
13
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
14
|
+
import { store as blockEditorStore, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Internal dependencies
|
|
18
18
|
*/
|
|
19
|
+
import { unlock } from '../../lock-unlock';
|
|
19
20
|
import CommentAuthorInfo from './comment-author-info';
|
|
20
21
|
import CommentForm from './comment-form';
|
|
22
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
+
const {
|
|
24
|
+
useBlockElement
|
|
25
|
+
} = unlock(blockEditorPrivateApis);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Finds the first block that has the specified comment ID.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} commentId - The comment ID to search for.
|
|
31
|
+
* @param {Array} blockList - The list of blocks to search through.
|
|
32
|
+
* @return {string|null} The client ID of the found block, or null if not found.
|
|
33
|
+
*/
|
|
34
|
+
const findBlockByCommentId = (commentId, blockList) => {
|
|
35
|
+
for (const block of blockList) {
|
|
36
|
+
if (block.attributes?.blockCommentId === commentId) {
|
|
37
|
+
return block.clientId;
|
|
38
|
+
}
|
|
39
|
+
if (block.innerBlocks) {
|
|
40
|
+
const found = findBlockByCommentId(commentId, block.innerBlocks);
|
|
41
|
+
if (found) {
|
|
42
|
+
return found;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
};
|
|
21
48
|
|
|
22
49
|
/**
|
|
23
50
|
* Renders the Comments component.
|
|
@@ -33,7 +60,6 @@ import CommentForm from './comment-form';
|
|
|
33
60
|
* @param {Function} props.setShowCommentBoard - The function to set the comment board visibility.
|
|
34
61
|
* @return {React.ReactNode} The rendered Comments component.
|
|
35
62
|
*/
|
|
36
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
37
63
|
export function Comments({
|
|
38
64
|
threads,
|
|
39
65
|
onEditComment,
|
|
@@ -45,22 +71,34 @@ export function Comments({
|
|
|
45
71
|
setShowCommentBoard
|
|
46
72
|
}) {
|
|
47
73
|
const {
|
|
48
|
-
blockCommentId
|
|
74
|
+
blockCommentId,
|
|
75
|
+
blocks
|
|
49
76
|
} = useSelect(select => {
|
|
50
77
|
const {
|
|
51
78
|
getBlockAttributes,
|
|
52
|
-
getSelectedBlockClientId
|
|
79
|
+
getSelectedBlockClientId,
|
|
80
|
+
getBlocks
|
|
53
81
|
} = select(blockEditorStore);
|
|
54
82
|
const _clientId = getSelectedBlockClientId();
|
|
55
83
|
return {
|
|
56
|
-
blockCommentId: _clientId ? getBlockAttributes(_clientId)?.blockCommentId : null
|
|
84
|
+
blockCommentId: _clientId ? getBlockAttributes(_clientId)?.blockCommentId : null,
|
|
85
|
+
blocks: getBlocks()
|
|
57
86
|
};
|
|
58
87
|
}, []);
|
|
59
|
-
const
|
|
88
|
+
const {
|
|
89
|
+
flashBlock
|
|
90
|
+
} = useDispatch(blockEditorStore);
|
|
60
91
|
const clearThreadFocus = () => {
|
|
61
92
|
setFocusThread(null);
|
|
62
93
|
setShowCommentBoard(false);
|
|
63
94
|
};
|
|
95
|
+
const [focusThread, setFocusThread] = useState(showCommentBoard && blockCommentId ? blockCommentId : null);
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
// Highlight comment when block is selected.
|
|
98
|
+
if (blockCommentId && !focusThread) {
|
|
99
|
+
setFocusThread(blockCommentId);
|
|
100
|
+
}
|
|
101
|
+
}, [blockCommentId, focusThread, blocks, setFocusThread]);
|
|
64
102
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
65
103
|
children: [
|
|
66
104
|
// If there are no comments, show a message indicating no comments are available.
|
|
@@ -72,25 +110,20 @@ export function Comments({
|
|
|
72
110
|
children:
|
|
73
111
|
// translators: message displayed when there are no comments available
|
|
74
112
|
__('No comments available')
|
|
75
|
-
}), Array.isArray(threads) && threads.length > 0 && threads.map(thread => /*#__PURE__*/_jsx(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
onEditComment: onEditComment,
|
|
90
|
-
isFocused: focusThread === thread.id,
|
|
91
|
-
clearThreadFocus: clearThreadFocus,
|
|
92
|
-
setFocusThread: setFocusThread
|
|
93
|
-
})
|
|
113
|
+
}), Array.isArray(threads) && threads.length > 0 && threads.map(thread => /*#__PURE__*/_jsx(Thread, {
|
|
114
|
+
thread: thread,
|
|
115
|
+
onAddReply: onAddReply,
|
|
116
|
+
onCommentDelete: onCommentDelete,
|
|
117
|
+
onCommentResolve: onCommentResolve,
|
|
118
|
+
onCommentReopen: onCommentReopen,
|
|
119
|
+
onEditComment: onEditComment,
|
|
120
|
+
isFocused: focusThread === thread.id,
|
|
121
|
+
clearThreadFocus: clearThreadFocus,
|
|
122
|
+
setFocusThread: setFocusThread,
|
|
123
|
+
blockCommentId: blockCommentId,
|
|
124
|
+
blocks: blocks,
|
|
125
|
+
flashBlock: flashBlock,
|
|
126
|
+
setShowCommentBoard: setShowCommentBoard
|
|
94
127
|
}, thread.id))]
|
|
95
128
|
});
|
|
96
129
|
}
|
|
@@ -103,9 +136,37 @@ function Thread({
|
|
|
103
136
|
onCommentReopen,
|
|
104
137
|
isFocused,
|
|
105
138
|
clearThreadFocus,
|
|
106
|
-
setFocusThread
|
|
139
|
+
setFocusThread,
|
|
140
|
+
blocks,
|
|
141
|
+
flashBlock,
|
|
142
|
+
setShowCommentBoard
|
|
107
143
|
}) {
|
|
108
|
-
|
|
144
|
+
// Find first block that has this comment ID - run at component root level.
|
|
145
|
+
const relatedBlock = useMemo(() => {
|
|
146
|
+
if (!thread.id || !blocks) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
return findBlockByCommentId(thread.id, blocks);
|
|
150
|
+
}, [thread.id, blocks]);
|
|
151
|
+
const relatedBlockElement = useBlockElement(relatedBlock);
|
|
152
|
+
const handleCommentSelect = threadId => {
|
|
153
|
+
setShowCommentBoard(false);
|
|
154
|
+
setFocusThread(threadId);
|
|
155
|
+
if (relatedBlock && relatedBlockElement) {
|
|
156
|
+
relatedBlockElement.scrollIntoView({
|
|
157
|
+
behavior: 'instant',
|
|
158
|
+
block: 'center'
|
|
159
|
+
});
|
|
160
|
+
flashBlock(relatedBlock);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
return /*#__PURE__*/_jsxs(VStack, {
|
|
164
|
+
className: clsx('editor-collab-sidebar-panel__thread', {
|
|
165
|
+
'editor-collab-sidebar-panel__focus-thread': isFocused
|
|
166
|
+
}),
|
|
167
|
+
id: thread.id,
|
|
168
|
+
spacing: "3",
|
|
169
|
+
onClick: () => handleCommentSelect(thread.id),
|
|
109
170
|
children: [/*#__PURE__*/_jsx(CommentBoard, {
|
|
110
171
|
thread: thread,
|
|
111
172
|
onResolve: onCommentResolve,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useState","RawHTML","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalConfirmDialog","ConfirmDialog","Button","DropdownMenu","published","moreVertical","__","_x","_n","sprintf","useSelect","store","blockEditorStore","CommentAuthorInfo","CommentForm","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","Comments","threads","onEditComment","onAddReply","onCommentDelete","onCommentResolve","onCommentReopen","showCommentBoard","setShowCommentBoard","blockCommentId","select","getBlockAttributes","getSelectedBlockClientId","_clientId","focusThread","setFocusThread","clearThreadFocus","children","Array","isArray","length","alignment","className","justify","spacing","map","thread","id","onClick","Thread","isFocused","CommentBoard","onResolve","onReopen","onEdit","onDelete","status","reply","__next40pxDefaultSize","variant","onSubmit","inputComment","onCancel","event","stopPropagation","placeholderText","submitButtonText","rows","actionState","setActionState","showConfirmDialog","setShowConfirmDialog","handleConfirmDelete","handleCancel","actions","title","moreActions","filter","item","avatar","author_avatar_urls","name","author_name","date","parent","label","size","icon","disabled","accessibleWhenDisabled","controls","value","content","rendered","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 } 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';\nimport { published, moreVertical } from '@wordpress/icons';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport CommentAuthorInfo from './comment-author-info';\nimport CommentForm from './comment-form';\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 } = useSelect( ( select ) => {\n\t\tconst { getBlockAttributes, getSelectedBlockClientId } =\n\t\t\tselect( blockEditorStore );\n\t\tconst _clientId = getSelectedBlockClientId();\n\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};\n\t}, [] );\n\n\tconst [ focusThread, setFocusThread ] = useState(\n\t\tshowCommentBoard && blockCommentId ? blockCommentId : null\n\t);\n\n\tconst clearThreadFocus = () => {\n\t\tsetFocusThread( null );\n\t\tsetShowCommentBoard( false );\n\t};\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<VStack\n\t\t\t\t\t\tkey={ thread.id }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'editor-collab-sidebar-panel__thread',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'editor-collab-sidebar-panel__active-thread':\n\t\t\t\t\t\t\t\t\tblockCommentId &&\n\t\t\t\t\t\t\t\t\tblockCommentId === thread.id,\n\t\t\t\t\t\t\t\t'editor-collab-sidebar-panel__focus-thread':\n\t\t\t\t\t\t\t\t\tfocusThread && focusThread === thread.id,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tid={ thread.id }\n\t\t\t\t\t\tspacing=\"3\"\n\t\t\t\t\t\tonClick={ () => setFocusThread( thread.id ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Thread\n\t\t\t\t\t\t\tthread={ thread }\n\t\t\t\t\t\t\tonAddReply={ onAddReply }\n\t\t\t\t\t\t\tonCommentDelete={ onCommentDelete }\n\t\t\t\t\t\t\tonCommentResolve={ onCommentResolve }\n\t\t\t\t\t\t\tonCommentReopen={ onCommentReopen }\n\t\t\t\t\t\t\tonEditComment={ onEditComment }\n\t\t\t\t\t\t\tisFocused={ focusThread === thread.id }\n\t\t\t\t\t\t\tclearThreadFocus={ clearThreadFocus }\n\t\t\t\t\t\t\tsetFocusThread={ setFocusThread }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\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} ) {\n\treturn (\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</>\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":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SACCC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,2BAA2B,IAAIC,aAAa,EAC5CC,MAAM,EACNC,YAAY,QACN,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,YAAY,QAAQ,kBAAkB;AAC1D,SAASC,EAAE,EAAEC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACrD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,OAAOC,WAAW,MAAM,gBAAgB;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAbA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAcA,OAAO,SAASC,QAAQA,CAAE;EACzBC,OAAO;EACPC,aAAa;EACbC,UAAU;EACVC,eAAe;EACfC,gBAAgB;EAChBC,eAAe;EACfC,gBAAgB;EAChBC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC;EAAe,CAAC,GAAGpB,SAAS,CAAIqB,MAAM,IAAM;IACnD,MAAM;MAAEC,kBAAkB;MAAEC;IAAyB,CAAC,GACrDF,MAAM,CAAEnB,gBAAiB,C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","RawHTML","useEffect","useMemo","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalConfirmDialog","ConfirmDialog","Button","DropdownMenu","published","moreVertical","__","_x","sprintf","_n","useSelect","useDispatch","store","blockEditorStore","privateApis","blockEditorPrivateApis","unlock","CommentAuthorInfo","CommentForm","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useBlockElement","findBlockByCommentId","commentId","blockList","block","attributes","blockCommentId","clientId","innerBlocks","found","Comments","threads","onEditComment","onAddReply","onCommentDelete","onCommentResolve","onCommentReopen","showCommentBoard","setShowCommentBoard","blocks","select","getBlockAttributes","getSelectedBlockClientId","getBlocks","_clientId","flashBlock","clearThreadFocus","setFocusThread","focusThread","children","Array","isArray","length","alignment","className","justify","spacing","map","thread","Thread","isFocused","id","relatedBlock","relatedBlockElement","handleCommentSelect","threadId","scrollIntoView","behavior","onClick","CommentBoard","onResolve","onReopen","onEdit","onDelete","status","reply","__next40pxDefaultSize","variant","onSubmit","inputComment","onCancel","event","stopPropagation","placeholderText","submitButtonText","rows","actionState","setActionState","showConfirmDialog","setShowConfirmDialog","handleConfirmDelete","handleCancel","actions","title","moreActions","filter","item","avatar","author_avatar_urls","name","author_name","date","parent","label","size","icon","disabled","accessibleWhenDisabled","controls","value","content","rendered","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":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,EAAEC,OAAO,QAAQ,oBAAoB;AAC1E,SACCC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,2BAA2B,IAAIC,aAAa,EAC5CC,MAAM,EACNC,YAAY,QACN,uBAAuB;AAE9B,SAASC,SAAS,EAAEC,YAAY,QAAQ,kBAAkB;AAC1D,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AACrD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;;AAEhC;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,OAAOC,WAAW,MAAM,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEzC,MAAM;EAAEC;AAAgB,CAAC,GAAGT,MAAM,CAAED,sBAAuB,CAAC;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMW,oBAAoB,GAAGA,CAAEC,SAAS,EAAEC,S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AGlF,EAAE,CAAE,QAAQ,EAAE,MAAO;IAAG,CAC3C,CAAC,gBAEFa,IAAA,CAAC3B,OAAO;MAACkE,SAAS,EAAC,2CAA2C;MAAAL,QAAA,EAC3DS,MAAM,EAAEoD,OAAO,EAAEC;IAAQ,CACnB,CACT,EACC,QAAQ,KAAKzB,WAAW,iBACzBvE,IAAA,CAACnB,aAAa;MACboH,MAAM,EAAGxB,iBAAmB;MAC5ByB,SAAS,EAAGvB,mBAAqB;MACjCV,QAAQ,EAAGW,YAAc;MACzBuB,iBAAiB,EAAGjH,EAAE,CAAE,QAAS,CAAG;MAAAgD,QAAA;MAGnC;MACAhD,EAAE,CAAE,+CAAgD;IAAC,CAExC,CACf;EAAA,CACA,CAAC;AAEL,CAAC","ignoreList":[]}
|
|
@@ -333,6 +333,7 @@ export default function CollabSidebar() {
|
|
|
333
333
|
,
|
|
334
334
|
title: __('Comments'),
|
|
335
335
|
icon: commentIcon,
|
|
336
|
+
closeLabel: __('Close Comments'),
|
|
336
337
|
children: /*#__PURE__*/_jsx(CollabSidebarContent, {
|
|
337
338
|
comments: resultComments,
|
|
338
339
|
showCommentBoard: showCommentBoard,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useSelect","useDispatch","resolveSelect","subscribe","useState","useMemo","comment","commentIcon","addFilter","store","noticesStore","coreStore","useEntityBlockEditor","useEntityRecords","blockEditorStore","interfaceStore","PluginSidebar","collabHistorySidebarName","collabSidebarName","Comments","AddComment","editorStore","AddCommentButton","CommentAvatarIndicator","useGlobalStylesContext","getCommentIdsFromBlocks","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","modifyBlockCommentAttributes","settings","attributes","blockCommentId","type","CollabSidebarContent","showCommentBoard","setShowCommentBoard","styles","comments","createNotice","saveEntityRecord","deleteEntityRecord","getEntityRecord","postId","select","getCurrentPostId","_postId","getSelectedBlockClientId","updateBlockAttributes","onError","error","errorMessage","message","code","isDismissible","addNewComment","parentCommentId","savedRecord","post","content","comment_type","comment_approved","parent","throwOnError","id","onCommentResolve","commentId","status","onCommentReopen","onEditComment","onCommentDelete","childComment","undefined","className","style","children","onSubmit","threads","onAddReply","CollabSidebar","enableComplementaryArea","getActiveComplementaryArea","postType","getCurrentPostType","queryArgs","per_page","records","totalPages","enabled","hasMoreComments","getBlockAttributes","_clientId","openCollabBoard","blocks","resultComments","unresolvedSortedThreads","compare","result","allComments","forEach","item","reply","push","length","updatedResult","map","reverse","blockCommentIds","threadIdMap","Map","thread","unresolvedSortedComments","get","filter","merged","GlobalStyles","backgroundColor","color","background","unsubscribe","activeSidebar","AddCommentComponent","currentThread","find","onClick","identifier","title","icon","isPinnable","header","headerClassName"],"sources":["@wordpress/editor/src/components/collab-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseSelect,\n\tuseDispatch,\n\tresolveSelect,\n\tsubscribe,\n} from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { comment as commentIcon } from '@wordpress/icons';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as noticesStore } from '@wordpress/notices';\nimport {\n\tstore as coreStore,\n\tuseEntityBlockEditor,\n\tuseEntityRecords,\n} from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport PluginSidebar from '../plugin-sidebar';\nimport { collabHistorySidebarName, collabSidebarName } from './constants';\nimport { Comments } from './comments';\nimport { AddComment } from './add-comment';\nimport { store as editorStore } from '../../store';\nimport AddCommentButton from './comment-button';\nimport CommentAvatarIndicator from './comment-indicator-toolbar';\nimport { useGlobalStylesContext } from '../global-styles-provider';\nimport { getCommentIdsFromBlocks } from './utils';\n\nconst modifyBlockCommentAttributes = ( settings ) => {\n\tif ( ! settings.attributes.blockCommentId ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tblockCommentId: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n};\n\n// Apply the filter to all core blocks\naddFilter(\n\t'blocks.registerBlockType',\n\t'block-comment/modify-core-block-attributes',\n\tmodifyBlockCommentAttributes\n);\n\nfunction CollabSidebarContent( {\n\tshowCommentBoard,\n\tsetShowCommentBoard,\n\tstyles,\n\tcomments,\n} ) {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord, deleteEntityRecord } = useDispatch( coreStore );\n\tconst { getEntityRecord } = resolveSelect( coreStore );\n\n\tconst { postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId } = select( editorStore );\n\t\tconst _postId = getCurrentPostId();\n\n\t\treturn {\n\t\t\tpostId: _postId,\n\t\t};\n\t}, [] );\n\n\tconst { getSelectedBlockClientId } = useSelect( blockEditorStore );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst onError = ( error ) => {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'An error occurred while performing an update.' );\n\t\tcreateNotice( 'error', errorMessage, {\n\t\t\ttype: 'snackbar',\n\t\t\tisDismissible: true,\n\t\t} );\n\t};\n\n\tconst addNewComment = async ( comment, parentCommentId ) => {\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\t{\n\t\t\t\t\tpost: postId,\n\t\t\t\t\tcontent: comment,\n\t\t\t\t\tcomment_type: 'block_comment',\n\t\t\t\t\tcomment_approved: 0,\n\t\t\t\t\t...( parentCommentId ? { parent: parentCommentId } : {} ),\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// If it's a main comment, update the block attributes with the comment id.\n\t\t\tif ( ! parentCommentId && savedRecord?.id ) {\n\t\t\t\tupdateBlockAttributes( getSelectedBlockClientId(), {\n\t\t\t\t\tblockCommentId: savedRecord.id,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice(\n\t\t\t\t'snackbar',\n\t\t\t\tparentCommentId\n\t\t\t\t\t? __( 'Reply added successfully.' )\n\t\t\t\t\t: __( 'Comment added successfully.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onCommentResolve = async ( commentId ) => {\n\t\ttry {\n\t\t\tawait saveEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\t{\n\t\t\t\t\tid: commentId,\n\t\t\t\t\tstatus: 'approved',\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tcreateNotice( 'snackbar', __( 'Comment marked as resolved.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onCommentReopen = async ( commentId ) => {\n\t\ttry {\n\t\t\tawait saveEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\t{\n\t\t\t\t\tid: commentId,\n\t\t\t\t\tstatus: 'hold',\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tcreateNotice( 'snackbar', __( 'Comment reopened.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onEditComment = async ( commentId, comment ) => {\n\t\ttry {\n\t\t\tawait saveEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\t{\n\t\t\t\t\tid: commentId,\n\t\t\t\t\tcontent: comment,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tcreateNotice( 'snackbar', __( 'Comment edited successfully.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onCommentDelete = async ( commentId ) => {\n\t\ttry {\n\t\t\tconst childComment = await getEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\tcommentId\n\t\t\t);\n\t\t\tawait deleteEntityRecord( 'root', 'comment', commentId, undefined, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\n\t\t\tif ( childComment && ! childComment.parent ) {\n\t\t\t\tupdateBlockAttributes( getSelectedBlockClientId(), {\n\t\t\t\t\tblockCommentId: undefined,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice( 'snackbar', __( 'Comment deleted successfully.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"editor-collab-sidebar-panel\" style={ styles }>\n\t\t\t<AddComment\n\t\t\t\tonSubmit={ addNewComment }\n\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t/>\n\t\t\t<Comments\n\t\t\t\tkey={ getSelectedBlockClientId() }\n\t\t\t\tthreads={ comments }\n\t\t\t\tonEditComment={ onEditComment }\n\t\t\t\tonAddReply={ addNewComment }\n\t\t\t\tonCommentDelete={ onCommentDelete }\n\t\t\t\tonCommentResolve={ onCommentResolve }\n\t\t\t\tonCommentReopen={ onCommentReopen }\n\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\n/**\n * Renders the Collab sidebar.\n */\nexport default function CollabSidebar() {\n\tconst [ showCommentBoard, setShowCommentBoard ] = useState( false );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\n\tconst { postId, postType } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tconst queryArgs = {\n\t\tpost: postId,\n\t\ttype: 'block_comment',\n\t\tstatus: 'all',\n\t\tper_page: 100,\n\t};\n\n\tconst { records: threads, totalPages } = useEntityRecords(\n\t\t'root',\n\t\t'comment',\n\t\tqueryArgs,\n\t\t{ enabled: !! postId && typeof postId === 'number' }\n\t);\n\n\tconst hasMoreComments = totalPages && totalPages > 1;\n\n\tconst { blockCommentId } = useSelect( ( select ) => {\n\t\tconst { getBlockAttributes, getSelectedBlockClientId } =\n\t\t\tselect( blockEditorStore );\n\t\tconst _clientId = getSelectedBlockClientId();\n\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};\n\t}, [] );\n\n\tconst openCollabBoard = () => {\n\t\tsetShowCommentBoard( true );\n\t\tenableComplementaryArea( 'core', collabHistorySidebarName );\n\t};\n\n\tconst [ blocks ] = useEntityBlockEditor( 'postType', postType, {\n\t\tid: postId,\n\t} );\n\n\t// Process comments to build the tree structure.\n\tconst { resultComments, unresolvedSortedThreads } = useMemo( () => {\n\t\t// Create a compare to store the references to all objects by id.\n\t\tconst compare = {};\n\t\tconst result = [];\n\n\t\tconst allComments = threads ?? [];\n\n\t\t// Initialize each object with an empty `reply` array.\n\t\tallComments.forEach( ( item ) => {\n\t\t\tcompare[ item.id ] = { ...item, reply: [] };\n\t\t} );\n\n\t\t// Iterate over the data to build the tree structure.\n\t\tallComments.forEach( ( item ) => {\n\t\t\tif ( item.parent === 0 ) {\n\t\t\t\t// If parent is 0, it's a root item, push it to the result array.\n\t\t\t\tresult.push( compare[ item.id ] );\n\t\t\t} else if ( compare[ item.parent ] ) {\n\t\t\t\t// Otherwise, find its parent and push it to the parent's `reply` array.\n\t\t\t\tcompare[ item.parent ].reply.push( compare[ item.id ] );\n\t\t\t}\n\t\t} );\n\n\t\tif ( 0 === result?.length ) {\n\t\t\treturn { resultComments: [], unresolvedSortedThreads: [] };\n\t\t}\n\n\t\tconst updatedResult = result.map( ( item ) => ( {\n\t\t\t...item,\n\t\t\treply: [ ...item.reply ].reverse(),\n\t\t} ) );\n\n\t\tconst blockCommentIds = getCommentIdsFromBlocks( blocks );\n\n\t\tconst threadIdMap = new Map(\n\t\t\tupdatedResult.map( ( thread ) => [ thread.id, thread ] )\n\t\t);\n\n\t\t// Get comments by block order, filter out undefined threads, and exclude resolved comments.\n\t\tconst unresolvedSortedComments = blockCommentIds\n\t\t\t.map( ( id ) => threadIdMap.get( id ) )\n\t\t\t.filter(\n\t\t\t\t( thread ) =>\n\t\t\t\t\tthread !== undefined && thread.status !== 'approved'\n\t\t\t);\n\n\t\treturn {\n\t\t\tresultComments: updatedResult,\n\t\t\tunresolvedSortedThreads: unresolvedSortedComments,\n\t\t};\n\t}, [ threads, blocks ] );\n\n\t// Get the global styles to set the background color of the sidebar.\n\tconst { merged: GlobalStyles } = useGlobalStylesContext();\n\tconst backgroundColor = GlobalStyles?.styles?.color?.background;\n\n\tif ( 0 < resultComments.length ) {\n\t\tconst unsubscribe = subscribe( () => {\n\t\t\tconst activeSidebar = getActiveComplementaryArea( 'core' );\n\n\t\t\tif ( ! activeSidebar ) {\n\t\t\t\tenableComplementaryArea( 'core', collabSidebarName );\n\t\t\t\tunsubscribe();\n\t\t\t}\n\t\t} );\n\t}\n\n\tconst AddCommentComponent = blockCommentId\n\t\t? CommentAvatarIndicator\n\t\t: AddCommentButton;\n\n\t// Find the current thread for the selected block.\n\tconst currentThread = blockCommentId\n\t\t? resultComments.find( ( thread ) => thread.id === blockCommentId )\n\t\t: null;\n\n\t// If postId is not a valid number, do not render the comment sidebar.\n\tif ( ! ( !! postId && typeof postId === 'number' ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<AddCommentComponent\n\t\t\t\tonClick={ openCollabBoard }\n\t\t\t\tthread={ currentThread }\n\t\t\t\thasMoreComments={ hasMoreComments }\n\t\t\t/>\n\t\t\t<PluginSidebar\n\t\t\t\tidentifier={ collabHistorySidebarName }\n\t\t\t\t// translators: Comments sidebar title\n\t\t\t\ttitle={ __( 'Comments' ) }\n\t\t\t\ticon={ commentIcon }\n\t\t\t>\n\t\t\t\t<CollabSidebarContent\n\t\t\t\t\tcomments={ resultComments }\n\t\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\t/>\n\t\t\t</PluginSidebar>\n\t\t\t<PluginSidebar\n\t\t\t\tisPinnable={ false }\n\t\t\t\theader={ false }\n\t\t\t\tidentifier={ collabSidebarName }\n\t\t\t\tclassName=\"editor-collab-sidebar\"\n\t\t\t\theaderClassName=\"editor-collab-sidebar__header\"\n\t\t\t>\n\t\t\t\t<CollabSidebarContent\n\t\t\t\t\tcomments={ unresolvedSortedThreads }\n\t\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\t\tstyles={ {\n\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</PluginSidebar>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,SAAS,EACTC,WAAW,EACXC,aAAa,EACbC,SAAS,QACH,iBAAiB;AACxB,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,OAAO,IAAIC,WAAW,QAAQ,kBAAkB;AACzD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,KAAK,IAAIC,YAAY,QAAQ,oBAAoB;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AC,uBAAuB;MACjCyD,eAAe,EAAC,+BAA+B;MAAAvD,QAAA,eAE/CnD,IAAA,CAACU,oBAAoB;QACpBI,QAAQ,EAAGyD,uBAAyB;QACpC5D,gBAAgB,EAAGA,gBAAkB;QACrCC,mBAAmB,EAAGA,mBAAqB;QAC3CC,MAAM,EAAG;UACR+E;QACD;MAAG,CACH;IAAC,CACY,CAAC;EAAA,CACf,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","useSelect","useDispatch","resolveSelect","subscribe","useState","useMemo","comment","commentIcon","addFilter","store","noticesStore","coreStore","useEntityBlockEditor","useEntityRecords","blockEditorStore","interfaceStore","PluginSidebar","collabHistorySidebarName","collabSidebarName","Comments","AddComment","editorStore","AddCommentButton","CommentAvatarIndicator","useGlobalStylesContext","getCommentIdsFromBlocks","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","modifyBlockCommentAttributes","settings","attributes","blockCommentId","type","CollabSidebarContent","showCommentBoard","setShowCommentBoard","styles","comments","createNotice","saveEntityRecord","deleteEntityRecord","getEntityRecord","postId","select","getCurrentPostId","_postId","getSelectedBlockClientId","updateBlockAttributes","onError","error","errorMessage","message","code","isDismissible","addNewComment","parentCommentId","savedRecord","post","content","comment_type","comment_approved","parent","throwOnError","id","onCommentResolve","commentId","status","onCommentReopen","onEditComment","onCommentDelete","childComment","undefined","className","style","children","onSubmit","threads","onAddReply","CollabSidebar","enableComplementaryArea","getActiveComplementaryArea","postType","getCurrentPostType","queryArgs","per_page","records","totalPages","enabled","hasMoreComments","getBlockAttributes","_clientId","openCollabBoard","blocks","resultComments","unresolvedSortedThreads","compare","result","allComments","forEach","item","reply","push","length","updatedResult","map","reverse","blockCommentIds","threadIdMap","Map","thread","unresolvedSortedComments","get","filter","merged","GlobalStyles","backgroundColor","color","background","unsubscribe","activeSidebar","AddCommentComponent","currentThread","find","onClick","identifier","title","icon","closeLabel","isPinnable","header","headerClassName"],"sources":["@wordpress/editor/src/components/collab-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseSelect,\n\tuseDispatch,\n\tresolveSelect,\n\tsubscribe,\n} from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { comment as commentIcon } from '@wordpress/icons';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as noticesStore } from '@wordpress/notices';\nimport {\n\tstore as coreStore,\n\tuseEntityBlockEditor,\n\tuseEntityRecords,\n} from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport PluginSidebar from '../plugin-sidebar';\nimport { collabHistorySidebarName, collabSidebarName } from './constants';\nimport { Comments } from './comments';\nimport { AddComment } from './add-comment';\nimport { store as editorStore } from '../../store';\nimport AddCommentButton from './comment-button';\nimport CommentAvatarIndicator from './comment-indicator-toolbar';\nimport { useGlobalStylesContext } from '../global-styles-provider';\nimport { getCommentIdsFromBlocks } from './utils';\n\nconst modifyBlockCommentAttributes = ( settings ) => {\n\tif ( ! settings.attributes.blockCommentId ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tblockCommentId: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n};\n\n// Apply the filter to all core blocks\naddFilter(\n\t'blocks.registerBlockType',\n\t'block-comment/modify-core-block-attributes',\n\tmodifyBlockCommentAttributes\n);\n\nfunction CollabSidebarContent( {\n\tshowCommentBoard,\n\tsetShowCommentBoard,\n\tstyles,\n\tcomments,\n} ) {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord, deleteEntityRecord } = useDispatch( coreStore );\n\tconst { getEntityRecord } = resolveSelect( coreStore );\n\n\tconst { postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId } = select( editorStore );\n\t\tconst _postId = getCurrentPostId();\n\n\t\treturn {\n\t\t\tpostId: _postId,\n\t\t};\n\t}, [] );\n\n\tconst { getSelectedBlockClientId } = useSelect( blockEditorStore );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst onError = ( error ) => {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'An error occurred while performing an update.' );\n\t\tcreateNotice( 'error', errorMessage, {\n\t\t\ttype: 'snackbar',\n\t\t\tisDismissible: true,\n\t\t} );\n\t};\n\n\tconst addNewComment = async ( comment, parentCommentId ) => {\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\t{\n\t\t\t\t\tpost: postId,\n\t\t\t\t\tcontent: comment,\n\t\t\t\t\tcomment_type: 'block_comment',\n\t\t\t\t\tcomment_approved: 0,\n\t\t\t\t\t...( parentCommentId ? { parent: parentCommentId } : {} ),\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// If it's a main comment, update the block attributes with the comment id.\n\t\t\tif ( ! parentCommentId && savedRecord?.id ) {\n\t\t\t\tupdateBlockAttributes( getSelectedBlockClientId(), {\n\t\t\t\t\tblockCommentId: savedRecord.id,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice(\n\t\t\t\t'snackbar',\n\t\t\t\tparentCommentId\n\t\t\t\t\t? __( 'Reply added successfully.' )\n\t\t\t\t\t: __( 'Comment added successfully.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onCommentResolve = async ( commentId ) => {\n\t\ttry {\n\t\t\tawait saveEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\t{\n\t\t\t\t\tid: commentId,\n\t\t\t\t\tstatus: 'approved',\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tcreateNotice( 'snackbar', __( 'Comment marked as resolved.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onCommentReopen = async ( commentId ) => {\n\t\ttry {\n\t\t\tawait saveEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\t{\n\t\t\t\t\tid: commentId,\n\t\t\t\t\tstatus: 'hold',\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tcreateNotice( 'snackbar', __( 'Comment reopened.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onEditComment = async ( commentId, comment ) => {\n\t\ttry {\n\t\t\tawait saveEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\t{\n\t\t\t\t\tid: commentId,\n\t\t\t\t\tcontent: comment,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tcreateNotice( 'snackbar', __( 'Comment edited successfully.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onCommentDelete = async ( commentId ) => {\n\t\ttry {\n\t\t\tconst childComment = await getEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\tcommentId\n\t\t\t);\n\t\t\tawait deleteEntityRecord( 'root', 'comment', commentId, undefined, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\n\t\t\tif ( childComment && ! childComment.parent ) {\n\t\t\t\tupdateBlockAttributes( getSelectedBlockClientId(), {\n\t\t\t\t\tblockCommentId: undefined,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice( 'snackbar', __( 'Comment deleted successfully.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"editor-collab-sidebar-panel\" style={ styles }>\n\t\t\t<AddComment\n\t\t\t\tonSubmit={ addNewComment }\n\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t/>\n\t\t\t<Comments\n\t\t\t\tkey={ getSelectedBlockClientId() }\n\t\t\t\tthreads={ comments }\n\t\t\t\tonEditComment={ onEditComment }\n\t\t\t\tonAddReply={ addNewComment }\n\t\t\t\tonCommentDelete={ onCommentDelete }\n\t\t\t\tonCommentResolve={ onCommentResolve }\n\t\t\t\tonCommentReopen={ onCommentReopen }\n\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\n/**\n * Renders the Collab sidebar.\n */\nexport default function CollabSidebar() {\n\tconst [ showCommentBoard, setShowCommentBoard ] = useState( false );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\n\tconst { postId, postType } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tconst queryArgs = {\n\t\tpost: postId,\n\t\ttype: 'block_comment',\n\t\tstatus: 'all',\n\t\tper_page: 100,\n\t};\n\n\tconst { records: threads, totalPages } = useEntityRecords(\n\t\t'root',\n\t\t'comment',\n\t\tqueryArgs,\n\t\t{ enabled: !! postId && typeof postId === 'number' }\n\t);\n\n\tconst hasMoreComments = totalPages && totalPages > 1;\n\n\tconst { blockCommentId } = useSelect( ( select ) => {\n\t\tconst { getBlockAttributes, getSelectedBlockClientId } =\n\t\t\tselect( blockEditorStore );\n\t\tconst _clientId = getSelectedBlockClientId();\n\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};\n\t}, [] );\n\n\tconst openCollabBoard = () => {\n\t\tsetShowCommentBoard( true );\n\t\tenableComplementaryArea( 'core', collabHistorySidebarName );\n\t};\n\n\tconst [ blocks ] = useEntityBlockEditor( 'postType', postType, {\n\t\tid: postId,\n\t} );\n\n\t// Process comments to build the tree structure.\n\tconst { resultComments, unresolvedSortedThreads } = useMemo( () => {\n\t\t// Create a compare to store the references to all objects by id.\n\t\tconst compare = {};\n\t\tconst result = [];\n\n\t\tconst allComments = threads ?? [];\n\n\t\t// Initialize each object with an empty `reply` array.\n\t\tallComments.forEach( ( item ) => {\n\t\t\tcompare[ item.id ] = { ...item, reply: [] };\n\t\t} );\n\n\t\t// Iterate over the data to build the tree structure.\n\t\tallComments.forEach( ( item ) => {\n\t\t\tif ( item.parent === 0 ) {\n\t\t\t\t// If parent is 0, it's a root item, push it to the result array.\n\t\t\t\tresult.push( compare[ item.id ] );\n\t\t\t} else if ( compare[ item.parent ] ) {\n\t\t\t\t// Otherwise, find its parent and push it to the parent's `reply` array.\n\t\t\t\tcompare[ item.parent ].reply.push( compare[ item.id ] );\n\t\t\t}\n\t\t} );\n\n\t\tif ( 0 === result?.length ) {\n\t\t\treturn { resultComments: [], unresolvedSortedThreads: [] };\n\t\t}\n\n\t\tconst updatedResult = result.map( ( item ) => ( {\n\t\t\t...item,\n\t\t\treply: [ ...item.reply ].reverse(),\n\t\t} ) );\n\n\t\tconst blockCommentIds = getCommentIdsFromBlocks( blocks );\n\n\t\tconst threadIdMap = new Map(\n\t\t\tupdatedResult.map( ( thread ) => [ thread.id, thread ] )\n\t\t);\n\n\t\t// Get comments by block order, filter out undefined threads, and exclude resolved comments.\n\t\tconst unresolvedSortedComments = blockCommentIds\n\t\t\t.map( ( id ) => threadIdMap.get( id ) )\n\t\t\t.filter(\n\t\t\t\t( thread ) =>\n\t\t\t\t\tthread !== undefined && thread.status !== 'approved'\n\t\t\t);\n\n\t\treturn {\n\t\t\tresultComments: updatedResult,\n\t\t\tunresolvedSortedThreads: unresolvedSortedComments,\n\t\t};\n\t}, [ threads, blocks ] );\n\n\t// Get the global styles to set the background color of the sidebar.\n\tconst { merged: GlobalStyles } = useGlobalStylesContext();\n\tconst backgroundColor = GlobalStyles?.styles?.color?.background;\n\n\tif ( 0 < resultComments.length ) {\n\t\tconst unsubscribe = subscribe( () => {\n\t\t\tconst activeSidebar = getActiveComplementaryArea( 'core' );\n\n\t\t\tif ( ! activeSidebar ) {\n\t\t\t\tenableComplementaryArea( 'core', collabSidebarName );\n\t\t\t\tunsubscribe();\n\t\t\t}\n\t\t} );\n\t}\n\n\tconst AddCommentComponent = blockCommentId\n\t\t? CommentAvatarIndicator\n\t\t: AddCommentButton;\n\n\t// Find the current thread for the selected block.\n\tconst currentThread = blockCommentId\n\t\t? resultComments.find( ( thread ) => thread.id === blockCommentId )\n\t\t: null;\n\n\t// If postId is not a valid number, do not render the comment sidebar.\n\tif ( ! ( !! postId && typeof postId === 'number' ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<AddCommentComponent\n\t\t\t\tonClick={ openCollabBoard }\n\t\t\t\tthread={ currentThread }\n\t\t\t\thasMoreComments={ hasMoreComments }\n\t\t\t/>\n\t\t\t<PluginSidebar\n\t\t\t\tidentifier={ collabHistorySidebarName }\n\t\t\t\t// translators: Comments sidebar title\n\t\t\t\ttitle={ __( 'Comments' ) }\n\t\t\t\ticon={ commentIcon }\n\t\t\t\tcloseLabel={ __( 'Close Comments' ) }\n\t\t\t>\n\t\t\t\t<CollabSidebarContent\n\t\t\t\t\tcomments={ resultComments }\n\t\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\t/>\n\t\t\t</PluginSidebar>\n\t\t\t<PluginSidebar\n\t\t\t\tisPinnable={ false }\n\t\t\t\theader={ false }\n\t\t\t\tidentifier={ collabSidebarName }\n\t\t\t\tclassName=\"editor-collab-sidebar\"\n\t\t\t\theaderClassName=\"editor-collab-sidebar__header\"\n\t\t\t>\n\t\t\t\t<CollabSidebarContent\n\t\t\t\t\tcomments={ unresolvedSortedThreads }\n\t\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\t\tstyles={ {\n\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</PluginSidebar>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,SAAS,EACTC,WAAW,EACXC,aAAa,EACbC,SAAS,QACH,iBAAiB;AACxB,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,OAAO,IAAIC,WAAW,QAAQ,kBAAkB;AACzD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,KAAK,IAAIC,YAAY,QAAQ,oBAAoB;AAC1D,SACCD,KAAK,IAAIE,SAAS,EAClBC,oBAAoB,EACpBC,gBAAgB,QACV,sBAAsB;AAC7B,SAASJ,KAAK,IAAIK,gBAAgB,QAAQ,yBAAyB;AACnE,SAASL,KAAK,IAAIM,cAAc,QAAQ,sBAAsB;;AAE9D;AACA;AACA;AACA,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,SAASC,wBAAwB,EAAEC,iBAAiB,QAAQ,aAAa;AACzE,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASX,KAAK,IAAIY,WAAW,QAAQ,aAAa;AAClD,OAAOC,gBAAgB,MAAM,kBAAkB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
|
import { store as editorStore } from '../../store';
|
|
11
|
+
function checkSupport(supports = {}, key) {
|
|
12
|
+
// Check for top-level support keys.
|
|
13
|
+
if (supports[key] !== undefined) {
|
|
14
|
+
return !!supports[key];
|
|
15
|
+
}
|
|
16
|
+
const [topKey, subKey] = key.split('.');
|
|
17
|
+
// Try to unwrap sub-properties from the superfluous array.
|
|
18
|
+
const [subProperties] = Array.isArray(supports[topKey]) ? supports[topKey] : [];
|
|
19
|
+
return Array.isArray(subProperties) ? subProperties.includes(subKey) : !!subProperties?.[subKey];
|
|
20
|
+
}
|
|
11
21
|
|
|
12
22
|
/**
|
|
13
23
|
* A component which renders its own children only if the current editor post
|
|
@@ -36,7 +46,7 @@ function PostTypeSupportCheck({
|
|
|
36
46
|
}, []);
|
|
37
47
|
let isSupported = !!postType;
|
|
38
48
|
if (postType) {
|
|
39
|
-
isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key =>
|
|
49
|
+
isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => checkSupport(postType.supports, key));
|
|
40
50
|
}
|
|
41
51
|
if (!isSupported) {
|
|
42
52
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","store","coreStore","editorStore","
|
|
1
|
+
{"version":3,"names":["useSelect","store","coreStore","editorStore","checkSupport","supports","key","undefined","topKey","subKey","split","subProperties","Array","isArray","includes","PostTypeSupportCheck","children","supportKeys","postType","select","getEditedPostAttribute","getPostType","isSupported","some"],"sources":["@wordpress/editor/src/components/post-type-support-check/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction checkSupport( supports = {}, key ) {\n\t// Check for top-level support keys.\n\tif ( supports[ key ] !== undefined ) {\n\t\treturn !! supports[ key ];\n\t}\n\n\tconst [ topKey, subKey ] = key.split( '.' );\n\t// Try to unwrap sub-properties from the superfluous array.\n\tconst [ subProperties ] = Array.isArray( supports[ topKey ] )\n\t\t? supports[ topKey ]\n\t\t: [];\n\n\treturn Array.isArray( subProperties )\n\t\t? subProperties.includes( subKey )\n\t\t: !! subProperties?.[ subKey ];\n}\n\n/**\n * A component which renders its own children only if the current editor post\n * type supports one of the given `supportKeys` prop.\n *\n * @param {Object} props Props.\n * @param {React.ReactNode} props.children Children to be rendered if post\n * type supports.\n * @param {(string|string[])} props.supportKeys String or string array of keys\n * to test.\n *\n * @return {React.ReactNode} The component to be rendered.\n */\nfunction PostTypeSupportCheck( { children, supportKeys } ) {\n\tconst postType = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn getPostType( getEditedPostAttribute( 'type' ) );\n\t}, [] );\n\tlet isSupported = !! postType;\n\tif ( postType ) {\n\t\tisSupported = (\n\t\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t\t).some( ( key ) => checkSupport( postType.supports, key ) );\n\t}\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default PostTypeSupportCheck;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAElD,SAASC,YAAYA,CAAEC,QAAQ,GAAG,CAAC,CAAC,EAAEC,GAAG,EAAG;EAC3C;EACA,IAAKD,QAAQ,CAAEC,GAAG,CAAE,KAAKC,SAAS,EAAG;IACpC,OAAO,CAAC,CAAEF,QAAQ,CAAEC,GAAG,CAAE;EAC1B;EAEA,MAAM,CAAEE,MAAM,EAAEC,MAAM,CAAE,GAAGH,GAAG,CAACI,KAAK,CAAE,GAAI,CAAC;EAC3C;EACA,MAAM,CAAEC,aAAa,CAAE,GAAGC,KAAK,CAACC,OAAO,CAAER,QAAQ,CAAEG,MAAM,CAAG,CAAC,GAC1DH,QAAQ,CAAEG,MAAM,CAAE,GAClB,EAAE;EAEL,OAAOI,KAAK,CAACC,OAAO,CAAEF,aAAc,CAAC,GAClCA,aAAa,CAACG,QAAQ,CAAEL,MAAO,CAAC,GAChC,CAAC,CAAEE,aAAa,GAAIF,MAAM,CAAE;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASM,oBAAoBA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EAC1D,MAAMC,QAAQ,GAAGlB,SAAS,CAAImB,MAAM,IAAM;IACzC,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAEhB,WAAY,CAAC;IACxD,MAAM;MAAEkB;IAAY,CAAC,GAAGF,MAAM,CAAEjB,SAAU,CAAC;IAC3C,OAAOmB,WAAW,CAAED,sBAAsB,CAAE,MAAO,CAAE,CAAC;EACvD,CAAC,EAAE,EAAG,CAAC;EACP,IAAIE,WAAW,GAAG,CAAC,CAAEJ,QAAQ;EAC7B,IAAKA,QAAQ,EAAG;IACfI,WAAW,GAAG,CACbV,KAAK,CAACC,OAAO,CAAEI,WAAY,CAAC,GAAGA,WAAW,GAAG,CAAEA,WAAW,CAAE,EAC3DM,IAAI,CAAIjB,GAAG,IAAMF,YAAY,CAAEc,QAAQ,CAACb,QAAQ,EAAEC,GAAI,CAAE,CAAC;EAC5D;EAEA,IAAK,CAAEgB,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OAAON,QAAQ;AAChB;AAEA,eAAeD,oBAAoB","ignoreList":[]}
|
|
@@ -614,6 +614,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
614
614
|
padding: 16px;
|
|
615
615
|
height: 100%;
|
|
616
616
|
}
|
|
617
|
+
|
|
617
618
|
.editor-collab-sidebar-panel__thread {
|
|
618
619
|
position: relative;
|
|
619
620
|
padding: 16px;
|
|
@@ -622,14 +623,17 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
622
623
|
background-color: #f0f0f0;
|
|
623
624
|
margin-bottom: 16px;
|
|
624
625
|
}
|
|
626
|
+
|
|
625
627
|
.editor-collab-sidebar-panel__active-thread {
|
|
626
628
|
border: 1.5px solid #3858e9;
|
|
627
629
|
}
|
|
630
|
+
|
|
628
631
|
.editor-collab-sidebar-panel__focus-thread {
|
|
629
632
|
border: 1.5px solid #3858e9;
|
|
630
633
|
background-color: #fff;
|
|
631
634
|
box-shadow: 0 5.5px 7.8px -0.3px rgba(0, 0, 0, 0.102);
|
|
632
635
|
}
|
|
636
|
+
|
|
633
637
|
.editor-collab-sidebar-panel__comment-field {
|
|
634
638
|
flex: 1;
|
|
635
639
|
}
|
|
@@ -637,9 +641,11 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
637
641
|
flex-grow: 1;
|
|
638
642
|
justify-content: center;
|
|
639
643
|
}
|
|
644
|
+
|
|
640
645
|
.editor-collab-sidebar-panel__child-thread {
|
|
641
646
|
margin-top: 15px;
|
|
642
647
|
}
|
|
648
|
+
|
|
643
649
|
.editor-collab-sidebar-panel__user-name {
|
|
644
650
|
font-size: 12px;
|
|
645
651
|
font-weight: 400;
|
|
@@ -648,6 +654,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
648
654
|
color: #757575;
|
|
649
655
|
text-transform: capitalize;
|
|
650
656
|
}
|
|
657
|
+
|
|
651
658
|
.editor-collab-sidebar-panel__user-time {
|
|
652
659
|
font-size: 12px;
|
|
653
660
|
font-weight: 400;
|
|
@@ -655,13 +662,16 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
655
662
|
text-align: right;
|
|
656
663
|
color: #757575;
|
|
657
664
|
}
|
|
665
|
+
|
|
658
666
|
.editor-collab-sidebar-panel__user-comment p:last-child {
|
|
659
667
|
margin-bottom: 0;
|
|
660
668
|
}
|
|
669
|
+
|
|
661
670
|
.editor-collab-sidebar-panel__user-avatar {
|
|
662
671
|
border-radius: 50%;
|
|
663
672
|
flex-shrink: 0;
|
|
664
673
|
}
|
|
674
|
+
|
|
665
675
|
.editor-collab-sidebar-panel__thread-overlay {
|
|
666
676
|
background-color: rgba(0, 0, 0, 0.7);
|
|
667
677
|
width: 100%;
|
|
@@ -682,6 +692,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
682
692
|
padding: 4px 10px;
|
|
683
693
|
color: #fff;
|
|
684
694
|
}
|
|
695
|
+
|
|
685
696
|
.editor-collab-sidebar-panel__comment-status {
|
|
686
697
|
margin-right: auto;
|
|
687
698
|
}
|
|
@@ -692,9 +703,11 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
692
703
|
height: 24px;
|
|
693
704
|
flex-shrink: 0;
|
|
694
705
|
}
|
|
706
|
+
|
|
695
707
|
.editor-collab-sidebar-panel__comment-dropdown-menu {
|
|
696
708
|
flex-shrink: 0;
|
|
697
709
|
}
|
|
710
|
+
|
|
698
711
|
.editor-collab-sidebar-panel__show-more-reply {
|
|
699
712
|
font-weight: 500;
|
|
700
713
|
font-style: italic;
|
package/build-style/style.css
CHANGED
|
@@ -614,6 +614,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
614
614
|
padding: 16px;
|
|
615
615
|
height: 100%;
|
|
616
616
|
}
|
|
617
|
+
|
|
617
618
|
.editor-collab-sidebar-panel__thread {
|
|
618
619
|
position: relative;
|
|
619
620
|
padding: 16px;
|
|
@@ -622,14 +623,17 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
622
623
|
background-color: #f0f0f0;
|
|
623
624
|
margin-bottom: 16px;
|
|
624
625
|
}
|
|
626
|
+
|
|
625
627
|
.editor-collab-sidebar-panel__active-thread {
|
|
626
628
|
border: 1.5px solid #3858e9;
|
|
627
629
|
}
|
|
630
|
+
|
|
628
631
|
.editor-collab-sidebar-panel__focus-thread {
|
|
629
632
|
border: 1.5px solid #3858e9;
|
|
630
633
|
background-color: #fff;
|
|
631
634
|
box-shadow: 0 5.5px 7.8px -0.3px rgba(0, 0, 0, 0.102);
|
|
632
635
|
}
|
|
636
|
+
|
|
633
637
|
.editor-collab-sidebar-panel__comment-field {
|
|
634
638
|
flex: 1;
|
|
635
639
|
}
|
|
@@ -637,9 +641,11 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
637
641
|
flex-grow: 1;
|
|
638
642
|
justify-content: center;
|
|
639
643
|
}
|
|
644
|
+
|
|
640
645
|
.editor-collab-sidebar-panel__child-thread {
|
|
641
646
|
margin-top: 15px;
|
|
642
647
|
}
|
|
648
|
+
|
|
643
649
|
.editor-collab-sidebar-panel__user-name {
|
|
644
650
|
font-size: 12px;
|
|
645
651
|
font-weight: 400;
|
|
@@ -648,6 +654,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
648
654
|
color: #757575;
|
|
649
655
|
text-transform: capitalize;
|
|
650
656
|
}
|
|
657
|
+
|
|
651
658
|
.editor-collab-sidebar-panel__user-time {
|
|
652
659
|
font-size: 12px;
|
|
653
660
|
font-weight: 400;
|
|
@@ -655,13 +662,16 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
655
662
|
text-align: left;
|
|
656
663
|
color: #757575;
|
|
657
664
|
}
|
|
665
|
+
|
|
658
666
|
.editor-collab-sidebar-panel__user-comment p:last-child {
|
|
659
667
|
margin-bottom: 0;
|
|
660
668
|
}
|
|
669
|
+
|
|
661
670
|
.editor-collab-sidebar-panel__user-avatar {
|
|
662
671
|
border-radius: 50%;
|
|
663
672
|
flex-shrink: 0;
|
|
664
673
|
}
|
|
674
|
+
|
|
665
675
|
.editor-collab-sidebar-panel__thread-overlay {
|
|
666
676
|
background-color: rgba(0, 0, 0, 0.7);
|
|
667
677
|
width: 100%;
|
|
@@ -682,6 +692,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
682
692
|
padding: 4px 10px;
|
|
683
693
|
color: #fff;
|
|
684
694
|
}
|
|
695
|
+
|
|
685
696
|
.editor-collab-sidebar-panel__comment-status {
|
|
686
697
|
margin-left: auto;
|
|
687
698
|
}
|
|
@@ -692,9 +703,11 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
692
703
|
height: 24px;
|
|
693
704
|
flex-shrink: 0;
|
|
694
705
|
}
|
|
706
|
+
|
|
695
707
|
.editor-collab-sidebar-panel__comment-dropdown-menu {
|
|
696
708
|
flex-shrink: 0;
|
|
697
709
|
}
|
|
710
|
+
|
|
698
711
|
.editor-collab-sidebar-panel__show-more-reply {
|
|
699
712
|
font-weight: 500;
|
|
700
713
|
font-style: italic;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment-author-info.d.ts","sourceRoot":"","sources":["../../../src/components/collab-sidebar/comment-author-info.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"comment-author-info.d.ts","sourceRoot":"","sources":["../../../src/components/collab-sidebar/comment-author-info.js"],"names":[],"mappings":";AAeA;;;;;;;;;GASG;AACH,2DANG;IAAsB,MAAM,EAApB,MAAM;IACQ,IAAI,EAAlB,MAAM;IACQ,IAAI,EAAlB,MAAM;CAEd,GAAS,KAAK,CAAC,SAAS,CAuD1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../../src/components/collab-sidebar/comments.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../../src/components/collab-sidebar/comments.js"],"names":[],"mappings":"AAwDA;;;;;;;;;;;;;GAaG;AACH,6JAVG;IAAwB,OAAO;IACP,aAAa;IACb,UAAU;IACV,eAAe;IACf,gBAAgB;IAChB,eAAe;IACf,gBAAgB,EAAhC,OAAO;IACS,mBAAmB;CAC3C,GAAS,KAAK,CAAC,SAAS,CAkF1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/collab-sidebar/index.js"],"names":[],"mappings":"AAyOA;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/collab-sidebar/index.js"],"names":[],"mappings":"AAyOA;;GAEG;AACH,4EA0KC"}
|