@manuscripts/body-editor 3.17.5 → 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.
Files changed (43) hide show
  1. package/dist/cjs/components/references/ReferenceLine.js +14 -1
  2. package/dist/cjs/components/references/ReferencesModal.js +155 -131
  3. package/dist/cjs/icons.js +2 -2
  4. package/dist/cjs/lib/normalize.js +31 -1
  5. package/dist/cjs/lib/paste.js +0 -1
  6. package/dist/cjs/plugins/add-subtitle.js +1 -1
  7. package/dist/cjs/plugins/bibliography.js +7 -1
  8. package/dist/cjs/plugins/translations.js +1 -1
  9. package/dist/cjs/versions.js +1 -1
  10. package/dist/cjs/views/bibliography_element.js +44 -2
  11. package/dist/cjs/views/figure_element.js +1 -1
  12. package/dist/cjs/views/headshot_grid.js +1 -1
  13. package/dist/es/components/references/ReferenceLine.js +14 -1
  14. package/dist/es/components/references/ReferencesModal.js +156 -132
  15. package/dist/es/icons.js +1 -1
  16. package/dist/es/lib/normalize.js +30 -1
  17. package/dist/es/lib/paste.js +0 -1
  18. package/dist/es/plugins/add-subtitle.js +2 -2
  19. package/dist/es/plugins/bibliography.js +7 -1
  20. package/dist/es/plugins/translations.js +2 -2
  21. package/dist/es/versions.js +1 -1
  22. package/dist/es/views/bibliography_element.js +45 -3
  23. package/dist/es/views/figure_element.js +2 -2
  24. package/dist/es/views/headshot_grid.js +2 -2
  25. package/dist/types/components/references/ReferenceLine.d.ts +1 -0
  26. package/dist/types/icons.d.ts +1 -1
  27. package/dist/types/lib/normalize.d.ts +30 -1
  28. package/dist/types/versions.d.ts +1 -1
  29. package/dist/types/views/bibliography_element.d.ts +5 -1
  30. package/package.json +1 -1
  31. package/src/components/references/ReferenceLine.tsx +16 -1
  32. package/src/components/references/ReferencesModal.tsx +178 -140
  33. package/src/icons.ts +1 -1
  34. package/src/lib/normalize.ts +36 -1
  35. package/src/lib/paste.ts +0 -1
  36. package/src/plugins/add-subtitle.ts +2 -2
  37. package/src/plugins/bibliography.ts +10 -3
  38. package/src/plugins/translations.ts +2 -2
  39. package/src/versions.ts +1 -1
  40. package/src/views/bibliography_element.ts +61 -4
  41. package/src/views/figure_element.ts +2 -2
  42. package/src/views/headshot_grid.ts +2 -2
  43. package/styles/AdvancedEditor.css +29 -2
@@ -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 ReferencesModalContainer = (0, styled_components_1.default)(style_guide_1.ModalContainer) `
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
- setSelection(item);
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, 1);
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
- const values = valuesRef.current;
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(ReferencesInnerWrapper, null, 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 },
298
- react_1.default.createElement(IconContainer, null,
299
- react_1.default.createElement(style_guide_1.CitationCountIcon, null),
300
- (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"))),
301
- react_1.default.createElement(ReferenceLine_1.ReferenceLine, { item: item })))))),
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: normalize(selection), showDelete: !citationCounts.get(selection.id) &&
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
+ `;
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.addAuthorIcon = void 0;
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.addAuthorIcon = renderIcon(style_guide_1.AddAuthorIcon);
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);
@@ -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;
@@ -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;
@@ -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.addAuthorIcon} <span class="add-subtitle-text">Add subtitle</span>`;
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 citationTexts = engine.rebuildProcessorState(nodes.map(([node]) => (0, transform_1.buildCiteprocCitation)(node.attrs)));
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;
@@ -85,7 +85,7 @@ exports.default = (props) => new prosemirror_state_1.Plugin({
85
85
  $span.tabIndex = 0;
86
86
  $span.className = 'add-trans-abstract';
87
87
  $span.title = 'Add translation';
88
- $span.innerHTML = `${icons_1.addAuthorIcon} <span class="add-trans-abstract-text">Add translation</span>`;
88
+ $span.innerHTML = `${icons_1.addIcon} <span class="add-trans-abstract-text">Add translation</span>`;
89
89
  const handleActivate = (event) => {
90
90
  event.preventDefault();
91
91
  event.stopPropagation();
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MATHJAX_VERSION = exports.VERSION = void 0;
4
- exports.VERSION = '3.17.5';
4
+ exports.VERSION = '3.18.0';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -20,6 +20,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.BibliographyElementBlockView = void 0;
22
22
  const style_guide_1 = require("@manuscripts/style-guide");
23
+ const transform_1 = require("@manuscripts/transform");
23
24
  const prosemirror_state_1 = require("prosemirror-state");
24
25
  const ReferencesEditor_1 = require("../components/references/ReferencesEditor");
25
26
  const comments_1 = require("../lib/comments");
@@ -34,6 +35,7 @@ const block_view_1 = __importDefault(require("./block_view"));
34
35
  const creators_1 = require("./creators");
35
36
  const ReactSubView_1 = __importDefault(require("./ReactSubView"));
36
37
  const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
38
+ const icons_1 = require("../icons");
37
39
  class BibliographyElementBlockView extends block_view_1.default {
38
40
  constructor() {
39
41
  super(...arguments);
@@ -138,7 +140,7 @@ class BibliographyElementBlockView extends block_view_1.default {
138
140
  const componentProps = {
139
141
  items: Array.from(bib.bibliographyItems.values()),
140
142
  citationCounts: bib.citationCounts,
141
- item: bib.bibliographyItems.get(id),
143
+ item: id ? bib.bibliographyItems.get(id) : undefined,
142
144
  onSave: this.handleSave,
143
145
  onDelete: this.handleDelete,
144
146
  };
@@ -181,7 +183,18 @@ class BibliographyElementBlockView extends block_view_1.default {
181
183
  return;
182
184
  }
183
185
  this.version = bib.version;
186
+ this.renderBibs(bib);
187
+ this.createInlineModalButton();
188
+ this.updateSelections();
189
+ }
190
+ renderBibs(bib) {
184
191
  const nodes = new Map();
192
+ const rids = [];
193
+ this.view.state.doc.descendants((node) => {
194
+ if ((0, transform_1.isCitationNode)(node)) {
195
+ rids.push(...node.attrs.rids);
196
+ }
197
+ });
185
198
  this.node.descendants((node) => {
186
199
  const id = node.attrs.id;
187
200
  nodes.set(id, node);
@@ -219,6 +232,12 @@ class BibliographyElementBlockView extends block_view_1.default {
219
232
  element.tabIndex = 0;
220
233
  const comment = (0, comments_1.createCommentMarker)('div', id);
221
234
  element.prepend(comment);
235
+ if (!rids.includes(id)) {
236
+ const uncitedMarker = document.createElement('span');
237
+ uncitedMarker.innerHTML = 'UNCITED';
238
+ uncitedMarker.classList.add('uncited-reference-marker');
239
+ element.prepend(uncitedMarker);
240
+ }
222
241
  (0, track_changes_plugin_1.addTrackChangesAttributes)(node.attrs, element);
223
242
  (0, track_changes_plugin_1.addTrackChangesClassNames)(node.attrs, element);
224
243
  wrapper.append(element);
@@ -236,7 +255,30 @@ class BibliographyElementBlockView extends block_view_1.default {
236
255
  else {
237
256
  this.container.appendChild(wrapper);
238
257
  }
239
- this.updateSelections();
258
+ }
259
+ createInlineModalButton() {
260
+ const can = this.props.getCapabilities();
261
+ if (!can.editCitationsAndRefs) {
262
+ if (this.inlineModalButton) {
263
+ this.inlineModalButton.remove();
264
+ this.inlineModalButton = null;
265
+ }
266
+ return;
267
+ }
268
+ if (this.inlineModalButton) {
269
+ return;
270
+ }
271
+ const $span = document.createElement('span');
272
+ $span.tabIndex = 0;
273
+ $span.className = 'add-new-reference add-trans-abstract';
274
+ $span.title = 'Add New Reference';
275
+ $span.innerHTML = `${icons_1.addIcon} <span type="button" tabindex="0" class="add-new-reference-text">Add new reference</span>`;
276
+ $span.addEventListener('click', (e) => {
277
+ this.showPopper();
278
+ });
279
+ $span.addEventListener('keydown', (0, navigation_utils_1.handleEnterKey)(() => this.showPopper()));
280
+ this.inlineModalButton = $span;
281
+ this.dom.appendChild($span);
240
282
  }
241
283
  }
242
284
  exports.BibliographyElementBlockView = BibliographyElementBlockView;
@@ -71,7 +71,7 @@ class FigureElementView extends image_element_1.ImageElementView {
71
71
  if (this.props.getCapabilities()?.editArticle) {
72
72
  this.addFigureBtn = Object.assign(document.createElement('button'), {
73
73
  className: 'add-button',
74
- innerHTML: icons_1.addAuthorIcon,
74
+ innerHTML: icons_1.addIcon,
75
75
  title: 'Add figure',
76
76
  });
77
77
  this.addFigureBtn.addEventListener('click', () => this.addFigure());
@@ -51,7 +51,7 @@ class HeadshotGridView extends block_view_1.default {
51
51
  this.addHeadshotButton.classList.add('add-headshot-element-button');
52
52
  this.addHeadshotButton.setAttribute('data-cy', 'headshot-add');
53
53
  this.addHeadshotButton.contentEditable = 'false';
54
- this.addHeadshotButton.innerHTML = icons_1.addAuthorIcon;
54
+ this.addHeadshotButton.innerHTML = icons_1.addIcon;
55
55
  const buttonText = document.createElement('span');
56
56
  buttonText.classList.add('add-headshot-element-text');
57
57
  buttonText.innerText = 'Add Headshot';
@@ -23,8 +23,21 @@ export const Metadata = styled.div `
23
23
  margin-top: ${(props) => props.theme.grid.unit}px;
24
24
  `;
25
25
  export const MetadataContainer = styled.div `
26
+ position: relative;
26
27
  flex: 1;
27
28
  `;
28
- export const ReferenceLine = ({ item }) => (React.createElement(MetadataContainer, null,
29
+ export const ReferenceLine = ({ item, showUncited }) => (React.createElement(MetadataContainer, null,
30
+ showUncited && React.createElement(UncitedBadge, null, "UNCITED"),
29
31
  React.createElement("div", { "data-cy": 'reference-title' }, item.title || item.literal || 'Untitled'),
30
32
  React.createElement(Metadata, null, metadata(item))));
33
+ const UncitedBadge = styled.span `
34
+ padding: 1px 6px;
35
+ display: flex;
36
+ margin-bottom: 2px;
37
+ max-width: max-content;
38
+ border-radius: 4px;
39
+ color: #353535;
40
+ background-color: #f7b314;
41
+ font-size: 10px;
42
+ font-weight: 500;
43
+ `;