@manuscripts/article-editor 4.2.3 → 4.2.5
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/EditorApp.js +1 -1
- package/dist/cjs/EditorApp.js.map +1 -1
- package/dist/cjs/components/FileManager/FileActions.js +28 -8
- package/dist/cjs/components/FileManager/FileActions.js.map +1 -1
- package/dist/cjs/components/FileManager/FileGroup.js +113 -0
- package/dist/cjs/components/FileManager/FileGroup.js.map +1 -0
- package/dist/cjs/components/FileManager/InlineFilesSection.js +78 -28
- package/dist/cjs/components/FileManager/InlineFilesSection.js.map +1 -1
- package/dist/cjs/components/FileManager/OtherFilesSection.js +1 -1
- package/dist/cjs/components/FileManager/SupplementsSection.js +1 -1
- package/dist/es/EditorApp.js +1 -1
- package/dist/es/EditorApp.js.map +1 -1
- package/dist/es/components/FileManager/FileActions.js +29 -9
- package/dist/es/components/FileManager/FileActions.js.map +1 -1
- package/dist/es/components/FileManager/FileGroup.js +107 -0
- package/dist/es/components/FileManager/FileGroup.js.map +1 -0
- package/dist/es/components/FileManager/InlineFilesSection.js +81 -31
- package/dist/es/components/FileManager/InlineFilesSection.js.map +1 -1
- package/dist/es/components/FileManager/OtherFilesSection.js +1 -1
- package/dist/es/components/FileManager/SupplementsSection.js +1 -1
- package/dist/types/components/FileManager/FileActions.d.ts +1 -0
- package/dist/types/components/FileManager/FileGroup.d.ts +19 -0
- package/dist/types/components/FileManager/OtherFilesSection.d.ts +1 -1
- package/dist/types/components/FileManager/SupplementsSection.d.ts +1 -1
- package/package.json +2 -2
package/dist/cjs/EditorApp.js
CHANGED
@@ -48,7 +48,7 @@ const EditorApp = ({ manuscriptID, projectID, permittedActions, fileManagement,
|
|
48
48
|
const observerSubscribed = (0, react_1.useRef)(false);
|
49
49
|
const api = (0, react_1.useMemo)(() => new Api_1.Api(getAuthToken), [getAuthToken]);
|
50
50
|
(0, react_1.useEffect)(() => {
|
51
|
-
// implement remount for the store if component is retriggered
|
51
|
+
// implement remount for the store if component is retriggered.
|
52
52
|
if (loadedRef.current) {
|
53
53
|
return;
|
54
54
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EditorApp.js","sourceRoot":"","sources":["../../src/EditorApp.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,+CAAmE;AACnE,0EAAsC;AAEtC,mCAA2C;AAC3C,+CAA2C;AAC3C,4CAAwC;AACxC,4GAAmF;AACnF,uFAAmF;AAEnF,mCAMgB;AAYhB,MAAM,kBAAkB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;CAOpC,CAAA;AAED,MAAM,SAAS,GAA6B,CAAC,EAC3C,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,YAAY,EACZ,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,GAAgB,CAAA;IAClD,MAAM,SAAS,GAAG,IAAA,cAAM,EAAU,KAAK,CAAC,CAAA;IACxC,MAAM,kBAAkB,GAAG,IAAA,cAAM,EAAU,KAAK,CAAC,CAAA;IAEjD,MAAM,GAAG,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAI,SAAG,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAA;IAEhE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb
|
1
|
+
{"version":3,"file":"EditorApp.js","sourceRoot":"","sources":["../../src/EditorApp.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,+CAAmE;AACnE,0EAAsC;AAEtC,mCAA2C;AAC3C,+CAA2C;AAC3C,4CAAwC;AACxC,4GAAmF;AACnF,uFAAmF;AAEnF,mCAMgB;AAYhB,MAAM,kBAAkB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;CAOpC,CAAA;AAED,MAAM,SAAS,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,IAAI,CAAC,QAAQ,IAAI,kBAAkB,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE;YACrD,OAAM;SACP;QACD,kBAAkB,CAAC,OAAO,GAAG,IAAI,CAAA;QACjC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;QAC7C,QAAQ,CAAC,KAAK,CAAC,OAAO,GAAG;YACvB,GAAG,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE;YAC5B,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAc,CAAC;SACnD,CAAA;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAA;IAErB,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,8BAAC,gBAAU,CAAC,QAAQ,IAAC,KAAK,EAAE,GAAG;QAC7B,8BAAC,4BAAoB,IAAC,KAAK,EAAE,KAAK;YAChC,8BAAC,WAAI;gBACH,8BAAC,iCAAuB,OAAG,CACtB,CACc,CACH,CACvB,CAAC,CAAC,CAAC,CACF,8BAAC,kBAAkB;QACjB,8BAAC,6CAAqB,OAAG,CACN,CACtB,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,SAAS,CAAA"}
|
@@ -33,22 +33,25 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
33
33
|
/**
|
34
34
|
* This component represents the drop-down list action for each file item.
|
35
35
|
*/
|
36
|
-
const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onUseAsMain, move, className, file, accept, }) => {
|
36
|
+
const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onDelete, onUseAsMain, move, className, file, accept, }) => {
|
37
37
|
const can = (0, style_guide_1.usePermissions)();
|
38
38
|
const { isOpen, toggleOpen, wrapperRef } = (0, style_guide_1.useDropdown)();
|
39
39
|
const [isMoveDialogOpen, setMoveDialogOpen] = (0, react_1.useState)(false);
|
40
40
|
const [isUseAsMainDialogOpen, setUseAsMainDialogOpen] = (0, react_1.useState)(false);
|
41
|
+
const fileInputRef = (0, react_1.useRef)(null);
|
41
42
|
const showDownload = can?.downloadFiles && onDownload;
|
42
43
|
const showReplace = can?.replaceFile && onReplace;
|
43
44
|
const showDetach = can?.detachFile && onDetach;
|
45
|
+
const showDelete = can?.detachFile && onDelete;
|
44
46
|
const showMove = can?.moveFile && move;
|
45
47
|
const showUseAsMain = can?.moveFile && onUseAsMain && isValidMainDocumentFormat(file);
|
46
48
|
const show = showDownload || showReplace || showDetach || showMove || showUseAsMain;
|
47
|
-
const fileInputRef = (0, react_1.useRef)(null);
|
48
49
|
const handleChange = async (event) => {
|
49
|
-
if (onReplace && event
|
50
|
-
|
51
|
-
|
50
|
+
if (onReplace && event?.target?.files?.[0]) {
|
51
|
+
await onReplace(event.target.files[0]);
|
52
|
+
if (fileInputRef.current) {
|
53
|
+
fileInputRef.current.value = '';
|
54
|
+
}
|
52
55
|
}
|
53
56
|
};
|
54
57
|
const openFileDialog = () => {
|
@@ -56,23 +59,40 @@ const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onUseAsMain
|
|
56
59
|
fileInputRef.current.click();
|
57
60
|
}
|
58
61
|
};
|
62
|
+
// Fix: Close dropdown when clicking outside or pressing escape
|
63
|
+
(0, react_1.useEffect)(() => {
|
64
|
+
const handleClickOutside = (event) => {
|
65
|
+
if (wrapperRef.current &&
|
66
|
+
!wrapperRef.current.contains(event.target)) {
|
67
|
+
toggleOpen();
|
68
|
+
}
|
69
|
+
};
|
70
|
+
if (isOpen) {
|
71
|
+
document.addEventListener('mousedown', handleClickOutside);
|
72
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
73
|
+
}
|
74
|
+
}, [isOpen, wrapperRef, toggleOpen]);
|
59
75
|
if (!show) {
|
60
76
|
return null;
|
61
77
|
}
|
62
78
|
return (react_1.default.createElement(style_guide_1.DropdownContainer, { ref: wrapperRef },
|
63
|
-
react_1.default.createElement(exports.ActionsIcon, { onClick:
|
79
|
+
react_1.default.createElement(exports.ActionsIcon, { onClick: (e) => {
|
80
|
+
e.stopPropagation();
|
81
|
+
toggleOpen();
|
82
|
+
}, type: "button", className: "show-on-hover", "data-cy": "file-actions", "aria-label": "Actions", "aria-pressed": isOpen },
|
64
83
|
react_1.default.createElement(style_guide_1.DotsIcon, null)),
|
65
|
-
isOpen && (react_1.default.createElement(exports.FileActionDropdownList, { "data-cy": "file-actions-dropdown", direction: "right", className: className, width: 192, top: 5, onClick:
|
84
|
+
isOpen && (react_1.default.createElement(exports.FileActionDropdownList, { "data-cy": "file-actions-dropdown", direction: "right", className: className, width: 192, top: 5, onClick: (e) => e.stopPropagation() },
|
66
85
|
showDownload && (react_1.default.createElement(exports.FileAction, { onClick: onDownload }, "Download")),
|
67
86
|
showReplace && (react_1.default.createElement(react_1.default.Fragment, null,
|
68
87
|
react_1.default.createElement(exports.FileAction, { onClick: openFileDialog }, "Replace"),
|
69
88
|
react_1.default.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange, accept: accept }))),
|
70
89
|
showDetach && react_1.default.createElement(exports.FileAction, { onClick: onDetach }, "Detach"),
|
90
|
+
showDelete && react_1.default.createElement(exports.FileAction, { onClick: onDelete }, "Delete"),
|
71
91
|
showMove && (react_1.default.createElement(exports.FileAction, { onClick: () => setMoveDialogOpen(true) },
|
72
92
|
"Move to ",
|
73
93
|
move.sectionType)),
|
74
94
|
showUseAsMain && (react_1.default.createElement(exports.FileAction, { onClick: () => setUseAsMainDialogOpen(true) }, "Use as main document")))),
|
75
|
-
showMove && (react_1.default.createElement(MoveFileConfirmationDialog, {
|
95
|
+
showMove && (react_1.default.createElement(MoveFileConfirmationDialog, { isOpen: isMoveDialogOpen, close: () => setMoveDialogOpen(false), source: sectionType, target: move.sectionType, handleMove: move.handler })),
|
76
96
|
showUseAsMain && (react_1.default.createElement(UseAsMainConfirmationDialog, { "data-cy": "file-use-as-main-confirm-dialog", isOpen: isUseAsMainDialogOpen, close: () => setUseAsMainDialogOpen(false), handleUseAsMain: onUseAsMain }))));
|
77
97
|
};
|
78
98
|
exports.FileActions = FileActions;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FileActions.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileActions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,0DASiC;AACjC,+
|
1
|
+
{"version":3,"file":"FileActions.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileActions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,0DASiC;AACjC,+CAAuE;AACvE,0EAAsC;AAItC;;GAEG;AACI,MAAM,WAAW,GAWnB,CAAC,EACJ,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,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;IAC1B,MAAM,YAAY,GAAG,IAAA,cAAM,EAAmB,IAAI,CAAC,CAAA;IAEnD,MAAM,YAAY,GAAG,GAAG,EAAE,aAAa,IAAI,UAAU,CAAA;IACrD,MAAM,WAAW,GAAG,GAAG,EAAE,WAAW,IAAI,SAAS,CAAA;IACjD,MAAM,UAAU,GAAG,GAAG,EAAE,UAAU,IAAI,QAAQ,CAAA;IAC9C,MAAM,UAAU,GAAG,GAAG,EAAE,UAAU,I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K,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"}
|
@@ -0,0 +1,113 @@
|
|
1
|
+
"use strict";
|
2
|
+
/*!
|
3
|
+
* 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.
|
4
|
+
*
|
5
|
+
* 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.
|
6
|
+
*
|
7
|
+
* The Original Code is manuscripts-frontend.
|
8
|
+
*
|
9
|
+
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
10
|
+
*
|
11
|
+
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2025 Atypon Systems LLC. All Rights Reserved.
|
12
|
+
*/
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
exports.ToggleIcon = exports.FileGroupHeader = exports.FileLabel = exports.FileGroup = exports.FileGroupItemContainer = exports.FileGroupContainer = void 0;
|
18
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
19
|
+
exports.FileGroupContainer = styled_components_1.default.div `
|
20
|
+
margin: 20px 0px 20px 15px;
|
21
|
+
`;
|
22
|
+
exports.FileGroupItemContainer = styled_components_1.default.div `
|
23
|
+
display: flex;
|
24
|
+
align-items: center;
|
25
|
+
cursor: pointer;
|
26
|
+
padding: 12px 18px;
|
27
|
+
|
28
|
+
.react-tooltip {
|
29
|
+
max-width: 100% !important;
|
30
|
+
}
|
31
|
+
|
32
|
+
svg {
|
33
|
+
width: 16px;
|
34
|
+
|
35
|
+
path {
|
36
|
+
fill: #6e6e6e;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
&.dragging {
|
41
|
+
opacity: 0.2;
|
42
|
+
}
|
43
|
+
|
44
|
+
.show-on-hover {
|
45
|
+
visibility: hidden;
|
46
|
+
}
|
47
|
+
|
48
|
+
&:hover .show-on-hover {
|
49
|
+
visibility: visible;
|
50
|
+
}
|
51
|
+
|
52
|
+
&:hover,
|
53
|
+
&:focus {
|
54
|
+
background: #f2fbfc;
|
55
|
+
}
|
56
|
+
`;
|
57
|
+
exports.FileGroup = styled_components_1.default.div `
|
58
|
+
display: block;
|
59
|
+
`;
|
60
|
+
exports.FileLabel = styled_components_1.default.div `
|
61
|
+
color: ${(props) => props.theme.colors.text.primary};
|
62
|
+
font-weight: bold;
|
63
|
+
font-size: 16px;
|
64
|
+
line-height: 20px;
|
65
|
+
white-space: nowrap;
|
66
|
+
align-content: center;
|
67
|
+
`;
|
68
|
+
exports.FileGroupHeader = styled_components_1.default.div `
|
69
|
+
display: flex;
|
70
|
+
align-items: center;
|
71
|
+
cursor: pointer;
|
72
|
+
padding-right: 20px;
|
73
|
+
margin-bottom: 20px;
|
74
|
+
|
75
|
+
.file-icon {
|
76
|
+
margin-right: ${(props) => props.theme.grid.unit * 2}px; /* Adjust as needed */
|
77
|
+
}
|
78
|
+
|
79
|
+
${exports.FileLabel} {
|
80
|
+
flex: 1;
|
81
|
+
}
|
82
|
+
`;
|
83
|
+
exports.ToggleIcon = styled_components_1.default.div `
|
84
|
+
width: 20px;
|
85
|
+
height: 20px;
|
86
|
+
border-radius: 50%;
|
87
|
+
border: 1px solid #e2e2e2;
|
88
|
+
text-align: center;
|
89
|
+
cursor: pointer;
|
90
|
+
|
91
|
+
svg {
|
92
|
+
width: 19px;
|
93
|
+
height: 19px;
|
94
|
+
transition: transform 0.2s ease; // Smooth transition for rotation
|
95
|
+
}
|
96
|
+
|
97
|
+
// Style for TriangleCollapsedIcon (when collapsed)
|
98
|
+
${(props) => !props.isOpen &&
|
99
|
+
`
|
100
|
+
svg {
|
101
|
+
transform: rotate(270deg); // Point downward when collapsed
|
102
|
+
}
|
103
|
+
`}
|
104
|
+
|
105
|
+
// Style for TriangleExpandedIcon (when expanded)
|
106
|
+
${(props) => props.isOpen &&
|
107
|
+
`
|
108
|
+
svg {
|
109
|
+
transform: rotate(0deg); // Point upward when expanded
|
110
|
+
}
|
111
|
+
`}
|
112
|
+
`;
|
113
|
+
//# sourceMappingURL=FileGroup.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"FileGroup.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileGroup.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;AAEH,0EAAsC;AAEzB,QAAA,kBAAkB,GAAG,2BAAM,CAAC,GAAG,CAAA;;CAE3C,CAAA;AACY,QAAA,sBAAsB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC/C,CAAA;AAEY,QAAA,SAAS,GAAG,2BAAM,CAAC,GAAG,CAAA;;CAElC,CAAA;AACY,QAAA,SAAS,GAAG,2BAAM,CAAC,GAAG,CAAA;WACxB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;;;;;;CAMpD,CAAA;AAEY,QAAA,eAAe,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;;oBAQrB,CAAC,KAAK,EAAE,EAAE,CACxB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;;;IAG3B,iBAAS;;;CAGZ,CAAA;AAEY,QAAA,UAAU,GAAG,2BAAM,CAAC,GAAG,CAAqB;;;;;;;;;;;;;;;IAerD,CAAC,KAAK,EAAE,EAAE,CACV,CAAC,KAAK,CAAC,MAAM;IACb;;;;GAID;;;IAGC,CAAC,KAAK,EAAE,EAAE,CACV,KAAK,CAAC,MAAM;IACZ;;;;GAID;CACF,CAAA"}
|
@@ -29,31 +29,30 @@ const transform_1 = require("@manuscripts/transform");
|
|
29
29
|
const prosemirror_state_1 = require("prosemirror-state");
|
30
30
|
const prosemirror_utils_1 = require("prosemirror-utils");
|
31
31
|
const react_1 = __importStar(require("react"));
|
32
|
+
const files_1 = require("../../lib/files");
|
32
33
|
const store_1 = require("../../store");
|
33
34
|
const FileActions_1 = require("./FileActions");
|
34
|
-
const FileContainer_1 = require("./FileContainer");
|
35
35
|
const FileCreatedDate_1 = require("./FileCreatedDate");
|
36
|
+
const FileGroup_1 = require("./FileGroup");
|
36
37
|
const FileManager_1 = require("./FileManager");
|
37
38
|
const FileName_1 = require("./FileName");
|
39
|
+
const FileTypeIcon_1 = require("./FileTypeIcon");
|
38
40
|
const InlineFilesSection = ({ elements, }) => {
|
39
41
|
const [{ view, fileManagement, sectionCategories }] = (0, store_1.useStore)((s) => ({
|
40
42
|
view: s.view,
|
41
43
|
fileManagement: s.fileManagement,
|
42
44
|
sectionCategories: s.sectionCategories,
|
43
45
|
}));
|
44
|
-
const
|
46
|
+
const groupedMetadata = (0, react_1.useMemo)(() => {
|
45
47
|
if (!view) {
|
46
48
|
return [];
|
47
49
|
}
|
48
50
|
let figureIndex = 1;
|
49
51
|
let imageIndex = 1;
|
50
52
|
return elements.map((element) => {
|
51
|
-
const figure = element.files[0];
|
52
|
-
const file = figure?.file || { id: '', name: '' };
|
53
53
|
const $pos = view.state.doc.resolve(element.pos);
|
54
54
|
const section = (0, prosemirror_utils_1.findParentNodeOfTypeClosestToPos)($pos, transform_1.schema.nodes.graphical_abstract_section);
|
55
|
-
let label;
|
56
|
-
let icon;
|
55
|
+
let label, icon;
|
57
56
|
if (section) {
|
58
57
|
const category = section.node.attrs.category;
|
59
58
|
label = sectionCategories.get(category)?.titles[0] || '';
|
@@ -63,62 +62,113 @@ const InlineFilesSection = ({ elements, }) => {
|
|
63
62
|
label = `Image ${imageIndex++}`;
|
64
63
|
icon = style_guide_1.FileImageIcon;
|
65
64
|
}
|
66
|
-
else if (element.node.type === transform_1.schema.nodes.hero_image) {
|
67
|
-
label = `Hero Image`;
|
68
|
-
icon = style_guide_1.FileImageIcon;
|
69
|
-
}
|
70
65
|
else {
|
71
66
|
label = `Figure ${figureIndex++}`;
|
72
67
|
icon = style_guide_1.FileFigureIcon;
|
73
68
|
}
|
74
69
|
return {
|
75
70
|
element,
|
76
|
-
node: figure?.node,
|
77
|
-
pos: figure?.pos,
|
78
|
-
file,
|
79
71
|
label,
|
80
72
|
icon,
|
73
|
+
files: element.files.filter((f) => f.file.id),
|
81
74
|
};
|
82
75
|
});
|
83
76
|
}, [elements, view, sectionCategories]);
|
77
|
+
const [openGroupIndexes, setOpenGroupIndexes] = (0, react_1.useState)(new Set(groupedMetadata.map((_, index) => index)));
|
78
|
+
const toggleGroupOpen = (groupIndex) => {
|
79
|
+
setOpenGroupIndexes((prevOpenIndexes) => {
|
80
|
+
const newOpenIndexes = new Set(prevOpenIndexes);
|
81
|
+
if (newOpenIndexes.has(groupIndex)) {
|
82
|
+
newOpenIndexes.delete(groupIndex);
|
83
|
+
}
|
84
|
+
else {
|
85
|
+
newOpenIndexes.add(groupIndex);
|
86
|
+
}
|
87
|
+
return newOpenIndexes;
|
88
|
+
});
|
89
|
+
};
|
84
90
|
if (!view) {
|
85
91
|
return null;
|
86
92
|
}
|
87
|
-
const handleClick = (
|
93
|
+
const handleClick = (element) => {
|
94
|
+
const tr = view.state.tr;
|
95
|
+
tr.setSelection(prosemirror_state_1.NodeSelection.create(view.state.doc, element.pos));
|
96
|
+
tr.scrollIntoView();
|
97
|
+
view.focus();
|
98
|
+
view.dispatch(tr);
|
99
|
+
};
|
100
|
+
const handleFileClick = (pos) => {
|
101
|
+
if (!pos) {
|
102
|
+
return;
|
103
|
+
}
|
88
104
|
const tr = view.state.tr;
|
89
|
-
tr.setSelection(prosemirror_state_1.NodeSelection.create(view.state.doc,
|
105
|
+
tr.setSelection(prosemirror_state_1.NodeSelection.create(view.state.doc, pos));
|
90
106
|
tr.scrollIntoView();
|
91
107
|
view.focus();
|
92
108
|
view.dispatch(tr);
|
93
109
|
};
|
94
|
-
const handleDetach = (
|
95
|
-
if (!
|
110
|
+
const handleDetach = (pos) => {
|
111
|
+
if (!pos) {
|
96
112
|
return;
|
97
113
|
}
|
98
114
|
const tr = view.state.tr;
|
99
|
-
tr.setNodeAttribute(
|
100
|
-
tr.setSelection(prosemirror_state_1.NodeSelection.create(tr.doc,
|
115
|
+
tr.setNodeAttribute(pos, 'src', '');
|
116
|
+
tr.setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, pos));
|
101
117
|
tr.scrollIntoView();
|
102
118
|
view.focus();
|
103
119
|
view.dispatch(tr);
|
104
120
|
};
|
105
|
-
const
|
106
|
-
if (!
|
121
|
+
const handleDelete = (pos) => {
|
122
|
+
if (!pos || !view) {
|
123
|
+
return;
|
124
|
+
}
|
125
|
+
const node = view.state.doc.nodeAt(pos);
|
126
|
+
if (node?.type === transform_1.schema.nodes.figure) {
|
127
|
+
const tr = view.state.tr;
|
128
|
+
tr.delete(pos, pos + node.nodeSize);
|
129
|
+
view.dispatch(tr);
|
130
|
+
}
|
131
|
+
};
|
132
|
+
const handleReplace = async (pos, file) => {
|
133
|
+
if (!pos || !file) {
|
107
134
|
return;
|
108
135
|
}
|
109
136
|
const uploaded = await fileManagement.upload(file);
|
110
137
|
const tr = view.state.tr;
|
111
|
-
tr.setNodeAttribute(
|
112
|
-
tr.setSelection(prosemirror_state_1.NodeSelection.create(tr.doc,
|
138
|
+
tr.setNodeAttribute(pos, 'src', uploaded.id);
|
139
|
+
tr.setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, pos));
|
113
140
|
tr.scrollIntoView();
|
114
141
|
view.focus();
|
115
142
|
view.dispatch(tr);
|
116
143
|
};
|
117
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
react_1.default.createElement(
|
144
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, groupedMetadata.map((group, groupIndex) => {
|
145
|
+
const isOpen = openGroupIndexes.has(groupIndex);
|
146
|
+
const figureCount = group.files.length;
|
147
|
+
return (react_1.default.createElement(FileGroup_1.FileGroupContainer, { "data-cy": "file-container", key: groupIndex, onClick: () => handleClick(group.element) },
|
148
|
+
react_1.default.createElement(FileGroup_1.FileGroupHeader, null,
|
149
|
+
react_1.default.createElement(group.icon, { className: "file-icon" }),
|
150
|
+
group.label && react_1.default.createElement(FileGroup_1.FileLabel, null,
|
151
|
+
group.label,
|
152
|
+
":"),
|
153
|
+
group.files.length > 0 && (react_1.default.createElement(FileGroup_1.ToggleIcon, { isOpen: isOpen, onClick: (e) => {
|
154
|
+
e.stopPropagation();
|
155
|
+
toggleGroupOpen(groupIndex);
|
156
|
+
} }, isOpen ? (react_1.default.createElement(style_guide_1.TriangleExpandedIcon, null)) : (react_1.default.createElement(style_guide_1.TriangleCollapsedIcon, null))))),
|
157
|
+
isOpen && group.files.length > 0 && (react_1.default.createElement(FileGroup_1.FileGroup, null, group.files.map((fileAttachment, fileIndex) => (react_1.default.createElement(FileGroup_1.FileGroupItemContainer, { key: fileIndex, "data-tooltip-id": `${fileAttachment.file?.id}-file-name-tooltip`, onClick: (e) => {
|
158
|
+
e.stopPropagation();
|
159
|
+
handleFileClick(fileAttachment.pos);
|
160
|
+
} },
|
161
|
+
fileAttachment.file && (react_1.default.createElement(FileTypeIcon_1.FileTypeIcon, { file: fileAttachment.file })),
|
162
|
+
react_1.default.createElement(FileName_1.FileNameText, { "data-cy": "filename" },
|
163
|
+
fileAttachment.file?.name
|
164
|
+
? (0, files_1.trimFilename)(fileAttachment.file.name, 25)
|
165
|
+
: 'Unknown file',
|
166
|
+
fileAttachment.file?.name && (react_1.default.createElement(style_guide_1.Tooltip, { id: `${fileAttachment.file?.id}-file-name-tooltip`, place: "bottom" }, fileAttachment.file?.name || 'Figure'))),
|
167
|
+
fileAttachment.file && (react_1.default.createElement(FileCreatedDate_1.FileCreatedDate, { file: fileAttachment.file, className: "show-on-hover" })),
|
168
|
+
react_1.default.createElement(FileActions_1.FileActions, { sectionType: FileManager_1.FileSectionType.Inline, onReplace: async (f) => await handleReplace(fileAttachment.pos, f), onDetach: () => handleDetach(fileAttachment.pos), onDownload: () => fileAttachment.file &&
|
169
|
+
fileManagement.download(fileAttachment.file), onDelete: figureCount > 1
|
170
|
+
? () => handleDelete(fileAttachment.pos)
|
171
|
+
: undefined }))))))));
|
122
172
|
})));
|
123
173
|
};
|
124
174
|
exports.InlineFilesSection = InlineFilesSection;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"InlineFilesSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/InlineFilesSection.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,
|
1
|
+
{"version":3,"file":"InlineFilesSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/InlineFilesSection.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,0DAOiC;AACjC,sDAA+C;AAC/C,yDAAiD;AACjD,yDAAoE;AACpE,+CAAgD;AAEhD,2CAA8C;AAC9C,uCAAsC;AACtC,+CAA2C;AAC3C,uDAAmD;AACnD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C,IAAI,EAAE,EAAE,CAAC;wBAC5C,CAAC,CAAC,cAAc;oBACjB,cAAc,CAAC,IAAI,EAAE,IAAI,IAAI,CAC5B,8BAAC,qBAAO,IACN,EAAE,EAAE,GAAG,cAAc,CAAC,IAAI,EAAE,EAAE,oBAAoB,EAClD,KAAK,EAAC,QAAQ,IAEb,cAAc,CAAC,IAAI,EAAE,IAAI,IAAI,QAAQ,CAC9B,CACX,CACY;gBACd,cAAc,CAAC,IAAI,IAAI,CACtB,8BAAC,iCAAe,IACd,IAAI,EAAE,cAAc,CAAC,IAAI,EACzB,SAAS,EAAC,eAAe,GACzB,CACH;gBACD,8BAAC,yBAAW,IACV,WAAW,EAAE,6BAAe,CAAC,MAAM,EACnC,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CACrB,MAAM,aAAa,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,CAAC,EAE5C,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,GAAG,CAAC,EAChD,UAAU,EAAE,GAAG,EAAE,CACf,cAAc,CAAC,IAAI;wBACnB,cAAc,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,EAE9C,QAAQ,EACN,WAAW,GAAG,CAAC;wBACb,CAAC,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,GAAG,CAAC;wBACxC,CAAC,CAAC,SAAS,GAEf,CACqB,CAC1B,CAAC,CACQ,CACb,CACkB,CACtB,CAAA;IACH,CAAC,CAAC,CACD,CACJ,CAAA;AACH,CAAC,CAAA;AAnNY,QAAA,kBAAkB,sBAmN9B"}
|
@@ -49,7 +49,7 @@ const FileName_1 = require("./FileName");
|
|
49
49
|
const FileSectionAlert_1 = require("./FileSectionAlert");
|
50
50
|
const FileUploader_1 = require("./FileUploader");
|
51
51
|
/**
|
52
|
-
*
|
52
|
+
* This component represents the other files in the file section.
|
53
53
|
*/
|
54
54
|
const OtherFilesSection = ({ files }) => {
|
55
55
|
const [{ view, fileManagement }] = (0, store_1.useStore)((s) => ({
|
@@ -50,7 +50,7 @@ const FileName_1 = require("./FileName");
|
|
50
50
|
const FileSectionAlert_1 = require("./FileSectionAlert");
|
51
51
|
const FileUploader_1 = require("./FileUploader");
|
52
52
|
/**
|
53
|
-
*
|
53
|
+
* This component represents the other files in the file section.
|
54
54
|
*/
|
55
55
|
const SupplementsSection = ({ supplements, }) => {
|
56
56
|
const [{ view, fileManagement }] = (0, store_1.useStore)((s) => ({
|
package/dist/es/EditorApp.js
CHANGED
@@ -20,7 +20,7 @@ const EditorApp = ({ manuscriptID, projectID, permittedActions, fileManagement,
|
|
20
20
|
const observerSubscribed = useRef(false);
|
21
21
|
const api = useMemo(() => new Api(getAuthToken), [getAuthToken]);
|
22
22
|
useEffect(() => {
|
23
|
-
// implement remount for the store if component is retriggered
|
23
|
+
// implement remount for the store if component is retriggered.
|
24
24
|
if (loadedRef.current) {
|
25
25
|
return;
|
26
26
|
}
|
package/dist/es/EditorApp.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EditorApp.js","sourceRoot":"","sources":["../../src/EditorApp.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACnE,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,uBAAuB,MAAM,+CAA+C,CAAA;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AAEnF,OAAO,EACL,WAAW,EACX,WAAW,EAEX,oBAAoB,GAErB,MAAM,SAAS,CAAA;AAYhB,MAAM,kBAAkB,GAAG,MAAM,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AAK,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;QAC7C,QAAQ,CAAC,KAAK,CAAC,OAAO,GAAG;YACvB,GAAG,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE;YAC5B,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAc,CAAC;SACnD,CAAA;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAA;IAErB,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,oBAAC,UAAU,CAAC,QAAQ,IAAC,KAAK,EAAE,GAAG;QAC7B,oBAAC,oBAAoB,IAAC,KAAK,EAAE,KAAK;YAChC,oBAAC,IAAI;gBACH,oBAAC,uBAAuB,OAAG,CACtB,CACc,CACH,CACvB,CAAC,CAAC,CAAC,CACF,oBAAC,kBAAkB;QACjB,oBAAC,qBAAqB,OAAG,CACN,CACtB,CAAA;AACH,CAAC,CAAA;AAED,eAAe,SAAS,CAAA"}
|
@@ -1,25 +1,28 @@
|
|
1
1
|
import { AttentionOrangeIcon, Category, Dialog, DotsIcon, DropdownContainer, DropdownList, useDropdown, usePermissions, } from '@manuscripts/style-guide';
|
2
|
-
import React, { useRef, useState } from 'react';
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
3
3
|
import styled from 'styled-components';
|
4
4
|
/**
|
5
5
|
* This component represents the drop-down list action for each file item.
|
6
6
|
*/
|
7
|
-
export const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onUseAsMain, move, className, file, accept, }) => {
|
7
|
+
export const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onDelete, onUseAsMain, move, className, file, accept, }) => {
|
8
8
|
const can = usePermissions();
|
9
9
|
const { isOpen, toggleOpen, wrapperRef } = useDropdown();
|
10
10
|
const [isMoveDialogOpen, setMoveDialogOpen] = useState(false);
|
11
11
|
const [isUseAsMainDialogOpen, setUseAsMainDialogOpen] = useState(false);
|
12
|
+
const fileInputRef = useRef(null);
|
12
13
|
const showDownload = can?.downloadFiles && onDownload;
|
13
14
|
const showReplace = can?.replaceFile && onReplace;
|
14
15
|
const showDetach = can?.detachFile && onDetach;
|
16
|
+
const showDelete = can?.detachFile && onDelete;
|
15
17
|
const showMove = can?.moveFile && move;
|
16
18
|
const showUseAsMain = can?.moveFile && onUseAsMain && isValidMainDocumentFormat(file);
|
17
19
|
const show = showDownload || showReplace || showDetach || showMove || showUseAsMain;
|
18
|
-
const fileInputRef = useRef(null);
|
19
20
|
const handleChange = async (event) => {
|
20
|
-
if (onReplace && event
|
21
|
-
|
22
|
-
|
21
|
+
if (onReplace && event?.target?.files?.[0]) {
|
22
|
+
await onReplace(event.target.files[0]);
|
23
|
+
if (fileInputRef.current) {
|
24
|
+
fileInputRef.current.value = '';
|
25
|
+
}
|
23
26
|
}
|
24
27
|
};
|
25
28
|
const openFileDialog = () => {
|
@@ -27,23 +30,40 @@ export const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onUs
|
|
27
30
|
fileInputRef.current.click();
|
28
31
|
}
|
29
32
|
};
|
33
|
+
// Fix: Close dropdown when clicking outside or pressing escape
|
34
|
+
useEffect(() => {
|
35
|
+
const handleClickOutside = (event) => {
|
36
|
+
if (wrapperRef.current &&
|
37
|
+
!wrapperRef.current.contains(event.target)) {
|
38
|
+
toggleOpen();
|
39
|
+
}
|
40
|
+
};
|
41
|
+
if (isOpen) {
|
42
|
+
document.addEventListener('mousedown', handleClickOutside);
|
43
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
44
|
+
}
|
45
|
+
}, [isOpen, wrapperRef, toggleOpen]);
|
30
46
|
if (!show) {
|
31
47
|
return null;
|
32
48
|
}
|
33
49
|
return (React.createElement(DropdownContainer, { ref: wrapperRef },
|
34
|
-
React.createElement(ActionsIcon, { onClick:
|
50
|
+
React.createElement(ActionsIcon, { onClick: (e) => {
|
51
|
+
e.stopPropagation();
|
52
|
+
toggleOpen();
|
53
|
+
}, type: "button", className: "show-on-hover", "data-cy": "file-actions", "aria-label": "Actions", "aria-pressed": isOpen },
|
35
54
|
React.createElement(DotsIcon, null)),
|
36
|
-
isOpen && (React.createElement(FileActionDropdownList, { "data-cy": "file-actions-dropdown", direction: "right", className: className, width: 192, top: 5, onClick:
|
55
|
+
isOpen && (React.createElement(FileActionDropdownList, { "data-cy": "file-actions-dropdown", direction: "right", className: className, width: 192, top: 5, onClick: (e) => e.stopPropagation() },
|
37
56
|
showDownload && (React.createElement(FileAction, { onClick: onDownload }, "Download")),
|
38
57
|
showReplace && (React.createElement(React.Fragment, null,
|
39
58
|
React.createElement(FileAction, { onClick: openFileDialog }, "Replace"),
|
40
59
|
React.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange, accept: accept }))),
|
41
60
|
showDetach && React.createElement(FileAction, { onClick: onDetach }, "Detach"),
|
61
|
+
showDelete && React.createElement(FileAction, { onClick: onDelete }, "Delete"),
|
42
62
|
showMove && (React.createElement(FileAction, { onClick: () => setMoveDialogOpen(true) },
|
43
63
|
"Move to ",
|
44
64
|
move.sectionType)),
|
45
65
|
showUseAsMain && (React.createElement(FileAction, { onClick: () => setUseAsMainDialogOpen(true) }, "Use as main document")))),
|
46
|
-
showMove && (React.createElement(MoveFileConfirmationDialog, {
|
66
|
+
showMove && (React.createElement(MoveFileConfirmationDialog, { isOpen: isMoveDialogOpen, close: () => setMoveDialogOpen(false), source: sectionType, target: move.sectionType, handleMove: move.handler })),
|
47
67
|
showUseAsMain && (React.createElement(UseAsMainConfirmationDialog, { "data-cy": "file-use-as-main-confirm-dialog", isOpen: isUseAsMainDialogOpen, close: () => setUseAsMainDialogOpen(false), handleUseAsMain: onUseAsMain }))));
|
48
68
|
};
|
49
69
|
const UseAsMainConfirmationDialog = ({ isOpen, close, handleUseAsMain }) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FileActions.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileActions.tsx"],"names":[],"mappings":"AAYA,OAAO,EACL,mBAAmB,EACnB,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;
|
1
|
+
{"version":3,"file":"FileActions.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileActions.tsx"],"names":[],"mappings":"AAYA,OAAO,EACL,mBAAmB,EACnB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,cAAc,GACf,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,EAAe,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvE,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAItC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAWnB,CAAC,EACJ,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,MAAM,GACP,EAAE,EAAE;IACH,MAAM,GAAG,GAAG,cAAc,EAAE,CAAA;IAC5B,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,WAAW,EAAE,CAAA;IACxD,MAAM,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAA;IACtE,MAAM,CAAC,qBAAqB,EAAE,sBAAsB,CAAC,GACnD,QAAQ,CAAU,KAAK,CAAC,CAAA;IAC1B,MAAM,YAAY,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAA;IAEnD,MAAM,YAAY,GAAG,GAAG,EAAE,aAAa,IAAI,UAAU,CAAA;IACrD,MAAM,WAAW,GAA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BACnB,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"}
|
@@ -0,0 +1,107 @@
|
|
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) 2025 Atypon Systems LLC. All Rights Reserved.
|
11
|
+
*/
|
12
|
+
import styled from 'styled-components';
|
13
|
+
export const FileGroupContainer = styled.div `
|
14
|
+
margin: 20px 0px 20px 15px;
|
15
|
+
`;
|
16
|
+
export const FileGroupItemContainer = styled.div `
|
17
|
+
display: flex;
|
18
|
+
align-items: center;
|
19
|
+
cursor: pointer;
|
20
|
+
padding: 12px 18px;
|
21
|
+
|
22
|
+
.react-tooltip {
|
23
|
+
max-width: 100% !important;
|
24
|
+
}
|
25
|
+
|
26
|
+
svg {
|
27
|
+
width: 16px;
|
28
|
+
|
29
|
+
path {
|
30
|
+
fill: #6e6e6e;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
&.dragging {
|
35
|
+
opacity: 0.2;
|
36
|
+
}
|
37
|
+
|
38
|
+
.show-on-hover {
|
39
|
+
visibility: hidden;
|
40
|
+
}
|
41
|
+
|
42
|
+
&:hover .show-on-hover {
|
43
|
+
visibility: visible;
|
44
|
+
}
|
45
|
+
|
46
|
+
&:hover,
|
47
|
+
&:focus {
|
48
|
+
background: #f2fbfc;
|
49
|
+
}
|
50
|
+
`;
|
51
|
+
export const FileGroup = styled.div `
|
52
|
+
display: block;
|
53
|
+
`;
|
54
|
+
export const FileLabel = styled.div `
|
55
|
+
color: ${(props) => props.theme.colors.text.primary};
|
56
|
+
font-weight: bold;
|
57
|
+
font-size: 16px;
|
58
|
+
line-height: 20px;
|
59
|
+
white-space: nowrap;
|
60
|
+
align-content: center;
|
61
|
+
`;
|
62
|
+
export const FileGroupHeader = styled.div `
|
63
|
+
display: flex;
|
64
|
+
align-items: center;
|
65
|
+
cursor: pointer;
|
66
|
+
padding-right: 20px;
|
67
|
+
margin-bottom: 20px;
|
68
|
+
|
69
|
+
.file-icon {
|
70
|
+
margin-right: ${(props) => props.theme.grid.unit * 2}px; /* Adjust as needed */
|
71
|
+
}
|
72
|
+
|
73
|
+
${FileLabel} {
|
74
|
+
flex: 1;
|
75
|
+
}
|
76
|
+
`;
|
77
|
+
export const ToggleIcon = styled.div `
|
78
|
+
width: 20px;
|
79
|
+
height: 20px;
|
80
|
+
border-radius: 50%;
|
81
|
+
border: 1px solid #e2e2e2;
|
82
|
+
text-align: center;
|
83
|
+
cursor: pointer;
|
84
|
+
|
85
|
+
svg {
|
86
|
+
width: 19px;
|
87
|
+
height: 19px;
|
88
|
+
transition: transform 0.2s ease; // Smooth transition for rotation
|
89
|
+
}
|
90
|
+
|
91
|
+
// Style for TriangleCollapsedIcon (when collapsed)
|
92
|
+
${(props) => !props.isOpen &&
|
93
|
+
`
|
94
|
+
svg {
|
95
|
+
transform: rotate(270deg); // Point downward when collapsed
|
96
|
+
}
|
97
|
+
`}
|
98
|
+
|
99
|
+
// Style for TriangleExpandedIcon (when expanded)
|
100
|
+
${(props) => props.isOpen &&
|
101
|
+
`
|
102
|
+
svg {
|
103
|
+
transform: rotate(0deg); // Point upward when expanded
|
104
|
+
}
|
105
|
+
`}
|
106
|
+
`;
|
107
|
+
//# sourceMappingURL=FileGroup.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"FileGroup.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileGroup.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAE3C,CAAA;AACD,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC/C,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;CAElC,CAAA;AACD,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;WACxB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;;;;;;CAMpD,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;oBAQrB,CAAC,KAAK,EAAE,EAAE,CACxB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;;;IAG3B,SAAS;;;CAGZ,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAqB;;;;;;;;;;;;;;;IAerD,CAAC,KAAK,EAAE,EAAE,CACV,CAAC,KAAK,CAAC,MAAM;IACb;;;;GAID;;;IAGC,CAAC,KAAK,EAAE,EAAE,CACV,KAAK,CAAC,MAAM;IACZ;;;;GAID;CACF,CAAA"}
|
@@ -1,33 +1,32 @@
|
|
1
|
-
import { FileFigureIcon, FileGraphicalAbstractIcon, FileImageIcon, } from '@manuscripts/style-guide';
|
1
|
+
import { FileFigureIcon, FileGraphicalAbstractIcon, FileImageIcon, Tooltip, TriangleCollapsedIcon, TriangleExpandedIcon, } from '@manuscripts/style-guide';
|
2
2
|
import { schema } from '@manuscripts/transform';
|
3
3
|
import { NodeSelection } from 'prosemirror-state';
|
4
4
|
import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
|
5
|
-
import React, { useMemo } from 'react';
|
5
|
+
import React, { useMemo, useState } from 'react';
|
6
|
+
import { trimFilename } from '../../lib/files';
|
6
7
|
import { useStore } from '../../store';
|
7
8
|
import { FileActions } from './FileActions';
|
8
|
-
import { FileContainer } from './FileContainer';
|
9
9
|
import { FileCreatedDate } from './FileCreatedDate';
|
10
|
+
import { FileGroup, FileGroupContainer, FileGroupHeader, FileGroupItemContainer, FileLabel, ToggleIcon, } from './FileGroup';
|
10
11
|
import { FileSectionType } from './FileManager';
|
11
|
-
import {
|
12
|
+
import { FileNameText } from './FileName';
|
13
|
+
import { FileTypeIcon } from './FileTypeIcon';
|
12
14
|
export const InlineFilesSection = ({ elements, }) => {
|
13
15
|
const [{ view, fileManagement, sectionCategories }] = useStore((s) => ({
|
14
16
|
view: s.view,
|
15
17
|
fileManagement: s.fileManagement,
|
16
18
|
sectionCategories: s.sectionCategories,
|
17
19
|
}));
|
18
|
-
const
|
20
|
+
const groupedMetadata = useMemo(() => {
|
19
21
|
if (!view) {
|
20
22
|
return [];
|
21
23
|
}
|
22
24
|
let figureIndex = 1;
|
23
25
|
let imageIndex = 1;
|
24
26
|
return elements.map((element) => {
|
25
|
-
const figure = element.files[0];
|
26
|
-
const file = figure?.file || { id: '', name: '' };
|
27
27
|
const $pos = view.state.doc.resolve(element.pos);
|
28
28
|
const section = findParentNodeOfTypeClosestToPos($pos, schema.nodes.graphical_abstract_section);
|
29
|
-
let label;
|
30
|
-
let icon;
|
29
|
+
let label, icon;
|
31
30
|
if (section) {
|
32
31
|
const category = section.node.attrs.category;
|
33
32
|
label = sectionCategories.get(category)?.titles[0] || '';
|
@@ -37,62 +36,113 @@ export const InlineFilesSection = ({ elements, }) => {
|
|
37
36
|
label = `Image ${imageIndex++}`;
|
38
37
|
icon = FileImageIcon;
|
39
38
|
}
|
40
|
-
else if (element.node.type === schema.nodes.hero_image) {
|
41
|
-
label = `Hero Image`;
|
42
|
-
icon = FileImageIcon;
|
43
|
-
}
|
44
39
|
else {
|
45
40
|
label = `Figure ${figureIndex++}`;
|
46
41
|
icon = FileFigureIcon;
|
47
42
|
}
|
48
43
|
return {
|
49
44
|
element,
|
50
|
-
node: figure?.node,
|
51
|
-
pos: figure?.pos,
|
52
|
-
file,
|
53
45
|
label,
|
54
46
|
icon,
|
47
|
+
files: element.files.filter((f) => f.file.id),
|
55
48
|
};
|
56
49
|
});
|
57
50
|
}, [elements, view, sectionCategories]);
|
51
|
+
const [openGroupIndexes, setOpenGroupIndexes] = useState(new Set(groupedMetadata.map((_, index) => index)));
|
52
|
+
const toggleGroupOpen = (groupIndex) => {
|
53
|
+
setOpenGroupIndexes((prevOpenIndexes) => {
|
54
|
+
const newOpenIndexes = new Set(prevOpenIndexes);
|
55
|
+
if (newOpenIndexes.has(groupIndex)) {
|
56
|
+
newOpenIndexes.delete(groupIndex);
|
57
|
+
}
|
58
|
+
else {
|
59
|
+
newOpenIndexes.add(groupIndex);
|
60
|
+
}
|
61
|
+
return newOpenIndexes;
|
62
|
+
});
|
63
|
+
};
|
58
64
|
if (!view) {
|
59
65
|
return null;
|
60
66
|
}
|
61
|
-
const handleClick = (
|
67
|
+
const handleClick = (element) => {
|
68
|
+
const tr = view.state.tr;
|
69
|
+
tr.setSelection(NodeSelection.create(view.state.doc, element.pos));
|
70
|
+
tr.scrollIntoView();
|
71
|
+
view.focus();
|
72
|
+
view.dispatch(tr);
|
73
|
+
};
|
74
|
+
const handleFileClick = (pos) => {
|
75
|
+
if (!pos) {
|
76
|
+
return;
|
77
|
+
}
|
62
78
|
const tr = view.state.tr;
|
63
|
-
tr.setSelection(NodeSelection.create(view.state.doc,
|
79
|
+
tr.setSelection(NodeSelection.create(view.state.doc, pos));
|
64
80
|
tr.scrollIntoView();
|
65
81
|
view.focus();
|
66
82
|
view.dispatch(tr);
|
67
83
|
};
|
68
|
-
const handleDetach = (
|
69
|
-
if (!
|
84
|
+
const handleDetach = (pos) => {
|
85
|
+
if (!pos) {
|
70
86
|
return;
|
71
87
|
}
|
72
88
|
const tr = view.state.tr;
|
73
|
-
tr.setNodeAttribute(
|
74
|
-
tr.setSelection(NodeSelection.create(tr.doc,
|
89
|
+
tr.setNodeAttribute(pos, 'src', '');
|
90
|
+
tr.setSelection(NodeSelection.create(tr.doc, pos));
|
75
91
|
tr.scrollIntoView();
|
76
92
|
view.focus();
|
77
93
|
view.dispatch(tr);
|
78
94
|
};
|
79
|
-
const
|
80
|
-
if (!
|
95
|
+
const handleDelete = (pos) => {
|
96
|
+
if (!pos || !view) {
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
const node = view.state.doc.nodeAt(pos);
|
100
|
+
if (node?.type === schema.nodes.figure) {
|
101
|
+
const tr = view.state.tr;
|
102
|
+
tr.delete(pos, pos + node.nodeSize);
|
103
|
+
view.dispatch(tr);
|
104
|
+
}
|
105
|
+
};
|
106
|
+
const handleReplace = async (pos, file) => {
|
107
|
+
if (!pos || !file) {
|
81
108
|
return;
|
82
109
|
}
|
83
110
|
const uploaded = await fileManagement.upload(file);
|
84
111
|
const tr = view.state.tr;
|
85
|
-
tr.setNodeAttribute(
|
86
|
-
tr.setSelection(NodeSelection.create(tr.doc,
|
112
|
+
tr.setNodeAttribute(pos, 'src', uploaded.id);
|
113
|
+
tr.setSelection(NodeSelection.create(tr.doc, pos));
|
87
114
|
tr.scrollIntoView();
|
88
115
|
view.focus();
|
89
116
|
view.dispatch(tr);
|
90
117
|
};
|
91
|
-
return (React.createElement(React.Fragment, null,
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
React.createElement(
|
118
|
+
return (React.createElement(React.Fragment, null, groupedMetadata.map((group, groupIndex) => {
|
119
|
+
const isOpen = openGroupIndexes.has(groupIndex);
|
120
|
+
const figureCount = group.files.length;
|
121
|
+
return (React.createElement(FileGroupContainer, { "data-cy": "file-container", key: groupIndex, onClick: () => handleClick(group.element) },
|
122
|
+
React.createElement(FileGroupHeader, null,
|
123
|
+
React.createElement(group.icon, { className: "file-icon" }),
|
124
|
+
group.label && React.createElement(FileLabel, null,
|
125
|
+
group.label,
|
126
|
+
":"),
|
127
|
+
group.files.length > 0 && (React.createElement(ToggleIcon, { isOpen: isOpen, onClick: (e) => {
|
128
|
+
e.stopPropagation();
|
129
|
+
toggleGroupOpen(groupIndex);
|
130
|
+
} }, isOpen ? (React.createElement(TriangleExpandedIcon, null)) : (React.createElement(TriangleCollapsedIcon, null))))),
|
131
|
+
isOpen && group.files.length > 0 && (React.createElement(FileGroup, null, group.files.map((fileAttachment, fileIndex) => (React.createElement(FileGroupItemContainer, { key: fileIndex, "data-tooltip-id": `${fileAttachment.file?.id}-file-name-tooltip`, onClick: (e) => {
|
132
|
+
e.stopPropagation();
|
133
|
+
handleFileClick(fileAttachment.pos);
|
134
|
+
} },
|
135
|
+
fileAttachment.file && (React.createElement(FileTypeIcon, { file: fileAttachment.file })),
|
136
|
+
React.createElement(FileNameText, { "data-cy": "filename" },
|
137
|
+
fileAttachment.file?.name
|
138
|
+
? trimFilename(fileAttachment.file.name, 25)
|
139
|
+
: 'Unknown file',
|
140
|
+
fileAttachment.file?.name && (React.createElement(Tooltip, { id: `${fileAttachment.file?.id}-file-name-tooltip`, place: "bottom" }, fileAttachment.file?.name || 'Figure'))),
|
141
|
+
fileAttachment.file && (React.createElement(FileCreatedDate, { file: fileAttachment.file, className: "show-on-hover" })),
|
142
|
+
React.createElement(FileActions, { sectionType: FileSectionType.Inline, onReplace: async (f) => await handleReplace(fileAttachment.pos, f), onDetach: () => handleDetach(fileAttachment.pos), onDownload: () => fileAttachment.file &&
|
143
|
+
fileManagement.download(fileAttachment.file), onDelete: figureCount > 1
|
144
|
+
? () => handleDelete(fileAttachment.pos)
|
145
|
+
: undefined }))))))));
|
96
146
|
})));
|
97
147
|
};
|
98
148
|
//# sourceMappingURL=InlineFilesSection.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"InlineFilesSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/InlineFilesSection.tsx"],"names":[],"mappings":"AAYA,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,aAAa,
|
1
|
+
{"version":3,"file":"InlineFilesSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/InlineFilesSection.tsx"],"names":[],"mappings":"AAYA,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,aAAa,EACb,OAAO,EACP,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAA;AACpE,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,QAAQ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,CACJ,CAAA;AACH,CAAC,CAAA"}
|
@@ -23,7 +23,7 @@ import { FileName } from './FileName';
|
|
23
23
|
import { FileSectionAlert, FileSectionAlertType } from './FileSectionAlert';
|
24
24
|
import { FileUploader } from './FileUploader';
|
25
25
|
/**
|
26
|
-
*
|
26
|
+
* This component represents the other files in the file section.
|
27
27
|
*/
|
28
28
|
export const OtherFilesSection = ({ files }) => {
|
29
29
|
const [{ view, fileManagement }] = useStore((s) => ({
|
@@ -24,7 +24,7 @@ import { FileName } from './FileName';
|
|
24
24
|
import { FileSectionAlert, FileSectionAlertType } from './FileSectionAlert';
|
25
25
|
import { FileUploader } from './FileUploader';
|
26
26
|
/**
|
27
|
-
*
|
27
|
+
* This component represents the other files in the file section.
|
28
28
|
*/
|
29
29
|
export const SupplementsSection = ({ supplements, }) => {
|
30
30
|
const [{ view, fileManagement }] = useStore((s) => ({
|
@@ -0,0 +1,19 @@
|
|
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) 2025 Atypon Systems LLC. All Rights Reserved.
|
11
|
+
*/
|
12
|
+
export declare const FileGroupContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
13
|
+
export declare const FileGroupItemContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
14
|
+
export declare const FileGroup: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
15
|
+
export declare const FileLabel: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
16
|
+
export declare const FileGroupHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
17
|
+
export declare const ToggleIcon: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
18
|
+
isOpen: boolean;
|
19
|
+
}, never>;
|
@@ -12,7 +12,7 @@
|
|
12
12
|
import { FileAttachment } from '@manuscripts/body-editor';
|
13
13
|
import React from 'react';
|
14
14
|
/**
|
15
|
-
*
|
15
|
+
* This component represents the other files in the file section.
|
16
16
|
*/
|
17
17
|
export declare const OtherFilesSection: React.FC<{
|
18
18
|
files: FileAttachment[];
|
@@ -15,6 +15,6 @@ export type SupplementsSectionProps = {
|
|
15
15
|
supplements: NodeFile[];
|
16
16
|
};
|
17
17
|
/**
|
18
|
-
*
|
18
|
+
* This component represents the other files in the file section.
|
19
19
|
*/
|
20
20
|
export declare const SupplementsSection: React.FC<SupplementsSectionProps>;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@manuscripts/article-editor",
|
3
|
-
"version": "4.2.
|
3
|
+
"version": "4.2.5",
|
4
4
|
"license": "CPAL-1.0",
|
5
5
|
"description": "React components for editing and viewing manuscripts",
|
6
6
|
"repository": "github:Atypon-OpenSource/manuscripts-article-editor",
|
@@ -31,7 +31,7 @@
|
|
31
31
|
"@fontsource/pt-sans": "5.2.5",
|
32
32
|
"@fontsource/pt-serif": "5.2.5",
|
33
33
|
"@headlessui/react": "2.2.3",
|
34
|
-
"@manuscripts/body-editor": "3.2.
|
34
|
+
"@manuscripts/body-editor": "3.2.4",
|
35
35
|
"@manuscripts/json-schema": "2.2.12",
|
36
36
|
"@manuscripts/style-guide": "3.1.0",
|
37
37
|
"@manuscripts/track-changes-plugin": "2.0.1",
|