@manuscripts/article-editor 3.2.16 → 3.2.17-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.
Files changed (36) hide show
  1. package/dist/cjs/components/comments/CommentActions.js +6 -2
  2. package/dist/cjs/components/comments/CommentActions.js.map +1 -1
  3. package/dist/cjs/components/comments/CommentCard.js +162 -0
  4. package/dist/cjs/components/comments/CommentCard.js.map +1 -0
  5. package/dist/cjs/components/comments/CommentResolveButton.js +1 -1
  6. package/dist/cjs/components/comments/CommentThread.js +77 -89
  7. package/dist/cjs/components/comments/CommentThread.js.map +1 -1
  8. package/dist/cjs/components/comments/CommentsPanel.js +31 -7
  9. package/dist/cjs/components/comments/CommentsPanel.js.map +1 -1
  10. package/dist/cjs/components/comments/DeleteCommentConfirmation.js +69 -0
  11. package/dist/cjs/components/comments/DeleteCommentConfirmation.js.map +1 -0
  12. package/dist/cjs/components/comments/ReplyBox.js +119 -0
  13. package/dist/cjs/components/comments/ReplyBox.js.map +1 -0
  14. package/dist/cjs/lib/comments.js +14 -5
  15. package/dist/cjs/lib/comments.js.map +1 -1
  16. package/dist/es/components/comments/CommentActions.js +6 -2
  17. package/dist/es/components/comments/CommentActions.js.map +1 -1
  18. package/dist/es/components/comments/CommentCard.js +132 -0
  19. package/dist/es/components/comments/CommentCard.js.map +1 -0
  20. package/dist/es/components/comments/CommentResolveButton.js +1 -1
  21. package/dist/es/components/comments/CommentThread.js +80 -92
  22. package/dist/es/components/comments/CommentThread.js.map +1 -1
  23. package/dist/es/components/comments/CommentsPanel.js +32 -8
  24. package/dist/es/components/comments/CommentsPanel.js.map +1 -1
  25. package/dist/es/components/comments/DeleteCommentConfirmation.js +62 -0
  26. package/dist/es/components/comments/DeleteCommentConfirmation.js.map +1 -0
  27. package/dist/es/components/comments/ReplyBox.js +89 -0
  28. package/dist/es/components/comments/ReplyBox.js.map +1 -0
  29. package/dist/es/lib/comments.js +11 -3
  30. package/dist/es/lib/comments.js.map +1 -1
  31. package/dist/types/components/comments/CommentCard.d.ts +25 -0
  32. package/dist/types/components/comments/CommentThread.d.ts +3 -2
  33. package/dist/types/components/comments/DeleteCommentConfirmation.d.ts +18 -0
  34. package/dist/types/components/comments/ReplyBox.d.ts +18 -0
  35. package/dist/types/lib/comments.d.ts +4 -3
  36. package/package.json +2 -2
@@ -10,12 +10,15 @@
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
12
  import { clearCommentSelection, 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 { buildCommentTrees } from '../../lib/comments';
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,15 @@ 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 }] = useStore((state) => ({
38
41
  view: state.view,
39
42
  newCommentID: state.newCommentID,
40
43
  selectedCommentKey: state.selectedCommentKey,
44
+ user: state.user,
41
45
  }));
42
46
  const [showResolved, setShowResolved] = useState(true);
43
47
  const comments = useMemo(() => view?.state ? commentsKey.getState(view.state)?.comments : undefined, [view?.state]);
44
- const trees = useMemo(() => comments ? buildCommentTrees([...comments.values()], newCommentID) : [], [comments, newCommentID]);
48
+ const threads = useMemo(() => (comments ? buildThreads([...comments.values()], newCommentID) : []), [comments, newCommentID]);
45
49
  const selectedRef = useCallback((e) => {
46
50
  if (e) {
47
51
  scrollIntoView(e);
@@ -66,6 +70,26 @@ export const CommentsPanel = () => {
66
70
  view.focus();
67
71
  view.dispatch(tr);
68
72
  };
73
+ const insertCommentReply = (target, contents) => {
74
+ if (!view) {
75
+ return;
76
+ }
77
+ const attrs = {
78
+ id: generateNodeID(schema.nodes.comment),
79
+ contents,
80
+ target,
81
+ contributions: [buildContribution(user._id)],
82
+ resolved: false,
83
+ };
84
+ const comment = view.state.schema.nodes.comment.create(attrs);
85
+ const comments = findChildrenByType(view.state.doc, view.state.schema.nodes.comments)[0];
86
+ if (comments) {
87
+ const pos = comments.pos + 1;
88
+ const tr = view.state.tr.insert(pos, comment);
89
+ clearCommentSelection(tr);
90
+ view.dispatch(skipTracking(tr));
91
+ }
92
+ };
69
93
  const handleSave = (attrs) => {
70
94
  const comment = comments?.get(attrs.id);
71
95
  if (!comment || !view) {
@@ -86,13 +110,13 @@ export const CommentsPanel = () => {
86
110
  clearCommentSelection(tr);
87
111
  view.dispatch(skipTracking(tr));
88
112
  };
89
- const isSelected = (tree) => {
90
- return tree && selectedCommentKey === tree.comment.key;
113
+ const isSelected = (thread) => {
114
+ return thread && selectedCommentKey === thread.comment.key;
91
115
  };
92
116
  if (!view) {
93
117
  return null;
94
118
  }
95
- if (!trees.length) {
119
+ if (!threads.length) {
96
120
  return React.createElement(CommentsPlaceholder, null);
97
121
  }
98
122
  return (React.createElement(React.Fragment, null,
@@ -100,8 +124,8 @@ export const CommentsPanel = () => {
100
124
  React.createElement(CheckboxLabel, null,
101
125
  React.createElement(CheckboxField, { name: 'show-resolved', checked: showResolved, onChange: (e) => setShowResolved(e.target.checked) }),
102
126
  React.createElement(CheckboxLabelText, null, "See resolved"))),
103
- trees
127
+ threads
104
128
  .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, tree: c, isSelected: isSelected(c), onSelect: () => setSelectedComment(c.comment), onSave: handleSave, onDelete: handleDelete })))));
129
+ .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
130
  };
107
131
  //# 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,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,uBAAuB,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIxB,CAAA;AAED,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA;WACzB,CAAC,KAAK,EAAE,EAAE,C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AM,EAAE;QACnB,OAAO,oBAAC,mBAAmB,OAAG,CAAA;KAC/B;IAED,OAAO,CACL;QACE,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,OAAO;aACL,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,MAAM,EAAE,CAAC,EACT,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,EACtB,kBAAkB,EAAE,kBAAkB,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,89 @@
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
+ setIsTextBoxFocused(false);
29
+ setValue('');
30
+ replyRef.current.value = '';
31
+ replyRef.current.style.height = '30px'; // Reset the height
32
+ }
33
+ };
34
+ const disableSaveButton = useMemo(() => !value.length, [value]);
35
+ const onTextChange = (e) => {
36
+ setValue(e.target.value);
37
+ if (replyRef.current) {
38
+ replyRef.current.style.height = '30px'; // Reset the height
39
+ replyRef.current.style.height = `${Math.min(replyRef.current.scrollHeight, 55)}px`; // Set the height based on content
40
+ }
41
+ };
42
+ return (React.createElement(React.Fragment, null,
43
+ React.createElement(TextBox, { "data-cy": "reply", placeholder: "Reply...", ref: replyRef, onChange: onTextChange, onFocus: handleFocus, onBlur: handleBlur }),
44
+ isTextBoxFocused && (React.createElement(Actions, { "data-cy": "reply-actions" },
45
+ React.createElement(SecondaryButton, { onClick: () => {
46
+ setIsTextBoxFocused(false);
47
+ setValue('');
48
+ if (replyRef.current) {
49
+ replyRef.current.value = '';
50
+ replyRef.current.style.height = '30px'; // Reset the height
51
+ }
52
+ } }, "Cancel"),
53
+ React.createElement(PrimaryButton, { onClick: reply, disabled: disableSaveButton }, "Reply")))));
54
+ };
55
+ const TextBox = styled.textarea `
56
+ cursor: text;
57
+ font-family: ${(props) => props.theme.font.family.sans};
58
+ color: ${(props) => props.theme.colors.text.primary};
59
+ margin: ${(props) => props.theme.grid.unit * 2}px 0;
60
+ resize: none;
61
+
62
+ width: 100%;
63
+
64
+ height: 30px;
65
+ max-height: 55px;
66
+
67
+ outline: 0;
68
+ border: 1px solid #e2e2e2;
69
+ border-radius: 6px;
70
+
71
+ &:focus {
72
+ background: #f2fbfc;
73
+ border: 1px solid #bce7f6;
74
+ border-radius: 6px;
75
+ }
76
+
77
+ box-sizing: border-box;
78
+ padding: 3px 16px 3px 16px;
79
+ font-style: normal;
80
+ font-weight: 400;
81
+ font-size: 14px;
82
+ line-height: 24px;
83
+ `;
84
+ const Actions = styled(ButtonGroup) `
85
+ & button:not(:last-of-type) {
86
+ margin-right: 4px;
87
+ }
88
+ `;
89
+ //# sourceMappingURL=ReplyBox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReplyBox.js","sourceRoot":"","sources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Q,CAAA;;iBAEd,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;;;;;;;;;;;;;;;;;;;;;;;;CAwB/C,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;;;;CAIlC,CAAA"}
@@ -5,11 +5,14 @@ export const getAuthorID = (comment) => {
5
5
  }
6
6
  return contributions[0].profileID;
7
7
  };
8
- export const buildCommentTrees = (comments, newCommentID) => {
9
- return comments.map((c) => ({
8
+ export const buildThreads = (comments, newCommentID) => {
9
+ return comments
10
+ .filter((c) => !c.node.attrs.target.includes('MPCommentAnnotation')) // Filter out replies
11
+ .map((c) => ({
10
12
  comment: c,
11
13
  isNew: newCommentID === c.node.attrs.id,
12
- children: [],
14
+ replies: comments.filter((reply) => reply.node.attrs.target === c.node.attrs.id // Find replies for each comment
15
+ ),
13
16
  }));
14
17
  };
15
18
  export const buildAuthorName = (user) => {
@@ -20,4 +23,9 @@ export const buildAuthorName = (user) => {
20
23
  .filter(Boolean)
21
24
  .join(' ');
22
25
  };
26
+ export const commentsByTime = (a, b) => {
27
+ const aTimestamp = a.node.attrs.contributions?.[0].timestamp || 0;
28
+ const bTimestamp = b.node.attrs.contributions?.[0].timestamp || 0;
29
+ return aTimestamp - bTimestamp;
30
+ };
23
31
  //# sourceMappingURL=comments.js.map
@@ -1 +1 @@
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,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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 { CommentTree } from '../../lib/comments';
14
+ import { Thread } from '../../lib/comments';
15
15
  export interface CommentThreadProps {
16
- tree: CommentTree;
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 CommentTree = {
14
+ export type Thread = {
15
15
  comment: Comment;
16
16
  isNew: boolean;
17
- children: CommentTree[];
17
+ replies: Comment[];
18
18
  };
19
19
  export declare const getAuthorID: (comment: Comment) => string | undefined;
20
- export declare const buildCommentTrees: (comments: Comment[], newCommentID?: string) => CommentTree[];
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.16",
3
+ "version": "3.2.17-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.15",
38
+ "@manuscripts/body-editor": "2.2.16-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",