@manuscripts/style-guide 0.30.23 → 0.30.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/FileManager/FileManager.js +1 -1
- package/dist/cjs/components/FileManager/InlineFilesSection.js +5 -2
- package/dist/es/components/FileManager/FileManager.js +1 -1
- package/dist/es/components/FileManager/InlineFilesSection.js +5 -2
- package/dist/types/components/FileManager/InlineFilesSection.d.ts +1 -0
- package/package.json +1 -1
|
@@ -148,7 +148,7 @@ const FileManager = ({ submissionId, externalFiles, modelMap, enableDragAndDrop,
|
|
|
148
148
|
react_1.default.createElement("div", null, "Files excluded from the final submission.")))),
|
|
149
149
|
react_1.default.createElement(Inspector_1.InspectorTabPanels, { style: { overflowY: 'visible', position: 'relative' } },
|
|
150
150
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
|
|
151
|
-
react_1.default.createElement(InlineFilesSection_1.InlineFilesSection, { modelMap: modelMap, submissionId: submissionId, handleReplace: handleReplace, handleDownload: handleDownload, dispatch: dispatch })),
|
|
151
|
+
react_1.default.createElement(InlineFilesSection_1.InlineFilesSection, { modelMap: modelMap, submissionId: submissionId, handleReplace: handleReplace, handleDownload: handleDownload, isEditor: enableDragAndDrop, dispatch: dispatch })),
|
|
152
152
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
|
|
153
153
|
react_1.default.createElement(FilesSection_1.FilesSection, { submissionId: submissionId, enableDragAndDrop: enableDragAndDrop, handleUpload: handleUploadFile, fileSection: util_1.FileSectionType.Supplements, filesItem: getFileSectionExternalFile(util_1.FileSectionType.Supplements), state: state, dispatch: dispatch })),
|
|
154
154
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
|
|
@@ -32,16 +32,19 @@ const FileInfo_1 = require("./FileSectionItem/FileInfo");
|
|
|
32
32
|
const FileSectionItem_1 = require("./FileSectionItem/FileSectionItem");
|
|
33
33
|
const ItemActions_1 = require("./FileSectionItem/ItemActions");
|
|
34
34
|
const util_1 = require("./util");
|
|
35
|
-
const InlineFilesSection = ({ submissionId, handleReplace, handleDownload, modelMap, dispatch }) => {
|
|
35
|
+
const InlineFilesSection = ({ submissionId, handleReplace, handleDownload, modelMap, isEditor, dispatch, }) => {
|
|
36
36
|
const inlineFiles = (0, react_1.useMemo)(() => (0, inlineFiles_1.default)(modelMap), [modelMap]);
|
|
37
37
|
const onElementClick = (0, react_1.useCallback)((e) => {
|
|
38
|
+
if (!isEditor) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
38
41
|
const { id } = e.currentTarget;
|
|
39
42
|
const isSelected = id == window.location.hash.substr(1);
|
|
40
43
|
window.location.hash = !isSelected ? `#${id}` : '#';
|
|
41
44
|
if (isSelected) {
|
|
42
45
|
window.location.hash = `#${id}`;
|
|
43
46
|
}
|
|
44
|
-
}, []);
|
|
47
|
+
}, [isEditor]);
|
|
45
48
|
return (react_1.default.createElement("div", null, inlineFiles.map((file, index) => {
|
|
46
49
|
var _a;
|
|
47
50
|
return (react_1.default.createElement(ElementItem, { className: 'item', key: index, id: file.id, onClick: onElementClick },
|
|
@@ -123,7 +123,7 @@ export const FileManager = ({ submissionId, externalFiles, modelMap, enableDragA
|
|
|
123
123
|
React.createElement("div", null, "Files excluded from the final submission.")))),
|
|
124
124
|
React.createElement(InspectorTabPanels, { style: { overflowY: 'visible', position: 'relative' } },
|
|
125
125
|
React.createElement(InspectorTabPanel, null,
|
|
126
|
-
React.createElement(InlineFilesSection, { modelMap: modelMap, submissionId: submissionId, handleReplace: handleReplace, handleDownload: handleDownload, dispatch: dispatch })),
|
|
126
|
+
React.createElement(InlineFilesSection, { modelMap: modelMap, submissionId: submissionId, handleReplace: handleReplace, handleDownload: handleDownload, isEditor: enableDragAndDrop, dispatch: dispatch })),
|
|
127
127
|
React.createElement(InspectorTabPanel, null,
|
|
128
128
|
React.createElement(FilesSection, { submissionId: submissionId, enableDragAndDrop: enableDragAndDrop, handleUpload: handleUploadFile, fileSection: FileSectionType.Supplements, filesItem: getFileSectionExternalFile(FileSectionType.Supplements), state: state, dispatch: dispatch })),
|
|
129
129
|
React.createElement(InspectorTabPanel, null,
|
|
@@ -7,16 +7,19 @@ import { FileDescription, FileInfoContainer, FileNameTitleContainer, FileTitle,
|
|
|
7
7
|
import { ActionsIcon, Item } from './FileSectionItem/FileSectionItem';
|
|
8
8
|
import { ItemActions } from './FileSectionItem/ItemActions';
|
|
9
9
|
import { extensionsWithFileTypesMap, fileTypesWithIconMap } from './util';
|
|
10
|
-
export const InlineFilesSection = ({ submissionId, handleReplace, handleDownload, modelMap, dispatch }) => {
|
|
10
|
+
export const InlineFilesSection = ({ submissionId, handleReplace, handleDownload, modelMap, isEditor, dispatch, }) => {
|
|
11
11
|
const inlineFiles = useMemo(() => getInlineFiles(modelMap), [modelMap]);
|
|
12
12
|
const onElementClick = useCallback((e) => {
|
|
13
|
+
if (!isEditor) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
13
16
|
const { id } = e.currentTarget;
|
|
14
17
|
const isSelected = id == window.location.hash.substr(1);
|
|
15
18
|
window.location.hash = !isSelected ? `#${id}` : '#';
|
|
16
19
|
if (isSelected) {
|
|
17
20
|
window.location.hash = `#${id}`;
|
|
18
21
|
}
|
|
19
|
-
}, []);
|
|
22
|
+
}, [isEditor]);
|
|
20
23
|
return (React.createElement("div", null, inlineFiles.map((file, index) => {
|
|
21
24
|
var _a;
|
|
22
25
|
return (React.createElement(ElementItem, { className: 'item', key: index, id: file.id, onClick: onElementClick },
|
|
@@ -11,5 +11,6 @@ export declare const InlineFilesSection: React.FC<{
|
|
|
11
11
|
modelMap: Map<string, Model>;
|
|
12
12
|
handleReplace: (submissionId: string, name: string, file: File, typeId: string) => Promise<boolean>;
|
|
13
13
|
handleDownload: (url: string) => void;
|
|
14
|
+
isEditor: boolean;
|
|
14
15
|
dispatch: Dispatch<Action>;
|
|
15
16
|
}>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/style-guide",
|
|
3
3
|
"description": "Shared components for Manuscripts applications",
|
|
4
|
-
"version": "0.30.
|
|
4
|
+
"version": "0.30.24",
|
|
5
5
|
"repository": "gitlab:atypon-opensource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|