@manuscripts/style-guide 0.32.31 → 1.0.0-LEAN-2108
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/AffiliationsEditor/AffiliationsEditor.js +5 -1
- package/dist/cjs/components/AffiliationsEditor/AffiliationsEditorItem.js +5 -1
- package/dist/cjs/components/AffiliationsEditor/AffiliationsEditorProfile.js +7 -3
- package/dist/cjs/components/AffiliationsEditor/AffiliationsEditorView.js +5 -1
- package/dist/cjs/components/AlertMessage.js +5 -1
- package/dist/cjs/components/AuthorForm/ContributorRolesSelect.js +5 -1
- package/dist/cjs/components/AuthorForm/index.js +5 -1
- package/dist/cjs/components/AuthorName.js +5 -1
- package/dist/cjs/components/AuthorsContainer.js +5 -1
- package/dist/cjs/components/AuthorsDND/AuthorsDND.js +5 -1
- package/dist/cjs/components/AuthorsList/Author.js +5 -1
- package/dist/cjs/components/AuthorsList/index.js +5 -1
- package/dist/cjs/components/Avatar.js +5 -1
- package/dist/cjs/components/Button.js +5 -1
- package/dist/cjs/components/ColorField/ColorSelector.js +5 -1
- package/dist/cjs/components/ColorField/index.js +5 -1
- package/dist/cjs/components/Comments/CommentActions.js +5 -1
- package/dist/cjs/components/Comments/CommentBody.js +5 -1
- package/dist/cjs/components/Comments/CommentTarget.js +5 -1
- package/dist/cjs/components/Comments/CommentWrapper.js +5 -1
- package/dist/cjs/components/EditorHeader/EditorHeader.js +5 -1
- package/dist/cjs/components/EditorHeader/ProceedView.js +5 -1
- package/dist/cjs/components/FileManager/FileManager.js +12 -20
- package/dist/cjs/components/FileManager/FileSectionItem/DesignationActions.js +5 -1
- package/dist/cjs/components/FileManager/FileSectionItem/DragLayer.js +5 -1
- package/dist/cjs/components/FileManager/FileSectionItem/DraggableFileSectionItem.js +5 -1
- package/dist/cjs/components/FileManager/FileSectionItem/FileInfo.js +5 -1
- package/dist/cjs/components/FileManager/FileSectionItem/ItemActions.js +5 -1
- package/dist/cjs/components/FileManager/FilesSection.js +5 -1
- package/dist/cjs/components/FileManager/InlineFilesSection.js +10 -4
- package/dist/cjs/components/FileManager/SelectDesignationActions.js +5 -1
- package/dist/cjs/components/FileManager/UploadFileArea.js +5 -1
- package/dist/cjs/components/FileManager/index.js +5 -1
- package/dist/cjs/components/InspectorSection.js +5 -1
- package/dist/cjs/components/ManuscriptNoteList.js +10 -6
- package/dist/cjs/components/NavDropdown.js +5 -1
- package/dist/cjs/components/PdfPreview.js +5 -1
- package/dist/cjs/components/Resizer/index.js +5 -1
- package/dist/cjs/components/SubmissionInspector/BaseInformation.js +5 -1
- package/dist/cjs/components/SubmissionInspector/index.js +5 -1
- package/dist/cjs/components/TextField.js +5 -1
- package/dist/cjs/components/Tip.js +5 -1
- package/dist/cjs/hooks/use-files.js +3 -3
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/lib/authors.js +2 -2
- package/dist/cjs/lib/inlineFiles.js +18 -42
- package/dist/es/components/AffiliationsEditor/AffiliationsEditorProfile.js +1 -1
- package/dist/es/components/FileManager/FileManager.js +6 -18
- package/dist/es/components/FileManager/InlineFilesSection.js +5 -3
- package/dist/es/components/ManuscriptNoteList.js +2 -2
- package/dist/es/hooks/use-files.js +2 -2
- package/dist/es/lib/authors.js +1 -1
- package/dist/es/lib/inlineFiles.js +10 -34
- package/dist/types/components/AffiliationsEditor/AffiliationsEditorProfile.d.ts +1 -1
- package/dist/types/components/AuthorForm/AuthorForm.d.ts +1 -1
- package/dist/types/components/AuthorForm/AuthorFormComponents.d.ts +1 -1
- package/dist/types/components/AuthorForm/ContributorRolesSelect.d.ts +1 -1
- package/dist/types/components/AuthorForm/RemoveAuthorButton.d.ts +1 -1
- package/dist/types/components/AuthorName.d.ts +1 -1
- package/dist/types/components/AuthorsContainer.d.ts +1 -1
- package/dist/types/components/AuthorsDND/AuthorItemComponents.d.ts +1 -1
- package/dist/types/components/AuthorsDND/AuthorsDND.d.ts +1 -1
- package/dist/types/components/AuthorsDND/DraggableAuthorItem.d.ts +2 -2
- package/dist/types/components/AuthorsList/Author.d.ts +1 -1
- package/dist/types/components/AuthorsList/AuthorsList.d.ts +1 -1
- package/dist/types/components/ColorField/ColorField.d.ts +2 -2
- package/dist/types/components/Comments/CommentBody.d.ts +1 -1
- package/dist/types/components/Comments/CommentUser.d.ts +2 -2
- package/dist/types/components/Dialog.d.ts +1 -0
- package/dist/types/components/EditorHeader/EditorHeader.d.ts +4 -4
- package/dist/types/components/FileManager/FileManager.d.ts +5 -5
- package/dist/types/components/FileManager/FileSectionItem/FileSectionItem.d.ts +2 -2
- package/dist/types/components/FileManager/InlineFilesSection.d.ts +0 -5
- package/dist/types/components/FileManager/util.d.ts +1 -0
- package/dist/types/components/ManuscriptNoteList.d.ts +2 -2
- package/dist/types/components/Resizer/types.d.ts +2 -2
- package/dist/types/components/SubmissionInspector/types.d.ts +11 -11
- package/dist/types/components/icons/add-author.d.ts +1 -0
- package/dist/types/components/icons/add-comment-icon.d.ts +1 -0
- package/dist/types/components/icons/add-icon-active.d.ts +1 -0
- package/dist/types/components/icons/add-icon-inverted.d.ts +1 -0
- package/dist/types/components/icons/back-arrow.d.ts +1 -0
- package/dist/types/components/icons/bookmark.d.ts +1 -0
- package/dist/types/components/icons/google.d.ts +1 -0
- package/dist/types/components/icons/orcid.d.ts +1 -0
- package/dist/types/components/icons/project-notification.d.ts +1 -0
- package/dist/types/components/icons/project.d.ts +1 -0
- package/dist/types/components/icons/projects-list.d.ts +1 -0
- package/dist/types/components/icons/search.d.ts +1 -0
- package/dist/types/components/icons/tick-mark.d.ts +1 -0
- package/dist/types/components/icons/user.d.ts +1 -0
- package/dist/types/hooks/use-files.d.ts +3 -3
- package/dist/types/lib/authors.d.ts +2 -2
- package/dist/types/lib/capabilities.d.ts +4 -4
- package/dist/types/lib/comments.d.ts +5 -5
- package/dist/types/lib/formatAddress.d.ts +1 -1
- package/dist/types/lib/inlineFiles.d.ts +2 -2
- package/dist/types/lib/name.d.ts +1 -1
- package/dist/types/types.d.ts +4 -4
- package/package.json +98 -76
- package/NOTICE +0 -2
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
*/
|
|
17
17
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
18
|
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
20
24
|
}) : (function(o, m, k, k2) {
|
|
21
25
|
if (k2 === undefined) k2 = k;
|
|
22
26
|
o[k2] = m[k];
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
*/
|
|
17
17
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
18
|
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
20
24
|
}) : (function(o, m, k, k2) {
|
|
21
25
|
if (k2 === undefined) k2 = k;
|
|
22
26
|
o[k2] = m[k];
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
*/
|
|
17
17
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
18
|
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
20
24
|
}) : (function(o, m, k, k2) {
|
|
21
25
|
if (k2 === undefined) k2 = k;
|
|
22
26
|
o[k2] = m[k];
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
*/
|
|
17
17
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
18
|
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
20
24
|
}) : (function(o, m, k, k2) {
|
|
21
25
|
if (k2 === undefined) k2 = k;
|
|
22
26
|
o[k2] = m[k];
|
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.useFiles = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
8
|
+
const transform_1 = require("@manuscripts/transform");
|
|
9
9
|
const inlineFiles_1 = __importDefault(require("../lib/inlineFiles"));
|
|
10
10
|
const use_deep_compare_1 = require("./use-deep-compare");
|
|
11
11
|
const getSupplementFiles = (modelMap, attachments, filePredicate) => {
|
|
12
|
-
const supplements = new Map((0,
|
|
12
|
+
const supplements = new Map((0, transform_1.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Supplement).map((supplement) => { var _a; return [(_a = supplement.href) === null || _a === void 0 ? void 0 : _a.replace('attachment:', ''), supplement]; }));
|
|
13
13
|
return attachments.filter((attachment) => {
|
|
14
14
|
if (supplements.has(attachment.id) && filePredicate) {
|
|
15
15
|
return filePredicate(attachment.name);
|
package/dist/cjs/index.js
CHANGED
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
*/
|
|
17
17
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
18
|
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
20
24
|
}) : (function(o, m, k, k2) {
|
|
21
25
|
if (k2 === undefined) k2 = k;
|
|
22
26
|
o[k2] = m[k];
|
package/dist/cjs/lib/authors.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.affiliationsOptions = exports.affiliationLabel = exports.isJointFirstAuthor = exports.buildAuthorsAndAffiliations = exports.buildAffiliationsMap = exports.buildAuthorAffiliations = exports.buildAffiliationIDs = exports.buildAuthorPriority = exports.buildSortedAuthors = void 0;
|
|
19
|
-
const
|
|
19
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
const getModelsByType = (modelMap, objectType) => {
|
|
21
21
|
const output = [];
|
|
22
22
|
for (const model of modelMap.values()) {
|
|
@@ -27,7 +27,7 @@ const getModelsByType = (modelMap, objectType) => {
|
|
|
27
27
|
return output;
|
|
28
28
|
};
|
|
29
29
|
const buildSortedAuthors = (modelMap) => {
|
|
30
|
-
return getModelsByType(modelMap,
|
|
30
|
+
return getModelsByType(modelMap, json_schema_1.ObjectTypes.Contributor)
|
|
31
31
|
.filter((item) => item.role === 'author')
|
|
32
32
|
.sort((a, b) => Number(a.priority) - Number(b.priority));
|
|
33
33
|
};
|
|
@@ -1,28 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
4
|
+
const transform_1 = require("@manuscripts/transform");
|
|
5
5
|
const util_1 = require("../components/FileManager/util");
|
|
6
|
-
const getAttachment = (externalFileRef, attachmentsMap) => {
|
|
7
|
-
if (!(externalFileRef === null || externalFileRef === void 0 ? void 0 : externalFileRef.url.startsWith('http'))) {
|
|
8
|
-
const attachmentId = externalFileRef === null || externalFileRef === void 0 ? void 0 : externalFileRef.url.replace('attachment:', '');
|
|
9
|
-
return attachmentId ? attachmentsMap.get(attachmentId) : undefined;
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
return [...attachmentsMap.values()].find((attachment) => attachment.link === externalFileRef.url.replace(/[&|?]format=jpg/, ''));
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
6
|
const getFigureData = (element, modelMap, attachmentsMap) => {
|
|
16
7
|
const attachments = [];
|
|
17
8
|
element.containedObjectIDs.map((id) => {
|
|
18
|
-
var _a;
|
|
19
9
|
const object = modelMap.get(id);
|
|
20
|
-
if (object && object.objectType ===
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
attachment
|
|
25
|
-
|
|
10
|
+
if (object && object.objectType === json_schema_1.ObjectTypes.Figure) {
|
|
11
|
+
const figure = object;
|
|
12
|
+
if (figure.src) {
|
|
13
|
+
const attachment = attachmentsMap.get(figure.src.replace('attachment:', ''));
|
|
14
|
+
if (attachment) {
|
|
15
|
+
attachment.modelId = id;
|
|
16
|
+
attachments.push(attachment);
|
|
17
|
+
}
|
|
26
18
|
}
|
|
27
19
|
}
|
|
28
20
|
});
|
|
@@ -34,7 +26,7 @@ const getFigureData = (element, modelMap, attachmentsMap) => {
|
|
|
34
26
|
exports.default = (modelMap, attachments) => {
|
|
35
27
|
const files = [];
|
|
36
28
|
const attachmentsMap = new Map(attachments.map((attachment) => [attachment.id, attachment]));
|
|
37
|
-
const { graphicalAbstractFigureId, figureElement
|
|
29
|
+
const { graphicalAbstractFigureId, figureElement } = getAuxiliaryObjects(modelMap);
|
|
38
30
|
if (graphicalAbstractFigureId) {
|
|
39
31
|
const element = modelMap.get(graphicalAbstractFigureId);
|
|
40
32
|
files.unshift(Object.assign(Object.assign({}, getFigureData(element, modelMap, attachmentsMap)), { label: `Graphical Abstract`, type: util_1.FileType.GraphicalAbstract }));
|
|
@@ -43,21 +35,6 @@ exports.default = (modelMap, attachments) => {
|
|
|
43
35
|
const element = modelMap.get(id);
|
|
44
36
|
files.push(Object.assign(Object.assign({}, getFigureData(element, modelMap, attachmentsMap)), { label: `Figure ${index + 1}`, type: util_1.FileType.Figure }));
|
|
45
37
|
});
|
|
46
|
-
tableElement.map((id) => {
|
|
47
|
-
var _a;
|
|
48
|
-
const tableElement = modelMap.get(id);
|
|
49
|
-
const table = modelMap.get(tableElement.containedObjectID);
|
|
50
|
-
const externalFileReference = (_a = table === null || table === void 0 ? void 0 : table.externalFileReferences) === null || _a === void 0 ? void 0 : _a.find((file) => file.kind === 'dataset' && file.ref);
|
|
51
|
-
const attachment = getAttachment(externalFileReference, attachmentsMap);
|
|
52
|
-
if (attachment) {
|
|
53
|
-
files.push({
|
|
54
|
-
id: tableElement._id,
|
|
55
|
-
label: `Table`,
|
|
56
|
-
type: util_1.FileType.SheetsWorkbooks,
|
|
57
|
-
attachments: [attachment],
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
38
|
return files;
|
|
62
39
|
};
|
|
63
40
|
const getAuxiliaryObjects = (modelMap) => {
|
|
@@ -66,12 +43,12 @@ const getAuxiliaryObjects = (modelMap) => {
|
|
|
66
43
|
const tableElementIds = [], orderObjects = {};
|
|
67
44
|
for (const model of modelMap.values()) {
|
|
68
45
|
switch (model.objectType) {
|
|
69
|
-
case
|
|
46
|
+
case json_schema_1.ObjectTypes.Section: {
|
|
70
47
|
const section = model;
|
|
71
48
|
if (section.category === 'MPSectionCategory:abstract-graphical') {
|
|
72
49
|
graphicalAbstractFigureId = (_a = section.elementIDs) === null || _a === void 0 ? void 0 : _a.find((id) => {
|
|
73
50
|
const obj = modelMap.get(id);
|
|
74
|
-
return obj && (0,
|
|
51
|
+
return obj && (0, transform_1.hasObjectType)(json_schema_1.ObjectTypes.FigureElement)(obj);
|
|
75
52
|
});
|
|
76
53
|
}
|
|
77
54
|
else {
|
|
@@ -81,11 +58,10 @@ const getAuxiliaryObjects = (modelMap) => {
|
|
|
81
58
|
return;
|
|
82
59
|
}
|
|
83
60
|
switch (element.objectType) {
|
|
84
|
-
case
|
|
85
|
-
case manuscripts_json_schema_1.ObjectTypes.MultiGraphicFigureElement:
|
|
61
|
+
case json_schema_1.ObjectTypes.FigureElement:
|
|
86
62
|
figureElementIds.push(element._id);
|
|
87
63
|
break;
|
|
88
|
-
case
|
|
64
|
+
case json_schema_1.ObjectTypes.TableElement:
|
|
89
65
|
tableElementIds.push(element._id);
|
|
90
66
|
break;
|
|
91
67
|
}
|
|
@@ -93,7 +69,7 @@ const getAuxiliaryObjects = (modelMap) => {
|
|
|
93
69
|
}
|
|
94
70
|
break;
|
|
95
71
|
}
|
|
96
|
-
case
|
|
72
|
+
case json_schema_1.ObjectTypes.ElementsOrder: {
|
|
97
73
|
const elementsOrder = model;
|
|
98
74
|
orderObjects[elementsOrder.elementType] = elementsOrder;
|
|
99
75
|
}
|
|
@@ -104,8 +80,8 @@ const getAuxiliaryObjects = (modelMap) => {
|
|
|
104
80
|
}
|
|
105
81
|
return {
|
|
106
82
|
graphicalAbstractFigureId,
|
|
107
|
-
figureElement: sortAuxiliaryObject(figureElementIds, orderObjects[
|
|
108
|
-
tableElement: sortAuxiliaryObject(tableElementIds, orderObjects[
|
|
83
|
+
figureElement: sortAuxiliaryObject(figureElementIds, orderObjects[json_schema_1.ObjectTypes.FigureElement]),
|
|
84
|
+
tableElement: sortAuxiliaryObject(tableElementIds, orderObjects[json_schema_1.ObjectTypes.TableElement]),
|
|
109
85
|
};
|
|
110
86
|
};
|
|
111
87
|
const sortAuxiliaryObject = (auxiliaryObjectIds, orderObject) => {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ObjectTypes
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import React, { useCallback, useState } from 'react';
|
|
18
18
|
import AffiliationsEditorView from './AffiliationsEditorView';
|
|
19
19
|
const AffiliationsEditorProfile = ({ affiliations, addAffiliation, updateAffiliation, removeAffiliation, components, styleOverrides, }) => {
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { buildSupplementaryMaterial
|
|
10
|
+
import { buildSupplementaryMaterial } from '@manuscripts/transform';
|
|
11
11
|
import React, { createContext, useCallback, useReducer } from 'react';
|
|
12
12
|
import ReactTooltip from 'react-tooltip';
|
|
13
13
|
import { useFiles } from '../../index';
|
|
@@ -61,31 +61,19 @@ export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileM
|
|
|
61
61
|
window.location.assign(url);
|
|
62
62
|
}, []);
|
|
63
63
|
const handleUpdateInline = useCallback((modelId, attachment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
|
-
var _a;
|
|
65
64
|
const figureModel = modelMap.get(modelId);
|
|
66
|
-
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
imageExternalFileIndex > -1) {
|
|
70
|
-
const newRefs = [...figureModel.externalFileReferences];
|
|
71
|
-
newRefs[imageExternalFileIndex] = {
|
|
72
|
-
url: `attachment:${attachment.id}`,
|
|
73
|
-
kind: 'imageRepresentation',
|
|
74
|
-
};
|
|
75
|
-
if (addAttachmentToState) {
|
|
76
|
-
addAttachmentToState(Object.assign({}, attachment));
|
|
77
|
-
}
|
|
78
|
-
yield saveModel(Object.assign(Object.assign({}, figureModel), { src: '', externalFileReferences: newRefs }));
|
|
65
|
+
figureModel.src = `attachment:${attachment.id}`;
|
|
66
|
+
if (addAttachmentToState) {
|
|
67
|
+
addAttachmentToState(Object.assign({}, attachment));
|
|
79
68
|
}
|
|
69
|
+
yield saveModel(figureModel);
|
|
80
70
|
}), [modelMap, saveModel, addAttachmentToState]);
|
|
81
71
|
const attachments = getAttachments();
|
|
82
72
|
const { otherFiles, supplementFiles, inlineFiles } = useFiles(modelMap, attachments);
|
|
83
73
|
const handleDetachFile = (attachmentId, modelId) => {
|
|
84
|
-
var _a;
|
|
85
74
|
const model = modelMap.get(modelId);
|
|
86
75
|
if (model) {
|
|
87
|
-
|
|
88
|
-
saveModel(Object.assign(Object.assign({}, model), { externalFileReferences: externalFileReferences || [], src: '' }));
|
|
76
|
+
saveModel(Object.assign(Object.assign({}, model), { src: '' }));
|
|
89
77
|
}
|
|
90
78
|
};
|
|
91
79
|
const getFileSectionExternalFile = (fileSection) => {
|
|
@@ -6,16 +6,18 @@ import { FileInfoContainer, FileNameTitleContainer, FileTitle, } from './FileSec
|
|
|
6
6
|
import { ActionsIcon, Item, } from './FileSectionItem/FileSectionItem';
|
|
7
7
|
import { ItemActions } from './FileSectionItem/ItemActions';
|
|
8
8
|
import { extensionsWithFileTypesMap, fileTypesWithIconMap, } from './util';
|
|
9
|
+
const trackedJoint = ':dataTracked:';
|
|
9
10
|
export const InlineFilesSection = ({ handleReplace, handleDownload, handleUpdateInline, handleDetachFile, inlineFiles, isEditor, dispatch, }) => {
|
|
10
11
|
const onElementClick = useCallback((e) => {
|
|
11
12
|
if (!isEditor) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
15
|
const { id } = e.currentTarget;
|
|
15
|
-
const
|
|
16
|
-
|
|
16
|
+
const clearedId = id.split(trackedJoint)[0];
|
|
17
|
+
const isSelected = clearedId == window.location.hash.substr(1);
|
|
18
|
+
window.location.hash = !isSelected ? `#${clearedId}` : '#';
|
|
17
19
|
if (isSelected) {
|
|
18
|
-
window.location.hash = `#${
|
|
20
|
+
window.location.hash = `#${clearedId}`;
|
|
19
21
|
}
|
|
20
22
|
}, [isEditor]);
|
|
21
23
|
return (React.createElement("div", null, inlineFiles.map((file, index) => {
|
|
@@ -8,8 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import GutterAddIconNormal from '@manuscripts/assets/react/GutterAddIconNormal';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { ObjectTypes, } from '@manuscripts/json-schema';
|
|
12
|
+
import { buildContribution, buildNote } from '@manuscripts/transform';
|
|
13
13
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
14
14
|
import styled from 'styled-components';
|
|
15
15
|
import { v4 as uuid } from 'uuid';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
2
|
+
import { getModelsByType } from '@manuscripts/transform';
|
|
3
3
|
import getInlineFiles from '../lib/inlineFiles';
|
|
4
4
|
import { useDeepCompareMemo } from './use-deep-compare';
|
|
5
5
|
const getSupplementFiles = (modelMap, attachments, filePredicate) => {
|
package/dist/es/lib/authors.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ObjectTypes, } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes, } from '@manuscripts/json-schema';
|
|
17
17
|
const getModelsByType = (modelMap, objectType) => {
|
|
18
18
|
const output = [];
|
|
19
19
|
for (const model of modelMap.values()) {
|
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ObjectTypes, } from '@manuscripts/json-schema';
|
|
2
|
+
import { hasObjectType } from '@manuscripts/transform';
|
|
3
3
|
import { FileType } from '../components/FileManager/util';
|
|
4
|
-
const getAttachment = (externalFileRef, attachmentsMap) => {
|
|
5
|
-
if (!(externalFileRef === null || externalFileRef === void 0 ? void 0 : externalFileRef.url.startsWith('http'))) {
|
|
6
|
-
const attachmentId = externalFileRef === null || externalFileRef === void 0 ? void 0 : externalFileRef.url.replace('attachment:', '');
|
|
7
|
-
return attachmentId ? attachmentsMap.get(attachmentId) : undefined;
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
return [...attachmentsMap.values()].find((attachment) => attachment.link === externalFileRef.url.replace(/[&|?]format=jpg/, ''));
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
4
|
const getFigureData = (element, modelMap, attachmentsMap) => {
|
|
14
5
|
const attachments = [];
|
|
15
6
|
element.containedObjectIDs.map((id) => {
|
|
16
|
-
var _a;
|
|
17
7
|
const object = modelMap.get(id);
|
|
18
8
|
if (object && object.objectType === ObjectTypes.Figure) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
attachment
|
|
23
|
-
|
|
9
|
+
const figure = object;
|
|
10
|
+
if (figure.src) {
|
|
11
|
+
const attachment = attachmentsMap.get(figure.src.replace('attachment:', ''));
|
|
12
|
+
if (attachment) {
|
|
13
|
+
attachment.modelId = id;
|
|
14
|
+
attachments.push(attachment);
|
|
15
|
+
}
|
|
24
16
|
}
|
|
25
17
|
}
|
|
26
18
|
});
|
|
@@ -32,7 +24,7 @@ const getFigureData = (element, modelMap, attachmentsMap) => {
|
|
|
32
24
|
export default (modelMap, attachments) => {
|
|
33
25
|
const files = [];
|
|
34
26
|
const attachmentsMap = new Map(attachments.map((attachment) => [attachment.id, attachment]));
|
|
35
|
-
const { graphicalAbstractFigureId, figureElement
|
|
27
|
+
const { graphicalAbstractFigureId, figureElement } = getAuxiliaryObjects(modelMap);
|
|
36
28
|
if (graphicalAbstractFigureId) {
|
|
37
29
|
const element = modelMap.get(graphicalAbstractFigureId);
|
|
38
30
|
files.unshift(Object.assign(Object.assign({}, getFigureData(element, modelMap, attachmentsMap)), { label: `Graphical Abstract`, type: FileType.GraphicalAbstract }));
|
|
@@ -41,21 +33,6 @@ export default (modelMap, attachments) => {
|
|
|
41
33
|
const element = modelMap.get(id);
|
|
42
34
|
files.push(Object.assign(Object.assign({}, getFigureData(element, modelMap, attachmentsMap)), { label: `Figure ${index + 1}`, type: FileType.Figure }));
|
|
43
35
|
});
|
|
44
|
-
tableElement.map((id) => {
|
|
45
|
-
var _a;
|
|
46
|
-
const tableElement = modelMap.get(id);
|
|
47
|
-
const table = modelMap.get(tableElement.containedObjectID);
|
|
48
|
-
const externalFileReference = (_a = table === null || table === void 0 ? void 0 : table.externalFileReferences) === null || _a === void 0 ? void 0 : _a.find((file) => file.kind === 'dataset' && file.ref);
|
|
49
|
-
const attachment = getAttachment(externalFileReference, attachmentsMap);
|
|
50
|
-
if (attachment) {
|
|
51
|
-
files.push({
|
|
52
|
-
id: tableElement._id,
|
|
53
|
-
label: `Table`,
|
|
54
|
-
type: FileType.SheetsWorkbooks,
|
|
55
|
-
attachments: [attachment],
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
36
|
return files;
|
|
60
37
|
};
|
|
61
38
|
const getAuxiliaryObjects = (modelMap) => {
|
|
@@ -80,7 +57,6 @@ const getAuxiliaryObjects = (modelMap) => {
|
|
|
80
57
|
}
|
|
81
58
|
switch (element.objectType) {
|
|
82
59
|
case ObjectTypes.FigureElement:
|
|
83
|
-
case ObjectTypes.MultiGraphicFigureElement:
|
|
84
60
|
figureElementIds.push(element._id);
|
|
85
61
|
break;
|
|
86
62
|
case ObjectTypes.TableElement:
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { UserProfileAffiliation } from '@manuscripts/
|
|
16
|
+
import { UserProfileAffiliation } from '@manuscripts/json-schema';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import { AuthorFormComponentOverrides } from '../AuthorForm/AuthorFormComponents';
|
|
19
19
|
interface Props {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Contributor, ContributorRole } from '@manuscripts/
|
|
16
|
+
import { Contributor, ContributorRole } from '@manuscripts/json-schema';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import { AuthorValues } from '../../types';
|
|
19
19
|
import { AuthorFormComponentOverrides } from './AuthorFormComponents';
|
|
@@ -25,7 +25,7 @@ export interface AuthorFormComponents {
|
|
|
25
25
|
CheckboxLabel: StyledComponent<'label', DefaultTheme>;
|
|
26
26
|
TextField: StyledComponent<'input', DefaultTheme>;
|
|
27
27
|
}
|
|
28
|
-
export
|
|
28
|
+
export type AuthorFormComponentOverrides = {
|
|
29
29
|
[K in keyof AuthorFormComponents]?: AuthorFormComponents[K];
|
|
30
30
|
};
|
|
31
31
|
export declare const defaultAuthorFormComponents: AuthorFormComponents;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ContributorRole } from '@manuscripts/
|
|
16
|
+
import { ContributorRole } from '@manuscripts/json-schema';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
export declare const ContributorRolesSelect: React.FC<{
|
|
19
19
|
contributorRoles: ContributorRole[];
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Contributor } from '@manuscripts/
|
|
16
|
+
import { Contributor } from '@manuscripts/json-schema';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
interface Props {
|
|
19
19
|
author: Contributor;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { BibliographicName } from '@manuscripts/
|
|
16
|
+
import { BibliographicName } from '@manuscripts/json-schema';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
export interface AuthorNameProps {
|
|
19
19
|
name: BibliographicName;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Contributor } from '@manuscripts/
|
|
16
|
+
import { Contributor } from '@manuscripts/json-schema';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import { AuthorData } from '../types';
|
|
19
19
|
export declare const AuthorsContainer: React.FC<{
|
|
@@ -18,7 +18,7 @@ import { AuthorNameProps } from '../AuthorName';
|
|
|
18
18
|
export interface AuthorItemComponents {
|
|
19
19
|
AuthorName: React.FunctionComponent<AuthorNameProps>;
|
|
20
20
|
}
|
|
21
|
-
export
|
|
21
|
+
export type AuthorItemComponentOverrides = {
|
|
22
22
|
[K in keyof AuthorItemComponents]?: AuthorItemComponents[K];
|
|
23
23
|
};
|
|
24
24
|
export declare const defaultAuthorItemComponents: AuthorItemComponents;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Contributor } from '@manuscripts/
|
|
16
|
+
import { Contributor } from '@manuscripts/json-schema';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import { AuthorItemComponentOverrides } from './AuthorItemComponents';
|
|
19
19
|
interface Props {
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Contributor } from '@manuscripts/
|
|
16
|
+
import { Contributor } from '@manuscripts/json-schema';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import { DefaultTheme } from 'styled-components';
|
|
19
19
|
import { AuthorItem, ConnectedDragSourceProps, ConnectedDropTargetProps, DropSide } from '../../types';
|
|
20
20
|
import { AuthorItemComponentOverrides } from './AuthorItemComponents';
|
|
21
|
-
|
|
21
|
+
type ConnectedProps = ConnectedDragSourceProps & ConnectedDropTargetProps;
|
|
22
22
|
interface Props {
|
|
23
23
|
authorItem: AuthorItem;
|
|
24
24
|
onDrop: (oldIndex: number, newIndex: number) => void;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Contributor } from '@manuscripts/
|
|
16
|
+
import { Contributor } from '@manuscripts/json-schema';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import { AuthorAffiliation as AuthorAffiliationT } from '../../types';
|
|
19
19
|
interface AuthorProps {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Contributor } from '@manuscripts/
|
|
16
|
+
import { Contributor } from '@manuscripts/json-schema';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import { AuthorAffiliation } from '../../types';
|
|
19
19
|
interface Props {
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Color } from '@manuscripts/
|
|
16
|
+
import { Color } from '@manuscripts/json-schema';
|
|
17
17
|
import React from 'react';
|
|
18
|
-
|
|
18
|
+
type ColorReq = Partial<Color> & {
|
|
19
19
|
value: string;
|
|
20
20
|
};
|
|
21
21
|
interface Props {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Keyword, UserProfile } from '@manuscripts/
|
|
1
|
+
import { Keyword, UserProfile } from '@manuscripts/json-schema';
|
|
2
2
|
import React, { Dispatch, SetStateAction } from 'react';
|
|
3
3
|
import { CommentType, UnsavedComment } from '../../lib/comments';
|
|
4
4
|
export interface CommentBodyProps {
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { Contribution } from '@manuscripts/json-schema';
|
|
17
|
+
import { UserProfileWithAvatar } from '@manuscripts/transform';
|
|
18
18
|
import React from 'react';
|
|
19
19
|
export declare const CommentUser: React.FC<{
|
|
20
20
|
contributions?: Contribution[];
|