@manuscripts/body-editor 3.17.3 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/commands.js +13 -19
- package/dist/cjs/components/references/ReferenceLine.js +14 -1
- package/dist/cjs/components/references/ReferencesModal.js +155 -131
- package/dist/cjs/configs/editor-views.js +1 -0
- package/dist/cjs/icons.js +2 -2
- package/dist/cjs/lib/context-menu.js +4 -1
- package/dist/cjs/lib/normalize.js +31 -1
- package/dist/cjs/lib/paste.js +0 -1
- package/dist/cjs/menus.js +1 -1
- package/dist/cjs/node-type-icons.js +1 -0
- package/dist/cjs/plugins/add-subtitle.js +1 -1
- package/dist/cjs/plugins/bibliography.js +7 -1
- package/dist/cjs/plugins/section_category.js +5 -2
- package/dist/cjs/plugins/translations.js +9 -21
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/bibliography_element.js +44 -2
- package/dist/cjs/views/figure_element.js +1 -1
- package/dist/cjs/views/headshot_grid.js +1 -1
- package/dist/es/commands.js +13 -19
- package/dist/es/components/references/ReferenceLine.js +14 -1
- package/dist/es/components/references/ReferencesModal.js +156 -132
- package/dist/es/configs/editor-views.js +1 -0
- package/dist/es/icons.js +1 -1
- package/dist/es/lib/context-menu.js +4 -1
- package/dist/es/lib/normalize.js +30 -1
- package/dist/es/lib/paste.js +0 -1
- package/dist/es/menus.js +1 -1
- package/dist/es/node-type-icons.js +1 -0
- package/dist/es/plugins/add-subtitle.js +2 -2
- package/dist/es/plugins/bibliography.js +7 -1
- package/dist/es/plugins/section_category.js +6 -3
- package/dist/es/plugins/translations.js +11 -23
- package/dist/es/versions.js +1 -1
- package/dist/es/views/bibliography_element.js +45 -3
- package/dist/es/views/figure_element.js +2 -2
- package/dist/es/views/headshot_grid.js +2 -2
- package/dist/types/commands.d.ts +2 -2
- package/dist/types/components/references/ReferenceLine.d.ts +1 -0
- package/dist/types/icons.d.ts +1 -1
- package/dist/types/lib/normalize.d.ts +30 -1
- package/dist/types/versions.d.ts +1 -1
- package/dist/types/views/bibliography_element.d.ts +5 -1
- package/package.json +2 -2
- package/src/commands.ts +22 -35
- package/src/components/references/ReferenceLine.tsx +16 -1
- package/src/components/references/ReferencesModal.tsx +178 -140
- package/src/configs/editor-views.ts +1 -0
- package/src/icons.ts +1 -1
- package/src/lib/context-menu.ts +4 -1
- package/src/lib/normalize.ts +36 -1
- package/src/lib/paste.ts +0 -1
- package/src/menus.tsx +1 -1
- package/src/node-type-icons.tsx +1 -0
- package/src/plugins/add-subtitle.ts +2 -2
- package/src/plugins/bibliography.ts +10 -3
- package/src/plugins/section_category.ts +7 -2
- package/src/plugins/translations.ts +18 -29
- package/src/versions.ts +1 -1
- package/src/views/bibliography_element.ts +61 -4
- package/src/views/figure_element.ts +2 -2
- package/src/views/headshot_grid.ts +2 -2
- package/styles/AdvancedEditor.css +29 -2
- package/styles/Editor.css +7 -0
package/dist/cjs/commands.js
CHANGED
|
@@ -754,16 +754,14 @@ const insertAbstractSection = (category) => (state, dispatch, view) => {
|
|
|
754
754
|
return false;
|
|
755
755
|
}
|
|
756
756
|
const abstracts = (0, doc_1.findAbstractsNode)(state.doc);
|
|
757
|
-
const
|
|
758
|
-
if (
|
|
757
|
+
const abstractNodes = (0, prosemirror_utils_1.findChildrenByType)(abstracts.node, transform_1.schema.nodes.abstract);
|
|
758
|
+
if (abstractNodes.some((s) => s.node.attrs.category === category.id)) {
|
|
759
759
|
return false;
|
|
760
760
|
}
|
|
761
|
-
const
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
}
|
|
766
|
-
const node = transform_1.schema.nodes.section.create({ category: category.id }, [
|
|
761
|
+
const pos = (0, utils_1.findInsertionPosition)(transform_1.schema.nodes.abstract, abstracts.node) +
|
|
762
|
+
abstracts.pos +
|
|
763
|
+
1;
|
|
764
|
+
const node = transform_1.schema.nodes.abstract.create({ category: category.id }, [
|
|
767
765
|
transform_1.schema.nodes.section_title.create({}, transform_1.schema.text(category.titles[0])),
|
|
768
766
|
transform_1.schema.nodes.paragraph.create({ placeholder: 'Type abstract here...' }),
|
|
769
767
|
]);
|
|
@@ -815,9 +813,9 @@ const insertGraphicalAbstract = (category) => (state, dispatch, view) => {
|
|
|
815
813
|
if (sections.some((s) => s.node.attrs.category === category.id)) {
|
|
816
814
|
return false;
|
|
817
815
|
}
|
|
818
|
-
const
|
|
819
|
-
|
|
820
|
-
|
|
816
|
+
const pos = (0, utils_1.findInsertionPosition)(transform_1.schema.nodes.graphical_abstract_section, abstracts.node) +
|
|
817
|
+
abstracts.pos +
|
|
818
|
+
1;
|
|
821
819
|
const node = transform_1.schema.nodes.graphical_abstract_section.createAndFill({ category: category.id }, [
|
|
822
820
|
transform_1.schema.nodes.section_title.create({}, transform_1.schema.text(category.titles[0])),
|
|
823
821
|
createAndFillFigureElement(state),
|
|
@@ -1029,7 +1027,7 @@ const insertTOCSection = () => {
|
|
|
1029
1027
|
return false;
|
|
1030
1028
|
};
|
|
1031
1029
|
exports.insertTOCSection = insertTOCSection;
|
|
1032
|
-
const insertTransAbstract = (state, dispatch, category
|
|
1030
|
+
const insertTransAbstract = (state, dispatch, category) => {
|
|
1033
1031
|
if (!(0, template_1.templateAllows)(state, transform_1.schema.nodes.trans_abstract)) {
|
|
1034
1032
|
return false;
|
|
1035
1033
|
}
|
|
@@ -1044,9 +1042,7 @@ const insertTransAbstract = (state, dispatch, category, insertAfterPos) => {
|
|
|
1044
1042
|
category,
|
|
1045
1043
|
}, [title, paragraph]);
|
|
1046
1044
|
const abstracts = (0, doc_1.findAbstractsNode)(state.doc);
|
|
1047
|
-
const pos =
|
|
1048
|
-
? insertAfterPos
|
|
1049
|
-
: abstracts.pos + abstracts.node.nodeSize - 1;
|
|
1045
|
+
const pos = abstracts.node.content.size + abstracts.pos + 1;
|
|
1050
1046
|
const tr = state.tr.insert(pos, node);
|
|
1051
1047
|
const selection = prosemirror_state_1.TextSelection.create(tr.doc, pos + 1);
|
|
1052
1048
|
tr.setSelection(selection).scrollIntoView();
|
|
@@ -1054,7 +1050,7 @@ const insertTransAbstract = (state, dispatch, category, insertAfterPos) => {
|
|
|
1054
1050
|
return true;
|
|
1055
1051
|
};
|
|
1056
1052
|
exports.insertTransAbstract = insertTransAbstract;
|
|
1057
|
-
const insertTransGraphicalAbstract = (category
|
|
1053
|
+
const insertTransGraphicalAbstract = (category) => (state, dispatch, view) => {
|
|
1058
1054
|
if (!(0, template_1.templateAllows)(state, transform_1.schema.nodes.trans_graphical_abstract)) {
|
|
1059
1055
|
return false;
|
|
1060
1056
|
}
|
|
@@ -1063,9 +1059,7 @@ const insertTransGraphicalAbstract = (category, insertAfterPos) => (state, dispa
|
|
|
1063
1059
|
}
|
|
1064
1060
|
const lang = state.doc.attrs.primaryLanguageCode || 'en';
|
|
1065
1061
|
const abstracts = (0, doc_1.findAbstractsNode)(state.doc);
|
|
1066
|
-
const pos =
|
|
1067
|
-
? insertAfterPos
|
|
1068
|
-
: abstracts.pos + abstracts.node.content.size + 1;
|
|
1062
|
+
const pos = abstracts.node.content.size + abstracts.pos + 1;
|
|
1069
1063
|
const node = transform_1.schema.nodes.trans_graphical_abstract.createAndFill({
|
|
1070
1064
|
lang,
|
|
1071
1065
|
category: category.id,
|
|
@@ -29,9 +29,22 @@ exports.Metadata = styled_components_1.default.div `
|
|
|
29
29
|
margin-top: ${(props) => props.theme.grid.unit}px;
|
|
30
30
|
`;
|
|
31
31
|
exports.MetadataContainer = styled_components_1.default.div `
|
|
32
|
+
position: relative;
|
|
32
33
|
flex: 1;
|
|
33
34
|
`;
|
|
34
|
-
const ReferenceLine = ({ item }) => (react_1.default.createElement(exports.MetadataContainer, null,
|
|
35
|
+
const ReferenceLine = ({ item, showUncited }) => (react_1.default.createElement(exports.MetadataContainer, null,
|
|
36
|
+
showUncited && react_1.default.createElement(UncitedBadge, null, "UNCITED"),
|
|
35
37
|
react_1.default.createElement("div", { "data-cy": 'reference-title' }, item.title || item.literal || 'Untitled'),
|
|
36
38
|
react_1.default.createElement(exports.Metadata, null, (0, references_1.metadata)(item))));
|
|
37
39
|
exports.ReferenceLine = ReferenceLine;
|
|
40
|
+
const UncitedBadge = styled_components_1.default.span `
|
|
41
|
+
padding: 1px 6px;
|
|
42
|
+
display: flex;
|
|
43
|
+
margin-bottom: 2px;
|
|
44
|
+
max-width: max-content;
|
|
45
|
+
border-radius: 4px;
|
|
46
|
+
color: #353535;
|
|
47
|
+
background-color: #f7b314;
|
|
48
|
+
font-size: 10px;
|
|
49
|
+
font-weight: 500;
|
|
50
|
+
`;
|
|
@@ -38,6 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.ReferencesModal = void 0;
|
|
40
40
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
41
|
+
const transform_1 = require("@manuscripts/transform");
|
|
41
42
|
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
42
43
|
const react_1 = __importStar(require("react"));
|
|
43
44
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
@@ -45,135 +46,19 @@ const ReferenceForm_1 = require("./ReferenceForm/ReferenceForm");
|
|
|
45
46
|
const ReferenceLine_1 = require("./ReferenceLine");
|
|
46
47
|
const ImportBibliographyModal_1 = require("./ImportBibliographyModal");
|
|
47
48
|
const ImportSuccessPlaceholder_1 = require("./ImportSuccessPlaceholder");
|
|
48
|
-
const
|
|
49
|
-
min-width: 960px;
|
|
50
|
-
`;
|
|
51
|
-
const ReferencesSidebar = (0, styled_components_1.default)(style_guide_1.ModalSidebar) `
|
|
52
|
-
width: 70%;
|
|
53
|
-
`;
|
|
54
|
-
const ReferencesSidebarContent = (0, styled_components_1.default)(style_guide_1.SidebarContent) `
|
|
55
|
-
overflow-y: auto;
|
|
56
|
-
`;
|
|
57
|
-
const ImportFromFileFooter = styled_components_1.default.div `
|
|
58
|
-
padding: 16px;
|
|
59
|
-
`;
|
|
60
|
-
const ImportFromFileButton = styled_components_1.default.button `
|
|
61
|
-
display: flex;
|
|
62
|
-
width: 100%;
|
|
63
|
-
padding: 8px 24px;
|
|
64
|
-
justify-content: center;
|
|
65
|
-
align-items: center;
|
|
66
|
-
gap: 8px;
|
|
67
|
-
border-radius: 4px;
|
|
68
|
-
border: 1px dashed #c9c9c9;
|
|
69
|
-
background: #fafafa;
|
|
70
|
-
cursor: pointer;
|
|
71
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
72
|
-
font-size: 14px;
|
|
73
|
-
color: #353535;
|
|
74
|
-
|
|
75
|
-
svg {
|
|
76
|
-
width: 20px;
|
|
77
|
-
height: 20px;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
svg rect {
|
|
81
|
-
fill: #6e6e6e;
|
|
82
|
-
}
|
|
83
|
-
`;
|
|
84
|
-
const ReferencesInnerWrapper = (0, style_guide_1.withListNavigation)(styled_components_1.default.div `
|
|
85
|
-
width: 100%;
|
|
86
|
-
padding: 12px 0;
|
|
87
|
-
`);
|
|
88
|
-
const ReferenceButton = (0, style_guide_1.withNavigableListItem)(styled_components_1.default.div `
|
|
89
|
-
cursor: pointer;
|
|
90
|
-
display: flex;
|
|
91
|
-
justify-content: flex-start;
|
|
92
|
-
padding: ${(props) => props.theme.grid.unit * 4}px 0;
|
|
93
|
-
border-top: 1px solid transparent;
|
|
94
|
-
border-bottom: 1px solid transparent;
|
|
95
|
-
|
|
96
|
-
path {
|
|
97
|
-
fill: #c9c9c9;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
&:hover {
|
|
101
|
-
background: ${(props) => props.theme.colors.background.info};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
&.selected {
|
|
105
|
-
background: ${(props) => props.theme.colors.background.info};
|
|
106
|
-
border-top-color: #bce7f6;
|
|
107
|
-
border-bottom-color: #bce7f6;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.tooltip {
|
|
111
|
-
max-width: ${(props) => props.theme.grid.unit * 25}px;
|
|
112
|
-
padding: ${(props) => props.theme.grid.unit * 2}px;
|
|
113
|
-
border-radius: 6px;
|
|
114
|
-
}
|
|
115
|
-
`);
|
|
116
|
-
const IconContainer = styled_components_1.default.div `
|
|
117
|
-
padding-right: ${(props) => props.theme.grid.unit * 5}px;
|
|
118
|
-
position: relative;
|
|
119
|
-
`;
|
|
120
|
-
const CitationCount = styled_components_1.default.div `
|
|
121
|
-
border-radius: 50%;
|
|
122
|
-
width: 12px;
|
|
123
|
-
height: 12px;
|
|
124
|
-
position: absolute;
|
|
125
|
-
color: #ffffff;
|
|
126
|
-
background-color: #bce7f6;
|
|
127
|
-
text-align: center;
|
|
128
|
-
vertical-align: top;
|
|
129
|
-
top: 0;
|
|
130
|
-
left: 16px;
|
|
131
|
-
font-size: 9px;
|
|
132
|
-
|
|
133
|
-
&.unused {
|
|
134
|
-
background-color: #fe8f1f;
|
|
135
|
-
}
|
|
136
|
-
`;
|
|
49
|
+
const normalize_1 = require("../../lib/normalize");
|
|
137
50
|
const selectionTopOffset = 10;
|
|
138
51
|
const pageSize = 12;
|
|
139
52
|
const topTrigger = 0.2;
|
|
140
53
|
const bottomTrigger = 0.8;
|
|
141
54
|
const dropLimit = 36;
|
|
142
|
-
const normalize = (item) => ({
|
|
143
|
-
id: item.id,
|
|
144
|
-
type: item.type,
|
|
145
|
-
author: item.author || [],
|
|
146
|
-
editor: item.editor || [],
|
|
147
|
-
issued: item.issued,
|
|
148
|
-
['container-title']: item['container-title'] || '',
|
|
149
|
-
['collection-title']: item['collection-title'] || '',
|
|
150
|
-
DOI: item.DOI || '',
|
|
151
|
-
URL: item.URL || '',
|
|
152
|
-
volume: item.volume || '',
|
|
153
|
-
issue: item.issue || '',
|
|
154
|
-
supplement: item.supplement || '',
|
|
155
|
-
edition: item.edition || '',
|
|
156
|
-
page: item.page || '',
|
|
157
|
-
['number-of-pages']: item['number-of-pages'] || '',
|
|
158
|
-
title: item.title || '',
|
|
159
|
-
literal: item.literal || '',
|
|
160
|
-
std: item.std || '',
|
|
161
|
-
publisher: item.publisher || '',
|
|
162
|
-
['publisher-place']: item['publisher-place'] || '',
|
|
163
|
-
event: item.event || '',
|
|
164
|
-
['event-place']: item['event-place'] || '',
|
|
165
|
-
['event-date']: item['event-date'],
|
|
166
|
-
institution: item.institution || '',
|
|
167
|
-
locator: item.locator || '',
|
|
168
|
-
accessed: item.accessed,
|
|
169
|
-
comment: item.comment || '',
|
|
170
|
-
});
|
|
171
55
|
const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts, onSave, onDelete, handleImport, }) => {
|
|
172
56
|
const [importing, setImporting] = (0, react_1.useState)(false);
|
|
173
57
|
const [importSuccessCount, setImportSuccessCount] = (0, react_1.useState)(null);
|
|
174
58
|
const [confirm, setConfirm] = (0, react_1.useState)(false);
|
|
175
59
|
const valuesRef = (0, react_1.useRef)(undefined);
|
|
176
60
|
const [selection, setSelection] = (0, react_1.useState)();
|
|
61
|
+
const [isNew, setIsNew] = (0, react_1.useState)(false);
|
|
177
62
|
const selectionRef = (0, react_1.useRef)(null);
|
|
178
63
|
const sortedItems = (0, react_1.useMemo)(() => [...items].sort((a, b) => {
|
|
179
64
|
const aUncited = (citationCounts.get(a.id) ?? 0) === 0;
|
|
@@ -188,7 +73,17 @@ const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts, onSave
|
|
|
188
73
|
};
|
|
189
74
|
const selectionIndex = sortedItems.findIndex(isSelected);
|
|
190
75
|
(0, react_1.useEffect)(() => {
|
|
191
|
-
|
|
76
|
+
if (item) {
|
|
77
|
+
setSelection(item);
|
|
78
|
+
setIsNew(false);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
setIsNew(true);
|
|
82
|
+
setSelection({
|
|
83
|
+
id: (0, transform_1.generateNodeID)(transform_1.schema.nodes.bibliography_item),
|
|
84
|
+
type: 'article-journal',
|
|
85
|
+
});
|
|
86
|
+
}
|
|
192
87
|
}, [item]);
|
|
193
88
|
(0, react_1.useEffect)(() => {
|
|
194
89
|
setTimeout(() => {
|
|
@@ -238,10 +133,11 @@ const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts, onSave
|
|
|
238
133
|
};
|
|
239
134
|
const currentCitationCount = citationCounts.get(item.id);
|
|
240
135
|
if (currentCitationCount === undefined) {
|
|
241
|
-
citationCounts.set(item.id,
|
|
136
|
+
citationCounts.set(item.id, 0);
|
|
242
137
|
}
|
|
243
138
|
onSave(item);
|
|
244
139
|
setSelection(item);
|
|
140
|
+
setIsNew(false);
|
|
245
141
|
setConfirm(false);
|
|
246
142
|
};
|
|
247
143
|
const handleDelete = () => {
|
|
@@ -251,14 +147,18 @@ const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts, onSave
|
|
|
251
147
|
onDelete(selection);
|
|
252
148
|
setSelection(undefined);
|
|
253
149
|
};
|
|
150
|
+
const hasChanged = () => {
|
|
151
|
+
const values = valuesRef.current;
|
|
152
|
+
return (values && selection && !(0, isEqual_1.default)(values, (0, normalize_1.normalizeBlblioItem)(selection)));
|
|
153
|
+
};
|
|
254
154
|
const clearImportSuccess = () => setImportSuccessCount(null);
|
|
255
155
|
const handleItemClick = (item) => {
|
|
256
156
|
clearImportSuccess();
|
|
257
|
-
|
|
258
|
-
if (values && selection && !(0, isEqual_1.default)(values, normalize(selection))) {
|
|
157
|
+
if (hasChanged()) {
|
|
259
158
|
setConfirm(true);
|
|
260
159
|
return;
|
|
261
160
|
}
|
|
161
|
+
setIsNew(false);
|
|
262
162
|
setSelection(item);
|
|
263
163
|
};
|
|
264
164
|
const handleChange = (values) => {
|
|
@@ -270,9 +170,6 @@ const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts, onSave
|
|
|
270
170
|
setSelection(undefined);
|
|
271
171
|
setImportSuccessCount(data.length);
|
|
272
172
|
};
|
|
273
|
-
if (sortedItems.length <= 0) {
|
|
274
|
-
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
275
|
-
}
|
|
276
173
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
277
174
|
importing && (react_1.default.createElement(ImportBibliographyModal_1.ImportBibliographyModal, { onCancel: () => setImporting(false), onSave: handleImportSave })),
|
|
278
175
|
react_1.default.createElement(style_guide_1.StyledModal, { isOpen: isOpen, onRequestClose: onCancel },
|
|
@@ -294,16 +191,143 @@ const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts, onSave
|
|
|
294
191
|
react_1.default.createElement(style_guide_1.ModalSidebarHeader, null,
|
|
295
192
|
react_1.default.createElement(style_guide_1.ModalSidebarTitle, null, "References")),
|
|
296
193
|
react_1.default.createElement(ReferencesSidebarContent, { ref: ref },
|
|
297
|
-
react_1.default.createElement(
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
194
|
+
react_1.default.createElement(NewReferenceButton, { onClick: () => {
|
|
195
|
+
if (hasChanged()) {
|
|
196
|
+
setConfirm(true);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
setIsNew(true);
|
|
200
|
+
setSelection({
|
|
201
|
+
id: (0, transform_1.generateNodeID)(transform_1.schema.nodes.bibliography_item),
|
|
202
|
+
type: 'article-journal',
|
|
203
|
+
});
|
|
204
|
+
}, className: isNew ? 'selected' : '', disabled: isNew },
|
|
205
|
+
react_1.default.createElement(style_guide_1.AddIcon, null),
|
|
206
|
+
react_1.default.createElement("span", null, "New Reference")),
|
|
207
|
+
react_1.default.createElement(ReferencesInnerWrapper, null,
|
|
208
|
+
react_1.default.createElement(ExistingReferencesHeading, null, "Existing References"),
|
|
209
|
+
sortedItems.slice(startIndex, endIndex + 1).map((item) => (react_1.default.createElement(ReferenceButton, { key: item.id, id: item.id, className: isSelected(item) ? 'selected' : '', onClick: () => handleItemClick(item), ref: isSelected(item) ? selectionRef : null },
|
|
210
|
+
react_1.default.createElement(IconContainer, null,
|
|
211
|
+
react_1.default.createElement(CitationCountIconStyled, null),
|
|
212
|
+
(citationCounts.get(item.id) || 0) > 0 ? (react_1.default.createElement(CitationCount, { "data-tooltip-content": "Number of times used in the document" }, citationCounts.get(item.id))) : (react_1.default.createElement(CitationCount, { className: "unused" }, "0"))),
|
|
213
|
+
react_1.default.createElement(ReferenceLine_1.ReferenceLine, { showUncited: !citationCounts.get(item.id), item: item })))))),
|
|
302
214
|
react_1.default.createElement(ImportFromFileFooter, null,
|
|
303
215
|
react_1.default.createElement(ImportFromFileButton, { type: "button", "data-cy": "import-from-file-button", onClick: () => setImporting(true) },
|
|
304
216
|
react_1.default.createElement(style_guide_1.AddAuthorIcon, null),
|
|
305
217
|
"Import from file"))),
|
|
306
|
-
react_1.default.createElement(style_guide_1.ScrollableModalContent, null, importSuccessCount !== null ? (react_1.default.createElement(ImportSuccessPlaceholder_1.ImportSuccessPlaceholder, { count: importSuccessCount })) : (selection && (react_1.default.createElement(ReferenceForm_1.ReferenceForm, { values:
|
|
218
|
+
react_1.default.createElement(style_guide_1.ScrollableModalContent, null, importSuccessCount !== null ? (react_1.default.createElement(ImportSuccessPlaceholder_1.ImportSuccessPlaceholder, { count: importSuccessCount })) : (selection && (react_1.default.createElement(ReferenceForm_1.ReferenceForm, { values: (0, normalize_1.normalizeBlblioItem)(selection), showDelete: !citationCounts.get(selection.id) &&
|
|
307
219
|
isNewItem(selection, ['id', 'type']), onChange: handleChange, onCancel: onCancel, onDelete: handleDelete, onSave: handleSave, actionsRef: actionsRef })))))))));
|
|
308
220
|
};
|
|
309
221
|
exports.ReferencesModal = ReferencesModal;
|
|
222
|
+
const ReferencesModalContainer = (0, styled_components_1.default)(style_guide_1.ModalContainer) `
|
|
223
|
+
min-width: 960px;
|
|
224
|
+
`;
|
|
225
|
+
const ReferencesSidebar = (0, styled_components_1.default)(style_guide_1.ModalSidebar) `
|
|
226
|
+
width: 70%;
|
|
227
|
+
`;
|
|
228
|
+
const ReferencesSidebarContent = (0, styled_components_1.default)(style_guide_1.SidebarContent) `
|
|
229
|
+
overflow-y: auto;
|
|
230
|
+
`;
|
|
231
|
+
const ReferencesInnerWrapper = (0, style_guide_1.withListNavigation)(styled_components_1.default.div `
|
|
232
|
+
width: 100%;
|
|
233
|
+
padding: 12px 0;
|
|
234
|
+
`);
|
|
235
|
+
const CitationCountIconStyled = (0, styled_components_1.default)(style_guide_1.CitationCountIcon) ``;
|
|
236
|
+
const ReferenceButton = (0, style_guide_1.withNavigableListItem)(styled_components_1.default.button `
|
|
237
|
+
cursor: pointer;
|
|
238
|
+
display: flex;
|
|
239
|
+
width: 100%;
|
|
240
|
+
justify-content: flex-start;
|
|
241
|
+
font: inherit;
|
|
242
|
+
appearance: none;
|
|
243
|
+
-webkit-appearance: none;
|
|
244
|
+
background: none;
|
|
245
|
+
border: none;
|
|
246
|
+
border-radius: 0;
|
|
247
|
+
text-align: inherit;
|
|
248
|
+
|
|
249
|
+
padding: ${(props) => props.theme.grid.unit * 4}px 0;
|
|
250
|
+
border-top: 1px solid transparent;
|
|
251
|
+
border-bottom: 1px solid transparent;
|
|
252
|
+
|
|
253
|
+
${CitationCountIconStyled} path {
|
|
254
|
+
fill: #c9c9c9;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
&:hover {
|
|
258
|
+
background: ${(props) => props.theme.colors.background.info};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
&.selected {
|
|
262
|
+
background: ${(props) => props.theme.colors.background.info};
|
|
263
|
+
border-top-color: #bce7f6;
|
|
264
|
+
border-bottom-color: #bce7f6;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.tooltip {
|
|
268
|
+
max-width: ${(props) => props.theme.grid.unit * 25}px;
|
|
269
|
+
padding: ${(props) => props.theme.grid.unit * 2}px;
|
|
270
|
+
border-radius: 6px;
|
|
271
|
+
}
|
|
272
|
+
`);
|
|
273
|
+
const IconContainer = styled_components_1.default.div `
|
|
274
|
+
padding-right: ${(props) => props.theme.grid.unit * 5}px;
|
|
275
|
+
position: relative;
|
|
276
|
+
`;
|
|
277
|
+
const CitationCount = styled_components_1.default.div `
|
|
278
|
+
border-radius: 50%;
|
|
279
|
+
width: 12px;
|
|
280
|
+
height: 12px;
|
|
281
|
+
position: absolute;
|
|
282
|
+
color: #ffffff;
|
|
283
|
+
background-color: #bce7f6;
|
|
284
|
+
text-align: center;
|
|
285
|
+
vertical-align: top;
|
|
286
|
+
top: 0;
|
|
287
|
+
left: 16px;
|
|
288
|
+
font-size: 9px;
|
|
289
|
+
|
|
290
|
+
&.unused {
|
|
291
|
+
background-color: #fe8f1f;
|
|
292
|
+
}
|
|
293
|
+
`;
|
|
294
|
+
const NewReferenceButton = (0, styled_components_1.default)(ReferenceButton) `
|
|
295
|
+
svg {
|
|
296
|
+
margin-right: 8px;
|
|
297
|
+
}
|
|
298
|
+
`;
|
|
299
|
+
const ExistingReferencesHeading = styled_components_1.default.h3 `
|
|
300
|
+
font-size: 18px;
|
|
301
|
+
font-style: normal;
|
|
302
|
+
font-weight: 400;
|
|
303
|
+
padding: 8px 0 20px;
|
|
304
|
+
margin: 0;
|
|
305
|
+
color: #6e6e6e;
|
|
306
|
+
`;
|
|
307
|
+
const ImportFromFileFooter = styled_components_1.default.div `
|
|
308
|
+
padding: 16px;
|
|
309
|
+
`;
|
|
310
|
+
const ImportFromFileButton = styled_components_1.default.button `
|
|
311
|
+
display: flex;
|
|
312
|
+
width: 100%;
|
|
313
|
+
padding: 8px 24px;
|
|
314
|
+
justify-content: center;
|
|
315
|
+
align-items: center;
|
|
316
|
+
gap: 8px;
|
|
317
|
+
border-radius: 4px;
|
|
318
|
+
border: 1px dashed #c9c9c9;
|
|
319
|
+
background: #fafafa;
|
|
320
|
+
cursor: pointer;
|
|
321
|
+
font-family: ${(props) => props.theme.font.family.sans};
|
|
322
|
+
font-size: 14px;
|
|
323
|
+
color: #353535;
|
|
324
|
+
|
|
325
|
+
svg {
|
|
326
|
+
width: 20px;
|
|
327
|
+
height: 20px;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
svg rect {
|
|
331
|
+
fill: #6e6e6e;
|
|
332
|
+
}
|
|
333
|
+
`;
|
|
@@ -118,6 +118,7 @@ exports.default = (props, dispatch) => {
|
|
|
118
118
|
headshot_element: (0, headshot_element_1.default)(props, dispatch),
|
|
119
119
|
headshot_image: (0, headshot_image_editable_1.default)(props, dispatch),
|
|
120
120
|
abstracts: (0, abstracts_1.default)(props),
|
|
121
|
+
abstract: (0, section_1.default)(props),
|
|
121
122
|
trans_abstract: (0, translated_abstract_editable_1.default)(props),
|
|
122
123
|
trans_graphical_abstract: (0, trans_graphical_abstract_editable_1.default)(props),
|
|
123
124
|
attachment: (0, attachment_1.default)(props, dispatch),
|
package/dist/cjs/icons.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.webLinkIcon = exports.ORCIDIcon = exports.tickIcon = exports.fileMainDocumentIcon = exports.leadingHalfLeftIcon = exports.leadingWallpaperIcon = exports.leadingLargeFloatIcon = exports.leadingSmallFloatIcon = exports.leadingHeroImageIcon = exports.linkIcon = exports.translateIcon = exports.draggableIcon = exports.fileCorruptedIcon = exports.imageDefaultIcon = exports.imageLeftIcon = exports.imageRightIcon = exports.plusIcon = exports.lockIcon = exports.scrollIcon = exports.sectionCategoryIcon = exports.editIcon = exports.deleteIcon = exports.cameraIcon = exports.alertIcon = exports.arrowUp = exports.arrowDown = exports.
|
|
3
|
+
exports.webLinkIcon = exports.ORCIDIcon = exports.tickIcon = exports.fileMainDocumentIcon = exports.leadingHalfLeftIcon = exports.leadingWallpaperIcon = exports.leadingLargeFloatIcon = exports.leadingSmallFloatIcon = exports.leadingHeroImageIcon = exports.linkIcon = exports.translateIcon = exports.draggableIcon = exports.fileCorruptedIcon = exports.imageDefaultIcon = exports.imageLeftIcon = exports.imageRightIcon = exports.plusIcon = exports.lockIcon = exports.scrollIcon = exports.sectionCategoryIcon = exports.editIcon = exports.deleteIcon = exports.cameraIcon = exports.alertIcon = exports.arrowUp = exports.arrowDown = exports.addIcon = void 0;
|
|
4
4
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const server_1 = require("react-dom/server");
|
|
7
7
|
const renderIcon = (c) => (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(c));
|
|
8
|
-
exports.
|
|
8
|
+
exports.addIcon = renderIcon(style_guide_1.AddAuthorIcon);
|
|
9
9
|
exports.arrowDown = renderIcon(style_guide_1.ArrowDownCircleIcon);
|
|
10
10
|
exports.arrowUp = renderIcon(style_guide_1.ArrowUpIcon);
|
|
11
11
|
exports.alertIcon = renderIcon(style_guide_1.AlertIcon);
|
|
@@ -263,7 +263,10 @@ class ContextMenu {
|
|
|
263
263
|
menu.appendChild(this.createMenuSection((section) => {
|
|
264
264
|
let nodeName = transform_1.nodeNames.get(type) || '';
|
|
265
265
|
if (type === transform_1.schema.nodes.section_title) {
|
|
266
|
-
|
|
266
|
+
const containerType = $pos.parent.type;
|
|
267
|
+
nodeName =
|
|
268
|
+
transform_1.nodeNames.get(containerType) ??
|
|
269
|
+
transform_1.nodeNames.get(transform_1.schema.nodes.section);
|
|
267
270
|
}
|
|
268
271
|
section.appendChild(this.createMenuItem(`Delete ${nodeName}`, () => {
|
|
269
272
|
this.deleteNode(type);
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.checkID = exports.normalizeAuthor = exports.normalizeAffiliation = void 0;
|
|
18
|
+
exports.normalizeBlblioItem = exports.checkID = exports.normalizeAuthor = exports.normalizeAffiliation = void 0;
|
|
19
19
|
const transform_1 = require("@manuscripts/transform");
|
|
20
20
|
const trim = (value) => (value ?? '').trim();
|
|
21
21
|
const normalizeAffiliation = (a) => ({
|
|
@@ -62,3 +62,33 @@ const checkID = (attrs, nodeType) => {
|
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
64
|
exports.checkID = checkID;
|
|
65
|
+
const normalizeBlblioItem = (item) => ({
|
|
66
|
+
id: item.id,
|
|
67
|
+
type: item.type,
|
|
68
|
+
author: item.author || [],
|
|
69
|
+
editor: item.editor || [],
|
|
70
|
+
issued: item.issued,
|
|
71
|
+
['container-title']: item['container-title'] || '',
|
|
72
|
+
['collection-title']: item['collection-title'] || '',
|
|
73
|
+
DOI: item.DOI || '',
|
|
74
|
+
URL: item.URL || '',
|
|
75
|
+
volume: item.volume || '',
|
|
76
|
+
issue: item.issue || '',
|
|
77
|
+
supplement: item.supplement || '',
|
|
78
|
+
edition: item.edition || '',
|
|
79
|
+
page: item.page || '',
|
|
80
|
+
['number-of-pages']: item['number-of-pages'] || '',
|
|
81
|
+
title: item.title || '',
|
|
82
|
+
literal: item.literal || '',
|
|
83
|
+
std: item.std || '',
|
|
84
|
+
publisher: item.publisher || '',
|
|
85
|
+
['publisher-place']: item['publisher-place'] || '',
|
|
86
|
+
event: item.event || '',
|
|
87
|
+
['event-place']: item['event-place'] || '',
|
|
88
|
+
['event-date']: item['event-date'],
|
|
89
|
+
institution: item.institution || '',
|
|
90
|
+
locator: item.locator || '',
|
|
91
|
+
accessed: item.accessed,
|
|
92
|
+
comment: item.comment || '',
|
|
93
|
+
});
|
|
94
|
+
exports.normalizeBlblioItem = normalizeBlblioItem;
|
package/dist/cjs/lib/paste.js
CHANGED
|
@@ -75,7 +75,6 @@ const transformPastedHTML = (html) => {
|
|
|
75
75
|
const doc = new DOMParser().parseFromString(html, 'text/html');
|
|
76
76
|
wrapHeadingWithSection(doc);
|
|
77
77
|
wrapTableWithFigure(doc);
|
|
78
|
-
console.log(doc.body.innerHTML);
|
|
79
78
|
return doc.body.innerHTML;
|
|
80
79
|
};
|
|
81
80
|
exports.transformPastedHTML = transformPastedHTML;
|
package/dist/cjs/menus.js
CHANGED
|
@@ -489,7 +489,7 @@ const getEditorMenus = (editor) => {
|
|
|
489
489
|
};
|
|
490
490
|
const ABSTRACT_ID = 'abstract';
|
|
491
491
|
const abstractSection = allAbstractsCategories.find((s) => s.id === ABSTRACT_ID);
|
|
492
|
-
const ABSTRACT_GRAPHICAL_ID = '
|
|
492
|
+
const ABSTRACT_GRAPHICAL_ID = 'graphical';
|
|
493
493
|
const graphicalAbstractSection = allAbstractsCategories.find((s) => s.id === ABSTRACT_GRAPHICAL_ID);
|
|
494
494
|
const abstractsSubmenuList = allAbstractsCategories.filter((c) => c.id !== ABSTRACT_ID && c.id !== ABSTRACT_GRAPHICAL_ID);
|
|
495
495
|
const metadata = {
|
|
@@ -38,6 +38,7 @@ const icons = new Map([
|
|
|
38
38
|
[nodes.paragraph, style_guide_1.OutlineParagraphIcon],
|
|
39
39
|
[nodes.pullquote_element, style_guide_1.OutlinePullQuoteIcon],
|
|
40
40
|
[nodes.section, style_guide_1.OutlineSectionIcon],
|
|
41
|
+
[nodes.abstract, style_guide_1.OutlineSectionIcon],
|
|
41
42
|
[nodes.table_element, style_guide_1.OutlineTableIcon],
|
|
42
43
|
[nodes.graphical_abstract_section, style_guide_1.OutlineSectionIcon],
|
|
43
44
|
[nodes.trans_graphical_abstract, style_guide_1.OutlineSectionIcon],
|
|
@@ -25,7 +25,7 @@ const utils_1 = require("../lib/utils");
|
|
|
25
25
|
const createAddSubtitleButton = (handler) => {
|
|
26
26
|
const button = document.createElement('span');
|
|
27
27
|
button.className = 'add-subtitle';
|
|
28
|
-
button.innerHTML = `${icons_1.
|
|
28
|
+
button.innerHTML = `${icons_1.addIcon} <span class="add-subtitle-text">Add subtitle</span>`;
|
|
29
29
|
button.tabIndex = 0;
|
|
30
30
|
const activate = (event) => {
|
|
31
31
|
event.preventDefault();
|
|
@@ -127,7 +127,13 @@ const buildBibliographyPluginState = (doc, csl, $old) => {
|
|
|
127
127
|
return item;
|
|
128
128
|
},
|
|
129
129
|
}, csl.style, 'en-US');
|
|
130
|
-
const
|
|
130
|
+
const uncitedIds = [];
|
|
131
|
+
bibliographyItems.forEach((item, id) => {
|
|
132
|
+
if (!rids.includes(id)) {
|
|
133
|
+
uncitedIds.push(id);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
const citationTexts = engine.rebuildProcessorState(nodes.map(([node]) => (0, transform_1.buildCiteprocCitation)(node.attrs)), 'html', uncitedIds);
|
|
131
137
|
$new.version = String(version++);
|
|
132
138
|
$new.citationCounts = citationCounts;
|
|
133
139
|
$new.engine = engine;
|
|
@@ -82,7 +82,7 @@ const buildPluginState = (state, props) => {
|
|
|
82
82
|
if (node.type === transform_1.schema.nodes.box_element) {
|
|
83
83
|
return false;
|
|
84
84
|
}
|
|
85
|
-
if ((0, transform_1.isSectionNode)(node)) {
|
|
85
|
+
if ((0, transform_1.isSectionNode)(node) || (0, transform_1.isAbstractNode)(node)) {
|
|
86
86
|
const categoryID = node.attrs.category;
|
|
87
87
|
const category = categories.get(categoryID);
|
|
88
88
|
const $pos = state.doc.resolve(pos);
|
|
@@ -100,7 +100,10 @@ const buildPluginState = (state, props) => {
|
|
|
100
100
|
return { decorations: prosemirror_view_1.DecorationSet.create(state.doc, decorations) };
|
|
101
101
|
};
|
|
102
102
|
const getUsedSectionCategoryIDs = (state) => {
|
|
103
|
-
const sections =
|
|
103
|
+
const sections = [
|
|
104
|
+
...(0, prosemirror_utils_1.findChildrenByType)(state.doc, transform_1.schema.nodes.section),
|
|
105
|
+
...(0, prosemirror_utils_1.findChildrenByType)(state.doc, transform_1.schema.nodes.abstract),
|
|
106
|
+
];
|
|
104
107
|
const used = new Set();
|
|
105
108
|
sections.forEach(({ node }) => {
|
|
106
109
|
if (node.attrs.category) {
|