@manuscripts/style-guide 0.31.27 → 0.31.28-1620
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/FileManager/FileManager.js +2 -8
- package/dist/cjs/components/ManuscriptNoteList.js +2 -0
- package/dist/cjs/lib/inlineFiles.js +7 -30
- package/dist/es/components/FileManager/FileManager.js +2 -8
- package/dist/es/components/ManuscriptNoteList.js +2 -0
- package/dist/es/lib/inlineFiles.js +7 -30
- package/dist/types/components/FileManager/InlineFilesSection.d.ts +0 -5
- package/dist/types/theme.d.ts +1 -0
- package/package.json +1 -1
|
@@ -86,15 +86,9 @@ const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileManageme
|
|
|
86
86
|
window.location.assign(url);
|
|
87
87
|
}, []);
|
|
88
88
|
const handleUpdateInline = (0, react_1.useCallback)((modelId, attachment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
89
|
-
var _a;
|
|
90
89
|
const figureModel = modelMap.get(modelId);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
typeof imageExternalFileIndex !== 'undefined' &&
|
|
94
|
-
imageExternalFileIndex > -1) {
|
|
95
|
-
figureModel.externalFileReferences[imageExternalFileIndex].url = `attachment:${attachment.id}`;
|
|
96
|
-
yield saveModel(figureModel);
|
|
97
|
-
}
|
|
90
|
+
figureModel.src = `attachment:${attachment.id}`;
|
|
91
|
+
yield saveModel(figureModel);
|
|
98
92
|
}), [modelMap, saveModel]);
|
|
99
93
|
const attachments = getAttachments();
|
|
100
94
|
const { otherFiles, supplementFiles, inlineFiles } = (0, index_1.useFiles)(modelMap, attachments);
|
|
@@ -143,6 +143,8 @@ exports.NoteBodyContainer = styled_components_1.default.div `
|
|
|
143
143
|
${(props) => borderStyle(props.theme.colors.border.secondary)};
|
|
144
144
|
${(props) => (props.isNew || props.isSelected) &&
|
|
145
145
|
borderStyle(props.theme.colors.border.primary)}
|
|
146
|
+
${(props) => props.isSelected &&
|
|
147
|
+
`background: ${props.theme.colors.background.selected};`}
|
|
146
148
|
|
|
147
149
|
.tooltip {
|
|
148
150
|
border-radius: 6px;
|
|
@@ -3,26 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const manuscript_transform_1 = require("@manuscripts/manuscript-transform");
|
|
4
4
|
const manuscripts_json_schema_1 = require("@manuscripts/manuscripts-json-schema");
|
|
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.includes('https://'))) {
|
|
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);
|
|
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
10
|
if (object && object.objectType === manuscripts_json_schema_1.ObjectTypes.Figure) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
attachment
|
|
25
|
-
|
|
11
|
+
const figure = object;
|
|
12
|
+
if (figure.src) {
|
|
13
|
+
const attachment = attachmentsMap.get(figure.src);
|
|
14
|
+
if (attachment) {
|
|
15
|
+
attachment.modelId = id;
|
|
16
|
+
attachments.push(attachment);
|
|
17
|
+
}
|
|
26
18
|
}
|
|
27
19
|
}
|
|
28
20
|
});
|
|
@@ -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) => {
|
|
@@ -61,15 +61,9 @@ 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
|
-
|
|
68
|
-
typeof imageExternalFileIndex !== 'undefined' &&
|
|
69
|
-
imageExternalFileIndex > -1) {
|
|
70
|
-
figureModel.externalFileReferences[imageExternalFileIndex].url = `attachment:${attachment.id}`;
|
|
71
|
-
yield saveModel(figureModel);
|
|
72
|
-
}
|
|
65
|
+
figureModel.src = `attachment:${attachment.id}`;
|
|
66
|
+
yield saveModel(figureModel);
|
|
73
67
|
}), [modelMap, saveModel]);
|
|
74
68
|
const attachments = getAttachments();
|
|
75
69
|
const { otherFiles, supplementFiles, inlineFiles } = useFiles(modelMap, attachments);
|
|
@@ -118,6 +118,8 @@ export const NoteBodyContainer = styled.div `
|
|
|
118
118
|
${(props) => borderStyle(props.theme.colors.border.secondary)};
|
|
119
119
|
${(props) => (props.isNew || props.isSelected) &&
|
|
120
120
|
borderStyle(props.theme.colors.border.primary)}
|
|
121
|
+
${(props) => props.isSelected &&
|
|
122
|
+
`background: ${props.theme.colors.background.selected};`}
|
|
121
123
|
|
|
122
124
|
.tooltip {
|
|
123
125
|
border-radius: 6px;
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
import { hasObjectType } from '@manuscripts/manuscript-transform';
|
|
2
2
|
import { ObjectTypes, } from '@manuscripts/manuscripts-json-schema';
|
|
3
3
|
import { FileType } from '../components/FileManager/util';
|
|
4
|
-
const getAttachment = (externalFileRef, attachmentsMap) => {
|
|
5
|
-
if (!(externalFileRef === null || externalFileRef === void 0 ? void 0 : externalFileRef.url.includes('https://'))) {
|
|
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);
|
|
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);
|
|
12
|
+
if (attachment) {
|
|
13
|
+
attachment.modelId = id;
|
|
14
|
+
attachments.push(attachment);
|
|
15
|
+
}
|
|
24
16
|
}
|
|
25
17
|
}
|
|
26
18
|
});
|
|
@@ -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) => {
|
|
@@ -3,11 +3,6 @@ import { Replace } from './FileManager';
|
|
|
3
3
|
import { SubmissionAttachment } from './FileSectionItem/FileSectionItem';
|
|
4
4
|
import { Action } from './FileSectionState';
|
|
5
5
|
import { FileType } from './util';
|
|
6
|
-
export interface ExternalFileRef {
|
|
7
|
-
url: string;
|
|
8
|
-
kind?: string;
|
|
9
|
-
ref?: SubmissionAttachment;
|
|
10
|
-
}
|
|
11
6
|
export declare const InlineFilesSection: React.FC<{
|
|
12
7
|
inlineFiles: {
|
|
13
8
|
id: string;
|
package/dist/types/theme.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/style-guide",
|
|
3
3
|
"description": "Shared components for Manuscripts applications",
|
|
4
|
-
"version": "0.31.
|
|
4
|
+
"version": "0.31.28-1620",
|
|
5
5
|
"repository": "gitlab:atypon-opensource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|