@manuscripts/article-editor 3.2.19-LEAN-3968-v0.0 → 3.2.19-LEAN-3894.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 +11 -7
- package/dist/cjs/components/comments/CommentActions.js.map +1 -1
- package/dist/cjs/components/comments/CommentCard.js +162 -0
- package/dist/cjs/components/comments/CommentCard.js.map +1 -0
- package/dist/cjs/components/comments/CommentResolveButton.js +1 -1
- package/dist/cjs/components/comments/CommentThread.js +77 -89
- package/dist/cjs/components/comments/CommentThread.js.map +1 -1
- package/dist/cjs/components/comments/CommentsPanel.js +33 -10
- package/dist/cjs/components/comments/CommentsPanel.js.map +1 -1
- package/dist/cjs/components/comments/DeleteCommentConfirmation.js +69 -0
- package/dist/cjs/components/comments/DeleteCommentConfirmation.js.map +1 -0
- package/dist/cjs/components/comments/ReplyBox.js +118 -0
- package/dist/cjs/components/comments/ReplyBox.js.map +1 -0
- package/dist/cjs/lib/comments.js +26 -5
- package/dist/cjs/lib/comments.js.map +1 -1
- package/dist/es/components/comments/CommentActions.js +11 -7
- package/dist/es/components/comments/CommentActions.js.map +1 -1
- package/dist/es/components/comments/CommentCard.js +132 -0
- package/dist/es/components/comments/CommentCard.js.map +1 -0
- package/dist/es/components/comments/CommentResolveButton.js +1 -1
- package/dist/es/components/comments/CommentThread.js +80 -92
- package/dist/es/components/comments/CommentThread.js.map +1 -1
- package/dist/es/components/comments/CommentsPanel.js +35 -12
- package/dist/es/components/comments/CommentsPanel.js.map +1 -1
- package/dist/es/components/comments/DeleteCommentConfirmation.js +62 -0
- package/dist/es/components/comments/DeleteCommentConfirmation.js.map +1 -0
- package/dist/es/components/comments/ReplyBox.js +88 -0
- package/dist/es/components/comments/ReplyBox.js.map +1 -0
- package/dist/es/lib/comments.js +23 -3
- package/dist/es/lib/comments.js.map +1 -1
- package/dist/types/components/comments/CommentCard.d.ts +25 -0
- package/dist/types/components/comments/CommentThread.d.ts +3 -2
- package/dist/types/components/comments/DeleteCommentConfirmation.d.ts +18 -0
- package/dist/types/components/comments/ReplyBox.d.ts +18 -0
- package/dist/types/lib/comments.d.ts +4 -3
- package/package.json +2 -2
@@ -9,13 +9,16 @@
|
|
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 {
|
12
|
+
import { commentsKey, isNodeComment, setCommentSelection, } from '@manuscripts/body-editor';
|
13
|
+
import { buildContribution } from '@manuscripts/json-schema';
|
13
14
|
import { CheckboxField, CheckboxLabel } from '@manuscripts/style-guide';
|
14
15
|
import { skipTracking } from '@manuscripts/track-changes-plugin';
|
16
|
+
import { generateNodeID, schema } from '@manuscripts/transform';
|
15
17
|
import { NodeSelection, TextSelection } from 'prosemirror-state';
|
18
|
+
import { findChildrenByType } from 'prosemirror-utils';
|
16
19
|
import React, { useCallback, useMemo, useState } from 'react';
|
17
20
|
import styled from 'styled-components';
|
18
|
-
import {
|
21
|
+
import { buildThreads } from '../../lib/comments';
|
19
22
|
import { useStore } from '../../store';
|
20
23
|
import { CommentsPlaceholder } from './CommentsPlaceholder';
|
21
24
|
import { CommentThread } from './CommentThread';
|
@@ -34,14 +37,17 @@ const scrollIntoView = (element) => {
|
|
34
37
|
}
|
35
38
|
};
|
36
39
|
export const CommentsPanel = () => {
|
37
|
-
const [{ view, newCommentID, selectedCommentKey }] = useStore((state) => ({
|
40
|
+
const [{ view, newCommentID, selectedCommentKey, user, doc }] = useStore((state) => ({
|
38
41
|
view: state.view,
|
42
|
+
doc: state.doc,
|
39
43
|
newCommentID: state.newCommentID,
|
40
44
|
selectedCommentKey: state.selectedCommentKey,
|
45
|
+
user: state.user,
|
41
46
|
}));
|
42
47
|
const [showResolved, setShowResolved] = useState(true);
|
43
|
-
const comments = useMemo(() => view?.state ? commentsKey.getState(view.state)?.comments : undefined, [view?.state]
|
44
|
-
|
48
|
+
const comments = useMemo(() => view?.state ? commentsKey.getState(view.state)?.comments : undefined, [view?.state, doc] // eslint-disable-line react-hooks/exhaustive-deps
|
49
|
+
);
|
50
|
+
const threads = useMemo(() => (comments ? buildThreads([...comments.values()], newCommentID) : []), [comments, newCommentID]);
|
45
51
|
const selectedRef = useCallback((e) => {
|
46
52
|
if (e) {
|
47
53
|
scrollIntoView(e);
|
@@ -66,6 +72,25 @@ export const CommentsPanel = () => {
|
|
66
72
|
view.focus();
|
67
73
|
view.dispatch(tr);
|
68
74
|
};
|
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
|
+
};
|
69
94
|
const handleSave = (attrs) => {
|
70
95
|
const comment = comments?.get(attrs.id);
|
71
96
|
if (!comment || !view) {
|
@@ -73,7 +98,6 @@ export const CommentsPanel = () => {
|
|
73
98
|
}
|
74
99
|
const tr = view.state.tr;
|
75
100
|
tr.setNodeMarkup(comment.pos, undefined, attrs);
|
76
|
-
clearCommentSelection(tr);
|
77
101
|
view.dispatch(skipTracking(tr));
|
78
102
|
};
|
79
103
|
const handleDelete = (id) => {
|
@@ -83,16 +107,15 @@ export const CommentsPanel = () => {
|
|
83
107
|
}
|
84
108
|
const tr = view.state.tr;
|
85
109
|
tr.delete(comment.pos, comment.pos + comment.node.nodeSize);
|
86
|
-
clearCommentSelection(tr);
|
87
110
|
view.dispatch(skipTracking(tr));
|
88
111
|
};
|
89
|
-
const isSelected = (
|
90
|
-
return
|
112
|
+
const isSelected = (thread) => {
|
113
|
+
return thread && selectedCommentKey === thread.comment.key;
|
91
114
|
};
|
92
115
|
if (!view) {
|
93
116
|
return null;
|
94
117
|
}
|
95
|
-
if (!
|
118
|
+
if (!threads.length) {
|
96
119
|
return React.createElement(CommentsPlaceholder, null);
|
97
120
|
}
|
98
121
|
return (React.createElement(React.Fragment, null,
|
@@ -100,8 +123,8 @@ export const CommentsPanel = () => {
|
|
100
123
|
React.createElement(CheckboxLabel, null,
|
101
124
|
React.createElement(CheckboxField, { name: 'show-resolved', checked: showResolved, onChange: (e) => setShowResolved(e.target.checked) }),
|
102
125
|
React.createElement(CheckboxLabelText, null, "See resolved"))),
|
103
|
-
|
126
|
+
threads
|
104
127
|
.filter((c) => showResolved || !c.comment.node.attrs.resolved)
|
105
|
-
.map((c, i, a) => (React.createElement(CommentThread, { key: c.comment.node.attrs.id, ref: isSelected(c) && !isSelected(a[i - 1]) ? selectedRef : null,
|
128
|
+
.map((c, i, a) => (React.createElement(CommentThread, { key: c.comment.node.attrs.id, ref: isSelected(c) && !isSelected(a[i - 1]) ? selectedRef : null, thread: c, isSelected: isSelected(c), onSelect: () => setSelectedComment(c.comment), onSave: handleSave, onDelete: handleDelete, insertCommentReply: insertCommentReply })))));
|
106
129
|
};
|
107
130
|
//# 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,EAGL,WAAW,EAEX,aAAa,EACb,mBAAmB,GACpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,E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AkB,GACtC,CACH,CAAC,CACH,CACJ,CAAA;AACH,CAAC,CAAA"}
|
@@ -0,0 +1,62 @@
|
|
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 { AttentionOrangeIcon, ButtonGroup, PrimaryButton, SecondaryButton, } from '@manuscripts/style-guide';
|
13
|
+
import React from 'react';
|
14
|
+
import styled from 'styled-components';
|
15
|
+
const MessageContainer = styled.div `
|
16
|
+
display: flex;
|
17
|
+
align-items: center;
|
18
|
+
flex-grow: 1;
|
19
|
+
`;
|
20
|
+
const CancelButton = styled(SecondaryButton) `
|
21
|
+
padding: 4px ${(props) => props.theme.grid.unit * 3}px;
|
22
|
+
font-size: 14px;
|
23
|
+
`;
|
24
|
+
const DeleteButton = styled(PrimaryButton) `
|
25
|
+
padding: 4px ${(props) => props.theme.grid.unit * 3}px;
|
26
|
+
font-size: 14px;
|
27
|
+
`;
|
28
|
+
const Message = styled.div `
|
29
|
+
font-weight: 700;
|
30
|
+
color: #000;
|
31
|
+
font-size: 14px;
|
32
|
+
line-height: 16px;
|
33
|
+
margin: 0 8px;
|
34
|
+
`;
|
35
|
+
const DeleteConfirmation = styled.div `
|
36
|
+
position: absolute;
|
37
|
+
top: 0;
|
38
|
+
left: 0;
|
39
|
+
right: 0;
|
40
|
+
bottom: 0;
|
41
|
+
opacity: 0.95;
|
42
|
+
display: flex;
|
43
|
+
align-items: center;
|
44
|
+
justify-content: center;
|
45
|
+
background: #fafafa;
|
46
|
+
z-index: 10;
|
47
|
+
`;
|
48
|
+
const Buttons = styled(ButtonGroup) `
|
49
|
+
& button:not(:last-of-type) {
|
50
|
+
margin-right: 4px;
|
51
|
+
}
|
52
|
+
`;
|
53
|
+
export const DeleteCommentConfirmation = ({ onCancel, onConfirm }) => {
|
54
|
+
return (React.createElement(DeleteConfirmation, null,
|
55
|
+
React.createElement(MessageContainer, null,
|
56
|
+
React.createElement(AttentionOrangeIcon, null),
|
57
|
+
React.createElement(Message, null, "Delete this comment?")),
|
58
|
+
React.createElement(Buttons, null,
|
59
|
+
React.createElement(CancelButton, { onClick: onCancel }, "Cancel"),
|
60
|
+
React.createElement(DeleteButton, { onClick: onConfirm }, "Delete"))));
|
61
|
+
};
|
62
|
+
//# sourceMappingURL=DeleteCommentConfirmation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"DeleteCommentConfirmation.js","sourceRoot":"","sources":["../../../../src/components/comments/DeleteCommentConfirmation.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,eAAe,GAChB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIlC,CAAA;AAED,MAAM,YAAY,GAAG,MAAM,CAAC,eAAe,CAAC,CAAA;iBAC3B,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;;CAEpD,CAAA;AACD,MAAM,YAAY,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;iBACzB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;;CAEpD,CAAA;AACD,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;CAMzB,CAAA;AAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;CAYpC,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;;;;CAIlC,CAAA;AAOD,MAAM,CAAC,MAAM,yBAAyB,GAElC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;IAC9B,OAAO,CACL,oBAAC,kBAAkB;QACjB,oBAAC,gBAAgB;YACf,oBAAC,mBAAmB,OAAG;YACvB,oBAAC,OAAO,+BAA+B,CACtB;QACnB,oBAAC,OAAO;YACN,oBAAC,YAAY,IAAC,OAAO,EAAE,QAAQ,aAAuB;YACtD,oBAAC,YAAY,IAAC,OAAO,EAAE,SAAS,aAAuB,CAC/C,CACS,CACtB,CAAA;AACH,CAAC,CAAA"}
|
@@ -0,0 +1,88 @@
|
|
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 { ButtonGroup, PrimaryButton, SecondaryButton, } from '@manuscripts/style-guide';
|
13
|
+
import React, { useMemo, useRef, useState } from 'react';
|
14
|
+
import styled from 'styled-components';
|
15
|
+
export const ReplyBox = ({ insertCommentReply, commentID, }) => {
|
16
|
+
const [isTextBoxFocused, setIsTextBoxFocused] = useState(false);
|
17
|
+
const [value, setValue] = useState('');
|
18
|
+
const replyRef = useRef(null);
|
19
|
+
const handleFocus = () => setIsTextBoxFocused(true);
|
20
|
+
const handleBlur = (event) => {
|
21
|
+
if (!event.target.value.length) {
|
22
|
+
setIsTextBoxFocused(false);
|
23
|
+
}
|
24
|
+
};
|
25
|
+
const reply = () => {
|
26
|
+
if (replyRef.current) {
|
27
|
+
insertCommentReply(commentID, replyRef.current.value);
|
28
|
+
setValue('');
|
29
|
+
replyRef.current.value = '';
|
30
|
+
replyRef.current.style.height = '30px'; // Reset the height
|
31
|
+
}
|
32
|
+
};
|
33
|
+
const disableSaveButton = useMemo(() => !value.length, [value]);
|
34
|
+
const onTextChange = (e) => {
|
35
|
+
setValue(e.target.value);
|
36
|
+
if (replyRef.current) {
|
37
|
+
replyRef.current.style.height = '30px'; // Reset the height
|
38
|
+
replyRef.current.style.height = `${Math.min(replyRef.current.scrollHeight, 55)}px`; // Set the height based on content
|
39
|
+
}
|
40
|
+
};
|
41
|
+
return (React.createElement(React.Fragment, null,
|
42
|
+
React.createElement(TextBox, { "data-cy": "reply", placeholder: "Reply...", ref: replyRef, onChange: onTextChange, onFocus: handleFocus, onBlur: handleBlur }),
|
43
|
+
isTextBoxFocused && (React.createElement(Actions, { "data-cy": "reply-actions" },
|
44
|
+
React.createElement(SecondaryButton, { onClick: () => {
|
45
|
+
setIsTextBoxFocused(false);
|
46
|
+
setValue('');
|
47
|
+
if (replyRef.current) {
|
48
|
+
replyRef.current.value = '';
|
49
|
+
replyRef.current.style.height = '30px'; // Reset the height
|
50
|
+
}
|
51
|
+
} }, "Cancel"),
|
52
|
+
React.createElement(PrimaryButton, { onClick: reply, disabled: disableSaveButton }, "Reply")))));
|
53
|
+
};
|
54
|
+
const TextBox = styled.textarea `
|
55
|
+
cursor: text;
|
56
|
+
font-family: ${(props) => props.theme.font.family.sans};
|
57
|
+
color: ${(props) => props.theme.colors.text.primary};
|
58
|
+
margin: ${(props) => props.theme.grid.unit * 2}px 0;
|
59
|
+
resize: none;
|
60
|
+
|
61
|
+
width: 100%;
|
62
|
+
|
63
|
+
height: 30px;
|
64
|
+
max-height: 55px;
|
65
|
+
|
66
|
+
outline: 0;
|
67
|
+
border: 1px solid #e2e2e2;
|
68
|
+
border-radius: 6px;
|
69
|
+
|
70
|
+
&:focus {
|
71
|
+
background: #f2fbfc;
|
72
|
+
border: 1px solid #bce7f6;
|
73
|
+
border-radius: 6px;
|
74
|
+
}
|
75
|
+
|
76
|
+
box-sizing: border-box;
|
77
|
+
padding: 3px 16px 3px 16px;
|
78
|
+
font-style: normal;
|
79
|
+
font-weight: 400;
|
80
|
+
font-size: 14px;
|
81
|
+
line-height: 24px;
|
82
|
+
`;
|
83
|
+
const Actions = styled(ButtonGroup) `
|
84
|
+
& button:not(:last-of-type) {
|
85
|
+
margin-right: 4px;
|
86
|
+
}
|
87
|
+
`;
|
88
|
+
//# sourceMappingURL=ReplyBox.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ReplyBox.js","sourceRoot":"","sources":["../../../../src/components/comments/ReplyBox.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,WAAW,EACX,aAAa,EACb,eAAe,GAChB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,EAAe,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACrE,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAOt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;;;;;CAwB/C,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;;;;CAIlC,CAAA"}
|
package/dist/es/lib/comments.js
CHANGED
@@ -1,3 +1,15 @@
|
|
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';
|
1
13
|
export const getAuthorID = (comment) => {
|
2
14
|
const contributions = comment.node.attrs.contributions;
|
3
15
|
if (!contributions?.length) {
|
@@ -5,11 +17,14 @@ export const getAuthorID = (comment) => {
|
|
5
17
|
}
|
6
18
|
return contributions[0].profileID;
|
7
19
|
};
|
8
|
-
export const
|
9
|
-
return comments
|
20
|
+
export const buildThreads = (comments, newCommentID) => {
|
21
|
+
return comments
|
22
|
+
.filter((c) => !isReply(c)) // Filter out replies
|
23
|
+
.map((c) => ({
|
10
24
|
comment: c,
|
11
25
|
isNew: newCommentID === c.node.attrs.id,
|
12
|
-
|
26
|
+
replies: comments.filter((reply) => reply.node.attrs.target === c.node.attrs.id // Find replies for each comment
|
27
|
+
),
|
13
28
|
}));
|
14
29
|
};
|
15
30
|
export const buildAuthorName = (user) => {
|
@@ -20,4 +35,9 @@ export const buildAuthorName = (user) => {
|
|
20
35
|
.filter(Boolean)
|
21
36
|
.join(' ');
|
22
37
|
};
|
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
|
+
};
|
23
43
|
//# 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":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAW,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAS3D,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,YAAY,GAAG,CAC1B,QAAmB,EACnB,YAAqB,EACX,EAAE;IACZ,OAAO,QAAQ;SACZ,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,qBAAqB;SAChD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACX,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,YAAY,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACvC,OAAO,EAAE,QAAQ,CAAC,MAAM,CACtB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,gCAAgC;SACxF;KACF,CAAC,CAAC,CAAA;AACP,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;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAU,EAAE,CAAU,EAAE,EAAE;IACvD,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAA;IACjE,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAA;IACjE,OAAO,UAAU,GAAG,UAAU,CAAA;AAChC,CAAC,CAAA"}
|
@@ -0,0 +1,25 @@
|
|
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 { Comment, CommentAttrs } from '@manuscripts/body-editor';
|
13
|
+
import React from 'react';
|
14
|
+
interface CommentCardProps {
|
15
|
+
comment: Comment;
|
16
|
+
isReply: boolean;
|
17
|
+
numOfReplies: number;
|
18
|
+
isNew: boolean;
|
19
|
+
isEndOfThread: boolean;
|
20
|
+
onSave: (comment: CommentAttrs) => void;
|
21
|
+
onDelete: (id: string) => void;
|
22
|
+
onSelect: () => void;
|
23
|
+
}
|
24
|
+
export declare const CommentCard: React.FC<CommentCardProps>;
|
25
|
+
export {};
|
@@ -11,12 +11,13 @@
|
|
11
11
|
*/
|
12
12
|
import { CommentAttrs } from '@manuscripts/body-editor';
|
13
13
|
import React from 'react';
|
14
|
-
import {
|
14
|
+
import { Thread } from '../../lib/comments';
|
15
15
|
export interface CommentThreadProps {
|
16
|
-
|
16
|
+
thread: Thread;
|
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;
|
21
22
|
}
|
22
23
|
export declare const CommentThread: React.ForwardRefExoticComponent<CommentThreadProps & React.RefAttributes<HTMLDivElement>>;
|
@@ -0,0 +1,18 @@
|
|
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 React from 'react';
|
13
|
+
interface DeleteCommentConfirmationProps {
|
14
|
+
onCancel: () => void;
|
15
|
+
onConfirm: () => void;
|
16
|
+
}
|
17
|
+
export declare const DeleteCommentConfirmation: React.FC<DeleteCommentConfirmationProps>;
|
18
|
+
export {};
|
@@ -0,0 +1,18 @@
|
|
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 React from 'react';
|
13
|
+
interface ReplyBoxProps {
|
14
|
+
insertCommentReply: (target: string, contents: string) => void;
|
15
|
+
commentID: string;
|
16
|
+
}
|
17
|
+
export declare const ReplyBox: React.FC<ReplyBoxProps>;
|
18
|
+
export {};
|
@@ -11,11 +11,12 @@
|
|
11
11
|
*/
|
12
12
|
import { Comment } from '@manuscripts/body-editor';
|
13
13
|
import { UserProfile } from '@manuscripts/json-schema';
|
14
|
-
export type
|
14
|
+
export type Thread = {
|
15
15
|
comment: Comment;
|
16
16
|
isNew: boolean;
|
17
|
-
|
17
|
+
replies: Comment[];
|
18
18
|
};
|
19
19
|
export declare const getAuthorID: (comment: Comment) => string | undefined;
|
20
|
-
export declare const
|
20
|
+
export declare const buildThreads: (comments: Comment[], newCommentID?: string) => Thread[];
|
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.2.19-LEAN-
|
3
|
+
"version": "3.2.19-LEAN-3894.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.2.20-LEAN-
|
38
|
+
"@manuscripts/body-editor": "2.2.20-LEAN-3894.0",
|
39
39
|
"@manuscripts/json-schema": "2.2.11",
|
40
40
|
"@manuscripts/library": "1.3.11",
|
41
41
|
"@manuscripts/style-guide": "2.0.21",
|