@manuscripts/body-editor 1.11.0 → 1.11.1
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/authors/AuthorActions.js +1 -1
- package/dist/cjs/components/authors/AuthorAffiliations.js +1 -1
- package/dist/cjs/components/authors/AuthorList.js +1 -1
- package/dist/cjs/components/authors/AuthorsModal.js +2 -2
- package/dist/cjs/components/authors/DraggableAuthor.js +14 -7
- package/dist/es/components/authors/AuthorActions.js +1 -1
- package/dist/es/components/authors/AuthorAffiliations.js +1 -1
- package/dist/es/components/authors/AuthorList.js +1 -1
- package/dist/es/components/authors/AuthorsModal.js +2 -2
- package/dist/es/components/authors/DraggableAuthor.js +14 -7
- package/package.json +2 -2
|
@@ -47,7 +47,7 @@ const StyledButtonGroup = (0, styled_components_1.default)(style_guide_1.ButtonG
|
|
|
47
47
|
`;
|
|
48
48
|
const AuthorActions = ({ author, onSave, onDelete, onCancel, }) => {
|
|
49
49
|
const [showDeleteDialog, setShowDeleteDialog] = (0, react_1.useState)(false);
|
|
50
|
-
return (react_1.default.createElement(AuthorActionsContainer,
|
|
50
|
+
return (react_1.default.createElement(AuthorActionsContainer, { "data-cy": "author-action" },
|
|
51
51
|
react_1.default.createElement(DeleteAuthorConfirmationDialog_1.DeleteAuthorConfirmationDialog, { author: author, isOpen: showDeleteDialog, onDelete: () => {
|
|
52
52
|
setShowDeleteDialog(true);
|
|
53
53
|
onDelete();
|
|
@@ -109,7 +109,7 @@ const AuthorAffiliations = ({ author, affiliations, onSave, onAdd, onRemove, })
|
|
|
109
109
|
onSave(affiliation);
|
|
110
110
|
onAdd(affiliation);
|
|
111
111
|
};
|
|
112
|
-
return (react_1.default.createElement(
|
|
112
|
+
return (react_1.default.createElement("div", { "data-cy": "affiliations-editor" },
|
|
113
113
|
authorAffiliations.map((a) => (react_1.default.createElement(AffiliationButton_1.AffiliationButton, { key: `${author.id}-${a.id}`, affiliation: a, onSave: onSave, onRemove: () => onRemove(a) }))),
|
|
114
114
|
react_1.default.createElement(creatable_1.default, { options: options, isMulti: false, isClearable: true, value: null, inputValue: searchText, components: {
|
|
115
115
|
IndicatorsContainer: exports.AddAffiliationIndicator,
|
|
@@ -30,7 +30,7 @@ const AuthorListContainer = styled_components_1.default.div `
|
|
|
30
30
|
`;
|
|
31
31
|
const AuthorList = ({ author, authors, onSelect, moveAuthor, }) => {
|
|
32
32
|
return (react_1.default.createElement(react_dnd_1.DndProvider, { backend: react_dnd_html5_backend_1.HTML5Backend },
|
|
33
|
-
react_1.default.createElement(AuthorListContainer,
|
|
33
|
+
react_1.default.createElement(AuthorListContainer, { "data-cy": "authors-list" }, authors.map((a) => {
|
|
34
34
|
return (react_1.default.createElement(DraggableAuthor_1.DraggableAuthor, { key: a.id, author: a, isSelected: a.id === (author === null || author === void 0 ? void 0 : author.id), onClick: () => onSelect(a), moveAuthor: moveAuthor }));
|
|
35
35
|
}))));
|
|
36
36
|
};
|
|
@@ -221,11 +221,11 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
|
|
|
221
221
|
react_1.default.createElement(style_guide_1.ModalSidebarHeader, null,
|
|
222
222
|
react_1.default.createElement(style_guide_1.ModalSidebarTitle, null, "Authors")),
|
|
223
223
|
react_1.default.createElement(style_guide_1.SidebarContent, null,
|
|
224
|
-
react_1.default.createElement(AddAuthorButton, { onClick: handleAddAuthor },
|
|
224
|
+
react_1.default.createElement(AddAuthorButton, { "data-cy": "add-author-button", onClick: handleAddAuthor },
|
|
225
225
|
react_1.default.createElement(style_guide_1.AddIcon, { width: 40, height: 40 }),
|
|
226
226
|
react_1.default.createElement(ActionTitle, null, "Add Author")),
|
|
227
227
|
react_1.default.createElement(AuthorList_1.AuthorList, { author: selection, authors: authors, onSelect: handleSelect, moveAuthor: handleMoveAuthor }))),
|
|
228
|
-
react_1.default.createElement(style_guide_1.ScrollableModalContent,
|
|
228
|
+
react_1.default.createElement(style_guide_1.ScrollableModalContent, { "data-cy": "author-modal-content" }, selection ? (react_1.default.createElement(AuthorForms, null,
|
|
229
229
|
react_1.default.createElement(SaveAuthorConfirmationDialog_1.SaveAuthorConfirmationDialog, { isOpen: showConfirmationDialog, onSave: () => handleSaveAuthor(valuesRef.current), onCancel: handleResetAuthor }),
|
|
230
230
|
react_1.default.createElement(AuthorActions_1.AuthorActions, { author: selection, onSave: () => handleSaveAuthor(valuesRef.current), onDelete: handleDeleteAuthor, onCancel: () => setOpen(false) }),
|
|
231
231
|
react_1.default.createElement(FormLabel, null, "Details"),
|
|
@@ -142,15 +142,22 @@ const DraggableAuthor = ({ author, isSelected, onClick, moveAuthor, }) => {
|
|
|
142
142
|
}),
|
|
143
143
|
});
|
|
144
144
|
dragRef(dropRef(ref));
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
145
|
+
const classes = [];
|
|
146
|
+
if (isDragging) {
|
|
147
|
+
classes.push('dragging');
|
|
148
|
+
}
|
|
149
|
+
if (isOver && dropSide) {
|
|
150
|
+
classes.push(`drop-${dropSide}`);
|
|
151
|
+
}
|
|
152
|
+
if (isSelected) {
|
|
153
|
+
classes.push('active');
|
|
154
|
+
}
|
|
155
|
+
return (react_1.default.createElement(AuthorContainer, { ref: ref, className: classes.join(' '), onClick: onClick, "data-cy": "author-item" },
|
|
156
|
+
react_1.default.createElement(AvatarContainer, { "data-cy": "author-avatar" },
|
|
150
157
|
react_1.default.createElement(style_guide_1.Avatar, { size: 36, color: '#6e6e6e' }),
|
|
151
|
-
react_1.default.createElement(AuthorNotes,
|
|
158
|
+
react_1.default.createElement(AuthorNotes, { "data-cy": "author-notes" }, author.isCorresponding && (react_1.default.createElement(AuthorBadge, null,
|
|
152
159
|
react_1.default.createElement(style_guide_1.CorrespondingAuthorIcon, null))))),
|
|
153
|
-
react_1.default.createElement(AuthorName,
|
|
160
|
+
react_1.default.createElement(AuthorName, { "data-cy": "author-name" }, (0, authors_1.authorLabel)(author)),
|
|
154
161
|
isSelected && react_1.default.createElement(DragHandle, null)));
|
|
155
162
|
};
|
|
156
163
|
exports.DraggableAuthor = DraggableAuthor;
|
|
@@ -18,7 +18,7 @@ const StyledButtonGroup = styled(ButtonGroup) `
|
|
|
18
18
|
`;
|
|
19
19
|
export const AuthorActions = ({ author, onSave, onDelete, onCancel, }) => {
|
|
20
20
|
const [showDeleteDialog, setShowDeleteDialog] = useState(false);
|
|
21
|
-
return (React.createElement(AuthorActionsContainer,
|
|
21
|
+
return (React.createElement(AuthorActionsContainer, { "data-cy": "author-action" },
|
|
22
22
|
React.createElement(DeleteAuthorConfirmationDialog, { author: author, isOpen: showDeleteDialog, onDelete: () => {
|
|
23
23
|
setShowDeleteDialog(true);
|
|
24
24
|
onDelete();
|
|
@@ -79,7 +79,7 @@ export const AuthorAffiliations = ({ author, affiliations, onSave, onAdd, onRemo
|
|
|
79
79
|
onSave(affiliation);
|
|
80
80
|
onAdd(affiliation);
|
|
81
81
|
};
|
|
82
|
-
return (React.createElement(
|
|
82
|
+
return (React.createElement("div", { "data-cy": "affiliations-editor" },
|
|
83
83
|
authorAffiliations.map((a) => (React.createElement(AffiliationButton, { key: `${author.id}-${a.id}`, affiliation: a, onSave: onSave, onRemove: () => onRemove(a) }))),
|
|
84
84
|
React.createElement(CreatableSelect, { options: options, isMulti: false, isClearable: true, value: null, inputValue: searchText, components: {
|
|
85
85
|
IndicatorsContainer: AddAffiliationIndicator,
|
|
@@ -24,7 +24,7 @@ const AuthorListContainer = styled.div `
|
|
|
24
24
|
`;
|
|
25
25
|
export const AuthorList = ({ author, authors, onSelect, moveAuthor, }) => {
|
|
26
26
|
return (React.createElement(DndProvider, { backend: HTML5Backend },
|
|
27
|
-
React.createElement(AuthorListContainer,
|
|
27
|
+
React.createElement(AuthorListContainer, { "data-cy": "authors-list" }, authors.map((a) => {
|
|
28
28
|
return (React.createElement(DraggableAuthor, { key: a.id, author: a, isSelected: a.id === (author === null || author === void 0 ? void 0 : author.id), onClick: () => onSelect(a), moveAuthor: moveAuthor }));
|
|
29
29
|
}))));
|
|
30
30
|
};
|
|
@@ -192,11 +192,11 @@ export const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, a
|
|
|
192
192
|
React.createElement(ModalSidebarHeader, null,
|
|
193
193
|
React.createElement(ModalSidebarTitle, null, "Authors")),
|
|
194
194
|
React.createElement(SidebarContent, null,
|
|
195
|
-
React.createElement(AddAuthorButton, { onClick: handleAddAuthor },
|
|
195
|
+
React.createElement(AddAuthorButton, { "data-cy": "add-author-button", onClick: handleAddAuthor },
|
|
196
196
|
React.createElement(AddIcon, { width: 40, height: 40 }),
|
|
197
197
|
React.createElement(ActionTitle, null, "Add Author")),
|
|
198
198
|
React.createElement(AuthorList, { author: selection, authors: authors, onSelect: handleSelect, moveAuthor: handleMoveAuthor }))),
|
|
199
|
-
React.createElement(ScrollableModalContent,
|
|
199
|
+
React.createElement(ScrollableModalContent, { "data-cy": "author-modal-content" }, selection ? (React.createElement(AuthorForms, null,
|
|
200
200
|
React.createElement(SaveAuthorConfirmationDialog, { isOpen: showConfirmationDialog, onSave: () => handleSaveAuthor(valuesRef.current), onCancel: handleResetAuthor }),
|
|
201
201
|
React.createElement(AuthorActions, { author: selection, onSave: () => handleSaveAuthor(valuesRef.current), onDelete: handleDeleteAuthor, onCancel: () => setOpen(false) }),
|
|
202
202
|
React.createElement(FormLabel, null, "Details"),
|
|
@@ -113,14 +113,21 @@ export const DraggableAuthor = ({ author, isSelected, onClick, moveAuthor, }) =>
|
|
|
113
113
|
}),
|
|
114
114
|
});
|
|
115
115
|
dragRef(dropRef(ref));
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
116
|
+
const classes = [];
|
|
117
|
+
if (isDragging) {
|
|
118
|
+
classes.push('dragging');
|
|
119
|
+
}
|
|
120
|
+
if (isOver && dropSide) {
|
|
121
|
+
classes.push(`drop-${dropSide}`);
|
|
122
|
+
}
|
|
123
|
+
if (isSelected) {
|
|
124
|
+
classes.push('active');
|
|
125
|
+
}
|
|
126
|
+
return (React.createElement(AuthorContainer, { ref: ref, className: classes.join(' '), onClick: onClick, "data-cy": "author-item" },
|
|
127
|
+
React.createElement(AvatarContainer, { "data-cy": "author-avatar" },
|
|
121
128
|
React.createElement(Avatar, { size: 36, color: '#6e6e6e' }),
|
|
122
|
-
React.createElement(AuthorNotes,
|
|
129
|
+
React.createElement(AuthorNotes, { "data-cy": "author-notes" }, author.isCorresponding && (React.createElement(AuthorBadge, null,
|
|
123
130
|
React.createElement(CorrespondingAuthorIcon, null))))),
|
|
124
|
-
React.createElement(AuthorName,
|
|
131
|
+
React.createElement(AuthorName, { "data-cy": "author-name" }, authorLabel(author)),
|
|
125
132
|
isSelected && React.createElement(DragHandle, null)));
|
|
126
133
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/body-editor",
|
|
3
3
|
"description": "Prosemirror components for editing and viewing manuscripts",
|
|
4
|
-
"version": "1.11.
|
|
4
|
+
"version": "1.11.1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -110,4 +110,4 @@
|
|
|
110
110
|
"@types/react": "^17.0.2",
|
|
111
111
|
"prosemirror-tables": "^1.3.5"
|
|
112
112
|
}
|
|
113
|
-
}
|
|
113
|
+
}
|