@manuscripts/body-editor 3.12.17 → 3.12.19
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/commands.js +3 -4
- package/dist/cjs/components/affiliations/AffiliationForm.js +5 -6
- package/dist/cjs/components/affiliations/AffiliationsModal.js +21 -57
- package/dist/cjs/components/affiliations/AffiliationsPanel.js +22 -0
- package/dist/cjs/components/authors/AuthorDetailsForm.js +3 -4
- package/dist/cjs/components/authors/AuthorsModal.js +15 -48
- package/dist/cjs/components/authors/AuthorsPanel.js +18 -0
- package/dist/cjs/components/authors/useManageAffiliations.js +6 -4
- package/dist/cjs/components/authors-affiliations/AuthorsAndAffiliationsModals.js +134 -0
- package/dist/cjs/components/authors-affiliations/GenericPanel.js +136 -0
- package/dist/cjs/components/form/ModalFormActions.js +11 -5
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/affiliations.js +5 -11
- package/dist/cjs/views/contributors.js +4 -7
- package/dist/es/commands.js +3 -4
- package/dist/es/components/affiliations/AffiliationForm.js +5 -6
- package/dist/es/components/affiliations/AffiliationsModal.js +21 -53
- package/dist/es/components/affiliations/AffiliationsPanel.js +15 -0
- package/dist/es/components/authors/AuthorDetailsForm.js +3 -4
- package/dist/es/components/authors/AuthorsModal.js +15 -45
- package/dist/es/components/authors/AuthorsPanel.js +11 -0
- package/dist/es/components/authors/useManageAffiliations.js +7 -5
- package/dist/es/components/authors-affiliations/AuthorsAndAffiliationsModals.js +93 -0
- package/dist/es/components/authors-affiliations/GenericPanel.js +94 -0
- package/dist/es/components/form/ModalFormActions.js +11 -5
- package/dist/es/versions.js +1 -1
- package/dist/es/views/affiliations.js +5 -11
- package/dist/es/views/contributors.js +5 -8
- package/dist/types/components/affiliations/AffiliationForm.d.ts +1 -0
- package/dist/types/components/affiliations/AffiliationsModal.d.ts +2 -5
- package/dist/types/components/affiliations/AffiliationsPanel.d.ts +11 -0
- package/dist/types/components/authors/AuthorDetailsForm.d.ts +1 -0
- package/dist/types/components/authors/AuthorsModal.d.ts +2 -4
- package/dist/types/components/authors/AuthorsPanel.d.ts +13 -0
- package/dist/types/components/authors/useManageAffiliations.d.ts +0 -2
- package/dist/types/components/authors-affiliations/AuthorsAndAffiliationsModals.d.ts +29 -0
- package/dist/types/components/authors-affiliations/GenericPanel.d.ts +48 -0
- package/dist/types/components/form/ModalFormActions.d.ts +1 -0
- package/dist/types/versions.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/authors/AffiliationDrawer.js +0 -24
- package/dist/es/components/authors/AffiliationDrawer.js +0 -17
- package/dist/types/components/authors/AffiliationDrawer.d.ts +0 -12
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { useReducer, useState } from 'react';
|
|
1
|
+
import { useEffect, useReducer, useState } from 'react';
|
|
2
2
|
import { arrayReducer } from '../../lib/array-reducer';
|
|
3
3
|
export const affiliationsReducer = arrayReducer((a, b) => a.id === b.id);
|
|
4
4
|
export const useManageAffiliations = (selection, $affiliations) => {
|
|
5
|
-
const [affiliations] = useReducer(affiliationsReducer,
|
|
6
|
-
|
|
5
|
+
const [affiliations, dispatchAffiliations] = useReducer(affiliationsReducer, [
|
|
6
|
+
...$affiliations,
|
|
7
|
+
]);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
dispatchAffiliations({ type: 'set', state: [...$affiliations] });
|
|
10
|
+
}, [$affiliations]);
|
|
7
11
|
const [selectedAffiliations, setSelectedAffiliations] = useState([]);
|
|
8
12
|
const removeAffiliation = (affId) => {
|
|
9
13
|
if (!selection) {
|
|
@@ -26,8 +30,6 @@ export const useManageAffiliations = (selection, $affiliations) => {
|
|
|
26
30
|
setSelectedAffiliations(affiliations.filter((item) => newAffiliations.includes(item.id)));
|
|
27
31
|
};
|
|
28
32
|
return {
|
|
29
|
-
showAffiliationDrawer,
|
|
30
|
-
setShowAffiliationDrawer,
|
|
31
33
|
selectedAffiliations,
|
|
32
34
|
setSelectedAffiliations,
|
|
33
35
|
removeAffiliation,
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { schema, } from '@manuscripts/transform';
|
|
17
|
+
import React, { useState } from 'react';
|
|
18
|
+
import { getEditorProps } from '../../plugins/editor-props';
|
|
19
|
+
import ReactSubView from '../../views/ReactSubView';
|
|
20
|
+
import { deleteNode, findChildByType, findChildrenAttrsByType, updateNodeAttrs, } from '../../lib/view';
|
|
21
|
+
import { AffiliationsModal, } from '../affiliations/AffiliationsModal';
|
|
22
|
+
import { AuthorsModal } from '../authors/AuthorsModal';
|
|
23
|
+
function insertNode(parentType, childType) {
|
|
24
|
+
return (view, attrs) => {
|
|
25
|
+
const parent = findChildByType(view, parentType);
|
|
26
|
+
if (parent) {
|
|
27
|
+
view.dispatch(view.state.tr.insert(parent.pos + 1, childType.create(attrs)));
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function upsertNode(nodeType, insertFn) {
|
|
32
|
+
return (view, attrs) => {
|
|
33
|
+
if (!updateNodeAttrs(view, nodeType, attrs)) {
|
|
34
|
+
insertFn(view, attrs);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const insertAuthorNode = insertNode(schema.nodes.contributors, schema.nodes.contributor);
|
|
39
|
+
const insertAffiliationNode = insertNode(schema.nodes.affiliations, schema.nodes.affiliation);
|
|
40
|
+
const upsertAuthor = upsertNode(schema.nodes.contributor, insertAuthorNode);
|
|
41
|
+
const upsertAffiliation = upsertNode(schema.nodes.affiliation, insertAffiliationNode);
|
|
42
|
+
export const AuthorsAndAffiliationsModals = ({ initialModal, view, author, affiliation, addNewAuthor, addNewAffiliation, }) => {
|
|
43
|
+
const [showOverlay, setShowOverlay] = useState(false);
|
|
44
|
+
const [authors, setAuthors] = useState(() => findChildrenAttrsByType(view, schema.nodes.contributor));
|
|
45
|
+
const [affiliations, setAffiliations] = useState(() => findChildrenAttrsByType(view, schema.nodes.affiliation));
|
|
46
|
+
const handleOpenOverlay = () => setShowOverlay(true);
|
|
47
|
+
const handleOverlayClose = () => {
|
|
48
|
+
setShowOverlay(false);
|
|
49
|
+
setAuthors(findChildrenAttrsByType(view, schema.nodes.contributor));
|
|
50
|
+
setAffiliations(findChildrenAttrsByType(view, schema.nodes.affiliation));
|
|
51
|
+
};
|
|
52
|
+
const authorsProps = {
|
|
53
|
+
author,
|
|
54
|
+
authors,
|
|
55
|
+
affiliations,
|
|
56
|
+
addNewAuthor,
|
|
57
|
+
onSaveAuthor: (a) => upsertAuthor(view, a),
|
|
58
|
+
onDeleteAuthor: (a) => deleteNode(view, a.id),
|
|
59
|
+
};
|
|
60
|
+
const affiliationsProps = {
|
|
61
|
+
affiliation,
|
|
62
|
+
authors,
|
|
63
|
+
affiliations,
|
|
64
|
+
addNewAffiliation,
|
|
65
|
+
onSaveAffiliation: (a) => upsertAffiliation(view, a),
|
|
66
|
+
onDeleteAffiliation: (a) => deleteNode(view, a.id),
|
|
67
|
+
onUpdateAuthors: (updated) => updated.forEach((a) => updateNodeAttrs(view, schema.nodes.contributor, a)),
|
|
68
|
+
};
|
|
69
|
+
if (initialModal === 'authors') {
|
|
70
|
+
return (React.createElement(React.Fragment, null,
|
|
71
|
+
React.createElement(AuthorsModal, { ...authorsProps, onOpenAffiliationsModal: handleOpenOverlay }),
|
|
72
|
+
showOverlay && (React.createElement(AffiliationsModal, { ...affiliationsProps, addNewAffiliation: true, onClose: handleOverlayClose }))));
|
|
73
|
+
}
|
|
74
|
+
return (React.createElement(React.Fragment, null,
|
|
75
|
+
React.createElement(AffiliationsModal, { ...affiliationsProps, onOpenAuthorsModal: handleOpenOverlay }),
|
|
76
|
+
showOverlay && (React.createElement(AuthorsModal, { ...authorsProps, addNewAuthor: true, onClose: handleOverlayClose }))));
|
|
77
|
+
};
|
|
78
|
+
export const openAuthorsAndAffiliationsModals = (pos, view, initialModal) => {
|
|
79
|
+
if (!view) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const { state } = view;
|
|
83
|
+
const props = getEditorProps(state);
|
|
84
|
+
const componentProps = {
|
|
85
|
+
initialModal,
|
|
86
|
+
view: view,
|
|
87
|
+
addNewAuthor: initialModal === 'authors',
|
|
88
|
+
addNewAffiliation: initialModal === 'affiliations',
|
|
89
|
+
};
|
|
90
|
+
const dialog = ReactSubView(props, AuthorsAndAffiliationsModals, componentProps, state.doc, () => pos, view);
|
|
91
|
+
view.focus();
|
|
92
|
+
document.body.appendChild(dialog);
|
|
93
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { AddedIcon, AddIcon, DrawerIcon, DrawerItemLabel, DrawerItemMeta, DrawerItemsList, DrawerLabelContainer, DrawerListItem, IconButton, PlusIcon, } from '@manuscripts/style-guide';
|
|
17
|
+
import React, { useMemo } from 'react';
|
|
18
|
+
import styled from 'styled-components';
|
|
19
|
+
export const ListItems = DrawerItemsList;
|
|
20
|
+
const Panel = styled.div `
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
`;
|
|
24
|
+
const PanelHeader = styled.div `
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: flex-start;
|
|
27
|
+
padding: ${(props) => props.theme.grid.unit * 2}px
|
|
28
|
+
${(props) => props.theme.grid.unit * 4}px;
|
|
29
|
+
`;
|
|
30
|
+
const PanelTitle = styled.span `
|
|
31
|
+
font-family: ${(props) => props.theme.font.family.sans};
|
|
32
|
+
font-size: 18px;
|
|
33
|
+
line-height: 24px;
|
|
34
|
+
letter-spacing: -0.37px;
|
|
35
|
+
color: ${(props) => props.theme.colors.text.secondary};
|
|
36
|
+
`;
|
|
37
|
+
const PanelCreateButton = styled(IconButton) `
|
|
38
|
+
color: #0d79d0;
|
|
39
|
+
font-size: 14px;
|
|
40
|
+
font-weight: 400;
|
|
41
|
+
font-style: normal;
|
|
42
|
+
line-height: 1;
|
|
43
|
+
width: auto;
|
|
44
|
+
height: 24px;
|
|
45
|
+
margin-left: auto;
|
|
46
|
+
svg {
|
|
47
|
+
margin-right: 4px;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
const PanelEmpty = styled.div `
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
gap: 16px;
|
|
56
|
+
padding: ${(props) => props.theme.grid.unit * 20}px
|
|
57
|
+
${(props) => props.theme.grid.unit * 4}px;
|
|
58
|
+
`;
|
|
59
|
+
const PanelEmptyIcon = styled.div `
|
|
60
|
+
width: 120px;
|
|
61
|
+
height: 120px;
|
|
62
|
+
flex-shrink: 0;
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
svg {
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
const PanelEmptyText = styled.p `
|
|
72
|
+
margin: 0;
|
|
73
|
+
font-size: 18px;
|
|
74
|
+
line-height: 24px;
|
|
75
|
+
text-align: center;
|
|
76
|
+
letter-spacing: -0.369px;
|
|
77
|
+
`;
|
|
78
|
+
export const GenericPanel = ({ title, createLabel, onCreate, createDataCy, emptyDataCy, isEmpty, emptyIcon, emptyMessage, children, }) => (React.createElement(Panel, null,
|
|
79
|
+
React.createElement(PanelHeader, null,
|
|
80
|
+
React.createElement(PanelTitle, null, title),
|
|
81
|
+
React.createElement(PanelCreateButton, { onClick: onCreate, "data-cy": createDataCy },
|
|
82
|
+
React.createElement(PlusIcon, null),
|
|
83
|
+
createLabel)),
|
|
84
|
+
isEmpty ? (React.createElement(PanelEmpty, { "data-cy": emptyDataCy },
|
|
85
|
+
React.createElement(PanelEmptyIcon, { "aria-hidden": true }, emptyIcon),
|
|
86
|
+
React.createElement(PanelEmptyText, null, emptyMessage))) : (children)));
|
|
87
|
+
export const ListItem = ({ selected, onClick, primary, secondary, }) => (React.createElement(DrawerListItem, { "data-cy": "item", selected: selected, onClick: onClick },
|
|
88
|
+
React.createElement(DrawerIcon, null, selected ? (React.createElement(AddedIcon, { width: 22, height: 22 })) : (React.createElement(AddIcon, { width: 22, height: 22 }))),
|
|
89
|
+
React.createElement(DrawerLabelContainer, null,
|
|
90
|
+
React.createElement(DrawerItemLabel, null, primary),
|
|
91
|
+
secondary != null && secondary !== '' ? (React.createElement(DrawerItemMeta, null, secondary)) : null)));
|
|
92
|
+
export function useListSelectedIds(selectedItems) {
|
|
93
|
+
return useMemo(() => new Set(selectedItems.map((x) => x.id)), [selectedItems]);
|
|
94
|
+
}
|
|
@@ -29,14 +29,20 @@ const StyledIconButton = styled(IconButton) `
|
|
|
29
29
|
margin-right: 4px;
|
|
30
30
|
}
|
|
31
31
|
`;
|
|
32
|
-
export const ModalFormActions = ({ type, form, onDelete, showingDeleteDialog, showDeleteDialog, newEntity, isDisableSave, }) => {
|
|
32
|
+
export const ModalFormActions = ({ type, form, onDelete, showingDeleteDialog, showDeleteDialog, newEntity, isDisableSave, onSubmitForm, }) => {
|
|
33
|
+
const saveButton = onSubmitForm ? (React.createElement(StyledIconButton, { disabled: isDisableSave, type: "button", onClick: () => {
|
|
34
|
+
if (!isDisableSave) {
|
|
35
|
+
void onSubmitForm();
|
|
36
|
+
}
|
|
37
|
+
} },
|
|
38
|
+
React.createElement(PlusIcon, null),
|
|
39
|
+
newEntity ? 'Save Details' : 'Update Details')) : (React.createElement(StyledIconButton, { disabled: isDisableSave, type: "submit", form: form },
|
|
40
|
+
React.createElement(PlusIcon, null),
|
|
41
|
+
newEntity ? 'Save Details' : 'Update Details'));
|
|
33
42
|
return (React.createElement(ActionsContainer, { "data-cy": `${type}-action` },
|
|
34
43
|
React.createElement(ConfirmationDialog, { isOpen: showingDeleteDialog, onPrimary: () => {
|
|
35
44
|
onDelete();
|
|
36
45
|
showDeleteDialog();
|
|
37
46
|
}, onSecondary: showDeleteDialog, type: DialogType.DELETE, entityType: type }),
|
|
38
|
-
React.createElement(StyledButtonGroup, null,
|
|
39
|
-
React.createElement(StyledIconButton, { disabled: isDisableSave, type: "submit", form: form },
|
|
40
|
-
React.createElement(PlusIcon, null),
|
|
41
|
-
newEntity ? 'Save Details' : 'Update Details'))));
|
|
47
|
+
React.createElement(StyledButtonGroup, null, saveButton)));
|
|
42
48
|
};
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.12.
|
|
1
|
+
export const VERSION = '3.12.19';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -17,7 +17,7 @@ import { ContextMenu } from '@manuscripts/style-guide';
|
|
|
17
17
|
import { addTrackChangesAttributes, isDeleted, } from '@manuscripts/track-changes-plugin';
|
|
18
18
|
import { schema } from '@manuscripts/transform';
|
|
19
19
|
import { NodeSelection } from 'prosemirror-state';
|
|
20
|
-
import {
|
|
20
|
+
import { AuthorsAndAffiliationsModals, } from '../components/authors-affiliations/AuthorsAndAffiliationsModals';
|
|
21
21
|
import { alertIcon } from '../icons';
|
|
22
22
|
import { affiliationName, } from '../lib/authors';
|
|
23
23
|
import { handleComment } from '../lib/comments';
|
|
@@ -52,22 +52,16 @@ export class AffiliationsView extends BlockView {
|
|
|
52
52
|
};
|
|
53
53
|
this.handleEdit = (id, addNew) => {
|
|
54
54
|
this.props.popper.destroy();
|
|
55
|
-
const contributors = findChildrenAttrsByType(this.view, schema.nodes.contributor);
|
|
56
55
|
const affiliations = findChildrenAttrsByType(this.view, schema.nodes.affiliation);
|
|
57
|
-
const affiliation = id
|
|
58
|
-
? affiliations.filter((a) => a.id === id)[0]
|
|
59
|
-
: undefined;
|
|
56
|
+
const affiliation = id ? affiliations.find((a) => a.id === id) : undefined;
|
|
60
57
|
const componentProps = {
|
|
58
|
+
initialModal: 'affiliations',
|
|
59
|
+
view: this.view,
|
|
61
60
|
affiliation,
|
|
62
|
-
authors: contributors,
|
|
63
|
-
affiliations,
|
|
64
|
-
onSaveAffiliation: (affiliation) => handleSaveAffiliation(this.view, affiliation, this.getPos()),
|
|
65
|
-
onDeleteAffiliation: (affiliation) => handleDeleteAffiliation(this.view, affiliation),
|
|
66
|
-
onUpdateAuthors: (authors) => handleUpdateAuthors(this.view, authors),
|
|
67
61
|
addNewAffiliation: addNew,
|
|
68
62
|
};
|
|
69
63
|
this.popper?.remove();
|
|
70
|
-
this.popper = ReactSubView(this.props,
|
|
64
|
+
this.popper = ReactSubView(this.props, AuthorsAndAffiliationsModals, componentProps, this.node, this.getPos, this.view);
|
|
71
65
|
this.container.appendChild(this.popper);
|
|
72
66
|
};
|
|
73
67
|
this.showGroupContextMenu = () => {
|
|
@@ -17,8 +17,8 @@ import { ContextMenu } from '@manuscripts/style-guide';
|
|
|
17
17
|
import { addTrackChangesAttributes, isDeleted, } from '@manuscripts/track-changes-plugin';
|
|
18
18
|
import { schema } from '@manuscripts/transform';
|
|
19
19
|
import { NodeSelection } from 'prosemirror-state';
|
|
20
|
-
import {
|
|
21
|
-
import { authorComparator, authorLabel
|
|
20
|
+
import { AuthorsAndAffiliationsModals, } from '../components/authors-affiliations/AuthorsAndAffiliationsModals';
|
|
21
|
+
import { authorComparator, authorLabel } from '../lib/authors';
|
|
22
22
|
import { handleComment } from '../lib/comments';
|
|
23
23
|
import { createKeyboardInteraction } from '../lib/navigation-utils';
|
|
24
24
|
import { findChildByID, findChildrenAttrsByType } from '../lib/view';
|
|
@@ -210,18 +210,15 @@ export class ContributorsView extends BlockView {
|
|
|
210
210
|
this.handleEdit = (id, addNew) => {
|
|
211
211
|
this.props.popper.destroy();
|
|
212
212
|
const contributors = findChildrenAttrsByType(this.view, schema.nodes.contributor);
|
|
213
|
-
const affiliations = findChildrenAttrsByType(this.view, schema.nodes.affiliation);
|
|
214
213
|
const author = id ? contributors.filter((a) => a.id === id)[0] : undefined;
|
|
215
214
|
const componentProps = {
|
|
215
|
+
initialModal: 'authors',
|
|
216
|
+
view: this.view,
|
|
216
217
|
author,
|
|
217
|
-
authors: contributors,
|
|
218
|
-
affiliations,
|
|
219
|
-
onSaveAuthor: (contributor) => handleSaveContributor(this.view, contributor, this.getPos()),
|
|
220
|
-
onDeleteAuthor: (contributor) => handleDeleteContributor(this.view, contributor),
|
|
221
218
|
addNewAuthor: addNew,
|
|
222
219
|
};
|
|
223
220
|
this.popper?.remove();
|
|
224
|
-
this.popper = ReactSubView(this.props,
|
|
221
|
+
this.popper = ReactSubView(this.props, AuthorsAndAffiliationsModals, componentProps, this.node, this.getPos, this.view);
|
|
225
222
|
this.container.appendChild(this.popper);
|
|
226
223
|
};
|
|
227
224
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AffiliationAttrs, ContributorAttrs } from '../../lib/authors';
|
|
3
|
-
import { EditorView } from 'prosemirror-view';
|
|
4
3
|
export interface AffiliationsModalProps {
|
|
5
4
|
affiliation?: AffiliationAttrs;
|
|
6
5
|
authors: ContributorAttrs[];
|
|
@@ -9,9 +8,7 @@ export interface AffiliationsModalProps {
|
|
|
9
8
|
onDeleteAffiliation: (affiliation: AffiliationAttrs) => void;
|
|
10
9
|
onUpdateAuthors: (authors: ContributorAttrs[]) => void;
|
|
11
10
|
addNewAffiliation?: boolean;
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
onOpenAuthorsModal?: () => void;
|
|
12
13
|
}
|
|
13
14
|
export declare const AffiliationsModal: React.FC<AffiliationsModalProps>;
|
|
14
|
-
export declare const openAffiliationsModal: (pos: number, view?: EditorView) => void;
|
|
15
|
-
export declare const handleSaveAffiliation: (view: EditorView, affiliation: AffiliationAttrs, affiliationsPos: number) => void;
|
|
16
|
-
export declare const handleDeleteAffiliation: (view: EditorView, affiliation: AffiliationAttrs) => void;
|
|
17
|
-
export declare const handleUpdateAuthors: (view: EditorView, authors: ContributorAttrs[]) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AffiliationAttrs } from '../../lib/authors';
|
|
3
|
+
export interface AffiliationsPanelProps {
|
|
4
|
+
items: AffiliationAttrs[];
|
|
5
|
+
selectedItems: {
|
|
6
|
+
id: string;
|
|
7
|
+
}[];
|
|
8
|
+
onSelect: (id: string) => void;
|
|
9
|
+
onOpenAffiliationsModal: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const AffiliationsPanel: React.FC<AffiliationsPanelProps>;
|
|
@@ -18,6 +18,7 @@ import React, { MutableRefObject } from 'react';
|
|
|
18
18
|
import { ContributorAttrs } from '../../lib/authors';
|
|
19
19
|
export interface FormActions {
|
|
20
20
|
reset: () => void;
|
|
21
|
+
submitForm: () => Promise<void> | void;
|
|
21
22
|
}
|
|
22
23
|
interface AuthorDetailsFormProps {
|
|
23
24
|
values: ContributorAttrs;
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import React from 'react';
|
|
17
17
|
import { AffiliationAttrs, ContributorAttrs } from '../../lib/authors';
|
|
18
|
-
import { EditorView } from 'prosemirror-view';
|
|
19
18
|
export declare const authorsReducer: (state: ContributorAttrs[], action: import("../../lib/array-reducer").Action<ContributorAttrs>) => ContributorAttrs[];
|
|
20
19
|
export interface AuthorsModalProps {
|
|
21
20
|
author?: ContributorAttrs;
|
|
@@ -24,8 +23,7 @@ export interface AuthorsModalProps {
|
|
|
24
23
|
onSaveAuthor: (author: ContributorAttrs) => void;
|
|
25
24
|
onDeleteAuthor: (author: ContributorAttrs) => void;
|
|
26
25
|
addNewAuthor?: boolean;
|
|
26
|
+
onOpenAffiliationsModal?: () => void;
|
|
27
|
+
onClose?: () => void;
|
|
27
28
|
}
|
|
28
29
|
export declare const AuthorsModal: React.FC<AuthorsModalProps>;
|
|
29
|
-
export declare const openAuthorsModal: (pos: number, view?: EditorView) => void;
|
|
30
|
-
export declare const handleSaveContributor: (view: EditorView, contributor: ContributorAttrs, contributorsPos: number) => void;
|
|
31
|
-
export declare const handleDeleteContributor: (view: EditorView, contributor: ContributorAttrs) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface AuthorsPanelProps {
|
|
3
|
+
items: {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}[];
|
|
7
|
+
selectedItems?: {
|
|
8
|
+
id: string;
|
|
9
|
+
}[];
|
|
10
|
+
onSelect: (id: string) => void;
|
|
11
|
+
onOpenAuthorsModal: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const AuthorsPanel: React.FC<AuthorsPanelProps>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { AffiliationAttrs, ContributorAttrs } from '../../lib/authors';
|
|
2
2
|
export declare const affiliationsReducer: (state: AffiliationAttrs[], action: import("../../lib/array-reducer").Action<AffiliationAttrs>) => AffiliationAttrs[];
|
|
3
3
|
export declare const useManageAffiliations: (selection: ContributorAttrs | undefined, $affiliations: AffiliationAttrs[]) => {
|
|
4
|
-
showAffiliationDrawer: boolean;
|
|
5
|
-
setShowAffiliationDrawer: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
6
4
|
selectedAffiliations: {
|
|
7
5
|
id: string;
|
|
8
6
|
institution: string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { ManuscriptEditorView } from '@manuscripts/transform';
|
|
17
|
+
import { EditorView } from 'prosemirror-view';
|
|
18
|
+
import React from 'react';
|
|
19
|
+
import { AffiliationAttrs, ContributorAttrs } from '../../lib/authors';
|
|
20
|
+
export interface AuthorsAndAffiliationsModalsProps {
|
|
21
|
+
initialModal: 'authors' | 'affiliations';
|
|
22
|
+
view: ManuscriptEditorView;
|
|
23
|
+
author?: ContributorAttrs;
|
|
24
|
+
affiliation?: AffiliationAttrs;
|
|
25
|
+
addNewAuthor?: boolean;
|
|
26
|
+
addNewAffiliation?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare const AuthorsAndAffiliationsModals: React.FC<AuthorsAndAffiliationsModalsProps>;
|
|
29
|
+
export declare const openAuthorsAndAffiliationsModals: (pos: number, view: ManuscriptEditorView | EditorView | undefined, initialModal: "authors" | "affiliations") => void;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
17
|
+
export declare const ListItems: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<Omit<{
|
|
18
|
+
[x: string]: any;
|
|
19
|
+
[x: number]: any;
|
|
20
|
+
[x: symbol]: any;
|
|
21
|
+
} & {
|
|
22
|
+
theme?: import("styled-components").DefaultTheme | undefined;
|
|
23
|
+
} & {
|
|
24
|
+
as?: string | React.ComponentType<any> | undefined;
|
|
25
|
+
forwardedAs?: string | React.ComponentType<any> | undefined;
|
|
26
|
+
}, "ref"> & React.RefAttributes<HTMLElement>>, import("styled-components").DefaultTheme, {}, never>;
|
|
27
|
+
export interface GenericPanelProps {
|
|
28
|
+
title: string;
|
|
29
|
+
createLabel: string;
|
|
30
|
+
onCreate: () => void;
|
|
31
|
+
createDataCy: string;
|
|
32
|
+
emptyDataCy: string;
|
|
33
|
+
isEmpty: boolean;
|
|
34
|
+
emptyIcon: React.ReactNode;
|
|
35
|
+
emptyMessage: React.ReactNode;
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
export declare const GenericPanel: React.FC<GenericPanelProps>;
|
|
39
|
+
export interface ListItemProps {
|
|
40
|
+
selected: boolean;
|
|
41
|
+
onClick: () => void;
|
|
42
|
+
primary: React.ReactNode;
|
|
43
|
+
secondary?: React.ReactNode;
|
|
44
|
+
}
|
|
45
|
+
export declare const ListItem: React.FC<ListItemProps>;
|
|
46
|
+
export declare function useListSelectedIds(selectedItems: {
|
|
47
|
+
id: string;
|
|
48
|
+
}[]): Set<string>;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.12.
|
|
1
|
+
export declare const VERSION = "3.12.19";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/body-editor",
|
|
3
3
|
"description": "Prosemirror components for editing and viewing manuscripts",
|
|
4
|
-
"version": "3.12.
|
|
4
|
+
"version": "3.12.19",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AffiliationsDrawer = void 0;
|
|
7
|
-
const style_guide_1 = require("@manuscripts/style-guide");
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const AffiliationsDrawer = ({ items, selectedItems = [], onSelect, ...drawerProps }) => {
|
|
10
|
-
return (react_1.default.createElement(style_guide_1.Drawer, { ...drawerProps },
|
|
11
|
-
react_1.default.createElement(style_guide_1.DrawerItemsList, null, items.map((item) => (react_1.default.createElement(style_guide_1.DrawerListItem, { "data-cy": "item", key: item.id, selected: selectedItems?.map((a) => a.id).includes(item.id), onClick: () => onSelect(item.id) },
|
|
12
|
-
react_1.default.createElement(style_guide_1.DrawerIcon, null, selectedItems?.map((a) => a.id).includes(item.id) ? (react_1.default.createElement(style_guide_1.AddedIcon, { width: 22, height: 22 })) : (react_1.default.createElement(style_guide_1.AddIcon, { width: 22, height: 22 }))),
|
|
13
|
-
react_1.default.createElement(style_guide_1.DrawerLabelContainer, null,
|
|
14
|
-
react_1.default.createElement(style_guide_1.DrawerItemLabel, null, item.institution),
|
|
15
|
-
react_1.default.createElement(style_guide_1.DrawerItemMeta, null,
|
|
16
|
-
item.city && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
17
|
-
item.city,
|
|
18
|
-
item.county || item.country ? ', ' : '')),
|
|
19
|
-
item.county && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
20
|
-
item.county,
|
|
21
|
-
item.country ? ', ' : '')),
|
|
22
|
-
item.country && react_1.default.createElement(react_1.default.Fragment, null, item.country)))))))));
|
|
23
|
-
};
|
|
24
|
-
exports.AffiliationsDrawer = AffiliationsDrawer;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AddedIcon, AddIcon, Drawer, DrawerIcon, DrawerItemLabel, DrawerItemMeta, DrawerItemsList, DrawerLabelContainer, DrawerListItem, } from '@manuscripts/style-guide';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export const AffiliationsDrawer = ({ items, selectedItems = [], onSelect, ...drawerProps }) => {
|
|
4
|
-
return (React.createElement(Drawer, { ...drawerProps },
|
|
5
|
-
React.createElement(DrawerItemsList, null, items.map((item) => (React.createElement(DrawerListItem, { "data-cy": "item", key: item.id, selected: selectedItems?.map((a) => a.id).includes(item.id), onClick: () => onSelect(item.id) },
|
|
6
|
-
React.createElement(DrawerIcon, null, selectedItems?.map((a) => a.id).includes(item.id) ? (React.createElement(AddedIcon, { width: 22, height: 22 })) : (React.createElement(AddIcon, { width: 22, height: 22 }))),
|
|
7
|
-
React.createElement(DrawerLabelContainer, null,
|
|
8
|
-
React.createElement(DrawerItemLabel, null, item.institution),
|
|
9
|
-
React.createElement(DrawerItemMeta, null,
|
|
10
|
-
item.city && (React.createElement(React.Fragment, null,
|
|
11
|
-
item.city,
|
|
12
|
-
item.county || item.country ? ', ' : '')),
|
|
13
|
-
item.county && (React.createElement(React.Fragment, null,
|
|
14
|
-
item.county,
|
|
15
|
-
item.country ? ', ' : '')),
|
|
16
|
-
item.country && React.createElement(React.Fragment, null, item.country)))))))));
|
|
17
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DrawerProps } from '@manuscripts/style-guide';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { AffiliationAttrs } from '../../lib/authors';
|
|
4
|
-
interface AffiliationsDrawerProps {
|
|
5
|
-
items: AffiliationAttrs[];
|
|
6
|
-
selectedItems: {
|
|
7
|
-
id: string;
|
|
8
|
-
}[];
|
|
9
|
-
onSelect: (id: string) => void;
|
|
10
|
-
}
|
|
11
|
-
export declare const AffiliationsDrawer: React.FC<AffiliationsDrawerProps & Omit<DrawerProps, 'children'>>;
|
|
12
|
-
export {};
|