@manuscripts/article-editor 3.8.9-LEAN-4355.0 → 3.8.9
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/FileActions.js +16 -43
- package/dist/cjs/components/FileManager/FileActions.js.map +1 -1
- package/dist/cjs/components/FileManager/FileManager.js +1 -7
- package/dist/cjs/components/FileManager/FileManager.js.map +1 -1
- package/dist/cjs/components/FileManager/FileSectionAlert.js +1 -12
- package/dist/cjs/components/FileManager/FileSectionAlert.js.map +1 -1
- package/dist/cjs/components/FileManager/FileUploader.js +3 -3
- package/dist/cjs/components/FileManager/FileUploader.js.map +1 -1
- package/dist/cjs/components/FileManager/OtherFilesSection.js +5 -12
- package/dist/cjs/components/FileManager/OtherFilesSection.js.map +1 -1
- package/dist/cjs/components/FileManager/SupplementsSection.js +4 -16
- package/dist/cjs/components/FileManager/SupplementsSection.js.map +1 -1
- package/dist/es/components/FileManager/FileActions.js +17 -44
- package/dist/es/components/FileManager/FileActions.js.map +1 -1
- package/dist/es/components/FileManager/FileManager.js +1 -7
- package/dist/es/components/FileManager/FileManager.js.map +1 -1
- package/dist/es/components/FileManager/FileSectionAlert.js +1 -12
- package/dist/es/components/FileManager/FileSectionAlert.js.map +1 -1
- package/dist/es/components/FileManager/FileUploader.js +3 -3
- package/dist/es/components/FileManager/FileUploader.js.map +1 -1
- package/dist/es/components/FileManager/OtherFilesSection.js +6 -13
- package/dist/es/components/FileManager/OtherFilesSection.js.map +1 -1
- package/dist/es/components/FileManager/SupplementsSection.js +5 -17
- package/dist/es/components/FileManager/SupplementsSection.js.map +1 -1
- package/dist/types/components/FileManager/FileActions.d.ts +0 -15
- package/dist/types/components/FileManager/FileManager.d.ts +1 -2
- package/dist/types/components/FileManager/FileSectionAlert.d.ts +1 -2
- package/dist/types/components/FileManager/FileUploader.d.ts +0 -2
- package/package.json +2 -2
- package/dist/cjs/components/FileManager/MainFilesSection.js +0 -183
- package/dist/cjs/components/FileManager/MainFilesSection.js.map +0 -1
- package/dist/es/components/FileManager/MainFilesSection.js +0 -153
- package/dist/es/components/FileManager/MainFilesSection.js.map +0 -1
- package/dist/types/components/FileManager/MainFilesSection.d.ts +0 -16
@@ -27,23 +27,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
27
|
};
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
29
|
exports.FileAction = exports.FileActionDropdownList = exports.ActionsIcon = exports.FileActions = void 0;
|
30
|
+
/*!
|
31
|
+
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
32
|
+
*
|
33
|
+
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
34
|
+
*
|
35
|
+
* The Original Code is manuscripts-frontend.
|
36
|
+
*
|
37
|
+
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
38
|
+
*
|
39
|
+
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
|
40
|
+
*/
|
30
41
|
const style_guide_1 = require("@manuscripts/style-guide");
|
31
42
|
const react_1 = __importStar(require("react"));
|
32
43
|
const styled_components_1 = __importDefault(require("styled-components"));
|
33
44
|
/**
|
34
45
|
* This component represents the drop-down list action for each file item.
|
35
46
|
*/
|
36
|
-
const FileActions = ({ sectionType, onDownload, onReplace, onDetach,
|
47
|
+
const FileActions = ({ sectionType, onDownload, onReplace, onDetach, move, className }) => {
|
37
48
|
const can = (0, style_guide_1.usePermissions)();
|
38
49
|
const { isOpen, toggleOpen, wrapperRef } = (0, style_guide_1.useDropdown)();
|
39
50
|
const [isMoveDialogOpen, setMoveDialogOpen] = (0, react_1.useState)(false);
|
40
|
-
const [isUseAsMainDialogOpen, setUseAsMainDialogOpen] = (0, react_1.useState)(false);
|
41
51
|
const showDownload = can?.downloadFiles && onDownload;
|
42
52
|
const showReplace = can?.replaceFile && onReplace;
|
43
53
|
const showDetach = can?.detachFile && onDetach;
|
44
54
|
const showMove = can?.moveFile && move;
|
45
|
-
const
|
46
|
-
const show = showDownload || showReplace || showDetach || showMove || showUseAsMain;
|
55
|
+
const show = showDownload || showReplace || showDetach || showMove;
|
47
56
|
const fileInputRef = (0, react_1.useRef)(null);
|
48
57
|
const handleChange = async (event) => {
|
49
58
|
if (onReplace && event && event.target && event.target.files) {
|
@@ -66,40 +75,14 @@ const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onUseAsMain
|
|
66
75
|
showDownload && (react_1.default.createElement(exports.FileAction, { onClick: onDownload }, "Download")),
|
67
76
|
showReplace && (react_1.default.createElement(react_1.default.Fragment, null,
|
68
77
|
react_1.default.createElement(exports.FileAction, { onClick: openFileDialog }, "Replace"),
|
69
|
-
react_1.default.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange
|
78
|
+
react_1.default.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange }))),
|
70
79
|
showDetach && react_1.default.createElement(exports.FileAction, { onClick: onDetach }, "Detach"),
|
71
80
|
showMove && (react_1.default.createElement(exports.FileAction, { onClick: () => setMoveDialogOpen(true) },
|
72
81
|
"Move to ",
|
73
|
-
move.sectionType)),
|
74
|
-
|
75
|
-
showMove && (react_1.default.createElement(MoveFileConfirmationDialog, { "data-cy": "file-move-confirm-dialog", isOpen: isMoveDialogOpen, close: () => setMoveDialogOpen(false), source: sectionType, target: move.sectionType, handleMove: move.handler })),
|
76
|
-
showUseAsMain && (react_1.default.createElement(UseAsMainConfirmationDialog, { "data-cy": "file-use-as-main-confirm-dialog", isOpen: isUseAsMainDialogOpen, close: () => setUseAsMainDialogOpen(false), handleUseAsMain: onUseAsMain }))));
|
82
|
+
move.sectionType)))),
|
83
|
+
showMove && (react_1.default.createElement(MoveFileConfirmationDialog, { "data-cy": "file-move-confirm-dialog", isOpen: isMoveDialogOpen, close: () => setMoveDialogOpen(false), source: sectionType, target: move.sectionType, handleMove: move.handler }))));
|
77
84
|
};
|
78
85
|
exports.FileActions = FileActions;
|
79
|
-
const UseAsMainConfirmationDialog = ({ isOpen, close, handleUseAsMain }) => {
|
80
|
-
const header = (react_1.default.createElement(react_1.default.Fragment, null,
|
81
|
-
react_1.default.createElement(StyledIcon, null),
|
82
|
-
"Use as main document"));
|
83
|
-
const message = (react_1.default.createElement(react_1.default.Fragment, null,
|
84
|
-
"This action will replace the current main document file with this one!",
|
85
|
-
react_1.default.createElement("br", null),
|
86
|
-
react_1.default.createElement("br", null),
|
87
|
-
"Do you want to continue?"));
|
88
|
-
const handleConfirm = () => {
|
89
|
-
handleUseAsMain();
|
90
|
-
close();
|
91
|
-
};
|
92
|
-
return (react_1.default.createElement(style_guide_1.Dialog, { isOpen: isOpen, category: style_guide_1.Category.confirmation, header: header, message: message, actions: {
|
93
|
-
primary: {
|
94
|
-
action: handleConfirm,
|
95
|
-
title: 'Replace',
|
96
|
-
},
|
97
|
-
secondary: {
|
98
|
-
action: () => close(),
|
99
|
-
title: 'Cancel',
|
100
|
-
},
|
101
|
-
} }));
|
102
|
-
};
|
103
86
|
const MoveFileConfirmationDialog = ({ isOpen, close, source, target, handleMove }) => {
|
104
87
|
const header = `Are you sure you want to move this file to “${target}”?`;
|
105
88
|
const message = `The file will be removed from “${source}” and added to “${target}”.`;
|
@@ -118,9 +101,6 @@ const MoveFileConfirmationDialog = ({ isOpen, close, source, target, handleMove
|
|
118
101
|
},
|
119
102
|
} }));
|
120
103
|
};
|
121
|
-
const StyledIcon = (0, styled_components_1.default)(style_guide_1.AttentionOrangeIcon) `
|
122
|
-
margin-right: 8px;
|
123
|
-
`;
|
124
104
|
exports.ActionsIcon = styled_components_1.default.button `
|
125
105
|
border: none;
|
126
106
|
background: transparent;
|
@@ -156,11 +136,4 @@ exports.FileAction = styled_components_1.default.div `
|
|
156
136
|
background: #f2fbfc;
|
157
137
|
}
|
158
138
|
`;
|
159
|
-
const isValidMainDocumentFormat = (file) => {
|
160
|
-
if (!file) {
|
161
|
-
return false;
|
162
|
-
}
|
163
|
-
const validExtensions = ['.docx', '.doc', '.pdf', '.xml'];
|
164
|
-
return validExtensions.some((ext) => file.name.toLowerCase().endsWith(ext.toLowerCase()));
|
165
|
-
};
|
166
139
|
//# sourceMappingURL=FileActions.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FileActions.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileActions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"FileActions.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileActions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,0DAQiC;AACjC,+CAA4D;AAC5D,0EAAsC;AAItC;;GAEG;AACI,MAAM,WAAW,GAOnB,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE;IACzE,MAAM,GAAG,GAAG,IAAA,4BAAc,GAAE,CAAA;IAC5B,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,IAAA,yBAAW,GAAE,CAAA;IACxD,MAAM,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAA;IAEtE,MAAM,YAAY,GAAG,GAAG,EAAE,aAAa,IAAI,UAAU,CAAA;IACrD,MAAM,WAAW,GAAG,GAAG,EAAE,WAAW,IAAI,SAAS,CAAA;IACjD,MAAM,UAAU,GAAG,GAAG,E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E,aAAa;gBACrB,KAAK,EAAE,MAAM;aACd;YACD,SAAS,EAAE;gBACT,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE;gBACrB,KAAK,EAAE,QAAQ;aAChB;SACF,GACD,CACH,CAAA;AACH,CAAC,CAAA;AAEY,QAAA,WAAW,GAAG,2BAAM,CAAC,MAAM,CAAA;;;;;;;;;;;CAWvC,CAAA;AAEY,QAAA,sBAAsB,GAAG,IAAA,2BAAM,EAAC,0BAAY,CAAC,CAAA;;;;;;gBAM1C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO;;;;CAI/D,CAAA;AAEY,QAAA,UAAU,GAAG,2BAAM,CAAC,GAAG,CAAA;iBACnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;;;;WAI7C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;;;;;;CAMpD,CAAA"}
|
@@ -22,7 +22,6 @@ const store_1 = require("../../store");
|
|
22
22
|
const Inspector_1 = require("../Inspector");
|
23
23
|
const FileManagerDragLayer_1 = require("./FileManagerDragLayer");
|
24
24
|
const InlineFilesSection_1 = require("./InlineFilesSection");
|
25
|
-
const MainFilesSection_1 = require("./MainFilesSection");
|
26
25
|
const OtherFilesSection_1 = require("./OtherFilesSection");
|
27
26
|
const SupplementsSection_1 = require("./SupplementsSection");
|
28
27
|
var FileSectionType;
|
@@ -30,7 +29,6 @@ var FileSectionType;
|
|
30
29
|
FileSectionType["Inline"] = "Inline files";
|
31
30
|
FileSectionType["Supplements"] = "Supplements";
|
32
31
|
FileSectionType["OtherFile"] = "Other files";
|
33
|
-
FileSectionType["MainFile"] = "Main Document";
|
34
32
|
})(FileSectionType = exports.FileSectionType || (exports.FileSectionType = {}));
|
35
33
|
/**
|
36
34
|
* This is the main component of the file handling
|
@@ -49,14 +47,12 @@ const FileManager = () => {
|
|
49
47
|
files: s.files,
|
50
48
|
inspectorOpenTabs: s.inspectorOpenTabs,
|
51
49
|
}));
|
52
|
-
const { figures, supplements, others
|
50
|
+
const { figures, supplements, others } = (0, body_editor_1.groupFiles)(doc, files);
|
53
51
|
return (react_1.default.createElement(Inspector_1.InspectorTabs, { defaultIndex: 0, selectedIndex: inspectorOpenTabs?.secondaryTab || 0, "data-cy": "files-tabs", style: { overflow: 'visible' }, onChange: (index) => dispatch({ inspectorOpenTabs: { secondaryTab: index } }) },
|
54
52
|
react_1.default.createElement(FileManagerDragLayer_1.FileManagerDragLayer, null),
|
55
53
|
react_1.default.createElement(Inspector_1.InspectorTabList, null,
|
56
54
|
react_1.default.createElement(Inspector_1.InspectorTab, { "data-tooltip-id": "inline-tooltip" }, "Inline files"),
|
57
55
|
react_1.default.createElement(style_guide_1.Tooltip, { id: "inline-tooltip", place: "bottom" }, "Files that can be found inline in the manuscript."),
|
58
|
-
react_1.default.createElement(Inspector_1.InspectorTab, { "data-tooltip-id": "main-tooltip" }, "Main Document"),
|
59
|
-
react_1.default.createElement(style_guide_1.Tooltip, { id: "main-tooltip", place: "bottom" }, "The main document of the manuscript."),
|
60
56
|
react_1.default.createElement(Inspector_1.InspectorTab, { "data-tooltip-id": "supplements-tooltip" }, "Supplements"),
|
61
57
|
react_1.default.createElement(style_guide_1.Tooltip, { id: "supplements-tooltip", place: "bottom" }, "Files that were marked as supplements."),
|
62
58
|
react_1.default.createElement(Inspector_1.InspectorTab, { "data-tooltip-id": "other-tooltip" }, "Other files"),
|
@@ -64,8 +60,6 @@ const FileManager = () => {
|
|
64
60
|
react_1.default.createElement(Inspector_1.InspectorTabPanels, { style: { overflowY: 'visible', position: 'relative' } },
|
65
61
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, { "data-cy": "inline" },
|
66
62
|
react_1.default.createElement(InlineFilesSection_1.InlineFilesSection, { elements: figures })),
|
67
|
-
react_1.default.createElement(Inspector_1.InspectorTabPanel, { "data-cy": "main" },
|
68
|
-
react_1.default.createElement(MainFilesSection_1.MainFilesSection, { mainDocument: mainDocument[0] })),
|
69
63
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, { "data-cy": "supplements" },
|
70
64
|
react_1.default.createElement(SupplementsSection_1.SupplementsSection, { supplements: supplements })),
|
71
65
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, { "data-cy": "other" },
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FileManager.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileManager.tsx"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;GAUG;AACH,0DAAqD;AACrD,0DAAkD;AAClD,kDAAyB;AAEzB,uCAAsC;AACtC,4CAMqB;AACrB,iEAA6D;AAC7D,6DAAyD;AACzD,
|
1
|
+
{"version":3,"file":"FileManager.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileManager.tsx"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;GAUG;AACH,0DAAqD;AACrD,0DAAkD;AAClD,kDAAyB;AAEzB,uCAAsC;AACtC,4CAMqB;AACrB,iEAA6D;AAC7D,6DAAyD;AACzD,2DAAuD;AACvD,6DAAyD;AAEzD,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,0CAAuB,CAAA;IACvB,8CAA2B,CAAA;IAC3B,4CAAyB,CAAA;AAC3B,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B;AASD;;;;;;;;;;GAUG;AAEI,MAAM,WAAW,GAAa,GAAG,EAAE;IACxC,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACrE,GAAG,EAAE,CAAC,CAAC,GAAG;QACV,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,iBAAiB,EAAE,CAAC,CAA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,CAClB,CACD,CACP,CACjB,CAAA;AACH,CAAC,CAAA;AArDY,QAAA,WAAW,eAqDvB"}
|
@@ -26,14 +26,12 @@ var FileSectionAlertType;
|
|
26
26
|
FileSectionAlertType[FileSectionAlertType["UPLOAD_IN_PROGRESS"] = 1] = "UPLOAD_IN_PROGRESS";
|
27
27
|
FileSectionAlertType[FileSectionAlertType["UPLOAD_SUCCESSFUL"] = 2] = "UPLOAD_SUCCESSFUL";
|
28
28
|
FileSectionAlertType[FileSectionAlertType["MOVE_SUCCESSFUL"] = 3] = "MOVE_SUCCESSFUL";
|
29
|
-
FileSectionAlertType[FileSectionAlertType["REPLACE_SUCCESSFUL"] = 4] = "REPLACE_SUCCESSFUL";
|
30
29
|
})(FileSectionAlertType = exports.FileSectionAlertType || (exports.FileSectionAlertType = {}));
|
31
30
|
const FileSectionAlert = ({ alert }) => {
|
32
31
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
33
32
|
alert.type === FileSectionAlertType.UPLOAD_IN_PROGRESS && (react_1.default.createElement(FileUploadInProgressAlert, { name: alert.message })),
|
34
33
|
alert.type === FileSectionAlertType.UPLOAD_SUCCESSFUL && (react_1.default.createElement(FileUploadSuccessful, null)),
|
35
|
-
alert.type === FileSectionAlertType.MOVE_SUCCESSFUL && (react_1.default.createElement(FileMoveSuccessful, { name: alert.message }))
|
36
|
-
alert.type === FileSectionAlertType.REPLACE_SUCCESSFUL && (react_1.default.createElement(FileReplaceSuccessful, { name: alert.message }))));
|
34
|
+
alert.type === FileSectionAlertType.MOVE_SUCCESSFUL && (react_1.default.createElement(FileMoveSuccessful, { name: alert.message }))));
|
37
35
|
};
|
38
36
|
exports.FileSectionAlert = FileSectionAlert;
|
39
37
|
const FileUploadInProgressAlert = ({ name }) => {
|
@@ -57,15 +55,6 @@ const FileMoveSuccessful = ({ name }) => {
|
|
57
55
|
"File moved to ",
|
58
56
|
name)));
|
59
57
|
};
|
60
|
-
const FileReplaceSuccessful = ({ name }) => {
|
61
|
-
return (react_1.default.createElement(AlertMessageContainer, null,
|
62
|
-
react_1.default.createElement(style_guide_1.AlertMessage, { type: style_guide_1.AlertMessageType.success, hideCloseButton: true, dismissButton: {
|
63
|
-
text: 'OK',
|
64
|
-
} },
|
65
|
-
"File replaced with ",
|
66
|
-
name,
|
67
|
-
" successfully")));
|
68
|
-
};
|
69
58
|
const AlertMessageContainer = styled_components_1.default.div `
|
70
59
|
margin-left: 16px;
|
71
60
|
margin-right: 16px;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FileSectionAlert.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileSectionAlert.tsx"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;GAUG;AACH,0DAIiC;AACjC,kDAAyB;AACzB,0EAAsC;AAEtC,mDAA+C;AAC/C,yCAAyC;AAEzC,IAAY,
|
1
|
+
{"version":3,"file":"FileSectionAlert.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileSectionAlert.tsx"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;GAUG;AACH,0DAIiC;AACjC,kDAAyB;AACzB,0EAAsC;AAEtC,mDAA+C;AAC/C,yCAAyC;AAEzC,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,+DAAI,CAAA;IACJ,2FAAkB,CAAA;IAClB,yFAAiB,CAAA;IACjB,qFAAe,CAAA;AACjB,CAAC,EALW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAK/B;AAEM,MAAM,gBAAgB,GAExB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACjB,OAAO,CACL;QACG,KAAK,CAAC,IAAI,KAAK,oBAAoB,CAAC,kBAAkB,IAAI,CACzD,8BAAC,yBAAyB,IAAC,IAAI,EAAE,KAAK,CAAC,OAAO,GAAI,CACnD;QACA,KAAK,CAAC,IAAI,KAAK,oBAAoB,CAAC,iBAAiB,IAAI,CACxD,8BAAC,oBAAoB,OAAG,CACzB;QACA,KAAK,CAAC,IAAI,KAAK,oB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AAqB,GAAa,GAAG,EAAE;IAC3C,OAAO,CACL,8BAAC,cAAc;QACb,8BAAC,GAAG,IAAC,SAAS,EAAC,MAAM,GAAO;QAC5B,8BAAC,GAAG,IAAC,SAAS,EAAC,MAAM,GAAO,CACb,CAClB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,cAAc,GAAG,2BAAM,CAAC,GAAG,CAAA;gBACjB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ;;;;;;;;;CAShE,CAAA;AACD,MAAM,GAAG,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4FrB,CAAA"}
|
@@ -42,7 +42,7 @@ const styled_components_1 = __importStar(require("styled-components"));
|
|
42
42
|
/**
|
43
43
|
* This component will show the drag or upload file area
|
44
44
|
*/
|
45
|
-
const FileUploader = ({ onUpload
|
45
|
+
const FileUploader = ({ onUpload }) => {
|
46
46
|
const fileInputRef = (0, react_1.useRef)(null);
|
47
47
|
const openFileDialog = () => {
|
48
48
|
if (fileInputRef && fileInputRef.current) {
|
@@ -68,8 +68,8 @@ const FileUploader = ({ onUpload, placeholder, accept, }) => {
|
|
68
68
|
});
|
69
69
|
const isActive = canDrop && isOver;
|
70
70
|
return (react_1.default.createElement(Container, { ref: dropRef, "data-cy": "file-uploader", active: isActive, onClick: openFileDialog },
|
71
|
-
react_1.default.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange,
|
72
|
-
|
71
|
+
react_1.default.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange, value: '' }),
|
72
|
+
"Drag or click to upload a new file"));
|
73
73
|
};
|
74
74
|
exports.FileUploader = FileUploader;
|
75
75
|
const activeBoxStyle = (0, styled_components_1.css) `
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FileUploader.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileUploader.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,+CAAkD;AAClD,yCAAmC;AACnC,qEAAqD;AACrD,uEAA+C;
|
1
|
+
{"version":3,"file":"FileUploader.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileUploader.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,+CAAkD;AAClD,yCAAmC;AACnC,qEAAqD;AACrD,uEAA+C;AAU/C;;GAEG;AACI,MAAM,YAAY,GAAgC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACxE,MAAM,YAAY,GAAG,IAAA,cAAM,EAAmB,IAAI,CAAC,CAAA;IAEnD,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,IAAI,YAAY,IAAI,YAAY,CAAC,OAAO,EAAE;YACxC,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;SAC7B;IACH,CAAC,CAAA;IACD,MAAM,YAAY,GAAG,CAAC,KAAoC,EAAE,EAAE;QAC5D,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE;YAC/C,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YAClC,QAAQ,CAAC,IAAI,CAAC,CAAA;SACf;IACH,CAAC,CAAA;IAED,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,GAAG,IAAA,mBAAO,EAAC;QAC7C,MAAM,EAAE,CAAC,qCAAW,CAAC,IAAI,CAAC;QAC1B,IAAI,EAAE,CAAC,IAAW,EAAE,EAAE;YACpB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YAC1B,QA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plements,
|
83
83
|
});
|
84
84
|
};
|
85
|
-
const asMainDocument = async (file) => {
|
86
|
-
(0, body_editor_1.insertAttachment)(file, view.state, 'document', view.dispatch);
|
87
|
-
setAlert({
|
88
|
-
type: FileSectionAlert_1.FileSectionAlertType.MOVE_SUCCESSFUL,
|
89
|
-
message: FileManager_1.FileSectionType.MainFile,
|
90
|
-
});
|
91
|
-
};
|
92
85
|
return (react_1.default.createElement("div", null,
|
93
|
-
can?.uploadFile &&
|
86
|
+
can?.uploadFile && react_1.default.createElement(FileUploader_1.FileUploader, { onUpload: handleUpload }),
|
94
87
|
react_1.default.createElement(FileSectionAlert_1.FileSectionAlert, { alert: alert }),
|
95
|
-
files.map((file) => (react_1.default.createElement(OtherFile, { key: file.id, file: file, onDownload: () => fileManagement.download(file), onMoveToSupplements: async () => await moveToSupplements(file)
|
88
|
+
files.map((file) => (react_1.default.createElement(OtherFile, { key: file.id, file: file, onDownload: () => fileManagement.download(file), onMoveToSupplements: async () => await moveToSupplements(file) })))));
|
96
89
|
};
|
97
90
|
exports.OtherFilesSection = OtherFilesSection;
|
98
|
-
const OtherFile = ({ file, onDownload, onMoveToSupplements
|
91
|
+
const OtherFile = ({ file, onDownload, onMoveToSupplements }) => {
|
99
92
|
const [{ isDragging }, dragRef, preview] = (0, react_dnd_1.useDrag)({
|
100
93
|
type: 'file',
|
101
94
|
item: {
|
@@ -111,9 +104,9 @@ const OtherFile = ({ file, onDownload, onMoveToSupplements, onUseAsMain }) => {
|
|
111
104
|
return (react_1.default.createElement(FileContainer_1.FileContainer, { key: file.id, "data-cy": "file-container", ref: dragRef, className: isDragging ? 'dragging' : '' },
|
112
105
|
react_1.default.createElement(FileName_1.FileName, { file: file }),
|
113
106
|
react_1.default.createElement(FileCreatedDate_1.FileCreatedDate, { file: file, className: "show-on-hover" }),
|
114
|
-
react_1.default.createElement(FileActions_1.FileActions, { sectionType: FileManager_1.FileSectionType.OtherFile, onDownload: onDownload,
|
107
|
+
react_1.default.createElement(FileActions_1.FileActions, { sectionType: FileManager_1.FileSectionType.OtherFile, onDownload: onDownload, move: {
|
115
108
|
sectionType: FileManager_1.FileSectionType.Supplements,
|
116
109
|
handler: onMoveToSupplements,
|
117
|
-
}
|
110
|
+
} })));
|
118
111
|
};
|
119
112
|
//# sourceMappingURL=OtherFilesSection.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"OtherFilesSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/OtherFilesSection.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,
|
1
|
+
{"version":3,"file":"OtherFilesSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/OtherFilesSection.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,0DAA2E;AAC3E,0DAAyD;AACzD,+CAAkD;AAClD,yCAAmC;AACnC,qEAAuD;AAEvD,uCAAsC;AACtC,+CAA2C;AAC3C,mDAA+C;AAC/C,uDAAmD;AACnD,+CAA+C;AAC/C,yCAAqC;AACrC,yDAA2E;AAC3E,iDAA6C;AAE7C;;GAEG;AACI,MAAM,iBAAiB,GAEzB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACjB,MAAM,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAClD,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,cAAc,EAAE,CAAC,CAAC,cAAc;KACjC,CAAC,CAAC,CAAA;IAEH,MAAM,GAAG,GAAG,IAAA,4BAAc,GAAE,CAAA;IAE5B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC;QACjC,IAAI,EAAE,uCAAoB,CAAC,IAAI;QAC/B,OAAO,EAAE,EAAE;KACZ,CAAC,CAAA;IAEF,IAAI,CAAC,IA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mBAAmB,EAAE,EAAE,EAAE;IACjD,MAAM,CAAC,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,IAAA,mBAAO,EAAC;QACjD,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE;YACJ,IAAI;SACL;QACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACrB,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;SACjC,CAAC;KACH,CAAC,CAAA;IAEF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,OAAO,CAAC,IAAA,uCAAa,GAAE,CAAC,CAAA;IAC1B,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAEb,OAAO,CACL,8BAAC,6BAAa,IACZ,GAAG,EAAE,IAAI,CAAC,EAAE,aACJ,gBAAgB,EACxB,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;QAEvC,8BAAC,mBAAQ,IAAC,IAAI,EAAE,IAAI,GAAI;QACxB,8BAAC,iCAAe,IAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,eAAe,GAAG;QACzD,8BAAC,yBAAW,IACV,WAAW,EAAE,6BAAe,CAAC,SAAS,EACtC,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE;gBACJ,WAAW,EAAE,6BAAe,CAAC,WAAW;gBACxC,OAAO,EAAE,mBAAmB;aAC7B,GACD,CACY,CACjB,CAAA;AACH,CAAC,CAAA"}
|
@@ -98,25 +98,13 @@ const SupplementsSection = ({ supplements, }) => {
|
|
98
98
|
message: FileManager_1.FileSectionType.OtherFile,
|
99
99
|
});
|
100
100
|
};
|
101
|
-
const handleUseAsMain = async (supplement) => {
|
102
|
-
const tr = view.state.tr;
|
103
|
-
const from = supplement.pos;
|
104
|
-
const to = from + supplement.node.nodeSize;
|
105
|
-
tr.delete(from, to);
|
106
|
-
view.dispatch((0, track_changes_plugin_1.skipTracking)(tr));
|
107
|
-
(0, body_editor_1.insertAttachment)(supplement.file, view.state, 'document', view.dispatch);
|
108
|
-
setAlert({
|
109
|
-
type: FileSectionAlert_1.FileSectionAlertType.MOVE_SUCCESSFUL,
|
110
|
-
message: FileManager_1.FileSectionType.MainFile,
|
111
|
-
});
|
112
|
-
};
|
113
101
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
114
|
-
can?.uploadFile &&
|
102
|
+
can?.uploadFile && react_1.default.createElement(FileUploader_1.FileUploader, { onUpload: handleUpload }),
|
115
103
|
react_1.default.createElement(FileSectionAlert_1.FileSectionAlert, { alert: alert }),
|
116
|
-
supplements.map((supplement) => (react_1.default.createElement(SupplementFile, { key: supplement.node.attrs.id, supplement: supplement, onDownload: () => fileManagement.download(supplement.file), onReplace: async (f) => await handleReplace(supplement, f), onDetach: () => handleMoveToOtherFiles(supplement)
|
104
|
+
supplements.map((supplement) => (react_1.default.createElement(SupplementFile, { key: supplement.node.attrs.id, supplement: supplement, onDownload: () => fileManagement.download(supplement.file), onReplace: async (f) => await handleReplace(supplement, f), onDetach: () => handleMoveToOtherFiles(supplement) })))));
|
117
105
|
};
|
118
106
|
exports.SupplementsSection = SupplementsSection;
|
119
|
-
const SupplementFile = ({ supplement, onDownload, onReplace, onDetach
|
107
|
+
const SupplementFile = ({ supplement, onDownload, onReplace, onDetach }) => {
|
120
108
|
const [{ isDragging }, dragRef, preview] = (0, react_dnd_1.useDrag)({
|
121
109
|
type: 'file',
|
122
110
|
item: {
|
@@ -142,6 +130,6 @@ const SupplementFile = ({ supplement, onDownload, onReplace, onDetach, onUseAsMa
|
|
142
130
|
sectionType: FileManager_1.FileSectionType.OtherFile,
|
143
131
|
handler: onDetach,
|
144
132
|
}
|
145
|
-
: undefined
|
133
|
+
: undefined })));
|
146
134
|
};
|
147
135
|
//# sourceMappingURL=SupplementsSection.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SupplementsSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/SupplementsSection.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,
|
1
|
+
{"version":3,"file":"SupplementsSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/SupplementsSection.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,0DAAqE;AACrE,0DAAyD;AACzD,4EAAgE;AAChE,+CAAkD;AAClD,yCAAmC;AACnC,qEAAuD;AAEvD,uCAAsC;AACtC,+CAA2C;AAC3C,mDAA+C;AAC/C,uDAAmD;AACnD,+CAAwD;AACxD,yCAAqC;AACrC,yDAA2E;AAC3E,iDAA6C;AAM7C;;GAEG;AACI,MAAM,kBAAkB,GAAsC,CAAC,EACpE,WAAW,GACZ,EAAE,EAAE;IACH,MAAM,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAClD,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,cAAc,EAAE,CAAC,CAAC,cAAc;KACjC,CAAC,CAAC,CAAA;IAEH,MAAM,GAAG,GAAG,IAAA,4BAAc,GAAE,CAAA;IAE5B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC;QACjC,IAAI,EAAE,uCAAoB,CAAC,IAAI;QAC/B,OAAO,EAAE,EAAE;KACZ,CAAC,CAAA;IAEF,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,MAAM,GAAG,KAAK,EAAE,IAAU,EAAE,EAAE;QAClC,QAAQ,CAAC;YACP,IAAI,EAAE,uCAAoB,CAAC,kBAAkB;YAC7C,OAAO,EAAE,IAAI,CAAC,IAAI;SACnB,CAAC,CAAA;QACF,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC,IAAI,CA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G,EAAE;QACb,OAAO,CAAC,IAAA,uCAAa,GAAE,CAAC,CAAA;IAC1B,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAEb,OAAO,CACL,8BAAC,6BAAa,eACJ,gBAAgB,EACxB,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,EACvB,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;QAEvC,8BAAC,mBAAQ,IAAC,IAAI,EAAE,UAAU,CAAC,IAAI,GAAI;QACnC,8BAAC,iCAAe,IAAC,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,SAAS,EAAC,eAAe,GAAG;QACpE,8BAAC,yBAAW,eACF,cAAc,EACtB,WAAW,EAAE,6BAAe,CAAC,WAAW,EACxC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EACpD,SAAS,EAAE,SAAS,EACpB,IAAI,EACF,UAAU,CAAC,IAAI;gBACb,CAAC,CAAC;oBACE,WAAW,EAAE,6BAAe,CAAC,SAAS;oBACtC,OAAO,EAAE,QAAQ;iBAClB;gBACH,CAAC,CAAC,SAAS,GAEf,CACY,CACjB,CAAA;AACH,CAAC,CAAA"}
|
@@ -1,20 +1,29 @@
|
|
1
|
-
|
1
|
+
/*!
|
2
|
+
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
3
|
+
*
|
4
|
+
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
5
|
+
*
|
6
|
+
* The Original Code is manuscripts-frontend.
|
7
|
+
*
|
8
|
+
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
9
|
+
*
|
10
|
+
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
|
11
|
+
*/
|
12
|
+
import { Category, Dialog, DotsIcon, DropdownContainer, DropdownList, useDropdown, usePermissions, } from '@manuscripts/style-guide';
|
2
13
|
import React, { useRef, useState } from 'react';
|
3
14
|
import styled from 'styled-components';
|
4
15
|
/**
|
5
16
|
* This component represents the drop-down list action for each file item.
|
6
17
|
*/
|
7
|
-
export const FileActions = ({ sectionType, onDownload, onReplace, onDetach,
|
18
|
+
export const FileActions = ({ sectionType, onDownload, onReplace, onDetach, move, className }) => {
|
8
19
|
const can = usePermissions();
|
9
20
|
const { isOpen, toggleOpen, wrapperRef } = useDropdown();
|
10
21
|
const [isMoveDialogOpen, setMoveDialogOpen] = useState(false);
|
11
|
-
const [isUseAsMainDialogOpen, setUseAsMainDialogOpen] = useState(false);
|
12
22
|
const showDownload = can?.downloadFiles && onDownload;
|
13
23
|
const showReplace = can?.replaceFile && onReplace;
|
14
24
|
const showDetach = can?.detachFile && onDetach;
|
15
25
|
const showMove = can?.moveFile && move;
|
16
|
-
const
|
17
|
-
const show = showDownload || showReplace || showDetach || showMove || showUseAsMain;
|
26
|
+
const show = showDownload || showReplace || showDetach || showMove;
|
18
27
|
const fileInputRef = useRef(null);
|
19
28
|
const handleChange = async (event) => {
|
20
29
|
if (onReplace && event && event.target && event.target.files) {
|
@@ -37,38 +46,12 @@ export const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onUs
|
|
37
46
|
showDownload && (React.createElement(FileAction, { onClick: onDownload }, "Download")),
|
38
47
|
showReplace && (React.createElement(React.Fragment, null,
|
39
48
|
React.createElement(FileAction, { onClick: openFileDialog }, "Replace"),
|
40
|
-
React.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange
|
49
|
+
React.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange }))),
|
41
50
|
showDetach && React.createElement(FileAction, { onClick: onDetach }, "Detach"),
|
42
51
|
showMove && (React.createElement(FileAction, { onClick: () => setMoveDialogOpen(true) },
|
43
52
|
"Move to ",
|
44
|
-
move.sectionType)),
|
45
|
-
|
46
|
-
showMove && (React.createElement(MoveFileConfirmationDialog, { "data-cy": "file-move-confirm-dialog", isOpen: isMoveDialogOpen, close: () => setMoveDialogOpen(false), source: sectionType, target: move.sectionType, handleMove: move.handler })),
|
47
|
-
showUseAsMain && (React.createElement(UseAsMainConfirmationDialog, { "data-cy": "file-use-as-main-confirm-dialog", isOpen: isUseAsMainDialogOpen, close: () => setUseAsMainDialogOpen(false), handleUseAsMain: onUseAsMain }))));
|
48
|
-
};
|
49
|
-
const UseAsMainConfirmationDialog = ({ isOpen, close, handleUseAsMain }) => {
|
50
|
-
const header = (React.createElement(React.Fragment, null,
|
51
|
-
React.createElement(StyledIcon, null),
|
52
|
-
"Use as main document"));
|
53
|
-
const message = (React.createElement(React.Fragment, null,
|
54
|
-
"This action will replace the current main document file with this one!",
|
55
|
-
React.createElement("br", null),
|
56
|
-
React.createElement("br", null),
|
57
|
-
"Do you want to continue?"));
|
58
|
-
const handleConfirm = () => {
|
59
|
-
handleUseAsMain();
|
60
|
-
close();
|
61
|
-
};
|
62
|
-
return (React.createElement(Dialog, { isOpen: isOpen, category: Category.confirmation, header: header, message: message, actions: {
|
63
|
-
primary: {
|
64
|
-
action: handleConfirm,
|
65
|
-
title: 'Replace',
|
66
|
-
},
|
67
|
-
secondary: {
|
68
|
-
action: () => close(),
|
69
|
-
title: 'Cancel',
|
70
|
-
},
|
71
|
-
} }));
|
53
|
+
move.sectionType)))),
|
54
|
+
showMove && (React.createElement(MoveFileConfirmationDialog, { "data-cy": "file-move-confirm-dialog", isOpen: isMoveDialogOpen, close: () => setMoveDialogOpen(false), source: sectionType, target: move.sectionType, handleMove: move.handler }))));
|
72
55
|
};
|
73
56
|
const MoveFileConfirmationDialog = ({ isOpen, close, source, target, handleMove }) => {
|
74
57
|
const header = `Are you sure you want to move this file to “${target}”?`;
|
@@ -88,9 +71,6 @@ const MoveFileConfirmationDialog = ({ isOpen, close, source, target, handleMove
|
|
88
71
|
},
|
89
72
|
} }));
|
90
73
|
};
|
91
|
-
const StyledIcon = styled(AttentionOrangeIcon) `
|
92
|
-
margin-right: 8px;
|
93
|
-
`;
|
94
74
|
export const ActionsIcon = styled.button `
|
95
75
|
border: none;
|
96
76
|
background: transparent;
|
@@ -126,11 +106,4 @@ export const FileAction = styled.div `
|
|
126
106
|
background: #f2fbfc;
|
127
107
|
}
|
128
108
|
`;
|
129
|
-
const isValidMainDocumentFormat = (file) => {
|
130
|
-
if (!file) {
|
131
|
-
return false;
|
132
|
-
}
|
133
|
-
const validExtensions = ['.docx', '.doc', '.pdf', '.xml'];
|
134
|
-
return validExtensions.some((ext) => file.name.toLowerCase().endsWith(ext.toLowerCase()));
|
135
|
-
};
|
136
109
|
//# sourceMappingURL=FileActions.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FileActions.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileActions.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"FileActions.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileActions.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,cAAc,GACf,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,EAAe,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC5D,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAItC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAOnB,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EA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,OAAO,GAAG,kCAAkC,MAAM,mBAAmB,MAAM,IAAI,CAAA;IAErF,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,UAAU,EAAE,CAAA;QACZ,KAAK,EAAE,CAAA;IACT,CAAC,CAAA;IAED,OAAO,CACL,oBAAC,MAAM,IACL,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,CAAC,YAAY,EAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,MAAM,EAAE,aAAa;gBACrB,KAAK,EAAE,MAAM;aACd;YACD,SAAS,EAAE;gBACT,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE;gBACrB,KAAK,EAAE,QAAQ;aAChB;SACF,GACD,CACH,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAA;;;;;;;;;;;CAWvC,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;;;;;;gBAM1C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO;;;;CAI/D,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAA;iBACnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;;;;WAI7C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;;;;;;CAMpD,CAAA"}
|
@@ -16,7 +16,6 @@ import { useStore } from '../../store';
|
|
16
16
|
import { InspectorTab, InspectorTabList, InspectorTabPanel, InspectorTabPanels, InspectorTabs, } from '../Inspector';
|
17
17
|
import { FileManagerDragLayer } from './FileManagerDragLayer';
|
18
18
|
import { InlineFilesSection } from './InlineFilesSection';
|
19
|
-
import { MainFilesSection } from './MainFilesSection';
|
20
19
|
import { OtherFilesSection } from './OtherFilesSection';
|
21
20
|
import { SupplementsSection } from './SupplementsSection';
|
22
21
|
export var FileSectionType;
|
@@ -24,7 +23,6 @@ export var FileSectionType;
|
|
24
23
|
FileSectionType["Inline"] = "Inline files";
|
25
24
|
FileSectionType["Supplements"] = "Supplements";
|
26
25
|
FileSectionType["OtherFile"] = "Other files";
|
27
|
-
FileSectionType["MainFile"] = "Main Document";
|
28
26
|
})(FileSectionType || (FileSectionType = {}));
|
29
27
|
/**
|
30
28
|
* This is the main component of the file handling
|
@@ -43,14 +41,12 @@ export const FileManager = () => {
|
|
43
41
|
files: s.files,
|
44
42
|
inspectorOpenTabs: s.inspectorOpenTabs,
|
45
43
|
}));
|
46
|
-
const { figures, supplements, others
|
44
|
+
const { figures, supplements, others } = groupFiles(doc, files);
|
47
45
|
return (React.createElement(InspectorTabs, { defaultIndex: 0, selectedIndex: inspectorOpenTabs?.secondaryTab || 0, "data-cy": "files-tabs", style: { overflow: 'visible' }, onChange: (index) => dispatch({ inspectorOpenTabs: { secondaryTab: index } }) },
|
48
46
|
React.createElement(FileManagerDragLayer, null),
|
49
47
|
React.createElement(InspectorTabList, null,
|
50
48
|
React.createElement(InspectorTab, { "data-tooltip-id": "inline-tooltip" }, "Inline files"),
|
51
49
|
React.createElement(Tooltip, { id: "inline-tooltip", place: "bottom" }, "Files that can be found inline in the manuscript."),
|
52
|
-
React.createElement(InspectorTab, { "data-tooltip-id": "main-tooltip" }, "Main Document"),
|
53
|
-
React.createElement(Tooltip, { id: "main-tooltip", place: "bottom" }, "The main document of the manuscript."),
|
54
50
|
React.createElement(InspectorTab, { "data-tooltip-id": "supplements-tooltip" }, "Supplements"),
|
55
51
|
React.createElement(Tooltip, { id: "supplements-tooltip", place: "bottom" }, "Files that were marked as supplements."),
|
56
52
|
React.createElement(InspectorTab, { "data-tooltip-id": "other-tooltip" }, "Other files"),
|
@@ -58,8 +54,6 @@ export const FileManager = () => {
|
|
58
54
|
React.createElement(InspectorTabPanels, { style: { overflowY: 'visible', position: 'relative' } },
|
59
55
|
React.createElement(InspectorTabPanel, { "data-cy": "inline" },
|
60
56
|
React.createElement(InlineFilesSection, { elements: figures })),
|
61
|
-
React.createElement(InspectorTabPanel, { "data-cy": "main" },
|
62
|
-
React.createElement(MainFilesSection, { mainDocument: mainDocument[0] })),
|
63
57
|
React.createElement(InspectorTabPanel, { "data-cy": "supplements" },
|
64
58
|
React.createElement(SupplementsSection, { supplements: supplements })),
|
65
59
|
React.createElement(InspectorTabPanel, { "data-cy": "other" },
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FileManager.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileManager.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,GACd,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"FileManager.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileManager.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACt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;QACxB,oBAAC,gBAAgB;YACf,oBAAC,YAAY,uBAAiB,gBAAgB,mBAE/B;YACf,oBAAC,OAAO,IAAC,EAAE,EAAC,gBAAgB,EAAC,KAAK,EAAC,QAAQ,wDAEjC;YACV,oBAAC,YAAY,uBAAiB,qBAAqB,kBAEpC;YACf,oBAAC,OAAO,IAAC,EAAE,EAAC,qBAAqB,EAAC,KAAK,EAAC,QAAQ,6CAEtC;YACV,oBAAC,YAAY,uBAAiB,eAAe,kBAA2B;YACxE,oBAAC,OAAO,IAAC,EAAE,EAAC,eAAe,EAAC,KAAK,EAAC,QAAQ,gDAEhC,CACO;QACnB,oBAAC,kBAAkB,IACjB,KAAK,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE;YAErD,oBAAC,iBAAiB,eAAS,QAAQ;gBACjC,oBAAC,kBAAkB,IAAC,QAAQ,EAAE,OAAO,GAAI,CACvB;YACpB,oBAAC,iBAAiB,eAAS,aAAa;gBACtC,oBAAC,kBAAkB,IAAC,WAAW,EAAE,WAAW,GAAI,CAC9B;YACpB,oBAAC,iBAAiB,eAAS,OAAO;gBAChC,oBAAC,iBAAiB,IAAC,KAAK,EAAE,MAAM,GAAI,CAClB,CACD,CACP,CACjB,CAAA;AACH,CAAC,CAAA"}
|
@@ -20,14 +20,12 @@ export var FileSectionAlertType;
|
|
20
20
|
FileSectionAlertType[FileSectionAlertType["UPLOAD_IN_PROGRESS"] = 1] = "UPLOAD_IN_PROGRESS";
|
21
21
|
FileSectionAlertType[FileSectionAlertType["UPLOAD_SUCCESSFUL"] = 2] = "UPLOAD_SUCCESSFUL";
|
22
22
|
FileSectionAlertType[FileSectionAlertType["MOVE_SUCCESSFUL"] = 3] = "MOVE_SUCCESSFUL";
|
23
|
-
FileSectionAlertType[FileSectionAlertType["REPLACE_SUCCESSFUL"] = 4] = "REPLACE_SUCCESSFUL";
|
24
23
|
})(FileSectionAlertType || (FileSectionAlertType = {}));
|
25
24
|
export const FileSectionAlert = ({ alert }) => {
|
26
25
|
return (React.createElement(React.Fragment, null,
|
27
26
|
alert.type === FileSectionAlertType.UPLOAD_IN_PROGRESS && (React.createElement(FileUploadInProgressAlert, { name: alert.message })),
|
28
27
|
alert.type === FileSectionAlertType.UPLOAD_SUCCESSFUL && (React.createElement(FileUploadSuccessful, null)),
|
29
|
-
alert.type === FileSectionAlertType.MOVE_SUCCESSFUL && (React.createElement(FileMoveSuccessful, { name: alert.message }))
|
30
|
-
alert.type === FileSectionAlertType.REPLACE_SUCCESSFUL && (React.createElement(FileReplaceSuccessful, { name: alert.message }))));
|
28
|
+
alert.type === FileSectionAlertType.MOVE_SUCCESSFUL && (React.createElement(FileMoveSuccessful, { name: alert.message }))));
|
31
29
|
};
|
32
30
|
const FileUploadInProgressAlert = ({ name }) => {
|
33
31
|
return (React.createElement(FileUploadContainer, null,
|
@@ -50,15 +48,6 @@ const FileMoveSuccessful = ({ name }) => {
|
|
50
48
|
"File moved to ",
|
51
49
|
name)));
|
52
50
|
};
|
53
|
-
const FileReplaceSuccessful = ({ name }) => {
|
54
|
-
return (React.createElement(AlertMessageContainer, null,
|
55
|
-
React.createElement(AlertMessage, { type: AlertMessageType.success, hideCloseButton: true, dismissButton: {
|
56
|
-
text: 'OK',
|
57
|
-
} },
|
58
|
-
"File replaced with ",
|
59
|
-
name,
|
60
|
-
" successfully")));
|
61
|
-
};
|
62
51
|
const AlertMessageContainer = styled.div `
|
63
52
|
margin-left: 16px;
|
64
53
|
margin-right: 16px;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FileSectionAlert.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileSectionAlert.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,GAChB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEzC,MAAM,CAAN,IAAY,
|
1
|
+
{"version":3,"file":"FileSectionAlert.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileSectionAlert.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,GAChB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEzC,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,+DAAI,CAAA;IACJ,2FAAkB,CAAA;IAClB,yFAAiB,CAAA;IACjB,qFAAe,CAAA;AACjB,CAAC,EALW,oBAAoB,KAApB,oBAAoB,QAK/B;AAED,MAAM,CAAC,MAAM,gBAAgB,GAExB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACjB,OAAO,CACL;QACG,KAAK,CAAC,IAAI,KAAK,oBAAoB,CAAC,kBAAkB,IAAI,CACzD,oBAAC,yBAAyB,IAAC,IAAI,EAAE,KAAK,CAAC,OAAO,GAAI,CACnD;QACA,KAAK,CAAC,IAAI,KAAK,oBAAoB,CAAC,iBAAiB,IAAI,CACxD,oBAAC,oBAAoB,OAAG,CACzB;QACA,KAAK,CAAC,IAAI,KAAK,oBAAoB,CAAC,eAAe,IAAI,CACtD,oBAAC,kBAAkB,IAAC,IAAI,EAAE,KAAK,CAAC,OAAO,GAAI,CAC5C,CACA,CACJ,CAAA;AACH,CAAC,CAAA;AAED,MAAM,yBAAyB,GAE1B,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAChB,OAAO,CACL,oBAAC,mBAAmB;Q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