@manuscripts/article-editor 3.8.17-LEAN-4425.0 → 3.8.18
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 +43 -16
- package/dist/cjs/components/FileManager/FileActions.js.map +1 -1
- package/dist/cjs/components/FileManager/FileManager.js +7 -1
- package/dist/cjs/components/FileManager/FileManager.js.map +1 -1
- package/dist/cjs/components/FileManager/FileSectionAlert.js +12 -1
- 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/MainFilesSection.js +183 -0
- package/dist/cjs/components/FileManager/MainFilesSection.js.map +1 -0
- package/dist/cjs/components/FileManager/OtherFilesSection.js +12 -5
- package/dist/cjs/components/FileManager/OtherFilesSection.js.map +1 -1
- package/dist/cjs/components/FileManager/SupplementsSection.js +16 -4
- package/dist/cjs/components/FileManager/SupplementsSection.js.map +1 -1
- package/dist/es/components/FileManager/FileActions.js +44 -17
- package/dist/es/components/FileManager/FileActions.js.map +1 -1
- package/dist/es/components/FileManager/FileManager.js +7 -1
- package/dist/es/components/FileManager/FileManager.js.map +1 -1
- package/dist/es/components/FileManager/FileSectionAlert.js +12 -1
- 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/MainFilesSection.js +153 -0
- package/dist/es/components/FileManager/MainFilesSection.js.map +1 -0
- package/dist/es/components/FileManager/OtherFilesSection.js +13 -6
- package/dist/es/components/FileManager/OtherFilesSection.js.map +1 -1
- package/dist/es/components/FileManager/SupplementsSection.js +17 -5
- package/dist/es/components/FileManager/SupplementsSection.js.map +1 -1
- package/dist/types/components/FileManager/FileActions.d.ts +15 -0
- package/dist/types/components/FileManager/FileManager.d.ts +2 -1
- package/dist/types/components/FileManager/FileSectionAlert.d.ts +2 -1
- package/dist/types/components/FileManager/FileUploader.d.ts +2 -0
- package/dist/types/components/FileManager/MainFilesSection.d.ts +16 -0
- package/package.json +3 -3
@@ -27,32 +27,23 @@ 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
|
-
*/
|
41
30
|
const style_guide_1 = require("@manuscripts/style-guide");
|
42
31
|
const react_1 = __importStar(require("react"));
|
43
32
|
const styled_components_1 = __importDefault(require("styled-components"));
|
44
33
|
/**
|
45
34
|
* This component represents the drop-down list action for each file item.
|
46
35
|
*/
|
47
|
-
const FileActions = ({ sectionType, onDownload, onReplace, onDetach, move, className }) => {
|
36
|
+
const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onUseAsMain, move, className, file, accept, }) => {
|
48
37
|
const can = (0, style_guide_1.usePermissions)();
|
49
38
|
const { isOpen, toggleOpen, wrapperRef } = (0, style_guide_1.useDropdown)();
|
50
39
|
const [isMoveDialogOpen, setMoveDialogOpen] = (0, react_1.useState)(false);
|
40
|
+
const [isUseAsMainDialogOpen, setUseAsMainDialogOpen] = (0, react_1.useState)(false);
|
51
41
|
const showDownload = can?.downloadFiles && onDownload;
|
52
42
|
const showReplace = can?.replaceFile && onReplace;
|
53
43
|
const showDetach = can?.detachFile && onDetach;
|
54
44
|
const showMove = can?.moveFile && move;
|
55
|
-
const
|
45
|
+
const showUseAsMain = can?.moveFile && onUseAsMain && isValidMainDocumentFormat(file);
|
46
|
+
const show = showDownload || showReplace || showDetach || showMove || showUseAsMain;
|
56
47
|
const fileInputRef = (0, react_1.useRef)(null);
|
57
48
|
const handleChange = async (event) => {
|
58
49
|
if (onReplace && event && event.target && event.target.files) {
|
@@ -75,14 +66,40 @@ const FileActions = ({ sectionType, onDownload, onReplace, onDetach, move, class
|
|
75
66
|
showDownload && (react_1.default.createElement(exports.FileAction, { onClick: onDownload }, "Download")),
|
76
67
|
showReplace && (react_1.default.createElement(react_1.default.Fragment, null,
|
77
68
|
react_1.default.createElement(exports.FileAction, { onClick: openFileDialog }, "Replace"),
|
78
|
-
react_1.default.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange }))),
|
69
|
+
react_1.default.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange, accept: accept }))),
|
79
70
|
showDetach && react_1.default.createElement(exports.FileAction, { onClick: onDetach }, "Detach"),
|
80
71
|
showMove && (react_1.default.createElement(exports.FileAction, { onClick: () => setMoveDialogOpen(true) },
|
81
72
|
"Move to ",
|
82
|
-
move.sectionType))
|
83
|
-
|
73
|
+
move.sectionType)),
|
74
|
+
showUseAsMain && (react_1.default.createElement(exports.FileAction, { onClick: () => setUseAsMainDialogOpen(true) }, "Use as main document")))),
|
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 }))));
|
84
77
|
};
|
85
78
|
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
|
+
};
|
86
103
|
const MoveFileConfirmationDialog = ({ isOpen, close, source, target, handleMove }) => {
|
87
104
|
const header = `Are you sure you want to move this file to “${target}”?`;
|
88
105
|
const message = `The file will be removed from “${source}” and added to “${target}”.`;
|
@@ -101,6 +118,9 @@ const MoveFileConfirmationDialog = ({ isOpen, close, source, target, handleMove
|
|
101
118
|
},
|
102
119
|
} }));
|
103
120
|
};
|
121
|
+
const StyledIcon = (0, styled_components_1.default)(style_guide_1.AttentionOrangeIcon) `
|
122
|
+
margin-right: 8px;
|
123
|
+
`;
|
104
124
|
exports.ActionsIcon = styled_components_1.default.button `
|
105
125
|
border: none;
|
106
126
|
background: transparent;
|
@@ -136,4 +156,11 @@ exports.FileAction = styled_components_1.default.div `
|
|
136
156
|
background: #f2fbfc;
|
137
157
|
}
|
138
158
|
`;
|
159
|
+
const isValidMainDocumentFormat = (file) => {
|
160
|
+
if (!file) {
|
161
|
+
return false;
|
162
|
+
}
|
163
|
+
const validExtensions = ['.docx', '.doc', '.pdf', '.xml', '.tex'];
|
164
|
+
return validExtensions.some((ext) => file.name.toLowerCase().endsWith(ext.toLowerCase()));
|
165
|
+
};
|
139
166
|
//# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,0DASiC;AACjC,+CAA4D;AAC5D,0EAAsC;AAItC;;GAEG;AACI,MAAM,WAAW,GAUnB,CAAC,EACJ,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,MAAM,GACP,EAAE,EAAE;IACH,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;IACtE,MAAM,CAAC,qBAAqB,EAAE,sBAAsB,CAAC,GACnD,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAA;IAE1B,MAAM,YAAY,GAAG,GAAG,EAAE,aAAa,IAAI,UAAU,CAAA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,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,UAAU,GAAG,IAAA,2BAAM,EAAC,iCAAmB,CAAC,CAAA;;CAE7C,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;AAED,MAAM,yBAAyB,GAAG,CAAC,IAAqB,EAAW,EAAE;IACnE,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,KAAK,CAAA;KACb;IAED,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IAEjE,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAClC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CACpD,CAAA;AACH,CAAC,CAAA"}
|
@@ -22,6 +22,7 @@ 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");
|
25
26
|
const OtherFilesSection_1 = require("./OtherFilesSection");
|
26
27
|
const SupplementsSection_1 = require("./SupplementsSection");
|
27
28
|
var FileSectionType;
|
@@ -29,6 +30,7 @@ var FileSectionType;
|
|
29
30
|
FileSectionType["Inline"] = "Inline files";
|
30
31
|
FileSectionType["Supplements"] = "Supplements";
|
31
32
|
FileSectionType["OtherFile"] = "Other files";
|
33
|
+
FileSectionType["MainFile"] = "Main Document";
|
32
34
|
})(FileSectionType = exports.FileSectionType || (exports.FileSectionType = {}));
|
33
35
|
/**
|
34
36
|
* This is the main component of the file handling
|
@@ -47,12 +49,14 @@ const FileManager = () => {
|
|
47
49
|
files: s.files,
|
48
50
|
inspectorOpenTabs: s.inspectorOpenTabs,
|
49
51
|
}));
|
50
|
-
const { figures, supplements, others } = (0, body_editor_1.groupFiles)(doc, files);
|
52
|
+
const { figures, supplements, others, mainDocument } = (0, body_editor_1.groupFiles)(doc, files);
|
51
53
|
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 } }) },
|
52
54
|
react_1.default.createElement(FileManagerDragLayer_1.FileManagerDragLayer, null),
|
53
55
|
react_1.default.createElement(Inspector_1.InspectorTabList, null,
|
54
56
|
react_1.default.createElement(Inspector_1.SecondaryInspectorTab, { "data-tooltip-id": "inline-tooltip" }, "Inline files"),
|
55
57
|
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.SecondaryInspectorTab, { "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."),
|
56
60
|
react_1.default.createElement(Inspector_1.SecondaryInspectorTab, { "data-tooltip-id": "supplements-tooltip" }, "Supplements"),
|
57
61
|
react_1.default.createElement(style_guide_1.Tooltip, { id: "supplements-tooltip", place: "bottom" }, "Files that were marked as supplements."),
|
58
62
|
react_1.default.createElement(Inspector_1.SecondaryInspectorTab, { "data-tooltip-id": "other-tooltip" }, "Other files"),
|
@@ -60,6 +64,8 @@ const FileManager = () => {
|
|
60
64
|
react_1.default.createElement(Inspector_1.InspectorTabPanels, { style: { overflowY: 'visible', position: 'relative' } },
|
61
65
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, { "data-cy": "inline" },
|
62
66
|
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] })),
|
63
69
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, { "data-cy": "supplements" },
|
64
70
|
react_1.default.createElement(SupplementsSection_1.SupplementsSection, { supplements: supplements })),
|
65
71
|
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,2DAAuD;AACvD,6DAAyD;AAEzD,IAAY,
|
1
|
+
{"version":3,"file":"FileManager.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileManager.tsx"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;GAUG;AACH,0DAAqD;AACrD,0DAAkD;AAClD,kDAAyB;AAEzB,uCAA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,oBAE7B;YACxB,8BAAC,qBAAO,IAAC,EAAE,EAAC,cAAc,EAAC,KAAK,EAAC,QAAQ,2CAE/B;YACV,8BAAC,iCAAqB,uBAAiB,qBAAqB,kBAEpC;YACxB,8BAAC,qBAAO,IAAC,EAAE,EAAC,qBAAqB,EAAC,KAAK,EAAC,QAAQ,6CAEtC;YACV,8BAAC,iCAAqB,uBAAiB,eAAe,kBAE9B;YACxB,8BAAC,qBAAO,IAAC,EAAE,EAAC,eAAe,EAAC,KAAK,EAAC,QAAQ,gDAEhC,CACO;QACnB,8BAAC,8BAAkB,IACjB,KAAK,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE;YAErD,8BAAC,6BAAiB,eAAS,QAAQ;gBACjC,8BAAC,uCAAkB,IAAC,QAAQ,EAAE,OAAO,GAAI,CACvB;YACpB,8BAAC,6BAAiB,eAAS,MAAM;gBAC/B,8BAAC,mCAAgB,IAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,GAAI,CACjC;YACpB,8BAAC,6BAAiB,eAAS,aAAa;gBACtC,8BAAC,uCAAkB,IAAC,WAAW,EAAE,WAAW,GAAI,CAC9B;YACpB,8BAAC,6BAAiB,eAAS,OAAO;gBAChC,8BAAC,qCAAiB,IAAC,KAAK,EAAE,MAAM,GAAI,CAClB,CACD,CACP,CACjB,CAAA;AACH,CAAC,CAAA;AAhEY,QAAA,WAAW,eAgEvB"}
|
@@ -26,12 +26,14 @@ 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";
|
29
30
|
})(FileSectionAlertType = exports.FileSectionAlertType || (exports.FileSectionAlertType = {}));
|
30
31
|
const FileSectionAlert = ({ alert }) => {
|
31
32
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
32
33
|
alert.type === FileSectionAlertType.UPLOAD_IN_PROGRESS && (react_1.default.createElement(FileUploadInProgressAlert, { name: alert.message })),
|
33
34
|
alert.type === FileSectionAlertType.UPLOAD_SUCCESSFUL && (react_1.default.createElement(FileUploadSuccessful, null)),
|
34
|
-
alert.type === FileSectionAlertType.MOVE_SUCCESSFUL && (react_1.default.createElement(FileMoveSuccessful, { name: alert.message }))
|
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 }))));
|
35
37
|
};
|
36
38
|
exports.FileSectionAlert = FileSectionAlert;
|
37
39
|
const FileUploadInProgressAlert = ({ name }) => {
|
@@ -55,6 +57,15 @@ const FileMoveSuccessful = ({ name }) => {
|
|
55
57
|
"File moved to ",
|
56
58
|
name)));
|
57
59
|
};
|
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
|
+
};
|
58
69
|
const AlertMessageContainer = styled_components_1.default.div `
|
59
70
|
margin-left: 16px;
|
60
71
|
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,oBAMX;AAND,WAAY,oBAAoB;IAC9B,+DAAI,CAAA;IACJ,2FAAkB,CAAA;IAClB,yFAAiB,CAAA;IACjB,qFAAe,CAAA;IACf,2FAAkB,CAAA;AACpB,CAAC,EANW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAM/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,oBAAoB,CAAC,eAAe,IAAI,CACtD,8BAAC,kBAAkB,IAAC,IAAI,EAAE,KAAK,CAAC,OAAO,GAAI,CAC5C;QACA,KAAK,CAAC,IAAI,KAAK,oBAAoB,CAAC,kBAAkB,IAAI,CACzD,8BAAC,qBAAqB,IAAC,IAAI,EAAE,KAAK,CAAC,OAAO,GAAI,CAC/C,CACA,CACJ,CAAA;AACH,CAAC,CAAA;AAnBY,QAAA,gBAAgB,oBAmB5B;AAED,MAAM,yBAAyB,GAE1B,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAChB,OAAO,CACL,8BAAC,mBAAmB;QAClB,8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AA;AAED,MAAM,qBAAqB,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, placeholder, accept, }) => {
|
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 }) => {
|
|
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, value: '' }),
|
72
|
-
|
71
|
+
react_1.default.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange, accept: accept, value: '' }),
|
72
|
+
placeholder));
|
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;AAY/C;;GAEG;AACI,MAAM,YAAY,GAAgC,CAAC,EACxD,QAAQ,EACR,WAAW,EACX,MAAM,GACP,EAAE,EAAE;IACH,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,C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@ -0,0 +1,183 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
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);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.MainFilesSection = 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) 2025 Atypon Systems LLC. All Rights Reserved.
|
40
|
+
*/
|
41
|
+
const body_editor_1 = require("@manuscripts/body-editor");
|
42
|
+
const style_guide_1 = require("@manuscripts/style-guide");
|
43
|
+
const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
44
|
+
const react_1 = __importStar(require("react"));
|
45
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
46
|
+
const store_1 = require("../../store");
|
47
|
+
const FileActions_1 = require("./FileActions");
|
48
|
+
const FileManager_1 = require("./FileManager");
|
49
|
+
const FileSectionAlert_1 = require("./FileSectionAlert");
|
50
|
+
const FileUploader_1 = require("./FileUploader");
|
51
|
+
const MainDocumentContainer = styled_components_1.default.div `
|
52
|
+
display: flex;
|
53
|
+
align-items: center;
|
54
|
+
padding: 26px 16px;
|
55
|
+
gap: 12px;
|
56
|
+
position: relative;
|
57
|
+
&:hover {
|
58
|
+
background-color: #f2fbfc;
|
59
|
+
}
|
60
|
+
`;
|
61
|
+
const MainDocumentInfo = styled_components_1.default.div `
|
62
|
+
display: flex;
|
63
|
+
flex: 1;
|
64
|
+
`;
|
65
|
+
const MainDocumentTitle = styled_components_1.default.div `
|
66
|
+
color: ${(props) => props.theme.colors.text.primary};
|
67
|
+
font-weight: 700;
|
68
|
+
display: flex;
|
69
|
+
align-items: center;
|
70
|
+
margin-top: 20px;
|
71
|
+
padding: 0 16px 8px 16px;
|
72
|
+
gap: 12px;
|
73
|
+
position: relative;
|
74
|
+
`;
|
75
|
+
const Label = styled_components_1.default.span `
|
76
|
+
color: ${(props) => props.theme.colors.text.primary};
|
77
|
+
font-size: 16px;
|
78
|
+
margin-right: 3.2px;
|
79
|
+
font-weight: 700;
|
80
|
+
`;
|
81
|
+
const FileName = styled_components_1.default.span `
|
82
|
+
color: ${(props) => props.theme.colors.text.primary};
|
83
|
+
font-size: 16px;
|
84
|
+
`;
|
85
|
+
const MainFilesSection = ({ mainDocument, }) => {
|
86
|
+
const [{ fileManagement, view }] = (0, store_1.useStore)((s) => ({
|
87
|
+
fileManagement: s.fileManagement,
|
88
|
+
view: s.view,
|
89
|
+
}));
|
90
|
+
const can = (0, style_guide_1.usePermissions)();
|
91
|
+
const [alert, setAlert] = (0, react_1.useState)({
|
92
|
+
type: FileSectionAlert_1.FileSectionAlertType.NONE,
|
93
|
+
message: '',
|
94
|
+
});
|
95
|
+
const [isConfirmDialogOpen, setConfirmDialogOpen] = (0, react_1.useState)(false);
|
96
|
+
const [fileToUpload, setFileToUpload] = (0, react_1.useState)(null);
|
97
|
+
const handleUpload = async (file) => {
|
98
|
+
if (mainDocument) {
|
99
|
+
setFileToUpload(file);
|
100
|
+
setConfirmDialogOpen(true);
|
101
|
+
}
|
102
|
+
else {
|
103
|
+
await uploadFile(file);
|
104
|
+
}
|
105
|
+
};
|
106
|
+
if (!view) {
|
107
|
+
return null;
|
108
|
+
}
|
109
|
+
const uploadFile = async (file) => {
|
110
|
+
setAlert({
|
111
|
+
type: FileSectionAlert_1.FileSectionAlertType.UPLOAD_IN_PROGRESS,
|
112
|
+
message: file.name,
|
113
|
+
});
|
114
|
+
const uploaded = await fileManagement.upload(file);
|
115
|
+
(0, body_editor_1.insertAttachment)(uploaded, view.state, 'document', view.dispatch);
|
116
|
+
setAlert({
|
117
|
+
type: FileSectionAlert_1.FileSectionAlertType.UPLOAD_SUCCESSFUL,
|
118
|
+
message: '',
|
119
|
+
});
|
120
|
+
return uploaded;
|
121
|
+
};
|
122
|
+
const handleDownload = () => {
|
123
|
+
if (mainDocument) {
|
124
|
+
fileManagement.download(mainDocument.file);
|
125
|
+
}
|
126
|
+
};
|
127
|
+
const handleReplace = async (file) => {
|
128
|
+
setFileToUpload(file);
|
129
|
+
setConfirmDialogOpen(true);
|
130
|
+
};
|
131
|
+
const handleMove = (mainFile) => {
|
132
|
+
const tr = view.state.tr;
|
133
|
+
const from = mainFile.pos;
|
134
|
+
const to = from + mainFile.node.nodeSize;
|
135
|
+
tr.delete(from, to);
|
136
|
+
view.dispatch((0, track_changes_plugin_1.skipTracking)(tr));
|
137
|
+
setAlert({
|
138
|
+
type: FileSectionAlert_1.FileSectionAlertType.MOVE_SUCCESSFUL,
|
139
|
+
message: FileManager_1.FileSectionType.OtherFile,
|
140
|
+
});
|
141
|
+
};
|
142
|
+
return (react_1.default.createElement("div", null,
|
143
|
+
mainDocument ? (react_1.default.createElement(MainDocumentContainer, { "data-cy": "file-container" },
|
144
|
+
react_1.default.createElement(style_guide_1.FileMainDocumentIcon, null),
|
145
|
+
react_1.default.createElement(MainDocumentInfo, null,
|
146
|
+
react_1.default.createElement(Label, null, "Main:"),
|
147
|
+
react_1.default.createElement(FileName, null, mainDocument.file.name)),
|
148
|
+
react_1.default.createElement(FileActions_1.FileActions, { "data-cy": "file-actions", sectionType: FileManager_1.FileSectionType.MainFile, onDownload: handleDownload, onReplace: handleReplace, move: {
|
149
|
+
sectionType: FileManager_1.FileSectionType.OtherFile,
|
150
|
+
handler: () => handleMove(mainDocument),
|
151
|
+
}, file: mainDocument.file, accept: ".docx, .doc, .pdf, .xml, .tex" }))) : (can?.uploadFile && (react_1.default.createElement(MainDocumentTitle, null, "Upload main document"))),
|
152
|
+
can?.uploadFile && (react_1.default.createElement(FileUploader_1.FileUploader, { onUpload: handleUpload, placeholder: "Drag or click to replace with a new file", accept: ".docx, .doc, .pdf, .xml, .tex" })),
|
153
|
+
react_1.default.createElement(FileSectionAlert_1.FileSectionAlert, { alert: alert }),
|
154
|
+
react_1.default.createElement(style_guide_1.Dialog, { isOpen: isConfirmDialogOpen, category: style_guide_1.Category.confirmation, header: "Replace Main Document", message: react_1.default.createElement(react_1.default.Fragment, null,
|
155
|
+
"This action will replace the current main document file with this one!",
|
156
|
+
react_1.default.createElement("br", null),
|
157
|
+
react_1.default.createElement("br", null),
|
158
|
+
"Do you want to continue?"), actions: {
|
159
|
+
primary: {
|
160
|
+
action: async () => {
|
161
|
+
if (fileToUpload) {
|
162
|
+
const uploaded = await fileManagement.upload(fileToUpload);
|
163
|
+
(0, body_editor_1.insertAttachment)(uploaded, view.state, 'document', view.dispatch);
|
164
|
+
}
|
165
|
+
setConfirmDialogOpen(false);
|
166
|
+
setAlert({
|
167
|
+
type: FileSectionAlert_1.FileSectionAlertType.REPLACE_SUCCESSFUL,
|
168
|
+
message: FileManager_1.FileSectionType.MainFile,
|
169
|
+
});
|
170
|
+
},
|
171
|
+
title: 'Replace',
|
172
|
+
},
|
173
|
+
secondary: {
|
174
|
+
action: () => {
|
175
|
+
setFileToUpload(null);
|
176
|
+
setConfirmDialogOpen(false);
|
177
|
+
},
|
178
|
+
title: 'Cancel',
|
179
|
+
},
|
180
|
+
} })));
|
181
|
+
};
|
182
|
+
exports.MainFilesSection = MainFilesSection;
|
183
|
+
//# sourceMappingURL=MainFilesSection.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MainFilesSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/MainFilesSection.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,0DAAqE;AACrE,0DAKiC;AACjC,4EAAgE;AAChE,+CAAuC;AACvC,0EAAsC;AAEtC,uCAAsC;AACtC,+CAA2C;AAC3C,+CAA+C;AAC/C,yDAA2E;AAC3E,iDAA6C;AAE7C,MAAM,qBAAqB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;;;CASvC,CAAA;AAED,MAAM,gBAAgB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;CAGlC,CAAA;AAED,MAAM,iBAAiB,GAAG,2BAAM,CAAC,GAAG,CAAA;WACzB,CAAC,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AAE;wBACjB,IAAI,YAAY,EAAE;4BAChB,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;4BAC1D,IAAA,8BAAgB,EACd,QAAQ,EACR,IAAI,CAAC,KAAK,EACV,UAAU,EACV,IAAI,CAAC,QAAQ,CACd,CAAA;yBACF;wBACD,oBAAoB,CAAC,KAAK,CAAC,CAAA;wBAC3B,QAAQ,CAAC;4BACP,IAAI,EAAE,uCAAoB,CAAC,kBAAkB;4BAC7C,OAAO,EAAE,6BAAe,CAAC,QAAQ;yBAClC,CAAC,CAAA;oBACJ,CAAC;oBACD,KAAK,EAAE,SAAS;iBACjB;gBACD,SAAS,EAAE;oBACT,MAAM,EAAE,GAAG,EAAE;wBACX,eAAe,CAAC,IAAI,CAAC,CAAA;wBACrB,oBAAoB,CAAC,KAAK,CAAC,CAAA;oBAC7B,CAAC;oBACD,KAAK,EAAE,QAAQ;iBAChB;aACF,GACD,CACE,CACP,CAAA;AACH,CAAC,CAAA;AAlJY,QAAA,gBAAgB,oBAkJ5B"}
|
@@ -82,13 +82,20 @@ const OtherFilesSection = ({ files }) => {
|
|
82
82
|
message: FileManager_1.FileSectionType.Supplements,
|
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
|
+
};
|
85
92
|
return (react_1.default.createElement("div", null,
|
86
|
-
can?.uploadFile && react_1.default.createElement(FileUploader_1.FileUploader, { onUpload: handleUpload }),
|
93
|
+
can?.uploadFile && (react_1.default.createElement(FileUploader_1.FileUploader, { onUpload: handleUpload, placeholder: "Drag or click to upload a new file" })),
|
87
94
|
react_1.default.createElement(FileSectionAlert_1.FileSectionAlert, { alert: alert }),
|
88
|
-
files.map((file) => (react_1.default.createElement(OtherFile, { key: file.id, file: file, onDownload: () => fileManagement.download(file), onMoveToSupplements: async () => await moveToSupplements(file) })))));
|
95
|
+
files.map((file) => (react_1.default.createElement(OtherFile, { key: file.id, file: file, onDownload: () => fileManagement.download(file), onMoveToSupplements: async () => await moveToSupplements(file), onUseAsMain: async () => await asMainDocument(file) })))));
|
89
96
|
};
|
90
97
|
exports.OtherFilesSection = OtherFilesSection;
|
91
|
-
const OtherFile = ({ file, onDownload, onMoveToSupplements }) => {
|
98
|
+
const OtherFile = ({ file, onDownload, onMoveToSupplements, onUseAsMain }) => {
|
92
99
|
const [{ isDragging }, dragRef, preview] = (0, react_dnd_1.useDrag)({
|
93
100
|
type: 'file',
|
94
101
|
item: {
|
@@ -104,9 +111,9 @@ const OtherFile = ({ file, onDownload, onMoveToSupplements }) => {
|
|
104
111
|
return (react_1.default.createElement(FileContainer_1.FileContainer, { key: file.id, "data-cy": "file-container", ref: dragRef, className: isDragging ? 'dragging' : '' },
|
105
112
|
react_1.default.createElement(FileName_1.FileName, { file: file }),
|
106
113
|
react_1.default.createElement(FileCreatedDate_1.FileCreatedDate, { file: file, className: "show-on-hover" }),
|
107
|
-
react_1.default.createElement(FileActions_1.FileActions, { sectionType: FileManager_1.FileSectionType.OtherFile, onDownload: onDownload, move: {
|
114
|
+
react_1.default.createElement(FileActions_1.FileActions, { sectionType: FileManager_1.FileSectionType.OtherFile, onDownload: onDownload, onUseAsMain: onUseAsMain, move: {
|
108
115
|
sectionType: FileManager_1.FileSectionType.Supplements,
|
109
116
|
handler: onMoveToSupplements,
|
110
|
-
} })));
|
117
|
+
}, file: file })));
|
111
118
|
};
|
112
119
|
//# 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,0DAIiC;AACjC,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,IAAI,EAAE;QACT,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,YAAY,GAAG,KAAK,EAAE,IAAU,EAAE,EAAE;QACxC,QAAQ,CAAC;YACP,IAAI,EAAE,uCAAoB,CAAC,kBAAkB;YAC7C,OAAO,EAAE,IAAI,CAAC,IAAI;SACnB,CAAC,CAAA;QACF,MAAM,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACjC,QAAQ,CAAC;YACP,IAAI,EAAE,uCAAoB,CAAC,iBAAiB;YAC5C,OAAO,EAAE,EAAE;SACZ,CAAC,C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S,GAKV,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,mBAAmB,EAAE,WAAW,EAAE,EAAE,EAAE;IAC9D,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,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE;gBACJ,WAAW,EAAE,6BAAe,CAAC,WAAW;gBACxC,OAAO,EAAE,mBAAmB;aAC7B,EACD,IAAI,EAAE,IAAI,GACV,CACY,CACjB,CAAA;AACH,CAAC,CAAA"}
|
@@ -98,13 +98,25 @@ 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
|
+
};
|
101
113
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
102
|
-
can?.uploadFile && react_1.default.createElement(FileUploader_1.FileUploader, { onUpload: handleUpload }),
|
114
|
+
can?.uploadFile && (react_1.default.createElement(FileUploader_1.FileUploader, { onUpload: handleUpload, placeholder: "Drag or click to upload a new file" })),
|
103
115
|
react_1.default.createElement(FileSectionAlert_1.FileSectionAlert, { alert: alert }),
|
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) })))));
|
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), onUseAsMain: () => handleUseAsMain(supplement) })))));
|
105
117
|
};
|
106
118
|
exports.SupplementsSection = SupplementsSection;
|
107
|
-
const SupplementFile = ({ supplement, onDownload, onReplace, onDetach }) => {
|
119
|
+
const SupplementFile = ({ supplement, onDownload, onReplace, onDetach, onUseAsMain }) => {
|
108
120
|
const [{ isDragging }, dragRef, preview] = (0, react_dnd_1.useDrag)({
|
109
121
|
type: 'file',
|
110
122
|
item: {
|
@@ -130,6 +142,6 @@ const SupplementFile = ({ supplement, onDownload, onReplace, onDetach }) => {
|
|
130
142
|
sectionType: FileManager_1.FileSectionType.OtherFile,
|
131
143
|
handler: onDetach,
|
132
144
|
}
|
133
|
-
: undefined })));
|
145
|
+
: undefined, onUseAsMain: onUseAsMain, file: supplement.file })));
|
134
146
|
};
|
135
147
|
//# 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,0DAIiC;AACjC,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,IAA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