@manuscripts/body-editor 3.12.62 → 3.12.64
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/affiliations/AffiliationForm.js +1 -1
- package/dist/cjs/components/affiliations/AffiliationsModal.js +1 -0
- package/dist/cjs/components/affiliations/AffiliationsPanel.js +2 -2
- package/dist/cjs/components/affiliations/CreateAffiliationModal.js +2 -2
- package/dist/cjs/components/authors/AuthorDetailsForm.js +1 -1
- package/dist/cjs/components/authors/AuthorsModal.js +1 -1
- package/dist/cjs/components/authors/AuthorsPanel.js +2 -2
- package/dist/cjs/components/authors/CreateAuthorModal.js +2 -2
- package/dist/cjs/components/authors-affiliations/GenericPanel.js +1 -9
- package/dist/cjs/plugins/objects.js +29 -20
- package/dist/cjs/plugins/placeholder.js +15 -1
- package/dist/cjs/versions.js +1 -1
- package/dist/es/components/affiliations/AffiliationForm.js +1 -1
- package/dist/es/components/affiliations/AffiliationsModal.js +1 -0
- package/dist/es/components/affiliations/AffiliationsPanel.js +2 -2
- package/dist/es/components/affiliations/CreateAffiliationModal.js +2 -2
- package/dist/es/components/authors/AuthorDetailsForm.js +1 -1
- package/dist/es/components/authors/AuthorsModal.js +1 -1
- package/dist/es/components/authors/AuthorsPanel.js +2 -2
- package/dist/es/components/authors/CreateAuthorModal.js +2 -2
- package/dist/es/components/authors-affiliations/GenericPanel.js +1 -9
- package/dist/es/plugins/objects.js +29 -20
- package/dist/es/plugins/placeholder.js +15 -1
- package/dist/es/versions.js +1 -1
- package/dist/types/components/authors-affiliations/GenericPanel.d.ts +0 -1
- package/dist/types/versions.d.ts +1 -1
- package/package.json +3 -3
- package/styles/AdvancedEditor.css +0 -4
- package/styles/Editor.css +46 -37
|
@@ -91,7 +91,7 @@ const AffiliationForm = ({ values, onSave, onChange, actionsRef, newEntity = fal
|
|
|
91
91
|
react_1.default.createElement(style_guide_1.FormRow, null,
|
|
92
92
|
react_1.default.createElement(formik_1.Field, { name: "department", type: "textarea" }, (props) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
93
93
|
react_1.default.createElement(UnsavedLabel_1.UnsavedLabel, { htmlFor: "department", showDot: showUnsavedDot('department') }, "Department"),
|
|
94
|
-
react_1.default.createElement(style_guide_1.TextField, { id: "department", ...props.field
|
|
94
|
+
react_1.default.createElement(style_guide_1.TextField, { id: "department", ...props.field }))))),
|
|
95
95
|
react_1.default.createElement(style_guide_1.FormRow, null,
|
|
96
96
|
react_1.default.createElement(formik_1.Field, { name: "addressLine1" }, (props) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
97
97
|
react_1.default.createElement(UnsavedLabel_1.UnsavedLabel, { htmlFor: "addressLine1", showDot: showUnsavedDot('addressLine1') }, "Street Address"),
|
|
@@ -431,6 +431,7 @@ const AddAffiliationButton = styled_components_1.default.button `
|
|
|
431
431
|
&[data-active='true'] {
|
|
432
432
|
background: ${(props) => props.theme.colors.background.fifth};
|
|
433
433
|
border: 1px solid ${(props) => props.theme.colors.border.primary};
|
|
434
|
+
padding: 11px 8px 11px 12px;
|
|
434
435
|
border-left: 0;
|
|
435
436
|
border-right: 0;
|
|
436
437
|
}
|
|
@@ -13,10 +13,10 @@ function affiliationSecondaryLine(item) {
|
|
|
13
13
|
}
|
|
14
14
|
const AffiliationsPanel = ({ items, selectedItems = [], onSelect, onOpenAffiliationsModal, }) => {
|
|
15
15
|
const selectedIds = (0, GenericPanel_1.useListSelectedIds)(selectedItems);
|
|
16
|
-
return (react_1.default.createElement(GenericPanel_1.GenericPanel, {
|
|
16
|
+
return (react_1.default.createElement(GenericPanel_1.GenericPanel, { createLabel: "New Affiliation", onCreate: onOpenAffiliationsModal, createDataCy: "add-affiliations-link", emptyDataCy: "affiliations-panel-empty", isEmpty: items.length === 0, emptyIcon: react_1.default.createElement(style_guide_1.InfoCircleIcon, null), emptyMessage: react_1.default.createElement(react_1.default.Fragment, null,
|
|
17
17
|
"There are no affiliations attributed yet!",
|
|
18
18
|
react_1.default.createElement("br", null),
|
|
19
|
-
"Click \
|
|
19
|
+
"Click \u2018+ New Affiliation\u2019") },
|
|
20
20
|
react_1.default.createElement(GenericPanel_1.ListItems, { "data-cy": "affiliations-panel" }, items.map((item) => (react_1.default.createElement(GenericPanel_1.ListItem, { key: item.id, selected: selectedIds.has(item.id), onClick: () => onSelect(item.id), primary: item.institution, secondary: affiliationSecondaryLine(item) }))))));
|
|
21
21
|
};
|
|
22
22
|
exports.AffiliationsPanel = AffiliationsPanel;
|
|
@@ -89,8 +89,8 @@ const CreateAffiliationModal = ({ affiliationsCount, onSave, onClose, }) => {
|
|
|
89
89
|
react_1.default.createElement(style_guide_1.CloseButton, { onClick: () => setIsOpen(false), "data-cy": "modal-close-button" })),
|
|
90
90
|
react_1.default.createElement(CreateModalStyles_1.StyledModalBody, null,
|
|
91
91
|
react_1.default.createElement(CreateModalStyles_1.StyledScrollableModalContent, null,
|
|
92
|
-
react_1.default.createElement(CreateModalStyles_1.FormTitle, null, "Create
|
|
92
|
+
react_1.default.createElement(CreateModalStyles_1.FormTitle, null, "Create Affiliation"),
|
|
93
93
|
react_1.default.createElement(AffiliationForm_1.AffiliationForm, { values: (0, normalize_1.checkID)(selection, 'affiliation'), onSave: handleSave, onChange: handleChange, actionsRef: actionsRef, newEntity: true, onAffiliationErrorChange: setHasError }))),
|
|
94
|
-
react_1.default.createElement(FormFooter_1.default, { onCancel: () => setIsOpen(false), primaryAction: react_1.default.createElement(ModalFormActions_1.ModalFormSaveButton, { form: "affiliation-form", isDisableSave: isDisableSave || hasError, label: "
|
|
94
|
+
react_1.default.createElement(FormFooter_1.default, { onCancel: () => setIsOpen(false), primaryAction: react_1.default.createElement(ModalFormActions_1.ModalFormSaveButton, { form: "affiliation-form", isDisableSave: isDisableSave || hasError, label: "New Affiliation", onSubmitForm: () => actionsRef.current?.submitForm?.() }) }))));
|
|
95
95
|
};
|
|
96
96
|
exports.CreateAffiliationModal = CreateAffiliationModal;
|
|
@@ -176,7 +176,7 @@ const AuthorDetailsForm = ({ values, onChange, onSave, actionsRef, isEmailRequir
|
|
|
176
176
|
})),
|
|
177
177
|
react_1.default.createElement(style_guide_1.FormRow, null,
|
|
178
178
|
react_1.default.createElement(formik_1.Field, { name: 'role' }, (props) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
179
|
-
react_1.default.createElement(UnsavedLabel_1.UnsavedLabel, { htmlFor: "role", showDot: showUnsavedDot('role') }, "Job
|
|
179
|
+
react_1.default.createElement(UnsavedLabel_1.UnsavedLabel, { htmlFor: "role", showDot: showUnsavedDot('role') }, "Job title"),
|
|
180
180
|
react_1.default.createElement(style_guide_1.TextField, { id: 'role', ...props.field }))))),
|
|
181
181
|
react_1.default.createElement(style_guide_1.FormRow, null,
|
|
182
182
|
react_1.default.createElement(formik_1.Field, { name: 'ORCID', type: 'text' }, (props) => {
|
|
@@ -368,7 +368,6 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
|
|
|
368
368
|
onOpenAffiliationsModal && (react_1.default.createElement(AuthorTabPanel, null,
|
|
369
369
|
react_1.default.createElement(AffiliationsPanel_1.AffiliationsPanel, { items: affiliations, selectedItems: selectedAffiliations, onSelect: selectAffiliation, onOpenAffiliationsModal: onOpenAffiliationsModal }))),
|
|
370
370
|
react_1.default.createElement(AuthorTabPanel, null,
|
|
371
|
-
react_1.default.createElement(style_guide_1.FormSubtitle, null, "Contributions (CRediT)"),
|
|
372
371
|
react_1.default.createElement(ContributionsDescriptionSubtitle, null, "Select the roles this author contributed to according to the CRediT taxonomy"),
|
|
373
372
|
react_1.default.createElement(CreditDrawer_1.CreditContributionsCheckboxes, { items: vocabTermItems, selectedItems: selectedCreditRoles.map((r) => ({
|
|
374
373
|
id: r.vocabTerm,
|
|
@@ -420,6 +419,7 @@ const AddAuthorButton = styled_components_1.default.button `
|
|
|
420
419
|
&[data-active='true'] {
|
|
421
420
|
background: ${(props) => props.theme.colors.background.fifth};
|
|
422
421
|
border: 1px solid ${(props) => props.theme.colors.border.primary};
|
|
422
|
+
padding: 11px 8px 11px 12px;
|
|
423
423
|
border-left: 0;
|
|
424
424
|
border-right: 0;
|
|
425
425
|
}
|
|
@@ -9,10 +9,10 @@ const react_1 = __importDefault(require("react"));
|
|
|
9
9
|
const GenericPanel_1 = require("../authors-affiliations/GenericPanel");
|
|
10
10
|
const AuthorsPanel = ({ items, selectedItems = [], onSelect, openAuthorsModal, }) => {
|
|
11
11
|
const selectedIds = (0, GenericPanel_1.useListSelectedIds)(selectedItems);
|
|
12
|
-
return (react_1.default.createElement(GenericPanel_1.GenericPanel, {
|
|
12
|
+
return (react_1.default.createElement(GenericPanel_1.GenericPanel, { createLabel: "New Author", onCreate: openAuthorsModal, createDataCy: "add-authors-link", emptyDataCy: "authors-panel-empty", isEmpty: items.length === 0, emptyIcon: react_1.default.createElement(style_guide_1.InfoCircleIcon, null), emptyMessage: react_1.default.createElement(react_1.default.Fragment, null,
|
|
13
13
|
"There are no authors attributed yet!",
|
|
14
14
|
react_1.default.createElement("br", null),
|
|
15
|
-
"Click \
|
|
15
|
+
"Click \u2018+ New Author\u2019") },
|
|
16
16
|
react_1.default.createElement(GenericPanel_1.ListItems, { "data-cy": "authors-panel" }, items.map((item) => (react_1.default.createElement(GenericPanel_1.ListItem, { key: item.id, selected: selectedIds.has(item.id), onClick: () => onSelect(item.id), primary: item.label }))))));
|
|
17
17
|
};
|
|
18
18
|
exports.AuthorsPanel = AuthorsPanel;
|
|
@@ -94,9 +94,9 @@ const CreateAuthorModal = ({ authorsCount, affiliations: $affiliations, onSave,
|
|
|
94
94
|
react_1.default.createElement(style_guide_1.CloseButton, { onClick: () => setIsOpen(false), "data-cy": "modal-close-button" })),
|
|
95
95
|
react_1.default.createElement(CreateModalStyles_1.StyledModalBody, null,
|
|
96
96
|
react_1.default.createElement(CreateModalStyles_1.StyledScrollableModalContent, null,
|
|
97
|
-
react_1.default.createElement(CreateModalStyles_1.FormTitle, null, "Create
|
|
97
|
+
react_1.default.createElement(CreateModalStyles_1.FormTitle, null, "Create Author"),
|
|
98
98
|
react_1.default.createElement(AuthorDetailsForm_1.AuthorDetailsForm, { values: (0, normalize_1.normalizeAuthor)(selection), onChange: handleChange, onSave: handleSave, actionsRef: actionsRef, isEmailRequired: isEmailRequired, selectedAffiliations: selectedAffiliations.map((a) => a.id), authorFormRef: authorFormRef, selectedCreditRoles: selectedCreditRoles, newEntity: true, onAuthorDetailsTabErrorChange: setHasError }))),
|
|
99
|
-
react_1.default.createElement(FormFooter_1.default, { onCancel: () => setIsOpen(false), primaryAction: react_1.default.createElement(ModalFormActions_1.ModalFormSaveButton, { form: "author-details-form", isDisableSave: isDisableSave || hasError, label: "
|
|
99
|
+
react_1.default.createElement(FormFooter_1.default, { onCancel: () => setIsOpen(false), primaryAction: react_1.default.createElement(ModalFormActions_1.ModalFormSaveButton, { form: "author-details-form", isDisableSave: isDisableSave || hasError, label: "New Author", onSubmitForm: () => actionsRef.current?.submitForm?.() }) }))));
|
|
100
100
|
};
|
|
101
101
|
exports.CreateAuthorModal = CreateAuthorModal;
|
|
102
102
|
function createEmptyAuthor(priority) {
|
|
@@ -67,13 +67,6 @@ const PanelHeader = styled_components_1.default.div `
|
|
|
67
67
|
padding: ${(props) => props.theme.grid.unit * 2}px
|
|
68
68
|
${(props) => props.theme.grid.unit * 4}px;
|
|
69
69
|
`;
|
|
70
|
-
const PanelTitle = styled_components_1.default.span `
|
|
71
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
72
|
-
font-size: 18px;
|
|
73
|
-
line-height: 24px;
|
|
74
|
-
letter-spacing: -0.37px;
|
|
75
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
76
|
-
`;
|
|
77
70
|
const PanelCreateButton = (0, styled_components_1.default)(style_guide_1.IconButton) `
|
|
78
71
|
color: #0d79d0;
|
|
79
72
|
font-size: 14px;
|
|
@@ -115,9 +108,8 @@ const PanelEmptyText = styled_components_1.default.p `
|
|
|
115
108
|
text-align: center;
|
|
116
109
|
letter-spacing: -0.369px;
|
|
117
110
|
`;
|
|
118
|
-
const GenericPanel = ({
|
|
111
|
+
const GenericPanel = ({ createLabel, onCreate, createDataCy, emptyDataCy, isEmpty, emptyIcon, emptyMessage, children, }) => (react_1.default.createElement(Panel, null,
|
|
119
112
|
react_1.default.createElement(PanelHeader, null,
|
|
120
|
-
react_1.default.createElement(PanelTitle, null, title),
|
|
121
113
|
react_1.default.createElement(PanelCreateButton, { onClick: onCreate, "data-cy": createDataCy },
|
|
122
114
|
react_1.default.createElement(style_guide_1.PlusIcon, null),
|
|
123
115
|
createLabel)),
|
|
@@ -43,18 +43,34 @@ exports.default = () => {
|
|
|
43
43
|
if (id) {
|
|
44
44
|
const target = targets.get(id);
|
|
45
45
|
if (target) {
|
|
46
|
-
const labelNode = document.createElement('span');
|
|
47
|
-
labelNode.className = 'element-label';
|
|
48
46
|
const caption = (0, prosemirror_utils_1.findChildren)(node, (node) => node.type === transform_1.schema.nodes.caption ||
|
|
49
47
|
node.type === transform_1.schema.nodes.caption_title, false)[0];
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
if (caption) {
|
|
49
|
+
let from;
|
|
50
|
+
let to;
|
|
51
|
+
if (caption.node.type === transform_1.schema.nodes.caption_title) {
|
|
52
|
+
from = pos + 1 + caption.pos;
|
|
53
|
+
to = from + caption.node.nodeSize;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const firstChild = caption.node.firstChild;
|
|
57
|
+
from = pos + 1 + caption.pos + 1;
|
|
58
|
+
to = from + (firstChild?.nodeSize || caption.node.nodeSize);
|
|
59
|
+
}
|
|
60
|
+
decorations.push(prosemirror_view_1.Decoration.node(from, to, {
|
|
61
|
+
'element-label': target.label,
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
const labelPos = getDecorationPos(target, state.doc, pos);
|
|
66
|
+
const labelNode = document.createElement('span');
|
|
67
|
+
labelNode.className = 'element-label';
|
|
68
|
+
labelNode.textContent = target.label;
|
|
69
|
+
decorations.push(prosemirror_view_1.Decoration.widget(labelPos, labelNode, {
|
|
70
|
+
side: -1,
|
|
71
|
+
key: `element-label-${id}-${target.label}`,
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
58
74
|
}
|
|
59
75
|
}
|
|
60
76
|
});
|
|
@@ -64,14 +80,7 @@ exports.default = () => {
|
|
|
64
80
|
},
|
|
65
81
|
});
|
|
66
82
|
};
|
|
67
|
-
const getDecorationPos = (target, doc, pos
|
|
68
|
-
const $pos = doc.resolve(pos +
|
|
69
|
-
|
|
70
|
-
if (!caption) {
|
|
71
|
-
targetPos = $pos.end();
|
|
72
|
-
}
|
|
73
|
-
else if (!$pos.nodeBefore) {
|
|
74
|
-
targetPos -= 1;
|
|
75
|
-
}
|
|
76
|
-
return targetPos;
|
|
83
|
+
const getDecorationPos = (target, doc, pos) => {
|
|
84
|
+
const $pos = doc.resolve(pos + 1);
|
|
85
|
+
return $pos.end();
|
|
77
86
|
};
|
|
@@ -72,6 +72,10 @@ const getParagraphPlaceholderText = (parent, node) => {
|
|
|
72
72
|
return 'Type here';
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
+
const isTextBlockOfQuoteElement = (node, parent) => node.type === transform_1.schema.nodes.text_block &&
|
|
76
|
+
!!parent &&
|
|
77
|
+
(parent.type === transform_1.schema.nodes.pullquote_element ||
|
|
78
|
+
parent.type === transform_1.schema.nodes.blockquote_element);
|
|
75
79
|
exports.default = () => new prosemirror_state_1.Plugin({
|
|
76
80
|
props: {
|
|
77
81
|
decorations: (state) => {
|
|
@@ -82,7 +86,7 @@ exports.default = () => new prosemirror_state_1.Plugin({
|
|
|
82
86
|
decorations.push(prosemirror_view_1.Decoration.widget(pos + 1, placeholderWidget('Insert reference here')));
|
|
83
87
|
}
|
|
84
88
|
if (node.type === node.type.schema.nodes.paragraph ||
|
|
85
|
-
node
|
|
89
|
+
isTextBlockOfQuoteElement(node, parent)) {
|
|
86
90
|
const text = getParagraphPlaceholderText(parent, node);
|
|
87
91
|
if (text) {
|
|
88
92
|
decorations.push(prosemirror_view_1.Decoration.widget(pos + 1, placeholderWidget(text)));
|
|
@@ -106,6 +110,16 @@ exports.default = () => new prosemirror_state_1.Plugin({
|
|
|
106
110
|
else if (node.type === node.type.schema.nodes.trans_abstract) {
|
|
107
111
|
decorations.push(prosemirror_view_1.Decoration.widget(pos + 1, placeholderWidget('Type new abstract title here')));
|
|
108
112
|
}
|
|
113
|
+
else if (node.type === transform_1.schema.nodes.caption_title) {
|
|
114
|
+
decorations.push(prosemirror_view_1.Decoration.widget(pos + 1, placeholderWidget('Caption title...'), {
|
|
115
|
+
key: node.attrs.id,
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
else if (node.type === transform_1.schema.nodes.text_block &&
|
|
119
|
+
parent &&
|
|
120
|
+
parent.type === transform_1.schema.nodes.caption) {
|
|
121
|
+
decorations.push(prosemirror_view_1.Decoration.widget(pos + 1, placeholderWidget('Caption...')));
|
|
122
|
+
}
|
|
109
123
|
else {
|
|
110
124
|
const placeholder = placeholderMap[node.type.name];
|
|
111
125
|
decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {
|
package/dist/cjs/versions.js
CHANGED
|
@@ -51,7 +51,7 @@ export const AffiliationForm = ({ values, onSave, onChange, actionsRef, newEntit
|
|
|
51
51
|
React.createElement(FormRow, null,
|
|
52
52
|
React.createElement(Field, { name: "department", type: "textarea" }, (props) => (React.createElement(React.Fragment, null,
|
|
53
53
|
React.createElement(UnsavedLabel, { htmlFor: "department", showDot: showUnsavedDot('department') }, "Department"),
|
|
54
|
-
React.createElement(TextField, { id: "department", ...props.field
|
|
54
|
+
React.createElement(TextField, { id: "department", ...props.field }))))),
|
|
55
55
|
React.createElement(FormRow, null,
|
|
56
56
|
React.createElement(Field, { name: "addressLine1" }, (props) => (React.createElement(React.Fragment, null,
|
|
57
57
|
React.createElement(UnsavedLabel, { htmlFor: "addressLine1", showDot: showUnsavedDot('addressLine1') }, "Street Address"),
|
|
@@ -391,6 +391,7 @@ const AddAffiliationButton = styled.button `
|
|
|
391
391
|
&[data-active='true'] {
|
|
392
392
|
background: ${(props) => props.theme.colors.background.fifth};
|
|
393
393
|
border: 1px solid ${(props) => props.theme.colors.border.primary};
|
|
394
|
+
padding: 11px 8px 11px 12px;
|
|
394
395
|
border-left: 0;
|
|
395
396
|
border-right: 0;
|
|
396
397
|
}
|
|
@@ -7,9 +7,9 @@ function affiliationSecondaryLine(item) {
|
|
|
7
7
|
}
|
|
8
8
|
export const AffiliationsPanel = ({ items, selectedItems = [], onSelect, onOpenAffiliationsModal, }) => {
|
|
9
9
|
const selectedIds = useListSelectedIds(selectedItems);
|
|
10
|
-
return (React.createElement(GenericPanel, {
|
|
10
|
+
return (React.createElement(GenericPanel, { createLabel: "New Affiliation", onCreate: onOpenAffiliationsModal, createDataCy: "add-affiliations-link", emptyDataCy: "affiliations-panel-empty", isEmpty: items.length === 0, emptyIcon: React.createElement(InfoCircleIcon, null), emptyMessage: React.createElement(React.Fragment, null,
|
|
11
11
|
"There are no affiliations attributed yet!",
|
|
12
12
|
React.createElement("br", null),
|
|
13
|
-
"Click \
|
|
13
|
+
"Click \u2018+ New Affiliation\u2019") },
|
|
14
14
|
React.createElement(ListItems, { "data-cy": "affiliations-panel" }, items.map((item) => (React.createElement(ListItem, { key: item.id, selected: selectedIds.has(item.id), onClick: () => onSelect(item.id), primary: item.institution, secondary: affiliationSecondaryLine(item) }))))));
|
|
15
15
|
};
|
|
@@ -50,7 +50,7 @@ export const CreateAffiliationModal = ({ affiliationsCount, onSave, onClose, })
|
|
|
50
50
|
React.createElement(CloseButton, { onClick: () => setIsOpen(false), "data-cy": "modal-close-button" })),
|
|
51
51
|
React.createElement(StyledModalBody, null,
|
|
52
52
|
React.createElement(StyledScrollableModalContent, null,
|
|
53
|
-
React.createElement(FormTitle, null, "Create
|
|
53
|
+
React.createElement(FormTitle, null, "Create Affiliation"),
|
|
54
54
|
React.createElement(AffiliationForm, { values: checkID(selection, 'affiliation'), onSave: handleSave, onChange: handleChange, actionsRef: actionsRef, newEntity: true, onAffiliationErrorChange: setHasError }))),
|
|
55
|
-
React.createElement(FormFooter, { onCancel: () => setIsOpen(false), primaryAction: React.createElement(ModalFormSaveButton, { form: "affiliation-form", isDisableSave: isDisableSave || hasError, label: "
|
|
55
|
+
React.createElement(FormFooter, { onCancel: () => setIsOpen(false), primaryAction: React.createElement(ModalFormSaveButton, { form: "affiliation-form", isDisableSave: isDisableSave || hasError, label: "New Affiliation", onSubmitForm: () => actionsRef.current?.submitForm?.() }) }))));
|
|
56
56
|
};
|
|
@@ -136,7 +136,7 @@ export const AuthorDetailsForm = ({ values, onChange, onSave, actionsRef, isEmai
|
|
|
136
136
|
})),
|
|
137
137
|
React.createElement(FormRow, null,
|
|
138
138
|
React.createElement(Field, { name: 'role' }, (props) => (React.createElement(React.Fragment, null,
|
|
139
|
-
React.createElement(UnsavedLabel, { htmlFor: "role", showDot: showUnsavedDot('role') }, "Job
|
|
139
|
+
React.createElement(UnsavedLabel, { htmlFor: "role", showDot: showUnsavedDot('role') }, "Job title"),
|
|
140
140
|
React.createElement(TextField, { id: 'role', ...props.field }))))),
|
|
141
141
|
React.createElement(FormRow, null,
|
|
142
142
|
React.createElement(Field, { name: 'ORCID', type: 'text' }, (props) => {
|
|
@@ -329,7 +329,6 @@ export const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, a
|
|
|
329
329
|
onOpenAffiliationsModal && (React.createElement(AuthorTabPanel, null,
|
|
330
330
|
React.createElement(AffiliationsPanel, { items: affiliations, selectedItems: selectedAffiliations, onSelect: selectAffiliation, onOpenAffiliationsModal: onOpenAffiliationsModal }))),
|
|
331
331
|
React.createElement(AuthorTabPanel, null,
|
|
332
|
-
React.createElement(FormSubtitle, null, "Contributions (CRediT)"),
|
|
333
332
|
React.createElement(ContributionsDescriptionSubtitle, null, "Select the roles this author contributed to according to the CRediT taxonomy"),
|
|
334
333
|
React.createElement(CreditContributionsCheckboxes, { items: vocabTermItems, selectedItems: selectedCreditRoles.map((r) => ({
|
|
335
334
|
id: r.vocabTerm,
|
|
@@ -380,6 +379,7 @@ const AddAuthorButton = styled.button `
|
|
|
380
379
|
&[data-active='true'] {
|
|
381
380
|
background: ${(props) => props.theme.colors.background.fifth};
|
|
382
381
|
border: 1px solid ${(props) => props.theme.colors.border.primary};
|
|
382
|
+
padding: 11px 8px 11px 12px;
|
|
383
383
|
border-left: 0;
|
|
384
384
|
border-right: 0;
|
|
385
385
|
}
|
|
@@ -3,9 +3,9 @@ import React from 'react';
|
|
|
3
3
|
import { GenericPanel, ListItem, ListItems, useListSelectedIds, } from '../authors-affiliations/GenericPanel';
|
|
4
4
|
export const AuthorsPanel = ({ items, selectedItems = [], onSelect, openAuthorsModal, }) => {
|
|
5
5
|
const selectedIds = useListSelectedIds(selectedItems);
|
|
6
|
-
return (React.createElement(GenericPanel, {
|
|
6
|
+
return (React.createElement(GenericPanel, { createLabel: "New Author", onCreate: openAuthorsModal, createDataCy: "add-authors-link", emptyDataCy: "authors-panel-empty", isEmpty: items.length === 0, emptyIcon: React.createElement(InfoCircleIcon, null), emptyMessage: React.createElement(React.Fragment, null,
|
|
7
7
|
"There are no authors attributed yet!",
|
|
8
8
|
React.createElement("br", null),
|
|
9
|
-
"Click \
|
|
9
|
+
"Click \u2018+ New Author\u2019") },
|
|
10
10
|
React.createElement(ListItems, { "data-cy": "authors-panel" }, items.map((item) => (React.createElement(ListItem, { key: item.id, selected: selectedIds.has(item.id), onClick: () => onSelect(item.id), primary: item.label }))))));
|
|
11
11
|
};
|
|
@@ -55,9 +55,9 @@ export const CreateAuthorModal = ({ authorsCount, affiliations: $affiliations, o
|
|
|
55
55
|
React.createElement(CloseButton, { onClick: () => setIsOpen(false), "data-cy": "modal-close-button" })),
|
|
56
56
|
React.createElement(StyledModalBody, null,
|
|
57
57
|
React.createElement(StyledScrollableModalContent, null,
|
|
58
|
-
React.createElement(FormTitle, null, "Create
|
|
58
|
+
React.createElement(FormTitle, null, "Create Author"),
|
|
59
59
|
React.createElement(AuthorDetailsForm, { values: normalizeAuthor(selection), onChange: handleChange, onSave: handleSave, actionsRef: actionsRef, isEmailRequired: isEmailRequired, selectedAffiliations: selectedAffiliations.map((a) => a.id), authorFormRef: authorFormRef, selectedCreditRoles: selectedCreditRoles, newEntity: true, onAuthorDetailsTabErrorChange: setHasError }))),
|
|
60
|
-
React.createElement(FormFooter, { onCancel: () => setIsOpen(false), primaryAction: React.createElement(ModalFormSaveButton, { form: "author-details-form", isDisableSave: isDisableSave || hasError, label: "
|
|
60
|
+
React.createElement(FormFooter, { onCancel: () => setIsOpen(false), primaryAction: React.createElement(ModalFormSaveButton, { form: "author-details-form", isDisableSave: isDisableSave || hasError, label: "New Author", onSubmitForm: () => actionsRef.current?.submitForm?.() }) }))));
|
|
61
61
|
};
|
|
62
62
|
function createEmptyAuthor(priority) {
|
|
63
63
|
return {
|
|
@@ -27,13 +27,6 @@ const PanelHeader = styled.div `
|
|
|
27
27
|
padding: ${(props) => props.theme.grid.unit * 2}px
|
|
28
28
|
${(props) => props.theme.grid.unit * 4}px;
|
|
29
29
|
`;
|
|
30
|
-
const PanelTitle = styled.span `
|
|
31
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
32
|
-
font-size: 18px;
|
|
33
|
-
line-height: 24px;
|
|
34
|
-
letter-spacing: -0.37px;
|
|
35
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
36
|
-
`;
|
|
37
30
|
const PanelCreateButton = styled(IconButton) `
|
|
38
31
|
color: #0d79d0;
|
|
39
32
|
font-size: 14px;
|
|
@@ -75,9 +68,8 @@ const PanelEmptyText = styled.p `
|
|
|
75
68
|
text-align: center;
|
|
76
69
|
letter-spacing: -0.369px;
|
|
77
70
|
`;
|
|
78
|
-
export const GenericPanel = ({
|
|
71
|
+
export const GenericPanel = ({ createLabel, onCreate, createDataCy, emptyDataCy, isEmpty, emptyIcon, emptyMessage, children, }) => (React.createElement(Panel, null,
|
|
79
72
|
React.createElement(PanelHeader, null,
|
|
80
|
-
React.createElement(PanelTitle, null, title),
|
|
81
73
|
React.createElement(PanelCreateButton, { onClick: onCreate, "data-cy": createDataCy },
|
|
82
74
|
React.createElement(PlusIcon, null),
|
|
83
75
|
createLabel)),
|
|
@@ -40,18 +40,34 @@ export default () => {
|
|
|
40
40
|
if (id) {
|
|
41
41
|
const target = targets.get(id);
|
|
42
42
|
if (target) {
|
|
43
|
-
const labelNode = document.createElement('span');
|
|
44
|
-
labelNode.className = 'element-label';
|
|
45
43
|
const caption = findChildren(node, (node) => node.type === schema.nodes.caption ||
|
|
46
44
|
node.type === schema.nodes.caption_title, false)[0];
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
if (caption) {
|
|
46
|
+
let from;
|
|
47
|
+
let to;
|
|
48
|
+
if (caption.node.type === schema.nodes.caption_title) {
|
|
49
|
+
from = pos + 1 + caption.pos;
|
|
50
|
+
to = from + caption.node.nodeSize;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const firstChild = caption.node.firstChild;
|
|
54
|
+
from = pos + 1 + caption.pos + 1;
|
|
55
|
+
to = from + (firstChild?.nodeSize || caption.node.nodeSize);
|
|
56
|
+
}
|
|
57
|
+
decorations.push(Decoration.node(from, to, {
|
|
58
|
+
'element-label': target.label,
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const labelPos = getDecorationPos(target, state.doc, pos);
|
|
63
|
+
const labelNode = document.createElement('span');
|
|
64
|
+
labelNode.className = 'element-label';
|
|
65
|
+
labelNode.textContent = target.label;
|
|
66
|
+
decorations.push(Decoration.widget(labelPos, labelNode, {
|
|
67
|
+
side: -1,
|
|
68
|
+
key: `element-label-${id}-${target.label}`,
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
55
71
|
}
|
|
56
72
|
}
|
|
57
73
|
});
|
|
@@ -61,14 +77,7 @@ export default () => {
|
|
|
61
77
|
},
|
|
62
78
|
});
|
|
63
79
|
};
|
|
64
|
-
const getDecorationPos = (target, doc, pos
|
|
65
|
-
const $pos = doc.resolve(pos +
|
|
66
|
-
|
|
67
|
-
if (!caption) {
|
|
68
|
-
targetPos = $pos.end();
|
|
69
|
-
}
|
|
70
|
-
else if (!$pos.nodeBefore) {
|
|
71
|
-
targetPos -= 1;
|
|
72
|
-
}
|
|
73
|
-
return targetPos;
|
|
80
|
+
const getDecorationPos = (target, doc, pos) => {
|
|
81
|
+
const $pos = doc.resolve(pos + 1);
|
|
82
|
+
return $pos.end();
|
|
74
83
|
};
|
|
@@ -70,6 +70,10 @@ const getParagraphPlaceholderText = (parent, node) => {
|
|
|
70
70
|
return 'Type here';
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
+
const isTextBlockOfQuoteElement = (node, parent) => node.type === schema.nodes.text_block &&
|
|
74
|
+
!!parent &&
|
|
75
|
+
(parent.type === schema.nodes.pullquote_element ||
|
|
76
|
+
parent.type === schema.nodes.blockquote_element);
|
|
73
77
|
export default () => new Plugin({
|
|
74
78
|
props: {
|
|
75
79
|
decorations: (state) => {
|
|
@@ -80,7 +84,7 @@ export default () => new Plugin({
|
|
|
80
84
|
decorations.push(Decoration.widget(pos + 1, placeholderWidget('Insert reference here')));
|
|
81
85
|
}
|
|
82
86
|
if (node.type === node.type.schema.nodes.paragraph ||
|
|
83
|
-
node
|
|
87
|
+
isTextBlockOfQuoteElement(node, parent)) {
|
|
84
88
|
const text = getParagraphPlaceholderText(parent, node);
|
|
85
89
|
if (text) {
|
|
86
90
|
decorations.push(Decoration.widget(pos + 1, placeholderWidget(text)));
|
|
@@ -104,6 +108,16 @@ export default () => new Plugin({
|
|
|
104
108
|
else if (node.type === node.type.schema.nodes.trans_abstract) {
|
|
105
109
|
decorations.push(Decoration.widget(pos + 1, placeholderWidget('Type new abstract title here')));
|
|
106
110
|
}
|
|
111
|
+
else if (node.type === schema.nodes.caption_title) {
|
|
112
|
+
decorations.push(Decoration.widget(pos + 1, placeholderWidget('Caption title...'), {
|
|
113
|
+
key: node.attrs.id,
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
else if (node.type === schema.nodes.text_block &&
|
|
117
|
+
parent &&
|
|
118
|
+
parent.type === schema.nodes.caption) {
|
|
119
|
+
decorations.push(Decoration.widget(pos + 1, placeholderWidget('Caption...')));
|
|
120
|
+
}
|
|
107
121
|
else {
|
|
108
122
|
const placeholder = placeholderMap[node.type.name];
|
|
109
123
|
decorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.12.
|
|
1
|
+
export const VERSION = '3.12.64';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -25,7 +25,6 @@ export declare const ListItems: import("styled-components").StyledComponent<Reac
|
|
|
25
25
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
|
26
26
|
}, "ref"> & React.RefAttributes<HTMLElement>>, import("styled-components").DefaultTheme, {}, never>;
|
|
27
27
|
export interface GenericPanelProps {
|
|
28
|
-
title: string;
|
|
29
28
|
createLabel: string;
|
|
30
29
|
onCreate: () => void;
|
|
31
30
|
createDataCy: string;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.12.
|
|
1
|
+
export declare const VERSION = "3.12.64";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
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": "3.12.
|
|
4
|
+
"version": "3.12.64",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@citation-js/plugin-pubmed": "0.3.0",
|
|
41
41
|
"@citation-js/plugin-ris": "0.7.18",
|
|
42
42
|
"@iarna/word-count": "1.1.2",
|
|
43
|
-
"@manuscripts/style-guide": "3.5.
|
|
44
|
-
"@manuscripts/track-changes-plugin": "2.3.
|
|
43
|
+
"@manuscripts/style-guide": "3.5.31",
|
|
44
|
+
"@manuscripts/track-changes-plugin": "2.3.16",
|
|
45
45
|
"@manuscripts/transform": "4.3.51",
|
|
46
46
|
"@popperjs/core": "2.11.8",
|
|
47
47
|
"citeproc": "2.4.63",
|
package/styles/Editor.css
CHANGED
|
@@ -314,27 +314,42 @@
|
|
|
314
314
|
|
|
315
315
|
/* Caption and Element Label */
|
|
316
316
|
|
|
317
|
-
|
|
317
|
+
/* Shared typography for all label variants */
|
|
318
|
+
.ProseMirror .element-label,
|
|
319
|
+
.ProseMirror .caption-title[element-label]::before,
|
|
320
|
+
.ProseMirror .caption-description > [element-label]::before {
|
|
321
|
+
color: #353535;
|
|
322
|
+
font-style: normal;
|
|
323
|
+
font-weight: 700;
|
|
324
|
+
line-height: 16px;
|
|
325
|
+
margin-right: 5px;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.ProseMirror .caption-title[element-label]::before,
|
|
329
|
+
.ProseMirror .caption-description > [element-label]::before {
|
|
330
|
+
content: attr(element-label)":";
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.ProseMirror .caption-title:not(:has(.placeholder-text)) {
|
|
318
334
|
font-weight: bold;
|
|
319
335
|
}
|
|
320
336
|
|
|
321
|
-
.ProseMirror .
|
|
322
|
-
|
|
323
|
-
outline: none;
|
|
324
|
-
margin: 0;
|
|
325
|
-
display: inline;
|
|
337
|
+
.ProseMirror .caption-title {
|
|
338
|
+
display: block;
|
|
326
339
|
}
|
|
327
340
|
|
|
328
|
-
.ProseMirror .
|
|
341
|
+
.ProseMirror .caption-description, .ProseMirror .caption-description[element-label] > p:first-child {
|
|
329
342
|
display: inline;
|
|
330
343
|
}
|
|
331
344
|
|
|
332
|
-
.ProseMirror .caption-description
|
|
345
|
+
.ProseMirror .caption-description, .ProseMirror .caption-title, .ProseMirror .element-label {
|
|
346
|
+
font-size: 14px;
|
|
347
|
+
outline: none;
|
|
333
348
|
margin: 0;
|
|
334
349
|
}
|
|
335
350
|
|
|
336
|
-
.ProseMirror .
|
|
337
|
-
margin
|
|
351
|
+
.ProseMirror .caption-description > p {
|
|
352
|
+
margin: 0;
|
|
338
353
|
}
|
|
339
354
|
|
|
340
355
|
.ProseMirror .block-equation_element .element-label {
|
|
@@ -342,23 +357,33 @@
|
|
|
342
357
|
text-align: center;
|
|
343
358
|
}
|
|
344
359
|
|
|
345
|
-
.ProseMirror .caption-title.
|
|
346
|
-
content: '
|
|
347
|
-
color: #000;
|
|
348
|
-
cursor: text;
|
|
360
|
+
.ProseMirror .block-table_element .caption-title .placeholder-text::before {
|
|
361
|
+
content: 'Table title';
|
|
349
362
|
}
|
|
350
363
|
|
|
351
|
-
.ProseMirror .caption-
|
|
352
|
-
|
|
353
|
-
color: #
|
|
354
|
-
|
|
364
|
+
.ProseMirror .supplement-item .caption-title .placeholder-text::before,
|
|
365
|
+
.ProseMirror .supplement-item .caption-description .placeholder-text::before {
|
|
366
|
+
color: #c9c9c9;
|
|
367
|
+
font-style: italic;
|
|
355
368
|
}
|
|
356
369
|
|
|
357
|
-
.ProseMirror .
|
|
358
|
-
content: '
|
|
370
|
+
.ProseMirror .supplement-item .caption-title .placeholder-text::before {
|
|
371
|
+
content: 'Insert caption title...';
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.ProseMirror .supplement-item .caption-description .placeholder-text::before {
|
|
375
|
+
content: 'Insert caption...';
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.ProseMirror .supplement-item .caption-description > p {
|
|
379
|
+
text-align: start;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.ProseMirror .box-element > .caption-title {
|
|
383
|
+
margin: 0 52px;
|
|
359
384
|
}
|
|
360
385
|
|
|
361
|
-
.ProseMirror .box-element > .caption-title.
|
|
386
|
+
.ProseMirror .box-element > .caption-title .placeholder-text::before {
|
|
362
387
|
color: #999;
|
|
363
388
|
font-style: italic;
|
|
364
389
|
}
|
|
@@ -1205,22 +1230,6 @@
|
|
|
1205
1230
|
border-bottom: none;
|
|
1206
1231
|
}
|
|
1207
1232
|
|
|
1208
|
-
.ProseMirror .supplement-item .caption-title.empty-node::before {
|
|
1209
|
-
content: 'Insert caption title...';
|
|
1210
|
-
color: #c9c9c9;
|
|
1211
|
-
font-style: italic;
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
.ProseMirror .supplement-item .caption-description > p.empty-node::before {
|
|
1215
|
-
content: 'Insert caption...';
|
|
1216
|
-
color: #c9c9c9;
|
|
1217
|
-
font-style: italic;
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
.ProseMirror .supplement-item .caption-description > p {
|
|
1221
|
-
text-align: start;
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
1233
|
.ProseMirror .supplement-file-info {
|
|
1225
1234
|
display: flex;
|
|
1226
1235
|
align-items: center;
|