@manuscripts/article-editor 4.0.4-LEAN-4591.2 → 4.0.4-LEAN-4608.3
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 +1 -3
- package/dist/cjs/components/FileManager/FileActions.js.map +1 -1
- package/dist/cjs/components/FileManager/InlineFilesSection.js +28 -78
- package/dist/cjs/components/FileManager/InlineFilesSection.js.map +1 -1
- package/dist/es/components/FileManager/FileActions.js +1 -3
- package/dist/es/components/FileManager/FileActions.js.map +1 -1
- package/dist/es/components/FileManager/InlineFilesSection.js +31 -81
- package/dist/es/components/FileManager/InlineFilesSection.js.map +1 -1
- package/dist/types/components/FileManager/FileActions.d.ts +0 -1
- package/package.json +3 -3
- package/dist/cjs/components/FileManager/FileGroup.js +0 -108
- package/dist/cjs/components/FileManager/FileGroup.js.map +0 -1
- package/dist/es/components/FileManager/FileGroup.js +0 -102
- package/dist/es/components/FileManager/FileGroup.js.map +0 -1
- package/dist/types/components/FileManager/FileGroup.d.ts +0 -19
@@ -33,7 +33,7 @@ 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,
|
36
|
+
const FileActions = ({ sectionType, onDownload, onReplace, onDetach, 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);
|
@@ -41,7 +41,6 @@ const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onDelete, o
|
|
41
41
|
const showDownload = can?.downloadFiles && onDownload;
|
42
42
|
const showReplace = can?.replaceFile && onReplace;
|
43
43
|
const showDetach = can?.detachFile && onDetach;
|
44
|
-
const showDelete = can?.detachFile && onDelete;
|
45
44
|
const showMove = can?.moveFile && move;
|
46
45
|
const showUseAsMain = can?.moveFile && onUseAsMain && isValidMainDocumentFormat(file);
|
47
46
|
const show = showDownload || showReplace || showDetach || showMove || showUseAsMain;
|
@@ -69,7 +68,6 @@ const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onDelete, o
|
|
69
68
|
react_1.default.createElement(exports.FileAction, { onClick: openFileDialog }, "Replace"),
|
70
69
|
react_1.default.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange, accept: accept }))),
|
71
70
|
showDetach && react_1.default.createElement(exports.FileAction, { onClick: onDetach }, "Detach"),
|
72
|
-
showDelete && react_1.default.createElement(exports.FileAction, { onClick: onDelete }, "Delete"),
|
73
71
|
showMove && (react_1.default.createElement(exports.FileAction, { onClick: () => setMoveDialogOpen(true) },
|
74
72
|
"Move to ",
|
75
73
|
move.sectionType)),
|
@@ -1 +1 @@
|
|
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,
|
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,yBA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,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"}
|
@@ -29,30 +29,31 @@ 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");
|
33
32
|
const store_1 = require("../../store");
|
34
33
|
const FileActions_1 = require("./FileActions");
|
34
|
+
const FileContainer_1 = require("./FileContainer");
|
35
35
|
const FileCreatedDate_1 = require("./FileCreatedDate");
|
36
|
-
const FileGroup_1 = require("./FileGroup");
|
37
36
|
const FileManager_1 = require("./FileManager");
|
38
37
|
const FileName_1 = require("./FileName");
|
39
|
-
const FileTypeIcon_1 = require("./FileTypeIcon");
|
40
38
|
const InlineFilesSection = ({ elements, }) => {
|
41
39
|
const [{ view, fileManagement, sectionCategories }] = (0, store_1.useStore)((s) => ({
|
42
40
|
view: s.view,
|
43
41
|
fileManagement: s.fileManagement,
|
44
42
|
sectionCategories: s.sectionCategories,
|
45
43
|
}));
|
46
|
-
const
|
44
|
+
const metadata = (0, react_1.useMemo)(() => {
|
47
45
|
if (!view) {
|
48
46
|
return [];
|
49
47
|
}
|
50
48
|
let figureIndex = 1;
|
51
49
|
let imageIndex = 1;
|
52
50
|
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
|
55
|
+
let label;
|
56
|
+
let icon;
|
56
57
|
if (section) {
|
57
58
|
const category = section.node.attrs.category;
|
58
59
|
label = sectionCategories.get(category)?.titles[0] || '';
|
@@ -62,113 +63,62 @@ const InlineFilesSection = ({ elements, }) => {
|
|
62
63
|
label = `Image ${imageIndex++}`;
|
63
64
|
icon = style_guide_1.FileImageIcon;
|
64
65
|
}
|
66
|
+
else if (element.node.type === transform_1.schema.nodes.hero_image) {
|
67
|
+
label = `Hero Image`;
|
68
|
+
icon = style_guide_1.FileImageIcon;
|
69
|
+
}
|
65
70
|
else {
|
66
71
|
label = `Figure ${figureIndex++}`;
|
67
72
|
icon = style_guide_1.FileFigureIcon;
|
68
73
|
}
|
69
74
|
return {
|
70
75
|
element,
|
76
|
+
node: figure?.node,
|
77
|
+
pos: figure?.pos,
|
78
|
+
file,
|
71
79
|
label,
|
72
80
|
icon,
|
73
|
-
files: element.files.filter((f) => f.file.id),
|
74
81
|
};
|
75
82
|
});
|
76
83
|
}, [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
|
-
};
|
90
84
|
if (!view) {
|
91
85
|
return null;
|
92
86
|
}
|
93
|
-
const handleClick = (
|
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
|
-
}
|
87
|
+
const handleClick = (metadata) => {
|
104
88
|
const tr = view.state.tr;
|
105
|
-
tr.setSelection(prosemirror_state_1.NodeSelection.create(view.state.doc, pos));
|
89
|
+
tr.setSelection(prosemirror_state_1.NodeSelection.create(view.state.doc, metadata.element.pos));
|
106
90
|
tr.scrollIntoView();
|
107
91
|
view.focus();
|
108
92
|
view.dispatch(tr);
|
109
93
|
};
|
110
|
-
const handleDetach = (
|
111
|
-
if (!pos) {
|
94
|
+
const handleDetach = (metadata) => {
|
95
|
+
if (!metadata.pos) {
|
112
96
|
return;
|
113
97
|
}
|
114
98
|
const tr = view.state.tr;
|
115
|
-
tr.setNodeAttribute(pos, 'src', '');
|
116
|
-
tr.setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, pos));
|
99
|
+
tr.setNodeAttribute(metadata.pos, 'src', '');
|
100
|
+
tr.setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, metadata.pos));
|
117
101
|
tr.scrollIntoView();
|
118
102
|
view.focus();
|
119
103
|
view.dispatch(tr);
|
120
104
|
};
|
121
|
-
const
|
122
|
-
if (!pos
|
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) {
|
105
|
+
const handleReplace = async (metadata, file) => {
|
106
|
+
if (!metadata.pos) {
|
134
107
|
return;
|
135
108
|
}
|
136
109
|
const uploaded = await fileManagement.upload(file);
|
137
110
|
const tr = view.state.tr;
|
138
|
-
tr.setNodeAttribute(pos, 'src', uploaded.id);
|
139
|
-
tr.setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, pos));
|
111
|
+
tr.setNodeAttribute(metadata.pos, 'src', uploaded.id);
|
112
|
+
tr.setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, metadata.pos));
|
140
113
|
tr.scrollIntoView();
|
141
114
|
view.focus();
|
142
115
|
view.dispatch(tr);
|
143
116
|
};
|
144
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
react_1.default.createElement(
|
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 // Skip displaying the delete option for the last remaining figure
|
170
|
-
? () => handleDelete(fileAttachment.pos)
|
171
|
-
: undefined }))))))));
|
117
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, metadata.map((e, index) => {
|
118
|
+
return (react_1.default.createElement(FileContainer_1.FileContainer, { "data-cy": "file-container", key: index, onClick: () => handleClick(e) },
|
119
|
+
react_1.default.createElement(FileName_1.FileName, { file: e.file, label: e.label, icon: e.icon }),
|
120
|
+
react_1.default.createElement(FileCreatedDate_1.FileCreatedDate, { file: e.file, className: "show-on-hover" }),
|
121
|
+
react_1.default.createElement(FileActions_1.FileActions, { "data-cy": "file-actions", sectionType: FileManager_1.FileSectionType.Inline, onReplace: async (f) => await handleReplace(e, f), onDetach: () => handleDetach(e), onDownload: () => fileManagement.download(e.file) })));
|
172
122
|
})));
|
173
123
|
};
|
174
124
|
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,0DAIiC;AACjC,sDAA+D;AAC/D,yDAAiD;AACjD,yDAAoE;AACpE,+CAAsC;AAEtC,uCAAsC;AACtC,+CAA2C;AAC3C,mDAA+C;AAC/C,uDAAmD;AACnD,+CAA+C;AAC/C,yCAAqC;AAe9B,MAAM,kBAAkB,GAAsC,CAAC,EACpE,QAAQ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,IAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,GAAI;YACxD,8BAAC,iCAAe,IAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,EAAC,eAAe,GAAG;YAC3D,8BAAC,yBAAW,eACF,cAAc,EACtB,WAAW,EAAE,6BAAe,CAAC,MAAM,EACnC,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EACjD,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,EAC/B,UAAU,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GACjD,CACY,CACjB,CAAA;IACH,CAAC,CAAC,CACD,CACJ,CAAA;AACH,CAAC,CAAA;AAhHY,QAAA,kBAAkB,sBAgH9B"}
|
@@ -4,7 +4,7 @@ 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,
|
7
|
+
export const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onUseAsMain, move, className, file, accept, }) => {
|
8
8
|
const can = usePermissions();
|
9
9
|
const { isOpen, toggleOpen, wrapperRef } = useDropdown();
|
10
10
|
const [isMoveDialogOpen, setMoveDialogOpen] = useState(false);
|
@@ -12,7 +12,6 @@ export const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onDe
|
|
12
12
|
const showDownload = can?.downloadFiles && onDownload;
|
13
13
|
const showReplace = can?.replaceFile && onReplace;
|
14
14
|
const showDetach = can?.detachFile && onDetach;
|
15
|
-
const showDelete = can?.detachFile && onDelete;
|
16
15
|
const showMove = can?.moveFile && move;
|
17
16
|
const showUseAsMain = can?.moveFile && onUseAsMain && isValidMainDocumentFormat(file);
|
18
17
|
const show = showDownload || showReplace || showDetach || showMove || showUseAsMain;
|
@@ -40,7 +39,6 @@ export const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onDe
|
|
40
39
|
React.createElement(FileAction, { onClick: openFileDialog }, "Replace"),
|
41
40
|
React.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange, accept: accept }))),
|
42
41
|
showDetach && React.createElement(FileAction, { onClick: onDetach }, "Detach"),
|
43
|
-
showDelete && React.createElement(FileAction, { onClick: onDelete }, "Delete"),
|
44
42
|
showMove && (React.createElement(FileAction, { onClick: () => setMoveDialogOpen(true) },
|
45
43
|
"Move to ",
|
46
44
|
move.sectionType)),
|
@@ -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;AAC5D,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAItC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,
|
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;AAC5D,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAItC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAUnB,CAAC,EACJ,W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AAC,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"}
|
@@ -1,32 +1,33 @@
|
|
1
|
-
import { FileFigureIcon, FileGraphicalAbstractIcon, FileImageIcon,
|
1
|
+
import { FileFigureIcon, FileGraphicalAbstractIcon, FileImageIcon, } 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
|
6
|
-
import { trimFilename } from '../../lib/files';
|
5
|
+
import React, { useMemo } from 'react';
|
7
6
|
import { useStore } from '../../store';
|
8
7
|
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';
|
11
10
|
import { FileSectionType } from './FileManager';
|
12
|
-
import {
|
13
|
-
import { FileTypeIcon } from './FileTypeIcon';
|
11
|
+
import { FileName } from './FileName';
|
14
12
|
export const InlineFilesSection = ({ elements, }) => {
|
15
13
|
const [{ view, fileManagement, sectionCategories }] = useStore((s) => ({
|
16
14
|
view: s.view,
|
17
15
|
fileManagement: s.fileManagement,
|
18
16
|
sectionCategories: s.sectionCategories,
|
19
17
|
}));
|
20
|
-
const
|
18
|
+
const metadata = useMemo(() => {
|
21
19
|
if (!view) {
|
22
20
|
return [];
|
23
21
|
}
|
24
22
|
let figureIndex = 1;
|
25
23
|
let imageIndex = 1;
|
26
24
|
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
|
29
|
+
let label;
|
30
|
+
let icon;
|
30
31
|
if (section) {
|
31
32
|
const category = section.node.attrs.category;
|
32
33
|
label = sectionCategories.get(category)?.titles[0] || '';
|
@@ -36,113 +37,62 @@ export const InlineFilesSection = ({ elements, }) => {
|
|
36
37
|
label = `Image ${imageIndex++}`;
|
37
38
|
icon = FileImageIcon;
|
38
39
|
}
|
40
|
+
else if (element.node.type === schema.nodes.hero_image) {
|
41
|
+
label = `Hero Image`;
|
42
|
+
icon = FileImageIcon;
|
43
|
+
}
|
39
44
|
else {
|
40
45
|
label = `Figure ${figureIndex++}`;
|
41
46
|
icon = FileFigureIcon;
|
42
47
|
}
|
43
48
|
return {
|
44
49
|
element,
|
50
|
+
node: figure?.node,
|
51
|
+
pos: figure?.pos,
|
52
|
+
file,
|
45
53
|
label,
|
46
54
|
icon,
|
47
|
-
files: element.files.filter((f) => f.file.id),
|
48
55
|
};
|
49
56
|
});
|
50
57
|
}, [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
|
-
};
|
64
58
|
if (!view) {
|
65
59
|
return null;
|
66
60
|
}
|
67
|
-
const handleClick = (
|
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
|
-
}
|
61
|
+
const handleClick = (metadata) => {
|
78
62
|
const tr = view.state.tr;
|
79
|
-
tr.setSelection(NodeSelection.create(view.state.doc, pos));
|
63
|
+
tr.setSelection(NodeSelection.create(view.state.doc, metadata.element.pos));
|
80
64
|
tr.scrollIntoView();
|
81
65
|
view.focus();
|
82
66
|
view.dispatch(tr);
|
83
67
|
};
|
84
|
-
const handleDetach = (
|
85
|
-
if (!pos) {
|
68
|
+
const handleDetach = (metadata) => {
|
69
|
+
if (!metadata.pos) {
|
86
70
|
return;
|
87
71
|
}
|
88
72
|
const tr = view.state.tr;
|
89
|
-
tr.setNodeAttribute(pos, 'src', '');
|
90
|
-
tr.setSelection(NodeSelection.create(tr.doc, pos));
|
73
|
+
tr.setNodeAttribute(metadata.pos, 'src', '');
|
74
|
+
tr.setSelection(NodeSelection.create(tr.doc, metadata.pos));
|
91
75
|
tr.scrollIntoView();
|
92
76
|
view.focus();
|
93
77
|
view.dispatch(tr);
|
94
78
|
};
|
95
|
-
const
|
96
|
-
if (!pos
|
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) {
|
79
|
+
const handleReplace = async (metadata, file) => {
|
80
|
+
if (!metadata.pos) {
|
108
81
|
return;
|
109
82
|
}
|
110
83
|
const uploaded = await fileManagement.upload(file);
|
111
84
|
const tr = view.state.tr;
|
112
|
-
tr.setNodeAttribute(pos, 'src', uploaded.id);
|
113
|
-
tr.setSelection(NodeSelection.create(tr.doc, pos));
|
85
|
+
tr.setNodeAttribute(metadata.pos, 'src', uploaded.id);
|
86
|
+
tr.setSelection(NodeSelection.create(tr.doc, metadata.pos));
|
114
87
|
tr.scrollIntoView();
|
115
88
|
view.focus();
|
116
89
|
view.dispatch(tr);
|
117
90
|
};
|
118
|
-
return (React.createElement(React.Fragment, null,
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
React.createElement(
|
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 // Skip displaying the delete option for the last remaining figure
|
144
|
-
? () => handleDelete(fileAttachment.pos)
|
145
|
-
: undefined }))))))));
|
91
|
+
return (React.createElement(React.Fragment, null, metadata.map((e, index) => {
|
92
|
+
return (React.createElement(FileContainer, { "data-cy": "file-container", key: index, onClick: () => handleClick(e) },
|
93
|
+
React.createElement(FileName, { file: e.file, label: e.label, icon: e.icon }),
|
94
|
+
React.createElement(FileCreatedDate, { file: e.file, className: "show-on-hover" }),
|
95
|
+
React.createElement(FileActions, { "data-cy": "file-actions", sectionType: FileSectionType.Inline, onReplace: async (f) => await handleReplace(e, f), onDetach: () => handleDetach(e), onDownload: () => fileManagement.download(e.file) })));
|
146
96
|
})));
|
147
97
|
};
|
148
98
|
//# 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,GACd,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAkB,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAA;AACpE,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO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AK,EAAE,CAAA;QACZ,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IACnB,CAAC,CAAA;IAED,OAAO,CACL,0CACG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QACzB,OAAO,CACL,oBAAC,aAAa,eACJ,gBAAgB,EACxB,GAAG,EAAE,KAAK,EACV,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;YAE7B,oBAAC,QAAQ,IAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,GAAI;YACxD,oBAAC,eAAe,IAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,EAAC,eAAe,GAAG;YAC3D,oBAAC,WAAW,eACF,cAAc,EACtB,WAAW,EAAE,eAAe,CAAC,MAAM,EACnC,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EACjD,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,EAC/B,UAAU,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GACjD,CACY,CACjB,CAAA;IACH,CAAC,CAAC,CACD,CACJ,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@manuscripts/article-editor",
|
3
|
-
"version": "4.0.4-LEAN-
|
3
|
+
"version": "4.0.4-LEAN-4608.3",
|
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",
|
@@ -30,11 +30,11 @@
|
|
30
30
|
"@fontsource/pt-sans": "5.2.5",
|
31
31
|
"@fontsource/pt-serif": "5.2.5",
|
32
32
|
"@headlessui/react": "2.2.3",
|
33
|
-
"@manuscripts/body-editor": "3.0.3-LEAN-
|
33
|
+
"@manuscripts/body-editor": "3.0.3-LEAN-4608.3",
|
34
34
|
"@manuscripts/json-schema": "2.2.12",
|
35
35
|
"@manuscripts/style-guide": "3.0.1",
|
36
36
|
"@manuscripts/track-changes-plugin": "2.0.1",
|
37
|
-
"@manuscripts/transform": "4.0.
|
37
|
+
"@manuscripts/transform": "4.0.1-LEAN-4608.1",
|
38
38
|
"@popperjs/core": "2.11.8",
|
39
39
|
"date-fns": "4.1.0",
|
40
40
|
"dompurify": "3.2.5",
|
@@ -1,108 +0,0 @@
|
|
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: 24px 18px;
|
27
|
-
|
28
|
-
.react-tooltip {
|
29
|
-
max-width: 100% !important;
|
30
|
-
}
|
31
|
-
|
32
|
-
svg {
|
33
|
-
width: 16px;
|
34
|
-
}
|
35
|
-
|
36
|
-
&.dragging {
|
37
|
-
opacity: 0.2;
|
38
|
-
}
|
39
|
-
|
40
|
-
.show-on-hover {
|
41
|
-
visibility: hidden;
|
42
|
-
}
|
43
|
-
|
44
|
-
&:hover .show-on-hover {
|
45
|
-
visibility: visible;
|
46
|
-
}
|
47
|
-
|
48
|
-
&:hover,
|
49
|
-
&:focus {
|
50
|
-
background: #f2fbfc;
|
51
|
-
}
|
52
|
-
`;
|
53
|
-
exports.FileGroup = styled_components_1.default.div `
|
54
|
-
display: block;
|
55
|
-
`;
|
56
|
-
exports.FileLabel = styled_components_1.default.div `
|
57
|
-
color: ${(props) => props.theme.colors.text.primary};
|
58
|
-
font-weight: bold;
|
59
|
-
font-size: 16px;
|
60
|
-
line-height: 20px;
|
61
|
-
white-space: nowrap;
|
62
|
-
align-content: center;
|
63
|
-
`;
|
64
|
-
exports.FileGroupHeader = styled_components_1.default.div `
|
65
|
-
display: flex;
|
66
|
-
align-items: center;
|
67
|
-
cursor: pointer;
|
68
|
-
padding-right: 20px;
|
69
|
-
|
70
|
-
.file-icon {
|
71
|
-
margin-right: ${(props) => props.theme.grid.unit * 2}px; /* Adjust as needed */
|
72
|
-
}
|
73
|
-
|
74
|
-
${exports.FileLabel} {
|
75
|
-
flex: 1;
|
76
|
-
}
|
77
|
-
`;
|
78
|
-
exports.ToggleIcon = styled_components_1.default.div `
|
79
|
-
width: 20px;
|
80
|
-
height: 20px;
|
81
|
-
border-radius: 50%;
|
82
|
-
border: 1px solid #e2e2e2;
|
83
|
-
text-align: center;
|
84
|
-
cursor: pointer;
|
85
|
-
|
86
|
-
svg {
|
87
|
-
width: 19px;
|
88
|
-
height: 19px;
|
89
|
-
transition: transform 0.2s ease; // Smooth transition for rotation
|
90
|
-
}
|
91
|
-
|
92
|
-
// Style for TriangleCollapsedIcon (when collapsed)
|
93
|
-
${(props) => !props.isOpen &&
|
94
|
-
`
|
95
|
-
svg {
|
96
|
-
transform: rotate(270deg); // Point downward when collapsed
|
97
|
-
}
|
98
|
-
`}
|
99
|
-
|
100
|
-
// Style for TriangleExpandedIcon (when expanded)
|
101
|
-
${(props) => props.isOpen &&
|
102
|
-
`
|
103
|
-
svg {
|
104
|
-
transform: rotate(0deg); // Point upward when expanded
|
105
|
-
}
|
106
|
-
`}
|
107
|
-
`;
|
108
|
-
//# sourceMappingURL=FileGroup.js.map
|
@@ -1 +0,0 @@
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B/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;;;;;;;oBAOrB,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"}
|
@@ -1,102 +0,0 @@
|
|
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: 24px 18px;
|
21
|
-
|
22
|
-
.react-tooltip {
|
23
|
-
max-width: 100% !important;
|
24
|
-
}
|
25
|
-
|
26
|
-
svg {
|
27
|
-
width: 16px;
|
28
|
-
}
|
29
|
-
|
30
|
-
&.dragging {
|
31
|
-
opacity: 0.2;
|
32
|
-
}
|
33
|
-
|
34
|
-
.show-on-hover {
|
35
|
-
visibility: hidden;
|
36
|
-
}
|
37
|
-
|
38
|
-
&:hover .show-on-hover {
|
39
|
-
visibility: visible;
|
40
|
-
}
|
41
|
-
|
42
|
-
&:hover,
|
43
|
-
&:focus {
|
44
|
-
background: #f2fbfc;
|
45
|
-
}
|
46
|
-
`;
|
47
|
-
export const FileGroup = styled.div `
|
48
|
-
display: block;
|
49
|
-
`;
|
50
|
-
export const FileLabel = styled.div `
|
51
|
-
color: ${(props) => props.theme.colors.text.primary};
|
52
|
-
font-weight: bold;
|
53
|
-
font-size: 16px;
|
54
|
-
line-height: 20px;
|
55
|
-
white-space: nowrap;
|
56
|
-
align-content: center;
|
57
|
-
`;
|
58
|
-
export const FileGroupHeader = styled.div `
|
59
|
-
display: flex;
|
60
|
-
align-items: center;
|
61
|
-
cursor: pointer;
|
62
|
-
padding-right: 20px;
|
63
|
-
|
64
|
-
.file-icon {
|
65
|
-
margin-right: ${(props) => props.theme.grid.unit * 2}px; /* Adjust as needed */
|
66
|
-
}
|
67
|
-
|
68
|
-
${FileLabel} {
|
69
|
-
flex: 1;
|
70
|
-
}
|
71
|
-
`;
|
72
|
-
export const ToggleIcon = styled.div `
|
73
|
-
width: 20px;
|
74
|
-
height: 20px;
|
75
|
-
border-radius: 50%;
|
76
|
-
border: 1px solid #e2e2e2;
|
77
|
-
text-align: center;
|
78
|
-
cursor: pointer;
|
79
|
-
|
80
|
-
svg {
|
81
|
-
width: 19px;
|
82
|
-
height: 19px;
|
83
|
-
transition: transform 0.2s ease; // Smooth transition for rotation
|
84
|
-
}
|
85
|
-
|
86
|
-
// Style for TriangleCollapsedIcon (when collapsed)
|
87
|
-
${(props) => !props.isOpen &&
|
88
|
-
`
|
89
|
-
svg {
|
90
|
-
transform: rotate(270deg); // Point downward when collapsed
|
91
|
-
}
|
92
|
-
`}
|
93
|
-
|
94
|
-
// Style for TriangleExpandedIcon (when expanded)
|
95
|
-
${(props) => props.isOpen &&
|
96
|
-
`
|
97
|
-
svg {
|
98
|
-
transform: rotate(0deg); // Point upward when expanded
|
99
|
-
}
|
100
|
-
`}
|
101
|
-
`;
|
102
|
-
//# sourceMappingURL=FileGroup.js.map
|
@@ -1 +0,0 @@
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B/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;;;;;;;oBAOrB,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,19 +0,0 @@
|
|
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>;
|