@manuscripts/article-editor 1.16.18 → 1.16.19-LEAN-3771.0
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 +136 -0
- package/dist/cjs/components/FileManager/FileActions.js.map +1 -0
- package/dist/cjs/components/FileManager/FileContainer.js +51 -0
- package/dist/cjs/components/FileManager/FileContainer.js.map +1 -0
- package/dist/cjs/components/FileManager/FileCreatedDate.js +26 -0
- package/dist/cjs/components/FileManager/FileCreatedDate.js.map +1 -0
- package/dist/cjs/components/FileManager/FileManager.js +68 -0
- package/dist/cjs/components/FileManager/FileManager.js.map +1 -0
- package/dist/cjs/components/FileManager/FileManagerDragLayer.js +67 -0
- package/dist/cjs/components/FileManager/FileManagerDragLayer.js.map +1 -0
- package/dist/cjs/components/FileManager/FileName.js +28 -0
- package/dist/cjs/components/FileManager/FileName.js.map +1 -0
- package/dist/cjs/components/FileManager/FileSectionAlert.js +181 -0
- package/dist/cjs/components/FileManager/FileSectionAlert.js.map +1 -0
- package/dist/cjs/components/FileManager/FileTypeIcon.js +24 -0
- package/dist/cjs/components/FileManager/FileTypeIcon.js.map +1 -0
- package/dist/cjs/components/FileManager/FileUploader.js +100 -0
- package/dist/cjs/components/FileManager/FileUploader.js.map +1 -0
- package/dist/cjs/components/FileManager/InlineFilesSection.js +158 -0
- package/dist/cjs/components/FileManager/InlineFilesSection.js.map +1 -0
- package/dist/cjs/components/FileManager/OtherFilesSection.js +109 -0
- package/dist/cjs/components/FileManager/OtherFilesSection.js.map +1 -0
- package/dist/cjs/components/FileManager/SupplementsSection.js +131 -0
- package/dist/cjs/components/FileManager/SupplementsSection.js.map +1 -0
- package/dist/cjs/components/projects/EditorElement.js +9 -12
- package/dist/cjs/components/projects/EditorElement.js.map +1 -1
- package/dist/cjs/components/projects/Inspector.js +2 -3
- package/dist/cjs/components/projects/Inspector.js.map +1 -1
- package/dist/cjs/lib/attrs-change-filter.js.map +1 -1
- package/dist/cjs/postgres-data/PsSource.js +11 -0
- package/dist/cjs/postgres-data/PsSource.js.map +1 -1
- package/dist/cjs/store/Store.js.map +1 -1
- package/dist/es/components/FileManager/FileActions.js +106 -0
- package/dist/es/components/FileManager/FileActions.js.map +1 -0
- package/dist/es/components/FileManager/FileContainer.js +45 -0
- package/dist/es/components/FileManager/FileContainer.js.map +1 -0
- package/dist/es/components/FileManager/FileCreatedDate.js +19 -0
- package/dist/es/components/FileManager/FileCreatedDate.js.map +1 -0
- package/dist/es/components/FileManager/FileManager.js +61 -0
- package/dist/es/components/FileManager/FileManager.js.map +1 -0
- package/dist/es/components/FileManager/FileManagerDragLayer.js +60 -0
- package/dist/es/components/FileManager/FileManagerDragLayer.js.map +1 -0
- package/dist/es/components/FileManager/FileName.js +21 -0
- package/dist/es/components/FileManager/FileName.js.map +1 -0
- package/dist/es/components/FileManager/FileSectionAlert.js +174 -0
- package/dist/es/components/FileManager/FileSectionAlert.js.map +1 -0
- package/dist/es/components/FileManager/FileTypeIcon.js +17 -0
- package/dist/es/components/FileManager/FileTypeIcon.js.map +1 -0
- package/dist/es/components/FileManager/FileUploader.js +73 -0
- package/dist/es/components/FileManager/FileUploader.js.map +1 -0
- package/dist/es/components/FileManager/InlineFilesSection.js +128 -0
- package/dist/es/components/FileManager/InlineFilesSection.js.map +1 -0
- package/dist/es/components/FileManager/OtherFilesSection.js +82 -0
- package/dist/es/components/FileManager/OtherFilesSection.js.map +1 -0
- package/dist/es/components/FileManager/SupplementsSection.js +104 -0
- package/dist/es/components/FileManager/SupplementsSection.js.map +1 -0
- package/dist/es/components/projects/EditorElement.js +10 -13
- package/dist/es/components/projects/EditorElement.js.map +1 -1
- package/dist/es/components/projects/Inspector.js +3 -4
- package/dist/es/components/projects/Inspector.js.map +1 -1
- package/dist/es/lib/attrs-change-filter.js.map +1 -1
- package/dist/es/postgres-data/PsSource.js +11 -0
- package/dist/es/postgres-data/PsSource.js.map +1 -1
- package/dist/es/store/Store.js.map +1 -1
- package/dist/types/EditorApp.d.ts +1 -1
- package/dist/types/components/FileManager/FileActions.d.ts +21 -0
- package/dist/types/components/FileManager/FileContainer.d.ts +1 -0
- package/dist/types/components/FileManager/FileCreatedDate.d.ts +19 -0
- package/dist/types/components/FileManager/FileManager.d.ts +23 -0
- package/dist/types/components/FileManager/FileManagerDragLayer.d.ts +13 -0
- package/dist/types/components/FileManager/FileName.d.ts +17 -0
- package/dist/types/components/FileManager/FileSectionAlert.d.ts +13 -0
- package/dist/types/components/FileManager/FileTypeIcon.d.ts +20 -0
- package/dist/types/components/FileManager/FileUploader.d.ts +19 -0
- package/dist/types/components/FileManager/InlineFilesSection.d.ts +17 -0
- package/dist/types/components/FileManager/OtherFilesSection.d.ts +19 -0
- package/dist/types/components/FileManager/SupplementsSection.d.ts +20 -0
- package/dist/types/lib/attrs-change-filter.d.ts +1 -1
- package/dist/types/postgres-data/PsSource.d.ts +1 -1
- package/dist/types/store/DataSourceStrategy.d.ts +1 -1
- package/dist/types/store/Store.d.ts +1 -2
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSectionAlert.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileSectionAlert.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,GAChB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEzC,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,+DAAI,CAAA;IACJ,2FAAkB,CAAA;IAClB,yFAAiB,CAAA;IACjB,qFAAe,CAAA;AACjB,CAAC,EALW,oBAAoB,KAApB,oBAAoB,QAK/B;AAED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AAED,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAGvC,CAAA;AAED,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;;CAEhD,CAAA;AAED,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAGzC,CAAA;AAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;;CAE9C,CAAA;AAED,MAAM,qBAAqB,GAAa,GAAG,EAAE;IAC3C,OAAO,CACL,oBAAC,cAAc;QACb,oBAAC,GAAG,IAAC,SAAS,EAAC,MAAM,GAAO;QAC5B,oBAAC,GAAG,IAAC,SAAS,EAAC,MAAM,GAAO,CACb,CAClB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;gBACjB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ;;;;;;;;;CAShE,CAAA;AACD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4FrB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FileCorruptedIcon, FileMainDocumentIcon, FileUnknownIcon, getFileIcon, } from '@manuscripts/style-guide';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Each file item has an icon to represent besides the file info based on the file extension,
|
|
5
|
+
* in case the file type is an image or video then the icon should be the preview image or video thumbnail.
|
|
6
|
+
*/
|
|
7
|
+
export const FileTypeIcon = ({ file }) => {
|
|
8
|
+
if (file.type.id === 'missing') {
|
|
9
|
+
return React.createElement(FileCorruptedIcon, { className: "file-icon" });
|
|
10
|
+
}
|
|
11
|
+
if (file.type.id === 'main-manuscript') {
|
|
12
|
+
return React.createElement(FileMainDocumentIcon, { className: "file-icon" });
|
|
13
|
+
}
|
|
14
|
+
const icon = getFileIcon(file.name);
|
|
15
|
+
return icon || React.createElement(FileUnknownIcon, { className: "file-icon" });
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=FileTypeIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileTypeIcon.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileTypeIcon.tsx"],"names":[],"mappings":"AAYA,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,WAAW,GACZ,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAEpB,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAChB,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,SAAS,EAAE;QAC9B,OAAO,oBAAC,iBAAiB,IAAC,SAAS,EAAC,WAAW,GAAG,CAAA;KACnD;IACD,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,iBAAiB,EAAE;QACtC,OAAO,oBAAC,oBAAoB,IAAC,SAAS,EAAC,WAAW,GAAG,CAAA;KACtD;IAED,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAEnC,OAAO,IAAI,IAAI,oBAAC,eAAe,IAAC,SAAS,EAAC,WAAW,GAAG,CAAA;AAC1D,CAAC,CAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
|
3
|
+
*
|
|
4
|
+
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
|
5
|
+
*
|
|
6
|
+
* The Original Code is manuscripts-frontend.
|
|
7
|
+
*
|
|
8
|
+
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
9
|
+
*
|
|
10
|
+
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
+
*/
|
|
12
|
+
import React, { useRef } from 'react';
|
|
13
|
+
import { useDrop } from 'react-dnd';
|
|
14
|
+
import { NativeTypes } from 'react-dnd-html5-backend';
|
|
15
|
+
import styled, { css } from 'styled-components';
|
|
16
|
+
/**
|
|
17
|
+
* This component will show the drag or upload file area
|
|
18
|
+
*/
|
|
19
|
+
export const FileUploader = ({ onUpload }) => {
|
|
20
|
+
const fileInputRef = useRef(null);
|
|
21
|
+
const openFileDialog = () => {
|
|
22
|
+
if (fileInputRef && fileInputRef.current) {
|
|
23
|
+
fileInputRef.current.click();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const handleChange = (event) => {
|
|
27
|
+
if (event && event.target && event.target.files) {
|
|
28
|
+
const file = event.target.files[0];
|
|
29
|
+
onUpload(file);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const [{ canDrop, isOver }, dropRef] = useDrop({
|
|
33
|
+
accept: [NativeTypes.FILE],
|
|
34
|
+
drop: (item) => {
|
|
35
|
+
const file = item.files[0];
|
|
36
|
+
onUpload(file);
|
|
37
|
+
},
|
|
38
|
+
collect: (monitor) => ({
|
|
39
|
+
isOver: monitor.isOver(),
|
|
40
|
+
canDrop: monitor.canDrop(),
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
const isActive = canDrop && isOver;
|
|
44
|
+
return (React.createElement(Container, { ref: dropRef, "data-cy": "file-uploader", active: isActive, onClick: openFileDialog },
|
|
45
|
+
React.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange, value: '' }),
|
|
46
|
+
"Drag or click to upload a new file"));
|
|
47
|
+
};
|
|
48
|
+
const activeBoxStyle = css `
|
|
49
|
+
background: #f2fbfc;
|
|
50
|
+
border: 1px dashed #bce7f6;
|
|
51
|
+
`;
|
|
52
|
+
const Container = styled.div `
|
|
53
|
+
background: ${(props) => props.theme.colors.background.secondary};
|
|
54
|
+
border: 1px dashed #e2e2e2;
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
border-radius: 8px;
|
|
57
|
+
height: 80px;
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
font-size: 14px;
|
|
62
|
+
line-height: 24px;
|
|
63
|
+
font-family: ${(props) => props.theme.font.family.Lato};
|
|
64
|
+
color: ${(props) => props.theme.colors.text.onLight};
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
margin: 16px 16px 8px;
|
|
67
|
+
${(props) => props.active
|
|
68
|
+
? css `
|
|
69
|
+
${activeBoxStyle}
|
|
70
|
+
`
|
|
71
|
+
: css ``}
|
|
72
|
+
`;
|
|
73
|
+
//# sourceMappingURL=FileUploader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileUploader.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileUploader.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,EAAe,MAAM,EAAE,MAAM,OAAO,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAU/C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAgC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACxE,MAAM,YAAY,G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AAE,EAAE,GACT;6CAEQ,CACb,CAAA;AACH,CAAC,CAAA;AAED,MAAM,cAAc,GAAG,GAAG,CAAA;;;CAGzB,CAAA;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAqB;gBACjC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS;;;;;;;;;;iBAUjD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;WAC7C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;;;IAGjD,CAAC,KAAK,EAAE,EAAE,CACV,KAAK,CAAC,MAAM;IACV,CAAC,CAAC,GAAG,CAAA;YACC,cAAc;SACjB;IACH,CAAC,CAAC,GAAG,CAAA,EAAE;CACZ,CAAA"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
|
3
|
+
*
|
|
4
|
+
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
|
5
|
+
*
|
|
6
|
+
* The Original Code is manuscripts-frontend.
|
|
7
|
+
*
|
|
8
|
+
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
9
|
+
*
|
|
10
|
+
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
+
*/
|
|
12
|
+
import { findAbstractsNode, } from '@manuscripts/body-editor';
|
|
13
|
+
import { FileType, getFileTypeIcon } from '@manuscripts/style-guide';
|
|
14
|
+
import { schema } from '@manuscripts/transform';
|
|
15
|
+
import { NodeSelection } from 'prosemirror-state';
|
|
16
|
+
import { findChildrenByType } from 'prosemirror-utils';
|
|
17
|
+
import React, { useMemo } from 'react';
|
|
18
|
+
import styled from 'styled-components';
|
|
19
|
+
import { useStore } from '../../store';
|
|
20
|
+
import { FileActions } from './FileActions';
|
|
21
|
+
import { FileContainer } from './FileContainer';
|
|
22
|
+
import { FileCreatedDate } from './FileCreatedDate';
|
|
23
|
+
import { FileSectionType } from './FileManager';
|
|
24
|
+
import { FileName } from './FileName';
|
|
25
|
+
const findGraphicalAbstractFigureElement = (doc) => {
|
|
26
|
+
const abstracts = findAbstractsNode(doc);
|
|
27
|
+
return findChildrenByType(abstracts.node, schema.nodes.figure_element)[0];
|
|
28
|
+
};
|
|
29
|
+
export const InlineFilesSection = ({ elements, }) => {
|
|
30
|
+
const [{ view, fileManagement }] = useStore((s) => ({
|
|
31
|
+
view: s.view,
|
|
32
|
+
fileManagement: s.fileManagement,
|
|
33
|
+
}));
|
|
34
|
+
const ga = useMemo(() => findGraphicalAbstractFigureElement(view.state.doc), [view.state.doc]);
|
|
35
|
+
const handleClick = (element) => {
|
|
36
|
+
const tr = view.state.tr;
|
|
37
|
+
tr.setSelection(NodeSelection.create(view.state.doc, element.pos));
|
|
38
|
+
tr.scrollIntoView();
|
|
39
|
+
view.focus();
|
|
40
|
+
view.dispatch(tr);
|
|
41
|
+
};
|
|
42
|
+
const handleDetach = async (figure) => {
|
|
43
|
+
const tr = view.state.tr;
|
|
44
|
+
tr.setNodeAttribute(figure.pos, 'src', '');
|
|
45
|
+
tr.setSelection(NodeSelection.create(view.state.doc, figure.pos));
|
|
46
|
+
tr.scrollIntoView();
|
|
47
|
+
view.focus();
|
|
48
|
+
view.dispatch(tr);
|
|
49
|
+
};
|
|
50
|
+
const handleReplace = async (figure, file) => {
|
|
51
|
+
const uploaded = await fileManagement.upload(file);
|
|
52
|
+
const tr = view.state.tr;
|
|
53
|
+
tr.setNodeAttribute(figure.pos, 'src', uploaded.id);
|
|
54
|
+
tr.setSelection(NodeSelection.create(view.state.doc, figure.pos));
|
|
55
|
+
tr.scrollIntoView();
|
|
56
|
+
view.focus();
|
|
57
|
+
view.dispatch(tr);
|
|
58
|
+
};
|
|
59
|
+
const getElementFileType = (element) => {
|
|
60
|
+
if (element.node.attrs.id === ga?.node.attrs.id) {
|
|
61
|
+
return FileType.GraphicalAbstract;
|
|
62
|
+
}
|
|
63
|
+
return FileType.Figure;
|
|
64
|
+
};
|
|
65
|
+
const getElementFileLabel = (index) => {
|
|
66
|
+
if (index === 0 && ga) {
|
|
67
|
+
return 'Graphical Abstract';
|
|
68
|
+
}
|
|
69
|
+
if (!ga) {
|
|
70
|
+
index++;
|
|
71
|
+
}
|
|
72
|
+
return `Figure ${index}`;
|
|
73
|
+
};
|
|
74
|
+
return (React.createElement(React.Fragment, null, elements.map((element, index) => (React.createElement(Element, { key: index, onClick: () => handleClick(element) },
|
|
75
|
+
React.createElement(ElementLabelContainer, null,
|
|
76
|
+
getFileTypeIcon(getElementFileType(element)),
|
|
77
|
+
React.createElement(ElementLabel, null, getElementFileLabel(index))),
|
|
78
|
+
React.createElement(ElementFilesContainer, { "data-cy": "file-elements-container" }, element.files?.map((figure) => (React.createElement(ElementFile, { key: figure.file.id, figure: figure, onReplace: async (f) => await handleReplace(figure, f), onDetach: async () => await handleDetach(figure), onDownload: () => fileManagement.download(figure.file) })))))))));
|
|
79
|
+
};
|
|
80
|
+
const ElementFile = ({ figure, onDownload, onReplace, onDetach }) => {
|
|
81
|
+
return (React.createElement(ModelFileContainer, { "data-cy": "file-container" },
|
|
82
|
+
React.createElement(FileName, { file: figure.file }),
|
|
83
|
+
React.createElement(FileCreatedDate, { file: figure.file, className: "show-on-hover" }),
|
|
84
|
+
React.createElement(FileActions, { "data-cy": "file-actions", sectionType: FileSectionType.Inline, onDownload: figure.file ? onDownload : undefined, onDetach: figure.file ? onDetach : undefined, onReplace: onReplace })));
|
|
85
|
+
};
|
|
86
|
+
const Element = styled.div `
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
padding: 0;
|
|
90
|
+
|
|
91
|
+
border-bottom: 1px dashed #f0f0f0;
|
|
92
|
+
|
|
93
|
+
svg {
|
|
94
|
+
width: 24px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
:last-child {
|
|
98
|
+
border-bottom: 0;
|
|
99
|
+
}
|
|
100
|
+
`;
|
|
101
|
+
const ElementLabelContainer = styled.div `
|
|
102
|
+
display: flex;
|
|
103
|
+
padding: 20px 16px;
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
`;
|
|
106
|
+
const ElementLabel = styled.div `
|
|
107
|
+
color: ${(props) => props.theme.colors.text.primary};
|
|
108
|
+
font-weight: bold;
|
|
109
|
+
font-size: 16px;
|
|
110
|
+
line-height: 20px;
|
|
111
|
+
white-space: nowrap;
|
|
112
|
+
margin-left: ${(props) => props.theme.grid.unit * 2}px;
|
|
113
|
+
`;
|
|
114
|
+
const ElementFilesContainer = styled.div `
|
|
115
|
+
width: 100%;
|
|
116
|
+
> :last-child {
|
|
117
|
+
margin-bottom: 25px;
|
|
118
|
+
}
|
|
119
|
+
`;
|
|
120
|
+
const ModelFileContainer = styled(FileContainer) `
|
|
121
|
+
padding: 8px 16px;
|
|
122
|
+
height: 40px;
|
|
123
|
+
|
|
124
|
+
path {
|
|
125
|
+
fill: #6e6e6e;
|
|
126
|
+
}
|
|
127
|
+
`;
|
|
128
|
+
//# sourceMappingURL=InlineFilesSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineFilesSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/InlineFilesSection.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAEL,iBAAiB,GAElB,MAAM,0BAA0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MAAM,CAAC,IAAI,CAAC,OAAO;;;;;iBAKpC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;CACpD,CAAA;AAED,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAKvC,CAAA;AAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;;;;;;;CAO/C,CAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
|
3
|
+
*
|
|
4
|
+
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
|
5
|
+
*
|
|
6
|
+
* The Original Code is manuscripts-frontend.
|
|
7
|
+
*
|
|
8
|
+
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
9
|
+
*
|
|
10
|
+
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
+
*/
|
|
12
|
+
import { insertSupplement } from '@manuscripts/body-editor';
|
|
13
|
+
import { usePermissions } from '@manuscripts/style-guide';
|
|
14
|
+
import React, { useEffect, useState } from 'react';
|
|
15
|
+
import { useDrag } from 'react-dnd';
|
|
16
|
+
import { getEmptyImage } from 'react-dnd-html5-backend';
|
|
17
|
+
import { useStore } from '../../store';
|
|
18
|
+
import { FileActions } from './FileActions';
|
|
19
|
+
import { FileContainer } from './FileContainer';
|
|
20
|
+
import { FileCreatedDate } from './FileCreatedDate';
|
|
21
|
+
import { FileSectionType } from './FileManager';
|
|
22
|
+
import { FileName } from './FileName';
|
|
23
|
+
import { FileSectionAlert, FileSectionAlertType } from './FileSectionAlert';
|
|
24
|
+
import { FileUploader } from './FileUploader';
|
|
25
|
+
/**
|
|
26
|
+
* This component represents the other files in the file section.
|
|
27
|
+
*/
|
|
28
|
+
export const OtherFilesSection = ({ files }) => {
|
|
29
|
+
const [{ view, fileManagement }] = useStore((s) => ({
|
|
30
|
+
view: s.view,
|
|
31
|
+
fileManagement: s.fileManagement,
|
|
32
|
+
}));
|
|
33
|
+
const can = usePermissions();
|
|
34
|
+
const [alert, setAlert] = useState({
|
|
35
|
+
type: FileSectionAlertType.NONE,
|
|
36
|
+
message: '',
|
|
37
|
+
});
|
|
38
|
+
const handleUpload = async (file) => {
|
|
39
|
+
setAlert({
|
|
40
|
+
type: FileSectionAlertType.UPLOAD_IN_PROGRESS,
|
|
41
|
+
message: file.name,
|
|
42
|
+
});
|
|
43
|
+
await fileManagement.upload(file);
|
|
44
|
+
setAlert({
|
|
45
|
+
type: FileSectionAlertType.UPLOAD_SUCCESSFUL,
|
|
46
|
+
message: '',
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const moveToSupplements = async (file) => {
|
|
50
|
+
insertSupplement(file, view.state, view.dispatch);
|
|
51
|
+
setAlert({
|
|
52
|
+
type: FileSectionAlertType.MOVE_SUCCESSFUL,
|
|
53
|
+
message: FileSectionType.Supplements,
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
return (React.createElement("div", null,
|
|
57
|
+
can?.uploadFile && React.createElement(FileUploader, { onUpload: handleUpload }),
|
|
58
|
+
React.createElement(FileSectionAlert, { alert: alert }),
|
|
59
|
+
files.map((file) => (React.createElement(OtherFile, { key: file.id, file: file, onDownload: () => fileManagement.download(file), onMoveToSupplements: async () => await moveToSupplements(file) })))));
|
|
60
|
+
};
|
|
61
|
+
const OtherFile = ({ file, onDownload, onMoveToSupplements }) => {
|
|
62
|
+
const [{ isDragging }, dragRef, preview] = useDrag({
|
|
63
|
+
type: 'file',
|
|
64
|
+
item: {
|
|
65
|
+
file,
|
|
66
|
+
},
|
|
67
|
+
collect: (monitor) => ({
|
|
68
|
+
isDragging: monitor.isDragging(),
|
|
69
|
+
}),
|
|
70
|
+
});
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
preview(getEmptyImage());
|
|
73
|
+
}, [preview]);
|
|
74
|
+
return (React.createElement(FileContainer, { key: file.id, "data-cy": "file-container", ref: dragRef, className: isDragging ? 'dragging' : '' },
|
|
75
|
+
React.createElement(FileName, { file: file }),
|
|
76
|
+
React.createElement(FileCreatedDate, { file: file, className: "show-on-hover" }),
|
|
77
|
+
React.createElement(FileActions, { sectionType: FileSectionType.OtherFile, onDownload: onDownload, move: {
|
|
78
|
+
sectionType: FileSectionType.Supplements,
|
|
79
|
+
handler: onMoveToSupplements,
|
|
80
|
+
} })));
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=OtherFilesSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OtherFilesSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/OtherFilesSection.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAkB,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBA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,oBAAC,QAAQ,IAAC,IAAI,EAAE,IAAI,GAAI;QACxB,oBAAC,eAAe,IAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,eAAe,GAAG;QACzD,oBAAC,WAAW,IACV,WAAW,EAAE,eAAe,CAAC,SAAS,EACtC,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE;gBACJ,WAAW,EAAE,eAAe,CAAC,WAAW;gBACxC,OAAO,EAAE,mBAAmB;aAC7B,GACD,CACY,CACjB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
|
3
|
+
*
|
|
4
|
+
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
|
5
|
+
*
|
|
6
|
+
* The Original Code is manuscripts-frontend.
|
|
7
|
+
*
|
|
8
|
+
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
9
|
+
*
|
|
10
|
+
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
+
*/
|
|
12
|
+
import { insertSupplement } from '@manuscripts/body-editor';
|
|
13
|
+
import { usePermissions } from '@manuscripts/style-guide';
|
|
14
|
+
import React, { useEffect, useState } from 'react';
|
|
15
|
+
import { useDrag } from 'react-dnd';
|
|
16
|
+
import { getEmptyImage } from 'react-dnd-html5-backend';
|
|
17
|
+
import { useStore } from '../../store';
|
|
18
|
+
import { FileActions } from './FileActions';
|
|
19
|
+
import { FileContainer } from './FileContainer';
|
|
20
|
+
import { FileCreatedDate } from './FileCreatedDate';
|
|
21
|
+
import { FileSectionType } from './FileManager';
|
|
22
|
+
import { FileName } from './FileName';
|
|
23
|
+
import { FileSectionAlert, FileSectionAlertType } from './FileSectionAlert';
|
|
24
|
+
import { FileUploader } from './FileUploader';
|
|
25
|
+
/**
|
|
26
|
+
* This component represents the other files in the file section.
|
|
27
|
+
*/
|
|
28
|
+
export const SupplementsSection = ({ supplements, }) => {
|
|
29
|
+
const [{ view, fileManagement }] = useStore((s) => ({
|
|
30
|
+
view: s.view,
|
|
31
|
+
fileManagement: s.fileManagement,
|
|
32
|
+
}));
|
|
33
|
+
const can = usePermissions();
|
|
34
|
+
const [alert, setAlert] = useState({
|
|
35
|
+
type: FileSectionAlertType.NONE,
|
|
36
|
+
message: '',
|
|
37
|
+
});
|
|
38
|
+
const upload = async (file) => {
|
|
39
|
+
setAlert({
|
|
40
|
+
type: FileSectionAlertType.UPLOAD_IN_PROGRESS,
|
|
41
|
+
message: file.name,
|
|
42
|
+
});
|
|
43
|
+
const uploaded = await fileManagement.upload(file);
|
|
44
|
+
setAlert({
|
|
45
|
+
type: FileSectionAlertType.UPLOAD_SUCCESSFUL,
|
|
46
|
+
message: '',
|
|
47
|
+
});
|
|
48
|
+
return uploaded;
|
|
49
|
+
};
|
|
50
|
+
const handleUpload = async (file) => {
|
|
51
|
+
const uploaded = await upload(file);
|
|
52
|
+
insertSupplement(uploaded, view.state, view.dispatch);
|
|
53
|
+
};
|
|
54
|
+
const handleReplace = async (supplement, file) => {
|
|
55
|
+
const uploaded = await upload(file);
|
|
56
|
+
const tr = view.state.tr;
|
|
57
|
+
tr.setNodeAttribute(supplement.pos, 'href', uploaded.id);
|
|
58
|
+
view.dispatch(tr);
|
|
59
|
+
};
|
|
60
|
+
const handleMoveToOtherFiles = (supplement) => {
|
|
61
|
+
const tr = view.state.tr;
|
|
62
|
+
const from = supplement.pos;
|
|
63
|
+
const to = from + supplement.node.nodeSize;
|
|
64
|
+
tr.delete(from, to);
|
|
65
|
+
view.dispatch(tr);
|
|
66
|
+
setAlert({
|
|
67
|
+
type: FileSectionAlertType.MOVE_SUCCESSFUL,
|
|
68
|
+
message: FileSectionType.OtherFile,
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
return (React.createElement(React.Fragment, null,
|
|
72
|
+
can?.uploadFile && React.createElement(FileUploader, { onUpload: handleUpload }),
|
|
73
|
+
React.createElement(FileSectionAlert, { alert: alert }),
|
|
74
|
+
supplements.map((supplement) => (React.createElement(SupplementFile, { key: supplement.node.attrs.id, supplement: supplement, onDownload: () => fileManagement.download(supplement.file), onReplace: async (f) => await handleReplace(supplement, f), onDetach: () => handleMoveToOtherFiles(supplement) })))));
|
|
75
|
+
};
|
|
76
|
+
const SupplementFile = ({ supplement, onDownload, onReplace, onDetach }) => {
|
|
77
|
+
const [{ isDragging }, dragRef, preview] = useDrag({
|
|
78
|
+
type: 'file',
|
|
79
|
+
item: {
|
|
80
|
+
file: supplement,
|
|
81
|
+
},
|
|
82
|
+
end: (_, monitor) => {
|
|
83
|
+
if (monitor.didDrop()) {
|
|
84
|
+
onDetach();
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
collect: (monitor) => ({
|
|
88
|
+
isDragging: monitor.isDragging(),
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
preview(getEmptyImage());
|
|
93
|
+
}, [preview]);
|
|
94
|
+
return (React.createElement(FileContainer, { "data-cy": "file-container", key: supplement.file.id, ref: dragRef, className: isDragging ? 'dragging' : '' },
|
|
95
|
+
React.createElement(FileName, { file: supplement.file }),
|
|
96
|
+
React.createElement(FileCreatedDate, { file: supplement.file, className: "show-on-hover" }),
|
|
97
|
+
React.createElement(FileActions, { "data-cy": "file-actions", sectionType: FileSectionType.Supplements, onDownload: supplement.file ? onDownload : undefined, onReplace: onReplace, move: supplement.file
|
|
98
|
+
? {
|
|
99
|
+
sectionType: FileSectionType.OtherFile,
|
|
100
|
+
handler: onDetach,
|
|
101
|
+
}
|
|
102
|
+
: undefined })));
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=SupplementsSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SupplementsSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/SupplementsSection.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,gBAAgB,EAAY,MAAM,0BAA0B,CAAA;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAW,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAM7C;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsC,CAAC,EACpE,WAAW,GACZ,EAAE,EAAE;IACH,MAAM,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAClD,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,cAAc,EAAE,CAAC,CAAC,cAAc;KACjC,CAAC,CAAC,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|
*/
|
|
12
|
-
import { findParentElement, getMatchingChild,
|
|
12
|
+
import { findParentElement, getMatchingChild, insertFigure, } from '@manuscripts/body-editor';
|
|
13
13
|
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
14
14
|
import { Category, Dialog } from '@manuscripts/style-guide';
|
|
15
15
|
import { CHANGE_STATUS, trackCommands, } from '@manuscripts/track-changes-plugin';
|
|
@@ -25,8 +25,7 @@ import { SpriteMap } from '../track-changes/suggestion-list/Icons';
|
|
|
25
25
|
const EditorElement = ({ editor }) => {
|
|
26
26
|
const { onRender, view, dispatch } = editor;
|
|
27
27
|
const [error, setError] = useState('');
|
|
28
|
-
const [{
|
|
29
|
-
deleteModel: store.deleteTrackModel,
|
|
28
|
+
const [{ trackState }] = useStore((store) => ({
|
|
30
29
|
trackState: store.trackState,
|
|
31
30
|
}));
|
|
32
31
|
const execCmd = useExecCmd();
|
|
@@ -38,10 +37,8 @@ const EditorElement = ({ editor }) => {
|
|
|
38
37
|
const docPos = view.posAtCoords({ left: offset.x, top: offset.y });
|
|
39
38
|
// @ts-expect-error: Ignoring default type from the React DnD plugin. Seems to be unreachable
|
|
40
39
|
const file = item.file;
|
|
41
|
-
// @ts-expect-error: Ignoring default type from the React DnD plugin. Seems to be unreachable
|
|
42
|
-
const model = item.model;
|
|
43
40
|
if (!file || !docPos || !docPos.pos) {
|
|
44
|
-
return;
|
|
41
|
+
return false;
|
|
45
42
|
}
|
|
46
43
|
const resolvedPos = view.state.doc.resolve(docPos.pos);
|
|
47
44
|
const attrs = {
|
|
@@ -70,17 +67,17 @@ const EditorElement = ({ editor }) => {
|
|
|
70
67
|
break;
|
|
71
68
|
}
|
|
72
69
|
default: {
|
|
73
|
-
const
|
|
70
|
+
const tr = view.state.tr;
|
|
71
|
+
tr.setSelection(NodeSelection.near(resolvedPos));
|
|
74
72
|
view.focus();
|
|
75
|
-
dispatch(
|
|
73
|
+
dispatch(tr);
|
|
76
74
|
// after dispatch is called - the view.state changes and becomes the new state of the editor so exactly the view.state has to be used to make changes on the actual state
|
|
77
|
-
|
|
75
|
+
insertFigure(file, view.state, dispatch);
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
|
-
|
|
81
|
-
await deleteModel(model._id);
|
|
82
|
-
}
|
|
78
|
+
return true;
|
|
83
79
|
}
|
|
80
|
+
return false;
|
|
84
81
|
},
|
|
85
82
|
});
|
|
86
83
|
const handleAcceptChange = useCallback((c) => {
|
|
@@ -176,7 +173,7 @@ const addFigureAtFigCaptionPosition = (editor, resolvePos, attrs, file) => {
|
|
|
176
173
|
const transaction = view.state.tr.setSelection(NodeSelection.near(resolvePos));
|
|
177
174
|
view.focus();
|
|
178
175
|
dispatch(transaction);
|
|
179
|
-
|
|
176
|
+
insertFigure(file, view.state, dispatch);
|
|
180
177
|
}
|
|
181
178
|
};
|
|
182
179
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorElement.js","sourceRoot":"","sources":["../../../../src/components/projects/EditorElement.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"EditorElement.js","sourceRoot":"","sources":["../../../../src/components/projects/EditorElement.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAEL,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,GAEb,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EACL,aAAa,EAEb,aAAa,GAEd,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAEL,UAAU,EAGV,MAAM,GACP,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,aAAa,EAAe,MAAM,mBAAmB,CAAA;AAC9D,OAAO,EAAE,0BAA0B,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AACvE,OAAO,KAAK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B,QAAmC,EACnC,KAA8B,EAC9B,GAAW,EACX,EAAE;IACF,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC;QAC1D,GAAG,KAAK;QACR,EAAE,EAAE,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC;KACnC,CAAe,CAAA;IAChB,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAC5C,QAAQ,CAAC,EAAE,CAAC,CAAA;AACd,CAAC,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
*
|
|
10
10
|
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2023 Atypon Systems LLC. All Rights Reserved.
|
|
11
11
|
*/
|
|
12
|
-
import {
|
|
12
|
+
import { usePermissions } from '@manuscripts/style-guide';
|
|
13
13
|
import React, { useEffect, useState } from 'react';
|
|
14
14
|
import config from '../../config';
|
|
15
15
|
import { useStore } from '../../store';
|
|
16
16
|
import { CommentsPanel } from '../comments/CommentsPanel';
|
|
17
|
+
import { FileManager } from '../FileManager/FileManager';
|
|
17
18
|
import { InspectorContainer, InspectorTab, InspectorTabList, InspectorTabPanel, InspectorTabs, PaddedInspectorTabPanels, } from '../Inspector';
|
|
18
19
|
import Panel from '../Panel';
|
|
19
20
|
import { ResizingInspectorButton } from '../ResizerButtons';
|
|
@@ -60,9 +61,7 @@ const Inspector = ({ editor }) => {
|
|
|
60
61
|
React.createElement(InspectorTabPanel, { key: "Content", "data-cy": "content" }, tabIndex === CONTENT_TAB_INDEX && (React.createElement(ContentTab, { state: state, dispatch: dispatch, key: "content" }))),
|
|
61
62
|
React.createElement(InspectorTabPanel, { key: "Comments", "data-cy": "comments" }, tabIndex === COMMENTS_TAB_INDEX && (React.createElement(CommentsPanel, { key: "comments" }))),
|
|
62
63
|
!can.editWithoutTracking && (React.createElement(InspectorTabPanel, { key: "History", "data-cy": "history" }, tabIndex === SUGGESTIONS_TAB_INDEX && (React.createElement(TrackChangesPanel, { key: "track-changes" })))),
|
|
63
|
-
config.features.fileManagement && (React.createElement(InspectorTabPanel, { key: "Files", "data-cy": "files" }, tabIndex === FILES_TAB_INDEX &&
|
|
64
|
-
// @ts-ignore
|
|
65
|
-
saveModel: store.saveTrackModel, deleteModel: store.deleteTrackModel, fileManagement: store.fileManagement })))))))));
|
|
64
|
+
config.features.fileManagement && (React.createElement(InspectorTabPanel, { key: "Files", "data-cy": "files" }, tabIndex === FILES_TAB_INDEX && React.createElement(FileManager, { key: "files" }))))))));
|
|
66
65
|
};
|
|
67
66
|
export default Inspector;
|
|
68
67
|
//# sourceMappingURL=Inspector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Inspector.js","sourceRoot":"","sources":["../../../../src/components/projects/Inspector.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Inspector.js","sourceRoot":"","sources":["../../../../src/components/projects/Inspector.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAElD,OAAO,MAAM,MAAM,cAAc,CAAA;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,wBAAwB,GACzB,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,MAAM,UAAU,CAAA;AAC5B,OAAO,EAAE,uBA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G,CAC1C,CACiB,CACrB;oBACA,MAAM,CAAC,QAAQ,CAAC,cAAc,IAAI,CACjC,oBAAC,iBAAiB,IAAC,GAAG,EAAC,OAAO,aAAS,OAAO,IAC3C,QAAQ,KAAK,eAAe,IAAI,oBAAC,WAAW,IAAC,GAAG,EAAC,OAAO,GAAG,CAC1C,CACrB,CACwB,CACb,CACG,CACf,CACT,CAAA;AACH,CAAC,CAAA;AAED,eAAe,SAAS,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attrs-change-filter.js","sourceRoot":"","sources":["../../../src/lib/attrs-change-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"attrs-change-filter.js","sourceRoot":"","sources":["../../../src/lib/attrs-change-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,EACL,cAAc,EACd,oBAAoB,GAErB,MAAM,wBAAwB,CAAA;AAE/B;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,aAA6B,EAC7B,WAA2B,EAC3B,KAAuB,EACvB,YAA2B,EAC3B,UAA8B,EAC9B,SAAqB,EACrB,EAAE;IACF,qEAAqE;IACrE,OAAO;QACL,QAAQ,EAAE,kBAAkB,CAC1B,aAAa,EACb,WAAW,CAAC,QAAQ,EACpB,KAAK,EACL,YAAY,EACZ,UAAU,EACV,SAAS,CACV;QACD,QAAQ,EAAE,kBAAkB,CAC1B,aAAa,EACb,WAAW,CAAC,QAAQ,EACpB,KAAK,EACL,YAAY,EACZ,UAAU,EACV,SAAS,CACV;KACF,CAAA;AACH,CAAC,CAAA;AAED,SAAS,wBAAwB,CAAC,KAAc;IAC9C,MAAM,IAAI,GAAG,KAA0B,CAAA;IACvC,OAAO,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC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