@manuscripts/article-editor 3.4.3-LEAN-3894.0 → 3.4.3-LEAN-4053.3
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 +88 -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/change-handlers.js +2 -2
- package/dist/cjs/lib/change-handlers.js.map +1 -1
- package/dist/cjs/lib/comments.js +5 -26
- package/dist/cjs/lib/comments.js.map +1 -1
- package/dist/cjs/lib/node-content-retriever.js +17 -24
- package/dist/cjs/lib/node-content-retriever.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 +91 -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/change-handlers.js +2 -2
- package/dist/es/lib/change-handlers.js.map +1 -1
- package/dist/es/lib/comments.js +3 -23
- package/dist/es/lib/comments.js.map +1 -1
- package/dist/es/lib/node-content-retriever.js +18 -25
- package/dist/es/lib/node-content-retriever.js.map +1 -1
- package/dist/types/components/comments/CommentThread.d.ts +2 -3
- package/dist/types/lib/comments.d.ts +3 -4
- package/dist/types/lib/node-content-retriever.d.ts +2 -6
- package/package.json +5 -5
- 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 -115
- 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 -85
- 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
@@ -9,7 +9,7 @@
|
|
9
9
|
*
|
10
10
|
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
|
11
11
|
*/
|
12
|
-
import { bibliographyPluginKey,
|
12
|
+
import { bibliographyPluginKey, findNodeByID, getFootnoteLabel, metadata, objectsPluginKey, } from '@manuscripts/body-editor';
|
13
13
|
import { isElementNodeType, isSectionNodeType, schema, } from '@manuscripts/transform';
|
14
14
|
import domPurify from 'dompurify';
|
15
15
|
export class NodeTextContentRetriever {
|
@@ -87,37 +87,30 @@ export class NodeTextContentRetriever {
|
|
87
87
|
const target = pluginState?.get(node.attrs.id);
|
88
88
|
return target?.label || '';
|
89
89
|
}
|
90
|
-
/**
|
91
|
-
* Finds a footnote node by its ID.
|
92
|
-
*/
|
93
|
-
findFootnoteById(doc, id) {
|
94
|
-
let footnoteNode = null;
|
95
|
-
doc.descendants((node) => {
|
96
|
-
if (node.type === schema.nodes.footnote && node.attrs.id === id) {
|
97
|
-
footnoteNode = node;
|
98
|
-
return false;
|
99
|
-
}
|
100
|
-
return !footnoteNode;
|
101
|
-
});
|
102
|
-
return footnoteNode;
|
103
|
-
}
|
104
90
|
/**
|
105
91
|
* Retrieves the inline footnote content.
|
106
92
|
*/
|
107
|
-
getInlineFootnoteContent(
|
108
|
-
const
|
109
|
-
|
110
|
-
|
111
|
-
|
93
|
+
getInlineFootnoteContent(state, attrs) {
|
94
|
+
const rid = attrs.rids[0];
|
95
|
+
if (!rid) {
|
96
|
+
return '';
|
97
|
+
}
|
98
|
+
//@ts-ignore
|
99
|
+
const footnote = findNodeByID(state.doc, rid).node;
|
100
|
+
if (!footnote) {
|
101
|
+
return '';
|
102
|
+
}
|
103
|
+
const label = getFootnoteLabel(state, footnote);
|
104
|
+
const text = footnote.textContent ?? '';
|
105
|
+
return `<sup class="footnote-decoration">${label}</sup>${text}`;
|
112
106
|
}
|
113
107
|
/**
|
114
108
|
* Retrieves the text content of a footnote node with decoration.
|
115
109
|
*/
|
116
|
-
getFootnoteContent(node) {
|
117
|
-
const
|
118
|
-
const
|
119
|
-
|
120
|
-
return `<sup class="footnote-decoration">${decorationText}</sup>${node.textContent || this.getNodeTextContent(node)}`;
|
110
|
+
getFootnoteContent(state, node) {
|
111
|
+
const label = getFootnoteLabel(state, node);
|
112
|
+
const text = node.textContent ?? '';
|
113
|
+
return `<sup class="footnote-decoration">${label}</sup>${text}`;
|
121
114
|
}
|
122
115
|
}
|
123
116
|
//# sourceMappingURL=node-content-retriever.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"node-content-retriever.js","sourceRoot":"","sources":["../../../src/lib/node-content-retriever.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAEL,qBAAqB,EACrB,
|
1
|
+
{"version":3,"file":"node-content-retriever.js","sourceRoot":"","sources":["../../../src/lib/node-content-retriever.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAEL,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR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;QACnC,OAAO,oCAAoC,KAAK,SAAS,IAAI,EAAE,CAAA;IACjE,CAAC;CACF"}
|
@@ -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;
|
@@ -22,16 +22,12 @@ export declare class NodeTextContentRetriever {
|
|
22
22
|
* Retrieves the label of a figure node.
|
23
23
|
*/
|
24
24
|
getFigureLabel(node: ManuscriptNode): string;
|
25
|
-
/**
|
26
|
-
* Finds a footnote node by its ID.
|
27
|
-
*/
|
28
|
-
private findFootnoteById;
|
29
25
|
/**
|
30
26
|
* Retrieves the inline footnote content.
|
31
27
|
*/
|
32
|
-
getInlineFootnoteContent(
|
28
|
+
getInlineFootnoteContent(state: ManuscriptEditorState, attrs: Record<any, any>): string;
|
33
29
|
/**
|
34
30
|
* Retrieves the text content of a footnote node with decoration.
|
35
31
|
*/
|
36
|
-
getFootnoteContent(node: ManuscriptNode): string;
|
32
|
+
getFootnoteContent(state: ManuscriptEditorState, node: ManuscriptNode): string;
|
37
33
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@manuscripts/article-editor",
|
3
|
-
"version": "3.4.3-LEAN-
|
3
|
+
"version": "3.4.3-LEAN-4053.3",
|
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,12 +35,12 @@
|
|
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.3-LEAN-
|
38
|
+
"@manuscripts/body-editor": "2.5.3-LEAN-4053.2",
|
39
39
|
"@manuscripts/json-schema": "2.2.11",
|
40
40
|
"@manuscripts/library": "1.3.11",
|
41
41
|
"@manuscripts/style-guide": "2.0.21",
|
42
|
-
"@manuscripts/track-changes-plugin": "1.8.0",
|
43
|
-
"@manuscripts/transform": "3.0.
|
42
|
+
"@manuscripts/track-changes-plugin": "1.8.1-LEAN-4053.0",
|
43
|
+
"@manuscripts/transform": "3.0.10-LEAN-4053.1",
|
44
44
|
"@popperjs/core": "^2.11.8",
|
45
45
|
"@reach/tabs": "^0.18.0",
|
46
46
|
"@types/use-sync-external-store": "^0.0.6",
|
@@ -108,4 +108,4 @@
|
|
108
108
|
"resolutions": {
|
109
109
|
"@types/react": "^18.3.1"
|
110
110
|
}
|
111
|
-
}
|
111
|
+
}
|
@@ -1,165 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
-
};
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
exports.CommentCard = void 0;
|
30
|
-
const style_guide_1 = require("@manuscripts/style-guide");
|
31
|
-
const react_1 = __importStar(require("react"));
|
32
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
33
|
-
const comments_1 = require("../../lib/comments");
|
34
|
-
const store_1 = require("../../store");
|
35
|
-
const CommentActions_1 = require("./CommentActions");
|
36
|
-
const CommentBody_1 = require("./CommentBody");
|
37
|
-
const DeleteCommentConfirmation_1 = require("./DeleteCommentConfirmation");
|
38
|
-
const CommentHeader = styled_components_1.default.div `
|
39
|
-
display: flex;
|
40
|
-
justify-content: space-between;
|
41
|
-
margin-bottom: 8px;
|
42
|
-
`;
|
43
|
-
const CommentMetadata = styled_components_1.default.div `
|
44
|
-
display: flex;
|
45
|
-
align-items: center;
|
46
|
-
padding-right: 8px;
|
47
|
-
`;
|
48
|
-
const AuthorContainer = styled_components_1.default.div `
|
49
|
-
display: flex;
|
50
|
-
color: #353535;
|
51
|
-
font-weight: 400;
|
52
|
-
max-width: 200px;
|
53
|
-
white-space: nowrap;
|
54
|
-
overflow: hidden;
|
55
|
-
flex-grow: 1;
|
56
|
-
text-overflow: ellipsis;
|
57
|
-
margin-right: 8px;
|
58
|
-
|
59
|
-
svg {
|
60
|
-
padding-right: 10px;
|
61
|
-
flex-shrink: 0;
|
62
|
-
}
|
63
|
-
`;
|
64
|
-
const CommentTarget = styled_components_1.default.div `
|
65
|
-
font-size: 14px;
|
66
|
-
color: #353535;
|
67
|
-
background-color: #ffeebf;
|
68
|
-
padding: 4px 8px;
|
69
|
-
margin-top: 16px;
|
70
|
-
margin-bottom: 16px;
|
71
|
-
`;
|
72
|
-
const Timestamp = (0, styled_components_1.default)(style_guide_1.RelativeDate) `
|
73
|
-
font-size: 12px;
|
74
|
-
line-height: 16px;
|
75
|
-
font-weight: 400;
|
76
|
-
color: #6e6e6e;
|
77
|
-
white-space: nowrap;
|
78
|
-
padding-right: 8px;
|
79
|
-
`;
|
80
|
-
const RepliesCount = styled_components_1.default.div `
|
81
|
-
border-radius: 50%;
|
82
|
-
width: 12px;
|
83
|
-
height: 12px;
|
84
|
-
color: #ffffff;
|
85
|
-
background-color: #1a9bc7;
|
86
|
-
text-align: center;
|
87
|
-
font-size: 9px;
|
88
|
-
`;
|
89
|
-
const Card = styled_components_1.default.div `
|
90
|
-
position: relative;
|
91
|
-
`;
|
92
|
-
const CommentCard = ({ comment, isReply, numOfReplies, isNew, isEndOfThread, editingCommentId, setEditingCommentId, onSave, onDelete, onSelect, }) => {
|
93
|
-
const can = (0, style_guide_1.usePermissions)();
|
94
|
-
const [{ user, collaboratorsById }] = (0, store_1.useStore)((state) => ({
|
95
|
-
user: state.user,
|
96
|
-
collaboratorsById: state.collaboratorsById,
|
97
|
-
}));
|
98
|
-
const authorID = (0, comments_1.getAuthorID)(comment);
|
99
|
-
const authorName = authorID
|
100
|
-
? (0, comments_1.buildAuthorName)(collaboratorsById.get(authorID))
|
101
|
-
: '';
|
102
|
-
const timestamp = comment.node.attrs.contributions?.[0].timestamp;
|
103
|
-
const isOwn = authorID === user._id;
|
104
|
-
const isResolveEnabled = isOwn
|
105
|
-
? can.resolveOwnComment
|
106
|
-
: can.resolveOthersComment;
|
107
|
-
const isActionsEnabled = isOwn
|
108
|
-
? can.handleOwnComments
|
109
|
-
: can.handleOthersComments;
|
110
|
-
const commentID = comment.node.attrs.id;
|
111
|
-
const [showDeleteConfirmation, setShowDeleteConfirmation] = (0, react_1.useState)(false);
|
112
|
-
const handleEdit = () => {
|
113
|
-
setEditingCommentId(commentID);
|
114
|
-
onSelect();
|
115
|
-
};
|
116
|
-
const handleSave = (contents) => {
|
117
|
-
onSave({
|
118
|
-
...comment.node.attrs,
|
119
|
-
contents,
|
120
|
-
});
|
121
|
-
setEditingCommentId(null);
|
122
|
-
};
|
123
|
-
const handleCancel = () => {
|
124
|
-
setEditingCommentId(null);
|
125
|
-
if (isNew) {
|
126
|
-
onDelete(commentID);
|
127
|
-
}
|
128
|
-
};
|
129
|
-
const handleToggleResolve = () => {
|
130
|
-
onSave({
|
131
|
-
...comment.node.attrs,
|
132
|
-
resolved: !comment.node.attrs.resolved,
|
133
|
-
});
|
134
|
-
};
|
135
|
-
const handleDelete = () => {
|
136
|
-
setShowDeleteConfirmation(true);
|
137
|
-
onSelect();
|
138
|
-
};
|
139
|
-
const confirmDelete = () => {
|
140
|
-
onDelete(commentID);
|
141
|
-
setShowDeleteConfirmation(false);
|
142
|
-
};
|
143
|
-
const cancelDelete = () => {
|
144
|
-
setShowDeleteConfirmation(false);
|
145
|
-
};
|
146
|
-
return (react_1.default.createElement(Card, null,
|
147
|
-
react_1.default.createElement(CommentHeader, { "data-cy": "comment-header" },
|
148
|
-
react_1.default.createElement(CommentMetadata, null,
|
149
|
-
react_1.default.createElement(AuthorContainer, null, authorName ? (react_1.default.createElement(react_1.default.Fragment, null,
|
150
|
-
react_1.default.createElement(style_guide_1.AvatarIcon, { width: 20, height: 20 }),
|
151
|
-
react_1.default.createElement(react_1.default.Fragment, null, authorName))) : (!isReply && (react_1.default.createElement(react_1.default.Fragment, null,
|
152
|
-
react_1.default.createElement(style_guide_1.SystemUserAvatarIcon, { width: 20, height: 20 }),
|
153
|
-
react_1.default.createElement(react_1.default.Fragment, null, "System"))))),
|
154
|
-
timestamp && react_1.default.createElement(Timestamp, { date: timestamp * 1000 }),
|
155
|
-
numOfReplies !== 0 && react_1.default.createElement(RepliesCount, null,
|
156
|
-
" ",
|
157
|
-
numOfReplies,
|
158
|
-
" ")),
|
159
|
-
react_1.default.createElement(CommentActions_1.CommentActions, { comment: comment, isResolveEnabled: isResolveEnabled && !isReply, isActionsEnabled: isActionsEnabled && isEndOfThread, onDelete: handleDelete, onEdit: handleEdit, toggleResolve: handleToggleResolve })),
|
160
|
-
comment.node.attrs.originalText && (react_1.default.createElement(CommentTarget, null, comment.node.attrs.originalText)),
|
161
|
-
react_1.default.createElement(CommentBody_1.CommentBody, { comment: comment, isEditing: editingCommentId === commentID, onSave: handleSave, onCancel: handleCancel, onSelect: onSelect }),
|
162
|
-
showDeleteConfirmation && (react_1.default.createElement(DeleteCommentConfirmation_1.DeleteCommentConfirmation, { isReply: isReply, onCancel: cancelDelete, onConfirm: confirmDelete }))));
|
163
|
-
};
|
164
|
-
exports.CommentCard = CommentCard;
|
165
|
-
//# sourceMappingURL=CommentCard.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"CommentCard.js","sourceRoot":"","sources":["../../../../src/components/comments/CommentCard.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,0DAKiC;AACjC,+CAAuC;AACvC,0EAAsC;AAEtC,iDAAiE;A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,yBAAW,IACV,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,gBAAgB,KAAK,SAAS,EACzC,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,QAAQ,GAClB;QACD,sBAAsB,IAAI,CACzB,8BAAC,qDAAyB,IACxB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,aAAa,GACxB,CACH,CACI,CACR,CAAA;AACH,CAAC,CAAA;AAhIY,QAAA,WAAW,eAgIvB"}
|
@@ -1,115 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/*!
|
3
|
-
* 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.
|
4
|
-
*
|
5
|
-
* 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.
|
6
|
-
*
|
7
|
-
* The Original Code is manuscripts-frontend.
|
8
|
-
*
|
9
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
10
|
-
*
|
11
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
|
12
|
-
*/
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
14
|
-
if (k2 === undefined) k2 = k;
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
18
|
-
}
|
19
|
-
Object.defineProperty(o, k2, desc);
|
20
|
-
}) : (function(o, m, k, k2) {
|
21
|
-
if (k2 === undefined) k2 = k;
|
22
|
-
o[k2] = m[k];
|
23
|
-
}));
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
26
|
-
}) : function(o, v) {
|
27
|
-
o["default"] = v;
|
28
|
-
});
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
30
|
-
if (mod && mod.__esModule) return mod;
|
31
|
-
var result = {};
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
33
|
-
__setModuleDefault(result, mod);
|
34
|
-
return result;
|
35
|
-
};
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
38
|
-
};
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
40
|
-
exports.DeleteCommentConfirmation = void 0;
|
41
|
-
const style_guide_1 = require("@manuscripts/style-guide");
|
42
|
-
const react_1 = __importStar(require("react"));
|
43
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
44
|
-
const MessageContainer = styled_components_1.default.div `
|
45
|
-
display: flex;
|
46
|
-
align-items: center;
|
47
|
-
flex-grow: 1;
|
48
|
-
|
49
|
-
svg {
|
50
|
-
padding-left: 14px;
|
51
|
-
}
|
52
|
-
`;
|
53
|
-
const CancelButton = (0, styled_components_1.default)(style_guide_1.SecondaryButton) `
|
54
|
-
padding: 4px ${(props) => props.theme.grid.unit * 3}px;
|
55
|
-
font-size: 14px;
|
56
|
-
`;
|
57
|
-
const DeleteButton = (0, styled_components_1.default)(style_guide_1.PrimaryButton) `
|
58
|
-
padding: 4px ${(props) => props.theme.grid.unit * 3}px;
|
59
|
-
margin-right: 16px;
|
60
|
-
font-size: 14px;
|
61
|
-
`;
|
62
|
-
const Message = styled_components_1.default.div `
|
63
|
-
font-weight: 700;
|
64
|
-
color: #000;
|
65
|
-
font-size: 14px;
|
66
|
-
line-height: 16px;
|
67
|
-
margin: 0 8px;
|
68
|
-
`;
|
69
|
-
const DeleteConfirmation = styled_components_1.default.div `
|
70
|
-
border-top: 1px solid #e2e2e2;
|
71
|
-
border-bottom: 1px solid #e2e2e2;
|
72
|
-
box-shadow: 0px 4px 9px 0px rgba(0, 0, 0, 0.3);
|
73
|
-
position: absolute;
|
74
|
-
top: -9px;
|
75
|
-
left: ${(props) => (props.isReply ? '-24px' : '-8px')};
|
76
|
-
right: -8px;
|
77
|
-
bottom: -16px;
|
78
|
-
opacity: 0.95;
|
79
|
-
display: flex;
|
80
|
-
align-items: center;
|
81
|
-
justify-content: center;
|
82
|
-
background: #fafafa;
|
83
|
-
z-index: 10;
|
84
|
-
`;
|
85
|
-
const Buttons = (0, styled_components_1.default)(style_guide_1.ButtonGroup) `
|
86
|
-
& button:not(:last-of-type) {
|
87
|
-
margin-right: 4px;
|
88
|
-
}
|
89
|
-
`;
|
90
|
-
const DeleteCommentConfirmation = ({ isReply, onCancel, onConfirm }) => {
|
91
|
-
const deleteConfirmationRef = (0, react_1.useRef)(null);
|
92
|
-
(0, react_1.useEffect)(() => {
|
93
|
-
const handleClickOutside = (e) => {
|
94
|
-
if (e.target &&
|
95
|
-
deleteConfirmationRef.current &&
|
96
|
-
!deleteConfirmationRef.current.contains(e.target) &&
|
97
|
-
!e.target.closest('.delete-button')) {
|
98
|
-
onCancel();
|
99
|
-
}
|
100
|
-
};
|
101
|
-
document.addEventListener('click', handleClickOutside);
|
102
|
-
return () => {
|
103
|
-
document.removeEventListener('click', handleClickOutside);
|
104
|
-
};
|
105
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
106
|
-
return (react_1.default.createElement(DeleteConfirmation, { isReply: isReply, ref: deleteConfirmationRef },
|
107
|
-
react_1.default.createElement(MessageContainer, null,
|
108
|
-
react_1.default.createElement(style_guide_1.AttentionOrangeIcon, null),
|
109
|
-
react_1.default.createElement(Message, null, "Delete this comment?")),
|
110
|
-
react_1.default.createElement(Buttons, null,
|
111
|
-
react_1.default.createElement(CancelButton, { onClick: onCancel }, "Cancel"),
|
112
|
-
react_1.default.createElement(DeleteButton, { onClick: onConfirm }, "Delete"))));
|
113
|
-
};
|
114
|
-
exports.DeleteCommentConfirmation = DeleteCommentConfirmation;
|
115
|
-
//# sourceMappingURL=DeleteCommentConfirmation.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"DeleteCommentConfirmation.js","sourceRoot":"","sources":["../../../../src/components/comments/DeleteCommentConfirmation.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,0DAKiC;AACjC,+CAAgD;AAChD,0EAAsC;AAEtC,MAAM,gBAAgB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;;CAQlC,CAAA;AAED,MAAM,YAAY,GAAG,IAAA,2BAAM,EAAC,6BAAe,CAAC,CAAA;iBAC3B,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;;CAEpD,CAAA;AACD,MAAM,YAAY,GAAG,IAAA,2BAAM,EAAC,2BAAa,CAAC,CAAA;iBACzB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;;;CAGpD,CAAA;AACD,MAAM,OAAO,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;CAMzB,CAAA;AAED,MAAM,kBAAkB,GAAG,2BAAM,CAAC,GAAG,CAAuB;;;;;;UAMlD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;;;;;;;;;CAStD,CAAA;AAED,MAAM,OAAO,GAAG,IAAA,2BAAM,EAAC,yBAAW,CAAC,CAAA;;;;CAIlC,CAAA;AAQM,MAAM,yBAAyB,GAElC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;IACvC,MAAM,qBAAqB,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAA;IAE1D,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,kBAAkB,GAAG,CAAC,CAAa,EAAE,EAAE;YAC3C,IACE,CAAC,CAAC,MAAM;gBACR,qBAAqB,CAAC,OAAO;gBAC7B,CAAC,qBAAqB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAqB,CAAC;gBAChE,CAAE,CAAC,CAAC,MAAsB,CAAC,OAAO,CAAC,gBAAgB,CAAC,EACpD;gBACA,QAAQ,EAAE,CAAA;aACX;QACH,CAAC,CAAA;QACD,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAA;QACtD,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAA;QAC3D,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA,CAAC,kDAAkD;IAEzD,OAAO,CACL,8BAAC,kBAAkB,IAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,qBAAqB;QAC9D,8BAAC,gBAAgB;YACf,8BAAC,iCAAmB,OAAG;YACvB,8BAAC,OAAO,+BAA+B,CACtB;QACnB,8BAAC,OAAO;YACN,8BAAC,YAAY,IAAC,OAAO,EAAE,QAAQ,aAAuB;YACtD,8BAAC,YAAY,IAAC,OAAO,EAAE,SAAS,aAAuB,CAC/C,CACS,CACtB,CAAA;AACH,CAAC,CAAA;AAlCY,QAAA,yBAAyB,6BAkCrC"}
|
@@ -1,121 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/*!
|
3
|
-
* 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.
|
4
|
-
*
|
5
|
-
* 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.
|
6
|
-
*
|
7
|
-
* The Original Code is manuscripts-frontend.
|
8
|
-
*
|
9
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
10
|
-
*
|
11
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
|
12
|
-
*/
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
14
|
-
if (k2 === undefined) k2 = k;
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
18
|
-
}
|
19
|
-
Object.defineProperty(o, k2, desc);
|
20
|
-
}) : (function(o, m, k, k2) {
|
21
|
-
if (k2 === undefined) k2 = k;
|
22
|
-
o[k2] = m[k];
|
23
|
-
}));
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
26
|
-
}) : function(o, v) {
|
27
|
-
o["default"] = v;
|
28
|
-
});
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
30
|
-
if (mod && mod.__esModule) return mod;
|
31
|
-
var result = {};
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
33
|
-
__setModuleDefault(result, mod);
|
34
|
-
return result;
|
35
|
-
};
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
38
|
-
};
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
40
|
-
exports.ReplyBox = void 0;
|
41
|
-
const style_guide_1 = require("@manuscripts/style-guide");
|
42
|
-
const react_1 = __importStar(require("react"));
|
43
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
44
|
-
const ReplyBox = ({ insertCommentReply, commentID, }) => {
|
45
|
-
const [isTextBoxFocused, setIsTextBoxFocused] = (0, react_1.useState)(false);
|
46
|
-
const [value, setValue] = (0, react_1.useState)('');
|
47
|
-
const replyRef = (0, react_1.useRef)(null);
|
48
|
-
const handleFocus = () => setIsTextBoxFocused(true);
|
49
|
-
const reply = () => {
|
50
|
-
if (replyRef.current) {
|
51
|
-
insertCommentReply(commentID, replyRef.current.value);
|
52
|
-
setValue('');
|
53
|
-
replyRef.current.value = '';
|
54
|
-
replyRef.current.style.height = '30px'; // Reset the height
|
55
|
-
}
|
56
|
-
};
|
57
|
-
const handleCancel = () => {
|
58
|
-
setIsTextBoxFocused(false);
|
59
|
-
setValue('');
|
60
|
-
if (replyRef.current) {
|
61
|
-
replyRef.current.value = '';
|
62
|
-
replyRef.current.style.height = '30px'; // Reset the height
|
63
|
-
}
|
64
|
-
};
|
65
|
-
const disableSaveButton = (0, react_1.useMemo)(() => !value.length, [value]);
|
66
|
-
const onTextChange = (e) => {
|
67
|
-
setValue(e.target.value);
|
68
|
-
if (replyRef.current) {
|
69
|
-
replyRef.current.style.height = '30px'; // Reset the height
|
70
|
-
replyRef.current.style.height = `${Math.min(replyRef.current.scrollHeight, 55)}px`; // Set the height based on content
|
71
|
-
}
|
72
|
-
};
|
73
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
74
|
-
react_1.default.createElement(TextBox, { "data-cy": "reply", placeholder: "Reply...", ref: replyRef, onChange: onTextChange, onFocus: handleFocus }),
|
75
|
-
isTextBoxFocused && (react_1.default.createElement(Actions, { "data-cy": "reply-actions" },
|
76
|
-
react_1.default.createElement(style_guide_1.TertiaryButton, { onClick: handleCancel }, "Cancel"),
|
77
|
-
react_1.default.createElement(style_guide_1.PrimaryButton, { onClick: reply, disabled: disableSaveButton }, "Reply")))));
|
78
|
-
};
|
79
|
-
exports.ReplyBox = ReplyBox;
|
80
|
-
const TextBox = styled_components_1.default.textarea `
|
81
|
-
cursor: text;
|
82
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
83
|
-
color: ${(props) => props.theme.colors.text.primary};
|
84
|
-
margin: ${(props) => props.theme.grid.unit * 2}px 0;
|
85
|
-
resize: none;
|
86
|
-
|
87
|
-
width: 100%;
|
88
|
-
|
89
|
-
height: 30px;
|
90
|
-
max-height: 55px;
|
91
|
-
|
92
|
-
outline: 0;
|
93
|
-
border: 1px solid #e2e2e2;
|
94
|
-
border-radius: 6px;
|
95
|
-
|
96
|
-
&:focus {
|
97
|
-
background: #f2fbfc;
|
98
|
-
border: 1px solid #bce7f6;
|
99
|
-
border-radius: 6px;
|
100
|
-
}
|
101
|
-
|
102
|
-
box-sizing: border-box;
|
103
|
-
padding: 3px 16px 3px 16px;
|
104
|
-
font-style: normal;
|
105
|
-
font-weight: 400;
|
106
|
-
font-size: 14px;
|
107
|
-
line-height: 24px;
|
108
|
-
overflow: hidden;
|
109
|
-
`;
|
110
|
-
const Actions = (0, styled_components_1.default)(style_guide_1.ButtonGroup) `
|
111
|
-
& button:not(:last-of-type) {
|
112
|
-
margin-right: 4px;
|
113
|
-
}
|
114
|
-
& ${style_guide_1.TertiaryButton} {
|
115
|
-
&:hover {
|
116
|
-
background-color: inherit !important;
|
117
|
-
border-color: transparent !important;
|
118
|
-
}
|
119
|
-
}
|
120
|
-
`;
|
121
|
-
//# sourceMappingURL=ReplyBox.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ReplyBox.js","sourceRoot":"","sources":["../../../../src/components/comments/ReplyBox.tsx"],"names":[],"mappings":";AAAA;;;;;;;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