@manuscripts/body-editor 2.7.7 → 2.7.8-LEAN-4213.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/affiliations/AffiliationForm.js +106 -0
- package/dist/cjs/components/affiliations/AffiliationItem.js +112 -0
- package/dist/cjs/components/affiliations/AffiliationList.js +47 -0
- package/dist/cjs/components/affiliations/AffiliationsModal.js +418 -0
- package/dist/cjs/components/authors/AuthorDetailsForm.js +10 -2
- package/dist/cjs/components/authors/AuthorList.js +1 -1
- package/dist/cjs/components/authors/AuthorsModal.js +184 -80
- package/dist/cjs/components/authors/DraggableAuthor.js +0 -3
- package/dist/cjs/components/dialog/ConfirmationDialog.js +86 -0
- package/dist/cjs/components/form/FormFooter.js +32 -0
- package/dist/cjs/components/form/FormPlaceholder.js +43 -0
- package/dist/cjs/components/{authors/AuthorActions.js → form/ModalFormActions.js} +12 -11
- package/dist/cjs/plugins/affiliations.js +5 -38
- package/dist/cjs/useEditor.js +0 -1
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/affiliations.js +82 -14
- package/dist/cjs/views/contributors.js +1 -9
- package/dist/es/components/affiliations/AffiliationForm.js +76 -0
- package/dist/es/components/affiliations/AffiliationItem.js +82 -0
- package/dist/es/components/affiliations/AffiliationList.js +40 -0
- package/dist/es/components/affiliations/AffiliationsModal.js +388 -0
- package/dist/es/components/authors/AuthorDetailsForm.js +11 -3
- package/dist/es/components/authors/AuthorList.js +1 -1
- package/dist/es/components/authors/AuthorsModal.js +183 -79
- package/dist/es/components/authors/DraggableAuthor.js +0 -3
- package/dist/es/components/dialog/ConfirmationDialog.js +79 -0
- package/dist/es/components/form/FormFooter.js +27 -0
- package/dist/es/components/form/FormPlaceholder.js +36 -0
- package/dist/es/components/{authors/AuthorActions.js → form/ModalFormActions.js} +10 -9
- package/dist/es/plugins/affiliations.js +6 -39
- package/dist/es/useEditor.js +0 -1
- package/dist/es/versions.js +1 -1
- package/dist/es/views/affiliations.js +85 -17
- package/dist/es/views/contributors.js +1 -9
- package/dist/types/components/{authors → affiliations}/AffiliationForm.d.ts +5 -0
- package/dist/types/components/affiliations/AffiliationItem.d.ts +10 -0
- package/dist/types/components/affiliations/AffiliationList.d.ts +26 -0
- package/dist/types/components/affiliations/AffiliationsModal.d.ts +11 -0
- package/dist/types/components/authors/AuthorDetailsForm.d.ts +1 -0
- package/dist/types/components/authors/AuthorsModal.d.ts +2 -1
- package/dist/types/components/dialog/ConfirmationDialog.d.ts +15 -0
- package/dist/types/components/form/FormFooter.d.ts +5 -0
- package/dist/types/components/form/FormPlaceholder.d.ts +9 -0
- package/dist/types/components/{authors/AuthorActions.d.ts → form/ModalFormActions.d.ts} +4 -3
- package/dist/types/lib/dnd.d.ts +1 -1
- package/dist/types/selection.d.ts +7 -1
- package/dist/types/versions.d.ts +1 -1
- package/dist/types/views/affiliations.d.ts +11 -0
- package/dist/types/views/contributors.d.ts +0 -1
- package/package.json +2 -2
- package/styles/AdvancedEditor.css +8 -4
- package/styles/Editor.css +7 -0
- package/dist/cjs/components/authors/AffiliationButton.js +0 -104
- package/dist/cjs/components/authors/AffiliationForm.js +0 -50
- package/dist/cjs/components/authors/AuthorAffiliations.js +0 -120
- package/dist/cjs/components/authors/AuthorFormPlaceholder.js +0 -71
- package/dist/cjs/components/authors/DeleteAuthorConfirmationDialog.js +0 -36
- package/dist/cjs/components/authors/RequiredFieldConfirmationDialog.js +0 -39
- package/dist/cjs/components/authors/SaveAuthorConfirmationDialog.js +0 -39
- package/dist/es/components/authors/AffiliationButton.js +0 -74
- package/dist/es/components/authors/AffiliationForm.js +0 -43
- package/dist/es/components/authors/AuthorAffiliations.js +0 -89
- package/dist/es/components/authors/AuthorFormPlaceholder.js +0 -64
- package/dist/es/components/authors/DeleteAuthorConfirmationDialog.js +0 -29
- package/dist/es/components/authors/RequiredFieldConfirmationDialog.js +0 -32
- package/dist/es/components/authors/SaveAuthorConfirmationDialog.js +0 -32
- package/dist/types/components/authors/AffiliationButton.d.ts +0 -8
- package/dist/types/components/authors/AuthorAffiliations.d.ts +0 -11
- package/dist/types/components/authors/AuthorFormPlaceholder.d.ts +0 -2
- package/dist/types/components/authors/DeleteAuthorConfirmationDialog.d.ts +0 -7
- package/dist/types/components/authors/RequiredFieldConfirmationDialog.d.ts +0 -7
- package/dist/types/components/authors/SaveAuthorConfirmationDialog.d.ts +0 -7
|
@@ -18,8 +18,7 @@ import { isEqual } from 'lodash';
|
|
|
18
18
|
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
19
19
|
import { Decoration, DecorationSet } from 'prosemirror-view';
|
|
20
20
|
import { authorComparator, } from '../lib/authors';
|
|
21
|
-
import {
|
|
22
|
-
import { isDeleted, isPendingInsert } from '../lib/track-changes-utils';
|
|
21
|
+
import { isDeleted } from '../lib/track-changes-utils';
|
|
23
22
|
export const affiliationsKey = new PluginKey('affiliations');
|
|
24
23
|
let id = 1;
|
|
25
24
|
export const buildPluginState = (doc, $old) => {
|
|
@@ -45,9 +44,12 @@ export const buildPluginState = (doc, $old) => {
|
|
|
45
44
|
return $old;
|
|
46
45
|
}
|
|
47
46
|
const iAffiliations = new Set();
|
|
48
|
-
contributors
|
|
47
|
+
contributors
|
|
48
|
+
.filter((contrib) => !deletedContribId.has(contrib.id))
|
|
49
|
+
.sort(authorComparator)
|
|
50
|
+
.forEach((attrs) => {
|
|
49
51
|
attrs.affiliations.forEach((aff) => {
|
|
50
|
-
|
|
52
|
+
iAffiliations.add(aff);
|
|
51
53
|
});
|
|
52
54
|
});
|
|
53
55
|
const indexedAffiliationIds = new Map([...iAffiliations].map((id, i) => [id, i + 1]));
|
|
@@ -83,41 +85,6 @@ export default () => {
|
|
|
83
85
|
}
|
|
84
86
|
},
|
|
85
87
|
},
|
|
86
|
-
appendTransaction(transactions, oldState, newState) {
|
|
87
|
-
const affs = affiliationsKey.getState(newState);
|
|
88
|
-
if (!affs || !transactions.find((tr) => tr.docChanged || isInit(tr))) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
const $old = affiliationsKey.getState(oldState);
|
|
92
|
-
const affiliations = new Map();
|
|
93
|
-
newState.doc.descendants((node, pos) => {
|
|
94
|
-
if (isAffiliationNode(node)) {
|
|
95
|
-
affiliations.set(node.attrs.id, [node, pos]);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
const deleteIDs = [];
|
|
99
|
-
for (const [id] of $old.indexedAffiliationIds.entries()) {
|
|
100
|
-
if (!affs.indexedAffiliationIds.has(id)) {
|
|
101
|
-
deleteIDs.push(id);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
if (!deleteIDs.length) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const tr = newState.tr;
|
|
108
|
-
tr.setMeta('origin', 'affiliations');
|
|
109
|
-
for (const id of deleteIDs) {
|
|
110
|
-
const affiliation = affiliations.get(id);
|
|
111
|
-
if (!affiliation) {
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
const [node, pos] = affiliation;
|
|
115
|
-
if (node && !isPendingInsert(node)) {
|
|
116
|
-
tr.delete(pos, pos + node.nodeSize);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return tr;
|
|
120
|
-
},
|
|
121
88
|
props: {
|
|
122
89
|
decorations: (state) => { var _a; return (_a = affiliationsKey.getState(state)) === null || _a === void 0 ? void 0 : _a.decorations; },
|
|
123
90
|
},
|
package/dist/es/useEditor.js
CHANGED
|
@@ -42,7 +42,6 @@ export const useEditor = (externalProps) => {
|
|
|
42
42
|
const localVersion = getVersion(view.current.state);
|
|
43
43
|
const since = yield collabProvider.stepsSince(localVersion);
|
|
44
44
|
if (since && since.version <= localVersion) {
|
|
45
|
-
console.log('detected run away update of document');
|
|
46
45
|
return;
|
|
47
46
|
}
|
|
48
47
|
if ((since === null || since === void 0 ? void 0 : since.steps.length) && since.clientIDs.length) {
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.7.
|
|
1
|
+
export const VERSION = '2.7.8-LEAN-4213.0';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -13,19 +13,101 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { ContextMenu } from '@manuscripts/style-guide';
|
|
17
|
+
import { schema } from '@manuscripts/transform';
|
|
16
18
|
import { NodeSelection } from 'prosemirror-state';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
19
|
+
import { AffiliationsModal, } from '../components/affiliations/AffiliationsModal';
|
|
20
|
+
import { affiliationName, } from '../lib/authors';
|
|
21
|
+
import { addTrackChangesAttributes, isDeleted, } from '../lib/track-changes-utils';
|
|
22
|
+
import { deleteNode, findChildByID, findChildrenAttrsByType, updateNodeAttrs, } from '../lib/view';
|
|
20
23
|
import { affiliationsKey } from '../plugins/affiliations';
|
|
21
24
|
import { selectedSuggestionKey } from '../plugins/selected-suggestion';
|
|
22
25
|
import BlockView from './block_view';
|
|
23
26
|
import { createNodeView } from './creators';
|
|
27
|
+
import ReactSubView from './ReactSubView';
|
|
24
28
|
export class AffiliationsView extends BlockView {
|
|
25
29
|
constructor() {
|
|
26
30
|
super(...arguments);
|
|
27
31
|
this.ignoreMutation = () => true;
|
|
28
32
|
this.stopEvent = () => true;
|
|
33
|
+
this.handleClick = (event) => {
|
|
34
|
+
const element = event.target;
|
|
35
|
+
const item = element.closest('.affiliation');
|
|
36
|
+
if (item) {
|
|
37
|
+
const node = findChildByID(this.view, item.id);
|
|
38
|
+
if (!node) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const view = this.view;
|
|
42
|
+
const tr = view.state.tr;
|
|
43
|
+
tr.setSelection(NodeSelection.create(view.state.doc, node.pos));
|
|
44
|
+
view.dispatch(tr);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
this.insertAffiliationNode = (attrs) => {
|
|
48
|
+
const pos = this.getPos();
|
|
49
|
+
const tr = this.view.state.tr;
|
|
50
|
+
const node = schema.nodes.affiliation.create(attrs);
|
|
51
|
+
this.view.dispatch(tr.insert(pos + 1, node));
|
|
52
|
+
};
|
|
53
|
+
this.handleSaveAffiliation = (affiliation) => {
|
|
54
|
+
const update = updateNodeAttrs(this.view, schema.nodes.affiliation, affiliation);
|
|
55
|
+
if (!update) {
|
|
56
|
+
this.insertAffiliationNode(affiliation);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
this.handleDeleteAffiliation = (affiliation) => {
|
|
60
|
+
deleteNode(this.view, affiliation.id);
|
|
61
|
+
};
|
|
62
|
+
this.handleEdit = (addNew) => {
|
|
63
|
+
var _a;
|
|
64
|
+
this.props.popper.destroy();
|
|
65
|
+
const contributors = findChildrenAttrsByType(this.view, schema.nodes.contributor);
|
|
66
|
+
const affiliations = findChildrenAttrsByType(this.view, schema.nodes.affiliation);
|
|
67
|
+
const componentProps = {
|
|
68
|
+
authors: contributors,
|
|
69
|
+
affiliations,
|
|
70
|
+
onSaveAffiliation: this.handleSaveAffiliation,
|
|
71
|
+
onDeleteAffiliation: this.handleDeleteAffiliation,
|
|
72
|
+
onUpdateAuthors: this.handleUpdateAuthors,
|
|
73
|
+
addNewAffiliation: addNew,
|
|
74
|
+
};
|
|
75
|
+
(_a = this.popper) === null || _a === void 0 ? void 0 : _a.remove();
|
|
76
|
+
this.popper = ReactSubView(this.props, AffiliationsModal, componentProps, this.node, this.getPos, this.view);
|
|
77
|
+
this.container.appendChild(this.popper);
|
|
78
|
+
};
|
|
79
|
+
this.showContextMenu = () => {
|
|
80
|
+
const can = this.props.getCapabilities();
|
|
81
|
+
const componentProps = {
|
|
82
|
+
actions: [],
|
|
83
|
+
};
|
|
84
|
+
if (can.editArticle) {
|
|
85
|
+
componentProps.actions.push({
|
|
86
|
+
label: 'New Affiliation',
|
|
87
|
+
action: () => this.handleEdit(true),
|
|
88
|
+
icon: 'AddOutline',
|
|
89
|
+
});
|
|
90
|
+
componentProps.actions.push({
|
|
91
|
+
label: 'Edit',
|
|
92
|
+
action: () => this.handleEdit(),
|
|
93
|
+
icon: 'Edit',
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
|
|
97
|
+
return this.contextMenu;
|
|
98
|
+
};
|
|
99
|
+
this.selectNode = () => {
|
|
100
|
+
this.dom.classList.add('ProseMirror-selectednode');
|
|
101
|
+
if (!isDeleted(this.node)) {
|
|
102
|
+
this.handleEdit(true);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
this.actionGutterButtons = () => [this.showContextMenu()];
|
|
106
|
+
this.handleUpdateAuthors = (authors) => {
|
|
107
|
+
authors.forEach((author) => {
|
|
108
|
+
updateNodeAttrs(this.view, schema.nodes.contributor, author);
|
|
109
|
+
});
|
|
110
|
+
};
|
|
29
111
|
}
|
|
30
112
|
createElement() {
|
|
31
113
|
this.container = document.createElement('div');
|
|
@@ -84,20 +166,6 @@ export class AffiliationsView extends BlockView {
|
|
|
84
166
|
const index2 = aff2.index || 10000;
|
|
85
167
|
return index1 - index2;
|
|
86
168
|
}
|
|
87
|
-
handleClick(event) {
|
|
88
|
-
const element = event.target;
|
|
89
|
-
const item = element.closest('.affiliation');
|
|
90
|
-
if (item) {
|
|
91
|
-
const node = findChildByID(this.view, item.id);
|
|
92
|
-
if (!node) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const view = this.view;
|
|
96
|
-
const tr = view.state.tr;
|
|
97
|
-
tr.setSelection(NodeSelection.create(view.state.doc, node.pos));
|
|
98
|
-
view.dispatch(tr);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
169
|
updateSelection() {
|
|
102
170
|
var _a;
|
|
103
171
|
const state = this.view.state;
|
|
@@ -199,11 +199,11 @@ export class ContributorsView extends BlockView {
|
|
|
199
199
|
affiliations,
|
|
200
200
|
onSaveAuthor: this.handleSaveAuthor,
|
|
201
201
|
onDeleteAuthor: this.handleDeleteAuthor,
|
|
202
|
-
onSaveAffiliation: this.handleSaveAffiliation,
|
|
203
202
|
addNewAuthor: addNew,
|
|
204
203
|
};
|
|
205
204
|
(_a = this.popper) === null || _a === void 0 ? void 0 : _a.remove();
|
|
206
205
|
this.popper = ReactSubView(this.props, AuthorsModal, componentProps, this.node, this.getPos, this.view);
|
|
206
|
+
console.dir(this.popper);
|
|
207
207
|
this.container.appendChild(this.popper);
|
|
208
208
|
};
|
|
209
209
|
this.handleSaveAuthor = (author) => {
|
|
@@ -215,14 +215,6 @@ export class ContributorsView extends BlockView {
|
|
|
215
215
|
this.handleDeleteAuthor = (author) => {
|
|
216
216
|
deleteNode(this.view, author.id);
|
|
217
217
|
};
|
|
218
|
-
this.handleSaveAffiliation = (affiliation) => {
|
|
219
|
-
if (!findChildByID(this.view, affiliation.id)) {
|
|
220
|
-
this.insertAffiliationNode(affiliation);
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
updateNodeAttrs(this.view, schema.nodes.affiliation, affiliation);
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
218
|
this.insertAuthorNode = (attrs) => {
|
|
227
219
|
const parent = findChildByType(this.view, schema.nodes.contributors);
|
|
228
220
|
const tr = this.view.state.tr;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AffiliationAttrs } from '../../lib/authors';
|
|
3
|
+
export interface FormActions {
|
|
4
|
+
reset: () => void;
|
|
5
|
+
}
|
|
3
6
|
export interface AffiliationFormProps {
|
|
4
7
|
values: AffiliationAttrs;
|
|
5
8
|
onSave: (values: AffiliationAttrs) => void;
|
|
9
|
+
onChange: (values: AffiliationAttrs) => void;
|
|
10
|
+
actionsRef?: React.MutableRefObject<FormActions | undefined>;
|
|
6
11
|
}
|
|
7
12
|
export declare const AffiliationForm: React.FC<AffiliationFormProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AffiliationAttrs } from '../../lib/authors';
|
|
3
|
+
export interface AffiliationContainerProps {
|
|
4
|
+
affiliation: AffiliationAttrs;
|
|
5
|
+
isSelected: boolean;
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
onDelete: () => void;
|
|
8
|
+
showSuccessIcon?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const AffiliationItem: React.FC<AffiliationContainerProps>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 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
|
+
import { AffiliationAttrs } from '../../lib/authors';
|
|
18
|
+
interface AffiliationListProps {
|
|
19
|
+
affiliation?: AffiliationAttrs;
|
|
20
|
+
affiliations: AffiliationAttrs[];
|
|
21
|
+
onSelect: (item: AffiliationAttrs) => void;
|
|
22
|
+
onDelete: () => void;
|
|
23
|
+
lastSavedAffiliationId?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const AffiliationList: React.FC<AffiliationListProps>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AffiliationAttrs, ContributorAttrs } from '../../lib/authors';
|
|
3
|
+
export interface AffiliationsModalProps {
|
|
4
|
+
authors: ContributorAttrs[];
|
|
5
|
+
affiliations: AffiliationAttrs[];
|
|
6
|
+
onSaveAffiliation: (affiliation: AffiliationAttrs) => void;
|
|
7
|
+
onDeleteAffiliation: (affiliation: AffiliationAttrs) => void;
|
|
8
|
+
onUpdateAuthors: (authors: ContributorAttrs[]) => void;
|
|
9
|
+
addNewAffiliation?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const AffiliationsModal: React.FC<AffiliationsModalProps>;
|
|
@@ -26,6 +26,7 @@ interface AuthorDetailsFormProps {
|
|
|
26
26
|
onSave: (values: ContributorAttrs) => void;
|
|
27
27
|
actionsRef?: MutableRefObject<FormActions | undefined>;
|
|
28
28
|
isEmailRequired?: boolean;
|
|
29
|
+
selectedAffiliations?: string[];
|
|
29
30
|
}
|
|
30
31
|
export declare const AuthorDetailsForm: React.FC<AuthorDetailsFormProps>;
|
|
31
32
|
export {};
|
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import React from 'react';
|
|
17
17
|
import { AffiliationAttrs, ContributorAttrs } from '../../lib/authors';
|
|
18
|
+
export declare const authorsReducer: (state: ContributorAttrs[], action: import("../../lib/array-reducer").Action<ContributorAttrs>) => ContributorAttrs[];
|
|
19
|
+
export declare const affiliationsReducer: (state: AffiliationAttrs[], action: import("../../lib/array-reducer").Action<AffiliationAttrs>) => AffiliationAttrs[];
|
|
18
20
|
export interface AuthorsModalProps {
|
|
19
21
|
author?: ContributorAttrs;
|
|
20
22
|
authors: ContributorAttrs[];
|
|
21
23
|
affiliations: AffiliationAttrs[];
|
|
22
24
|
onSaveAuthor: (author: ContributorAttrs) => void;
|
|
23
25
|
onDeleteAuthor: (author: ContributorAttrs) => void;
|
|
24
|
-
onSaveAffiliation: (affiliation: AffiliationAttrs) => void;
|
|
25
26
|
addNewAuthor?: boolean;
|
|
26
27
|
}
|
|
27
28
|
export declare const AuthorsModal: React.FC<AuthorsModalProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare enum DialogType {
|
|
3
|
+
SAVE = "save",
|
|
4
|
+
DELETE = "delete",
|
|
5
|
+
REQUIRED = "required"
|
|
6
|
+
}
|
|
7
|
+
interface ConfirmationDialogProps {
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
type: DialogType;
|
|
10
|
+
entityType: string;
|
|
11
|
+
onPrimary: () => void;
|
|
12
|
+
onSecondary: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const ConfirmationDialog: React.FC<ConfirmationDialogProps>;
|
|
15
|
+
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export interface
|
|
2
|
+
export interface FormActionsProps {
|
|
3
|
+
type: string;
|
|
3
4
|
onSave: () => void;
|
|
4
5
|
onDelete: () => void;
|
|
5
6
|
showDeleteDialog: boolean;
|
|
6
7
|
handleShowDeleteDialog: () => void;
|
|
7
|
-
|
|
8
|
+
newEntity: boolean;
|
|
8
9
|
isDisableSave: boolean;
|
|
9
10
|
}
|
|
10
|
-
export declare const
|
|
11
|
+
export declare const ModalFormActions: React.FC<FormActionsProps>;
|
package/dist/types/lib/dnd.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DropTargetMonitor } from 'react-dnd';
|
|
2
2
|
export type DropSide = 'before' | 'after';
|
|
3
|
-
export declare const getDropSide: (element: Element, monitor: DropTargetMonitor) => "
|
|
3
|
+
export declare const getDropSide: (element: Element, monitor: DropTargetMonitor) => "before" | "after";
|
|
@@ -2,12 +2,18 @@ import { ManuscriptEditorState } from '@manuscripts/transform';
|
|
|
2
2
|
import { Node, ResolvedPos } from 'prosemirror-model';
|
|
3
3
|
import { Selection } from 'prosemirror-state';
|
|
4
4
|
import { Mappable } from 'prosemirror-transform';
|
|
5
|
+
interface NodesSelectionJSON {
|
|
6
|
+
type: 'inlineNodes';
|
|
7
|
+
startNode: ResolvedPos;
|
|
8
|
+
endNode: ResolvedPos;
|
|
9
|
+
}
|
|
5
10
|
export declare class NodesSelection extends Selection {
|
|
6
11
|
$startNode: ResolvedPos;
|
|
7
12
|
$endNode: ResolvedPos;
|
|
8
13
|
constructor($from: ResolvedPos, $to: ResolvedPos);
|
|
9
14
|
eq(selection: Selection): boolean;
|
|
10
15
|
map(doc: Node, mapping: Mappable): Selection;
|
|
11
|
-
toJSON():
|
|
16
|
+
toJSON(): NodesSelectionJSON;
|
|
12
17
|
}
|
|
13
18
|
export declare const getSelectionChangeGroup: (state: ManuscriptEditorState) => import("@manuscripts/track-changes-plugin").TrackedChange[] | undefined;
|
|
19
|
+
export {};
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.7.
|
|
1
|
+
export declare const VERSION = "2.7.8-LEAN-4213.0";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
|
@@ -14,11 +14,14 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { AffiliationNode } from '@manuscripts/transform';
|
|
17
|
+
import { AffiliationAttrs, ContributorAttrs } from '../lib/authors';
|
|
17
18
|
import { Trackable } from '../types';
|
|
18
19
|
import BlockView from './block_view';
|
|
19
20
|
export declare class AffiliationsView extends BlockView<Trackable<AffiliationNode>> {
|
|
21
|
+
contextMenu: HTMLElement;
|
|
20
22
|
version: string;
|
|
21
23
|
container: HTMLElement;
|
|
24
|
+
popper?: HTMLElement;
|
|
22
25
|
ignoreMutation: () => boolean;
|
|
23
26
|
stopEvent: () => boolean;
|
|
24
27
|
createElement(): void;
|
|
@@ -28,6 +31,14 @@ export declare class AffiliationsView extends BlockView<Trackable<AffiliationNod
|
|
|
28
31
|
private sortAffiliations;
|
|
29
32
|
private handleClick;
|
|
30
33
|
private updateSelection;
|
|
34
|
+
insertAffiliationNode: (attrs: AffiliationAttrs) => void;
|
|
35
|
+
handleSaveAffiliation: (affiliation: AffiliationAttrs) => void;
|
|
36
|
+
handleDeleteAffiliation: (affiliation: AffiliationAttrs) => void;
|
|
37
|
+
handleEdit: (addNew?: boolean) => void;
|
|
38
|
+
showContextMenu: () => HTMLElement;
|
|
39
|
+
selectNode: () => void;
|
|
40
|
+
actionGutterButtons: () => HTMLElement[];
|
|
41
|
+
handleUpdateAuthors: (authors: ContributorAttrs[]) => void;
|
|
31
42
|
}
|
|
32
43
|
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<AffiliationsView>;
|
|
33
44
|
export default _default;
|
|
@@ -42,7 +42,6 @@ export declare class ContributorsView extends BlockView<Trackable<ContributorsNo
|
|
|
42
42
|
handleEdit: (id: string, addNew?: boolean) => void;
|
|
43
43
|
handleSaveAuthor: (author: ContributorAttrs) => void;
|
|
44
44
|
handleDeleteAuthor: (author: ContributorAttrs) => void;
|
|
45
|
-
handleSaveAffiliation: (affiliation: AffiliationAttrs) => void;
|
|
46
45
|
insertAuthorNode: (attrs: ContributorAttrs) => void;
|
|
47
46
|
insertAffiliationNode: (attrs: AffiliationAttrs) => void;
|
|
48
47
|
actionGutterButtons: () => HTMLElement[];
|
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": "2.7.
|
|
4
|
+
"version": "2.7.8-LEAN-4213.0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@iarna/word-count": "^1.1.2",
|
|
33
33
|
"@manuscripts/json-schema": "2.2.11",
|
|
34
34
|
"@manuscripts/library": "1.3.11",
|
|
35
|
-
"@manuscripts/style-guide": "2.0.
|
|
35
|
+
"@manuscripts/style-guide": "2.0.30-LEAN-4213.1",
|
|
36
36
|
"@manuscripts/track-changes-plugin": "1.9.1",
|
|
37
37
|
"@manuscripts/transform": "3.0.35",
|
|
38
38
|
"@popperjs/core": "^2.11.8",
|
|
@@ -826,7 +826,8 @@ figure.block:has(.equation.set_attrs.selected-suggestion) {
|
|
|
826
826
|
.contributors-list .separator {
|
|
827
827
|
margin-right: 4px;
|
|
828
828
|
}
|
|
829
|
-
.block-contributors .tools-panel
|
|
829
|
+
.block-contributors .tools-panel,
|
|
830
|
+
.block-affiliations .tools-panel {
|
|
830
831
|
position: initial;
|
|
831
832
|
display: flex;
|
|
832
833
|
flex: 1;
|
|
@@ -1064,14 +1065,17 @@ th:hover > .table-context-menu-button,
|
|
|
1064
1065
|
pointer-events: none;
|
|
1065
1066
|
}
|
|
1066
1067
|
|
|
1067
|
-
|
|
1068
|
+
|
|
1069
|
+
.ProseMirror .block-contributors .context-menu > div,
|
|
1070
|
+
.ProseMirror .block-affiliations .context-menu > div {
|
|
1068
1071
|
border-radius: 4px;
|
|
1069
1072
|
border: 1px solid #c9c9c9;
|
|
1070
1073
|
background: #fff;
|
|
1071
1074
|
box-shadow: 0px 4px 9px 0px rgba(0, 0, 0, 0.3);
|
|
1072
1075
|
}
|
|
1073
1076
|
|
|
1074
|
-
.ProseMirror .block-contributors .action-gutter
|
|
1075
|
-
|
|
1077
|
+
.ProseMirror .block-contributors .action-gutter,
|
|
1078
|
+
.ProseMirror .block-affiliations .action-gutter {
|
|
1079
|
+
right: 24px;
|
|
1076
1080
|
pointer-events: none;
|
|
1077
1081
|
}
|
package/styles/Editor.css
CHANGED
|
@@ -694,6 +694,13 @@
|
|
|
694
694
|
z-index: 2;
|
|
695
695
|
}
|
|
696
696
|
|
|
697
|
+
.ProseMirror .block-container.block-affiliations:hover .action-gutter {
|
|
698
|
+
pointer-events: visible;
|
|
699
|
+
opacity: 1;
|
|
700
|
+
z-index: 2;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
|
|
697
704
|
.ProseMirror .block-box_element:hover > .block-gutter {
|
|
698
705
|
opacity: 1;
|
|
699
706
|
z-index: 2;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.AffiliationButton = void 0;
|
|
30
|
-
const style_guide_1 = require("@manuscripts/style-guide");
|
|
31
|
-
const lodash_1 = require("lodash");
|
|
32
|
-
const react_1 = __importStar(require("react"));
|
|
33
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
34
|
-
const authors_1 = require("../../lib/authors");
|
|
35
|
-
const AffiliationForm_1 = require("./AffiliationForm");
|
|
36
|
-
const Container = styled_components_1.default.div `
|
|
37
|
-
border: 1px solid ${(props) => props.theme.colors.border.field.default};
|
|
38
|
-
border-radius: ${(props) => props.theme.grid.radius.default};
|
|
39
|
-
background: ${(props) => props.theme.colors.background.primary};
|
|
40
|
-
margin-bottom: 2px;
|
|
41
|
-
overflow: hidden;
|
|
42
|
-
`;
|
|
43
|
-
const AffiliationFormContainer = styled_components_1.default.div `
|
|
44
|
-
border: 1px solid ${(props) => props.theme.colors.border.field.default};
|
|
45
|
-
border-radius: ${(props) => props.theme.grid.radius.default};
|
|
46
|
-
margin: 6px 12px 12px;
|
|
47
|
-
overflow: hidden;
|
|
48
|
-
`;
|
|
49
|
-
const AffiliationLabel = styled_components_1.default.div `
|
|
50
|
-
margin: 0;
|
|
51
|
-
display: flex;
|
|
52
|
-
align-items: center;
|
|
53
|
-
font-size: 0.875rem;
|
|
54
|
-
padding-right: 0.5rem;
|
|
55
|
-
`;
|
|
56
|
-
const DropdownIndicator = (0, styled_components_1.default)(style_guide_1.ArrowDownCircleIcon) `
|
|
57
|
-
border: 0;
|
|
58
|
-
border-radius: 50%;
|
|
59
|
-
margin-right: 0.6em;
|
|
60
|
-
min-width: 20px;
|
|
61
|
-
`;
|
|
62
|
-
const ToggleButton = styled_components_1.default.button `
|
|
63
|
-
flex-grow: 1;
|
|
64
|
-
display: flex;
|
|
65
|
-
align-items: center;
|
|
66
|
-
width: 100%;
|
|
67
|
-
background: transparent;
|
|
68
|
-
border: none;
|
|
69
|
-
text-align: left;
|
|
70
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
71
|
-
font-size: 1rem;
|
|
72
|
-
padding: 0.6em 0.5em;
|
|
73
|
-
outline: none;
|
|
74
|
-
|
|
75
|
-
&.open svg {
|
|
76
|
-
transform: rotateX(180deg);
|
|
77
|
-
}
|
|
78
|
-
`;
|
|
79
|
-
const RemoveButton = styled_components_1.default.div `
|
|
80
|
-
cursor: pointer;
|
|
81
|
-
`;
|
|
82
|
-
const AffiliationButton = ({ affiliation, onSave, onRemove, }) => {
|
|
83
|
-
const [isOpen, setOpen] = (0, react_1.useState)(false);
|
|
84
|
-
const toggleOpen = () => {
|
|
85
|
-
setOpen((o) => !o);
|
|
86
|
-
};
|
|
87
|
-
const handleSave = (values) => {
|
|
88
|
-
if ((0, lodash_1.isEqual)(values, affiliation)) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
const copy = Object.assign(Object.assign({}, affiliation), values);
|
|
92
|
-
onSave(copy);
|
|
93
|
-
};
|
|
94
|
-
return (react_1.default.createElement(Container, null,
|
|
95
|
-
react_1.default.createElement(AffiliationLabel, null,
|
|
96
|
-
react_1.default.createElement(ToggleButton, { type: "button", className: isOpen ? 'open' : '', onClick: toggleOpen },
|
|
97
|
-
react_1.default.createElement(DropdownIndicator, null),
|
|
98
|
-
(0, authors_1.affiliationLabel)(affiliation)),
|
|
99
|
-
react_1.default.createElement(RemoveButton, { onClick: onRemove },
|
|
100
|
-
react_1.default.createElement(style_guide_1.DeleteIcon, null))),
|
|
101
|
-
isOpen && (react_1.default.createElement(AffiliationFormContainer, null,
|
|
102
|
-
react_1.default.createElement(AffiliationForm_1.AffiliationForm, { values: affiliation, onSave: handleSave })))));
|
|
103
|
-
};
|
|
104
|
-
exports.AffiliationButton = AffiliationButton;
|