@manuscripts/article-editor 3.4.2-LEAN-3894.0 → 3.4.2-LEAN-3638.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/dist/cjs/components/comments/CommentActions.js +7 -11
- package/dist/cjs/components/comments/CommentActions.js.map +1 -1
- package/dist/cjs/components/comments/CommentBody.js +6 -10
- package/dist/cjs/components/comments/CommentBody.js.map +1 -1
- package/dist/cjs/components/comments/CommentResolveButton.js +1 -1
- package/dist/cjs/components/comments/CommentThread.js +89 -83
- package/dist/cjs/components/comments/CommentThread.js.map +1 -1
- package/dist/cjs/components/comments/CommentsPanel.js +10 -33
- package/dist/cjs/components/comments/CommentsPanel.js.map +1 -1
- package/dist/cjs/lib/comments.js +5 -26
- package/dist/cjs/lib/comments.js.map +1 -1
- package/dist/es/components/comments/CommentActions.js +7 -11
- package/dist/es/components/comments/CommentActions.js.map +1 -1
- package/dist/es/components/comments/CommentBody.js +7 -11
- package/dist/es/components/comments/CommentBody.js.map +1 -1
- package/dist/es/components/comments/CommentResolveButton.js +1 -1
- package/dist/es/components/comments/CommentThread.js +92 -86
- package/dist/es/components/comments/CommentThread.js.map +1 -1
- package/dist/es/components/comments/CommentsPanel.js +12 -35
- package/dist/es/components/comments/CommentsPanel.js.map +1 -1
- package/dist/es/lib/comments.js +3 -23
- package/dist/es/lib/comments.js.map +1 -1
- package/dist/types/components/comments/CommentThread.d.ts +2 -3
- package/dist/types/lib/comments.d.ts +3 -4
- package/package.json +2 -2
- package/dist/cjs/components/comments/CommentCard.js +0 -165
- package/dist/cjs/components/comments/CommentCard.js.map +0 -1
- package/dist/cjs/components/comments/DeleteCommentConfirmation.js +0 -74
- package/dist/cjs/components/comments/DeleteCommentConfirmation.js.map +0 -1
- package/dist/cjs/components/comments/ReplyBox.js +0 -121
- package/dist/cjs/components/comments/ReplyBox.js.map +0 -1
- package/dist/es/components/comments/CommentCard.js +0 -135
- package/dist/es/components/comments/CommentCard.js.map +0 -1
- package/dist/es/components/comments/DeleteCommentConfirmation.js +0 -67
- package/dist/es/components/comments/DeleteCommentConfirmation.js.map +0 -1
- package/dist/es/components/comments/ReplyBox.js +0 -91
- package/dist/es/components/comments/ReplyBox.js.map +0 -1
- package/dist/types/components/comments/CommentCard.d.ts +0 -27
- package/dist/types/components/comments/DeleteCommentConfirmation.d.ts +0 -19
- package/dist/types/components/comments/ReplyBox.d.ts +0 -18
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CommentBody.js","sourceRoot":"","sources":["../../../../src/components/comments/CommentBody.tsx"],"names":[],"mappings":"AAYA,OAAO,EACL,WAAW,EACX,aAAa,EACb,
|
1
|
+
{"version":3,"file":"CommentBody.js","sourceRoot":"","sources":["../../../../src/components/comments/CommentBody.tsx"],"names":[],"mappings":"AAYA,OAAO,EACL,WAAW,EACX,aAAa,EACb,eAAe,GAChB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,EAEZ,WAAW,EACX,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAA;AACd,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEpD,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEhC,CAAA;AAED,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAA;;iBAEpB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;WAC7C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;YACzC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;CAoB/C,CAAA;AAED,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA;;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CAAC,QAAQ,EAAE,KAAK,CAAC,CACrC,CAAA;IACD,MAAM,YAAY,GAAG,CAAC,CAAmC,EAAE,EAAE,CAC3D,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAE1B,OAAO,CACL,0CACG,SAAS,CAAC,CAAC,CAAC,CACX;QACE,oBAAC,aAAa,eACJ,gBAAgB,EACxB,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EACzC,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,QAAQ,EAAE,GAC5C;QACjB,oBAAC,aAAa,eAAS,iBAAiB;YACtC,oBAAC,eAAe,IAAC,OAAO,EAAE,QAAQ,aAA0B;YAC5D,oBAAC,aAAa,IAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,iBAAiB,WAE/C,CACF,CACf,CACJ,CAAC,CAAC,CAAC,CACF;QACE,oBAAC,cAAc,IAAC,OAAO,EAAE,QAAQ;YAC/B,oBAAC,aAAa,eAAS,cAAc,IAClC,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAClC,CACD,CAChB,CACJ,CACA,CACJ,CAAA;AACH,CAAC,CAAA"}
|
@@ -1,99 +1,105 @@
|
|
1
|
-
import {
|
2
|
-
import React, { forwardRef,
|
1
|
+
import { AvatarIcon, RelativeDate, SystemUserAvatarIcon, usePermissions, } from '@manuscripts/style-guide';
|
2
|
+
import React, { forwardRef, useState } from 'react';
|
3
3
|
import styled from 'styled-components';
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
4
|
+
import { buildAuthorName, getAuthorID } from '../../lib/comments';
|
5
|
+
import { useStore } from '../../store';
|
6
|
+
import { CommentActions } from './CommentActions';
|
7
|
+
import { CommentBody } from './CommentBody';
|
7
8
|
const Container = styled.div `
|
8
|
-
padding:
|
9
|
-
background-color: ${(props) => (props.isSelected ? '#
|
10
|
-
border: 1px solid #
|
11
|
-
|
12
|
-
border-radius: 4px;
|
9
|
+
padding: 16px;
|
10
|
+
background-color: ${(props) => (props.isSelected ? '#f2fbfc' : '#ffffff')};
|
11
|
+
border: 1px solid ${(props) => (props.isSelected ? '#bce7f6' : '#e2e2e2')};
|
12
|
+
border-left-width: 4px;
|
13
13
|
margin-bottom: 16px;
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
`;
|
15
|
+
const CommentHeader = styled.div `
|
16
|
+
display: flex;
|
17
|
+
margin-bottom: 16px;
|
18
|
+
`;
|
19
|
+
const CommentMetadata = styled.div `
|
20
|
+
flex: 1;
|
21
|
+
padding-left: 8px;
|
22
|
+
padding-right: 8px;
|
23
|
+
`;
|
24
|
+
const CommentAuthor = styled.div `
|
25
|
+
display: flex;
|
26
|
+
color: #353535;
|
27
|
+
font-weight: 400;
|
28
|
+
max-width: 200px;
|
29
|
+
white-space: nowrap;
|
30
|
+
overflow: hidden;
|
31
|
+
text-overflow: ellipsis;
|
32
|
+
width: 100%;
|
23
33
|
|
24
|
-
|
25
|
-
|
26
|
-
}
|
34
|
+
svg {
|
35
|
+
padding-right: 10px;
|
27
36
|
}
|
28
37
|
`;
|
29
|
-
const
|
30
|
-
|
31
|
-
|
32
|
-
|
38
|
+
const CommentTarget = styled.div `
|
39
|
+
font-size: 14px;
|
40
|
+
color: #353535;
|
41
|
+
background-color: #ffeebf;
|
42
|
+
padding: 4px 8px;
|
43
|
+
margin-top: 16px;
|
44
|
+
margin-bottom: 16px;
|
33
45
|
`;
|
34
|
-
const
|
35
|
-
|
46
|
+
const Timestamp = styled(RelativeDate) `
|
47
|
+
font-size: 12px;
|
48
|
+
line-height: 16px;
|
49
|
+
font-weight: 400;
|
50
|
+
color: #6e6e6e;
|
36
51
|
`;
|
37
52
|
export const CommentThread = forwardRef((props, ref) => {
|
38
|
-
const {
|
39
|
-
const
|
40
|
-
const
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
const
|
50
|
-
|
51
|
-
|
53
|
+
const { tree, isSelected, onSelect, onSave, onDelete } = props;
|
54
|
+
const can = usePermissions();
|
55
|
+
const [{ user, collaboratorsById }] = useStore((state) => ({
|
56
|
+
user: state.user,
|
57
|
+
collaboratorsById: state.collaboratorsById,
|
58
|
+
}));
|
59
|
+
const authorID = getAuthorID(tree.comment);
|
60
|
+
const authorName = authorID
|
61
|
+
? buildAuthorName(collaboratorsById.get(authorID))
|
62
|
+
: '';
|
63
|
+
const timestamp = tree.comment.node.attrs.contributions?.[0].timestamp;
|
64
|
+
const isOwn = authorID === user._id;
|
65
|
+
const isResolveEnabled = isOwn
|
66
|
+
? can.resolveOwnComment
|
67
|
+
: can.resolveOthersComment;
|
68
|
+
const isActionsEnabled = isOwn
|
69
|
+
? can.handleOwnComments
|
70
|
+
: can.handleOthersComments;
|
71
|
+
const [isEditing, setEditing] = useState(tree.isNew);
|
72
|
+
const handleEdit = () => setEditing(true);
|
73
|
+
const handleSave = (contents) => {
|
74
|
+
onSave({
|
75
|
+
...tree.comment.node.attrs,
|
76
|
+
contents,
|
77
|
+
});
|
78
|
+
setEditing(false);
|
79
|
+
};
|
80
|
+
const handleCancel = () => {
|
81
|
+
setEditing(false);
|
82
|
+
if (tree.isNew) {
|
83
|
+
onDelete(tree.comment.node.attrs.id);
|
52
84
|
}
|
53
85
|
};
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
86
|
+
const handleToggleResolve = () => {
|
87
|
+
onSave({
|
88
|
+
...tree.comment.node.attrs,
|
89
|
+
resolved: !tree.comment.node.attrs.resolved,
|
90
|
+
});
|
91
|
+
};
|
92
|
+
return (React.createElement(Container, { "data-cy": "comment", isSelected: isSelected, ref: ref },
|
93
|
+
React.createElement(CommentHeader, { "data-cy": "comment-header" },
|
94
|
+
React.createElement(CommentMetadata, null,
|
95
|
+
React.createElement(CommentAuthor, null, authorName ? (React.createElement(React.Fragment, null,
|
96
|
+
React.createElement(AvatarIcon, { width: 20, height: 20 }),
|
97
|
+
React.createElement(CommentAuthor, null, authorName))) : (React.createElement(React.Fragment, null,
|
98
|
+
React.createElement(SystemUserAvatarIcon, { width: 20, height: 20 }),
|
99
|
+
React.createElement(CommentAuthor, null, "System")))),
|
100
|
+
timestamp && React.createElement(Timestamp, { date: timestamp * 1000 })),
|
101
|
+
React.createElement(CommentActions, { comment: tree.comment, isResolveEnabled: isResolveEnabled, isActionsEnabled: isActionsEnabled, onDelete: () => onDelete(tree.comment.node.attrs.id), onEdit: handleEdit, toggleResolve: handleToggleResolve })),
|
102
|
+
tree.comment.node.attrs.originalText && (React.createElement(CommentTarget, null, tree.comment.node.attrs.originalText)),
|
103
|
+
React.createElement(CommentBody, { comment: tree.comment, isEditing: tree.isNew || isEditing, onSave: handleSave, onCancel: handleCancel, onSelect: onSelect })));
|
69
104
|
});
|
70
|
-
const ButtonContainer = styled.div `
|
71
|
-
display: flex;
|
72
|
-
justify-content: center;
|
73
|
-
align-items: center;
|
74
|
-
`;
|
75
|
-
const ShowMore = styled(TextButton) `
|
76
|
-
cursor: pointer;
|
77
|
-
text-align: center;
|
78
|
-
margin-top: 6px;
|
79
|
-
color: #353535;
|
80
|
-
`;
|
81
|
-
const CardsWrapper = styled.div `
|
82
|
-
max-height: ${({ isSelected }) => (isSelected ? 'none' : '280px')};
|
83
|
-
position: relative;
|
84
|
-
${({ showMore, isSelected }) => showMore &&
|
85
|
-
!isSelected &&
|
86
|
-
`
|
87
|
-
overflow: hidden;
|
88
|
-
&:after {
|
89
|
-
content: '';
|
90
|
-
position: absolute;
|
91
|
-
bottom: 0;
|
92
|
-
left: 0;
|
93
|
-
right: 0;
|
94
|
-
height: 40px;
|
95
|
-
background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
|
96
|
-
}
|
97
|
-
`}
|
98
|
-
`;
|
99
105
|
//# sourceMappingURL=CommentThread.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CommentThread.js","sourceRoot":"","sources":["../../../../src/components/comments/CommentThread.tsx"],"names":[],"mappings":"AAYA,OAAO,
|
1
|
+
{"version":3,"file":"CommentThread.js","sourceRoot":"","sources":["../../../../src/components/comments/CommentThread.tsx"],"names":[],"mappings":"AAYA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,cAAc,GACf,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,eAAe,EAAe,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAA0B;;sBAEhC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;sBACrD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;;;CAG1E,CAAA;AAED,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAG/B,CAAA;AAED,MAAM,eAAe,GAAG,MAAM,CAAC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CACF;oBACE,oBAAC,oBAAoB,IAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,GAAI;oBAC/C,oBAAC,aAAa,iBAAuB,CACpC,CACJ,CACa;gBACf,SAAS,IAAI,oBAAC,SAAS,IAAC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAI,CACnC;YAClB,oBAAC,cAAc,IACb,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EACpD,MAAM,EAAE,UAAU,EAClB,aAAa,EAAE,mBAAmB,GAClC,CACY;QACf,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,CACvC,oBAAC,aAAa,QAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAiB,CACtE;QACD,oBAAC,WAAW,IACV,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,SAAS,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS,EAClC,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,QAAQ,GAClB,CACQ,CACb,CAAA;AACH,CAAC,CACF,CAAA"}
|
@@ -9,16 +9,13 @@
|
|
9
9
|
*
|
10
10
|
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
11
11
|
*/
|
12
|
-
import { commentsKey, isNodeComment, setCommentSelection, } from '@manuscripts/body-editor';
|
13
|
-
import { buildContribution } from '@manuscripts/json-schema';
|
12
|
+
import { clearCommentSelection, commentsKey, isNodeComment, setCommentSelection, } from '@manuscripts/body-editor';
|
14
13
|
import { CheckboxField, CheckboxLabel } from '@manuscripts/style-guide';
|
15
14
|
import { skipTracking } from '@manuscripts/track-changes-plugin';
|
16
|
-
import { generateNodeID, schema } from '@manuscripts/transform';
|
17
15
|
import { NodeSelection, TextSelection } from 'prosemirror-state';
|
18
|
-
import { findChildrenByType } from 'prosemirror-utils';
|
19
16
|
import React, { useCallback, useMemo, useState } from 'react';
|
20
17
|
import styled from 'styled-components';
|
21
|
-
import {
|
18
|
+
import { buildCommentTrees } from '../../lib/comments';
|
22
19
|
import { useStore } from '../../store';
|
23
20
|
import { CommentsPlaceholder } from './CommentsPlaceholder';
|
24
21
|
import { CommentThread } from './CommentThread';
|
@@ -37,17 +34,14 @@ const scrollIntoView = (element) => {
|
|
37
34
|
}
|
38
35
|
};
|
39
36
|
export const CommentsPanel = () => {
|
40
|
-
const [{ view, newCommentID, selectedCommentKey
|
37
|
+
const [{ view, newCommentID, selectedCommentKey }] = useStore((state) => ({
|
41
38
|
view: state.view,
|
42
|
-
doc: state.doc,
|
43
39
|
newCommentID: state.newCommentID,
|
44
40
|
selectedCommentKey: state.selectedCommentKey,
|
45
|
-
user: state.user,
|
46
41
|
}));
|
47
42
|
const [showResolved, setShowResolved] = useState(true);
|
48
|
-
const comments = useMemo(() => view?.state ? commentsKey.getState(view.state)?.comments : undefined, [view?.state
|
49
|
-
);
|
50
|
-
const threads = useMemo(() => (comments ? buildThreads([...comments.values()], newCommentID) : []), [comments, newCommentID]);
|
43
|
+
const comments = useMemo(() => view?.state ? commentsKey.getState(view.state)?.comments : undefined, [view?.state]);
|
44
|
+
const trees = useMemo(() => comments ? buildCommentTrees([...comments.values()], newCommentID) : [], [comments, newCommentID]);
|
51
45
|
const selectedRef = useCallback((e) => {
|
52
46
|
if (e) {
|
53
47
|
scrollIntoView(e);
|
@@ -72,25 +66,6 @@ export const CommentsPanel = () => {
|
|
72
66
|
view.focus();
|
73
67
|
view.dispatch(tr);
|
74
68
|
};
|
75
|
-
const insertCommentReply = (target, contents) => {
|
76
|
-
if (!view) {
|
77
|
-
return;
|
78
|
-
}
|
79
|
-
const attrs = {
|
80
|
-
id: generateNodeID(schema.nodes.comment),
|
81
|
-
contents,
|
82
|
-
target,
|
83
|
-
contributions: [buildContribution(user._id)],
|
84
|
-
resolved: false,
|
85
|
-
};
|
86
|
-
const comment = view.state.schema.nodes.comment.create(attrs);
|
87
|
-
const comments = findChildrenByType(view.state.doc, view.state.schema.nodes.comments)[0];
|
88
|
-
if (comments) {
|
89
|
-
const pos = comments.pos + 1;
|
90
|
-
const tr = view.state.tr.insert(pos, comment);
|
91
|
-
view.dispatch(skipTracking(tr));
|
92
|
-
}
|
93
|
-
};
|
94
69
|
const handleSave = (attrs) => {
|
95
70
|
const comment = comments?.get(attrs.id);
|
96
71
|
if (!comment || !view) {
|
@@ -98,6 +73,7 @@ export const CommentsPanel = () => {
|
|
98
73
|
}
|
99
74
|
const tr = view.state.tr;
|
100
75
|
tr.setNodeMarkup(comment.pos, undefined, attrs);
|
76
|
+
clearCommentSelection(tr);
|
101
77
|
view.dispatch(skipTracking(tr));
|
102
78
|
};
|
103
79
|
const handleDelete = (id) => {
|
@@ -107,15 +83,16 @@ export const CommentsPanel = () => {
|
|
107
83
|
}
|
108
84
|
const tr = view.state.tr;
|
109
85
|
tr.delete(comment.pos, comment.pos + comment.node.nodeSize);
|
86
|
+
clearCommentSelection(tr);
|
110
87
|
view.dispatch(skipTracking(tr));
|
111
88
|
};
|
112
|
-
const isSelected = (
|
113
|
-
return
|
89
|
+
const isSelected = (tree) => {
|
90
|
+
return tree && selectedCommentKey === tree.comment.key;
|
114
91
|
};
|
115
92
|
if (!view) {
|
116
93
|
return null;
|
117
94
|
}
|
118
|
-
if (!
|
95
|
+
if (!trees.length) {
|
119
96
|
return React.createElement(CommentsPlaceholder, null);
|
120
97
|
}
|
121
98
|
return (React.createElement(React.Fragment, null,
|
@@ -123,8 +100,8 @@ export const CommentsPanel = () => {
|
|
123
100
|
React.createElement(CheckboxLabel, null,
|
124
101
|
React.createElement(CheckboxField, { name: 'show-resolved', checked: showResolved, onChange: (e) => setShowResolved(e.target.checked) }),
|
125
102
|
React.createElement(CheckboxLabelText, null, "See resolved"))),
|
126
|
-
|
103
|
+
trees
|
127
104
|
.filter((c) => showResolved || !c.comment.node.attrs.resolved)
|
128
|
-
.map((c, i, a) => (React.createElement(CommentThread, { key: c.comment.node.attrs.id, ref: isSelected(c) && !isSelected(a[i - 1]) ? selectedRef : null,
|
105
|
+
.map((c, i, a) => (React.createElement(CommentThread, { key: c.comment.node.attrs.id, ref: isSelected(c) && !isSelected(a[i - 1]) ? selectedRef : null, tree: c, isSelected: isSelected(c), onSelect: () => setSelectedComment(c.comment), onSave: handleSave, onDelete: handleDelete })))));
|
129
106
|
};
|
130
107
|
//# sourceMappingURL=CommentsPanel.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CommentsPanel.js","sourceRoot":"","sources":["../../../../src/components/comments/CommentsPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,
|
1
|
+
{"version":3,"file":"CommentsPanel.js","sourceRoot":"","sources":["../../../../src/components/comments/CommentsPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,qBAAqB,EAGrB,WAAW,EAEX,aAAa,EACb,mBAAmB,GACpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC7D,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,iBAAiB,EAAe,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAu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E,oBAAC,MAAM;YACL,oBAAC,aAAa;gBACZ,oBAAC,aAAa,IACZ,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAClD;gBACF,oBAAC,iBAAiB,uBAAiC,CACrC,CACT;QACR,KAAK;aACH,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;aAC7D,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAChB,oBAAC,aAAa,IACZ,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAC5B,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,EAChE,IAAI,EAAE,CAAC,EACP,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EACzB,QAAQ,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC,EAC7C,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,YAAY,GACtB,CACH,CAAC,CACH,CACJ,CAAA;AACH,CAAC,CAAA"}
|
package/dist/es/lib/comments.js
CHANGED
@@ -1,15 +1,3 @@
|
|
1
|
-
/*!
|
2
|
-
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
3
|
-
*
|
4
|
-
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
5
|
-
*
|
6
|
-
* The Original Code is manuscripts-frontend.
|
7
|
-
*
|
8
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
9
|
-
*
|
10
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
|
11
|
-
*/
|
12
|
-
import { isReply } from '@manuscripts/body-editor';
|
13
1
|
export const getAuthorID = (comment) => {
|
14
2
|
const contributions = comment.node.attrs.contributions;
|
15
3
|
if (!contributions?.length) {
|
@@ -17,14 +5,11 @@ export const getAuthorID = (comment) => {
|
|
17
5
|
}
|
18
6
|
return contributions[0].profileID;
|
19
7
|
};
|
20
|
-
export const
|
21
|
-
return comments
|
22
|
-
.filter((c) => !isReply(c)) // Filter out replies
|
23
|
-
.map((c) => ({
|
8
|
+
export const buildCommentTrees = (comments, newCommentID) => {
|
9
|
+
return comments.map((c) => ({
|
24
10
|
comment: c,
|
25
11
|
isNew: newCommentID === c.node.attrs.id,
|
26
|
-
|
27
|
-
),
|
12
|
+
children: [],
|
28
13
|
}));
|
29
14
|
};
|
30
15
|
export const buildAuthorName = (user) => {
|
@@ -35,9 +20,4 @@ export const buildAuthorName = (user) => {
|
|
35
20
|
.filter(Boolean)
|
36
21
|
.join(' ');
|
37
22
|
};
|
38
|
-
export const commentsByTime = (a, b) => {
|
39
|
-
const aTimestamp = a.node.attrs.contributions?.[0].timestamp || 0;
|
40
|
-
const bTimestamp = b.node.attrs.contributions?.[0].timestamp || 0;
|
41
|
-
return aTimestamp - bTimestamp;
|
42
|
-
};
|
43
23
|
//# sourceMappingURL=comments.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"comments.js","sourceRoot":"","sources":["../../../src/lib/comments.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"comments.js","sourceRoot":"","sources":["../../../src/lib/comments.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC9C,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAA;IACtD,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE;QAC1B,OAAO,SAAS,CAAA;KACjB;IACD,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACnC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,QAAmB,EACnB,YAAqB,EACN,EAAE;IACjB,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1B,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,YAAY,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACvC,QAAQ,EAAE,EAAE;KACb,CAAC,CAAC,CAAA;AACL,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAA6B,EAAE,EAAE;IAC/D,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,EAAE,CAAA;KACV;IACD,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC;SACjE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAA;AACd,CAAC,CAAA"}
|
@@ -11,13 +11,12 @@
|
|
11
11
|
*/
|
12
12
|
import { CommentAttrs } from '@manuscripts/body-editor';
|
13
13
|
import React from 'react';
|
14
|
-
import {
|
14
|
+
import { CommentTree } from '../../lib/comments';
|
15
15
|
export interface CommentThreadProps {
|
16
|
-
|
16
|
+
tree: CommentTree;
|
17
17
|
isSelected: boolean;
|
18
18
|
onSelect: () => void;
|
19
19
|
onSave: (comment: CommentAttrs) => void;
|
20
20
|
onDelete: (id: string) => void;
|
21
|
-
insertCommentReply: (target: string, contents: string) => void;
|
22
21
|
}
|
23
22
|
export declare const CommentThread: React.ForwardRefExoticComponent<CommentThreadProps & React.RefAttributes<HTMLDivElement>>;
|
@@ -11,12 +11,11 @@
|
|
11
11
|
*/
|
12
12
|
import { Comment } from '@manuscripts/body-editor';
|
13
13
|
import { UserProfile } from '@manuscripts/json-schema';
|
14
|
-
export type
|
14
|
+
export type CommentTree = {
|
15
15
|
comment: Comment;
|
16
16
|
isNew: boolean;
|
17
|
-
|
17
|
+
children: CommentTree[];
|
18
18
|
};
|
19
19
|
export declare const getAuthorID: (comment: Comment) => string | undefined;
|
20
|
-
export declare const
|
20
|
+
export declare const buildCommentTrees: (comments: Comment[], newCommentID?: string) => CommentTree[];
|
21
21
|
export declare const buildAuthorName: (user: UserProfile | undefined) => string;
|
22
|
-
export declare const commentsByTime: (a: Comment, b: Comment) => number;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@manuscripts/article-editor",
|
3
|
-
"version": "3.4.2-LEAN-
|
3
|
+
"version": "3.4.2-LEAN-3638.0",
|
4
4
|
"license": "CPAL-1.0",
|
5
5
|
"description": "React components for editing and viewing manuscripts",
|
6
6
|
"repository": "github:Atypon-OpenSource/manuscripts-article-editor",
|
@@ -35,7 +35,7 @@
|
|
35
35
|
"@fontsource/lato": "^4.5.10",
|
36
36
|
"@fontsource/pt-sans": "^4.5.11",
|
37
37
|
"@fontsource/pt-serif": "^4.5.11",
|
38
|
-
"@manuscripts/body-editor": "2.5.2-LEAN-
|
38
|
+
"@manuscripts/body-editor": "2.5.2-LEAN-3638.0",
|
39
39
|
"@manuscripts/json-schema": "2.2.11",
|
40
40
|
"@manuscripts/library": "1.3.11",
|
41
41
|
"@manuscripts/style-guide": "2.0.21",
|