@manuscripts/body-editor 1.7.19 → 1.7.20

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.
Files changed (83) hide show
  1. package/dist/cjs/components/authors/AffiliationButton.js +105 -0
  2. package/dist/cjs/components/authors/AffiliationForm.js +50 -0
  3. package/dist/cjs/components/authors/AuthorActions.js +61 -0
  4. package/dist/cjs/components/authors/AuthorAffiliations.js +116 -0
  5. package/dist/cjs/components/authors/AuthorDetailsForm.js +97 -0
  6. package/dist/cjs/components/authors/AuthorFormPlaceholder.js +57 -0
  7. package/dist/cjs/components/authors/AuthorList.js +40 -0
  8. package/dist/cjs/components/authors/AuthorsModal.js +226 -0
  9. package/dist/cjs/components/authors/ChangeHandlingForm.js +37 -0
  10. package/dist/cjs/components/authors/DeleteAuthorConfirmationDialog.js +23 -0
  11. package/dist/cjs/components/authors/DraggableAuthor.js +170 -0
  12. package/dist/cjs/components/authors/SaveAuthorConfirmationDialog.js +21 -0
  13. package/dist/cjs/lib/array-reducer.js +2 -0
  14. package/dist/cjs/lib/authors.js +43 -0
  15. package/dist/cjs/lib/track-changes-utils.js +5 -1
  16. package/dist/cjs/lib/utils.js +1 -5
  17. package/dist/cjs/lib/view.js +97 -0
  18. package/dist/cjs/views/base_node_view.js +0 -19
  19. package/dist/cjs/views/bibliography_element.js +3 -2
  20. package/dist/cjs/views/citation_editable.js +3 -2
  21. package/dist/cjs/views/contributors.js +78 -25
  22. package/dist/es/components/authors/AffiliationButton.js +75 -0
  23. package/dist/es/components/authors/AffiliationForm.js +43 -0
  24. package/dist/es/components/authors/AuthorActions.js +31 -0
  25. package/dist/es/components/authors/AuthorAffiliations.js +85 -0
  26. package/dist/es/components/authors/AuthorDetailsForm.js +67 -0
  27. package/dist/es/components/authors/AuthorFormPlaceholder.js +50 -0
  28. package/dist/es/components/authors/AuthorList.js +33 -0
  29. package/dist/es/components/authors/AuthorsModal.js +196 -0
  30. package/dist/es/components/authors/ChangeHandlingForm.js +10 -0
  31. package/dist/es/components/authors/DeleteAuthorConfirmationDialog.js +16 -0
  32. package/dist/es/components/authors/DraggableAuthor.js +140 -0
  33. package/dist/es/components/authors/SaveAuthorConfirmationDialog.js +14 -0
  34. package/dist/es/configs/editor-views.js +2 -2
  35. package/dist/es/lib/array-reducer.js +2 -0
  36. package/dist/es/lib/authors.js +36 -0
  37. package/dist/es/lib/track-changes-utils.js +3 -0
  38. package/dist/es/lib/utils.js +1 -4
  39. package/dist/es/lib/view.js +64 -0
  40. package/dist/es/views/base_node_view.js +0 -19
  41. package/dist/es/views/bibliography_element.js +3 -2
  42. package/dist/es/views/citation_editable.js +3 -2
  43. package/dist/es/views/contributors.js +79 -26
  44. package/dist/types/components/authors/AffiliationButton.d.ts +8 -0
  45. package/dist/types/components/authors/AffiliationForm.d.ts +7 -0
  46. package/dist/types/components/authors/AuthorActions.d.ts +9 -0
  47. package/dist/types/components/authors/AuthorAffiliations.d.ts +11 -0
  48. package/dist/types/components/authors/AuthorDetailsForm.d.ts +30 -0
  49. package/dist/types/components/authors/AuthorFormPlaceholder.d.ts +2 -0
  50. package/dist/types/components/authors/AuthorList.d.ts +25 -0
  51. package/dist/types/components/authors/AuthorsModal.d.ts +26 -0
  52. package/dist/types/components/authors/ChangeHandlingForm.d.ts +5 -0
  53. package/dist/types/components/authors/DeleteAuthorConfirmationDialog.d.ts +9 -0
  54. package/dist/types/components/authors/DraggableAuthor.d.ts +25 -0
  55. package/dist/types/components/authors/SaveAuthorConfirmationDialog.d.ts +7 -0
  56. package/dist/types/components/outline/DraggableTree.d.ts +1 -1
  57. package/dist/types/configs/ManuscriptsEditor.d.ts +0 -2
  58. package/dist/types/configs/editor-views.d.ts +0 -28
  59. package/dist/types/lib/array-reducer.d.ts +5 -1
  60. package/dist/types/lib/authors.d.ts +23 -0
  61. package/dist/types/lib/track-changes-utils.d.ts +1 -0
  62. package/dist/types/lib/utils.d.ts +0 -1
  63. package/dist/types/lib/view.d.ts +25 -0
  64. package/dist/types/views/base_node_view.d.ts +1 -4
  65. package/dist/types/views/bibliography_element_editable.d.ts +0 -2
  66. package/dist/types/views/blockquote_element_editable.d.ts +0 -2
  67. package/dist/types/views/bullet_list_editable.d.ts +0 -2
  68. package/dist/types/views/contributors.d.ts +25 -8
  69. package/dist/types/views/editable_block.d.ts +0 -2
  70. package/dist/types/views/equation_element_editable.d.ts +0 -2
  71. package/dist/types/views/figure_element_editable.d.ts +0 -2
  72. package/dist/types/views/footnote_editable.d.ts +0 -2
  73. package/dist/types/views/footnotes_element_editable.d.ts +0 -2
  74. package/dist/types/views/listing_element_editable.d.ts +0 -2
  75. package/dist/types/views/ordered_list_editable.d.ts +0 -2
  76. package/dist/types/views/paragraph_editable.d.ts +0 -2
  77. package/dist/types/views/placeholder_element_editable.d.ts +0 -2
  78. package/dist/types/views/pullquote_element_editable.d.ts +0 -2
  79. package/dist/types/views/section_title_editable.d.ts +0 -2
  80. package/dist/types/views/table_element_editable.d.ts +0 -2
  81. package/dist/types/views/toc_element_editable.d.ts +0 -2
  82. package/package.json +4 -3
  83. package/styles/AdvancedEditor.css +3 -3
@@ -1,6 +1,24 @@
1
+ /*!
2
+ * © 2023 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
+ */
1
16
  import { SecondaryButton } from '@manuscripts/style-guide';
2
- import { isContributorNode } from '@manuscripts/transform';
17
+ import { isContributorNode, schema, } from '@manuscripts/transform';
18
+ import { AuthorsModal, } from '../components/authors/AuthorsModal';
19
+ import { authorLabel } from '../lib/authors';
3
20
  import { getActualAttrs } from '../lib/track-changes-utils';
21
+ import { deleteNode, findChildByID, findChildByType, findChildrenAttrsByType, updateNodeAttrs, } from '../lib/view';
4
22
  import { affiliationsKey } from '../plugins/affiliations';
5
23
  import { selectedSuggestionKey } from '../plugins/selected-suggestion-ui';
6
24
  import BlockView from './block_view';
@@ -71,15 +89,11 @@ export class ContributorsView extends BlockView {
71
89
  }
72
90
  const can = this.props.getCapabilities();
73
91
  const disableEditButton = !can.editMetadata;
74
- const { bibliographicName, isCorresponding, email, id } = displayAttr;
75
- container.addEventListener('click', (e) => {
76
- e.preventDefault();
77
- if (!disableEditButton) {
78
- this.props.openAuthorEditing();
79
- this.props.selectAuthorForEditing(id);
80
- }
81
- });
82
- const name = this.buildNameLiteral(bibliographicName);
92
+ const { isCorresponding, email } = displayAttr;
93
+ if (!disableEditButton) {
94
+ container.addEventListener('click', this.handleClick);
95
+ }
96
+ const name = authorLabel(displayAttr);
83
97
  container.innerHTML =
84
98
  isCorresponding && email
85
99
  ? `<span class="name">${name} (${email})</span>`
@@ -107,21 +121,6 @@ export class ContributorsView extends BlockView {
107
121
  }
108
122
  return container;
109
123
  };
110
- this.initials = (given) => given
111
- ? given
112
- .trim()
113
- .split(' ')
114
- .map((part) => part.substr(0, 1).toUpperCase() + '.')
115
- .join('')
116
- : '';
117
- this.buildNameLiteral = ({ given = '', family = '', suffix = '' }) => {
118
- if (!given && !family) {
119
- return 'Unknown Author';
120
- }
121
- return [this.initials(given), family, suffix]
122
- .filter((part) => part)
123
- .join(' ');
124
- };
125
124
  this.isJointFirstAuthor = (authors, index) => {
126
125
  const author = index === 0 ? authors[index] : authors[index - 1];
127
126
  return Boolean(author.attrs.isJointContributor);
@@ -142,7 +141,7 @@ export class ContributorsView extends BlockView {
142
141
  const can = this.props.getCapabilities();
143
142
  const button = ReactSubView(this.props, SecondaryButton, {
144
143
  mini: true,
145
- onClick: this.props.openAuthorEditing,
144
+ onClick: this.handleClick,
146
145
  className: 'edit-authors-button',
147
146
  disabled: !can.editMetadata,
148
147
  children: 'Edit Authors',
@@ -162,6 +161,60 @@ export class ContributorsView extends BlockView {
162
161
  }
163
162
  }
164
163
  };
164
+ this.handleClick = (e) => {
165
+ var _a, _b;
166
+ e.stopPropagation();
167
+ const contributors = findChildrenAttrsByType(this.view, schema.nodes.contributor);
168
+ const affiliations = findChildrenAttrsByType(this.view, schema.nodes.affiliation);
169
+ let author = undefined;
170
+ const target = e.target;
171
+ if (target) {
172
+ const id = (_a = target.closest('.contributor')) === null || _a === void 0 ? void 0 : _a.getAttribute('id');
173
+ author = contributors.filter((a) => a.id === id)[0];
174
+ }
175
+ const componentProps = {
176
+ author,
177
+ authors: contributors,
178
+ affiliations,
179
+ onSaveAuthor: this.handleSaveAuthor,
180
+ onDeleteAuthor: this.handleDeleteAuthor,
181
+ onSaveAffiliation: this.handleSaveAffiliation,
182
+ };
183
+ (_b = this.popper) === null || _b === void 0 ? void 0 : _b.remove();
184
+ this.popper = ReactSubView(this.props, AuthorsModal, componentProps, this.node, this.getPos, this.view);
185
+ this.container.appendChild(this.popper);
186
+ };
187
+ this.handleSaveAuthor = (author) => {
188
+ if (!findChildByID(this.view, author.id)) {
189
+ this.insertAuthorNode(author);
190
+ }
191
+ else {
192
+ updateNodeAttrs(this.view, schema.nodes.contributor, author);
193
+ }
194
+ };
195
+ this.handleDeleteAuthor = (author) => {
196
+ deleteNode(this.view, author.id);
197
+ };
198
+ this.handleSaveAffiliation = (affiliation) => {
199
+ if (!findChildByID(this.view, affiliation.id)) {
200
+ this.insertAffiliationNode(affiliation);
201
+ }
202
+ else {
203
+ updateNodeAttrs(this.view, schema.nodes.affiliation, affiliation);
204
+ }
205
+ };
206
+ this.insertAuthorNode = (attrs) => {
207
+ const parent = findChildByType(this.view, schema.nodes.contributors);
208
+ const tr = this.view.state.tr;
209
+ const node = schema.nodes.contributor.create(attrs);
210
+ this.view.dispatch(tr.insert(parent.pos + 1, node));
211
+ };
212
+ this.insertAffiliationNode = (attrs) => {
213
+ const parent = findChildByType(this.view, schema.nodes.affiliations);
214
+ const tr = this.view.state.tr;
215
+ const node = schema.nodes.affiliation.create(attrs);
216
+ this.view.dispatch(tr.insert(parent.pos + 1, node));
217
+ };
165
218
  this.ignoreMutation = () => true;
166
219
  this.stopEvent = () => true;
167
220
  }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { AffiliationAttrs } from '../../lib/authors';
3
+ export interface AffiliationButtonProps {
4
+ affiliation: AffiliationAttrs;
5
+ onSave: (affiliation: AffiliationAttrs) => void;
6
+ onRemove: () => void;
7
+ }
8
+ export declare const AffiliationButton: React.FC<AffiliationButtonProps>;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { AffiliationAttrs } from '../../lib/authors';
3
+ export interface AffiliationFormProps {
4
+ values: AffiliationAttrs;
5
+ onSave: (values: AffiliationAttrs) => void;
6
+ }
7
+ export declare const AffiliationForm: React.FC<AffiliationFormProps>;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ContributorAttrs } from '../../lib/authors';
3
+ export interface AuthorActionsProps {
4
+ author: ContributorAttrs;
5
+ onSave: () => void;
6
+ onDelete: () => void;
7
+ onCancel: () => void;
8
+ }
9
+ export declare const AuthorActions: React.FC<AuthorActionsProps>;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { AffiliationAttrs, ContributorAttrs } from '../../lib/authors';
3
+ export declare const AddAffiliationIndicator: React.FC;
4
+ export interface AuthorAffiliationsProps {
5
+ author: ContributorAttrs;
6
+ affiliations: AffiliationAttrs[];
7
+ onSave: (affiliation: AffiliationAttrs) => void;
8
+ onAdd: (affiliation: AffiliationAttrs) => void;
9
+ onRemove: (affiliation: AffiliationAttrs) => void;
10
+ }
11
+ export declare const AuthorAffiliations: React.FC<AuthorAffiliationsProps>;
@@ -0,0 +1,30 @@
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, { MutableRefObject } from 'react';
17
+ import { ContributorAttrs } from '../../lib/authors';
18
+ export declare const LabelText: import("styled-components").StyledComponent<"div", any, {}, never>;
19
+ export declare const Fieldset: import("styled-components").StyledComponent<"fieldset", any, {}, never>;
20
+ export interface FormActions {
21
+ reset: () => void;
22
+ }
23
+ interface AuthorDetailsFormProps {
24
+ values: ContributorAttrs;
25
+ onChange: (values: ContributorAttrs) => void;
26
+ onSave: (values: ContributorAttrs) => void;
27
+ actionsRef?: MutableRefObject<FormActions | undefined>;
28
+ }
29
+ export declare const AuthorDetailsForm: React.FC<AuthorDetailsFormProps>;
30
+ export {};
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const AuthorFormPlaceholder: React.FC;
@@ -0,0 +1,25 @@
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 { ContributorAttrs } from '../../lib/authors';
18
+ interface AuthorListProps {
19
+ author?: ContributorAttrs;
20
+ authors: ContributorAttrs[];
21
+ onSelect: (item: ContributorAttrs) => void;
22
+ moveAuthor: (index: number, target: number) => void;
23
+ }
24
+ export declare const AuthorList: React.FC<AuthorListProps>;
25
+ export {};
@@ -0,0 +1,26 @@
1
+ /*!
2
+ * © 2024 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, ContributorAttrs } from '../../lib/authors';
18
+ export interface AuthorsModalProps {
19
+ author?: ContributorAttrs;
20
+ authors: ContributorAttrs[];
21
+ affiliations: AffiliationAttrs[];
22
+ onSaveAuthor: (author: ContributorAttrs) => void;
23
+ onDeleteAuthor: (author: ContributorAttrs) => void;
24
+ onSaveAffiliation: (affiliation: AffiliationAttrs) => void;
25
+ }
26
+ export declare const AuthorsModal: React.FC<AuthorsModalProps>;
@@ -0,0 +1,5 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ export interface ChangeHandlingFormProps<Values> {
3
+ onChange: (values: Values) => void;
4
+ }
5
+ export declare const ChangeHandlingForm: <Values>(props: React.PropsWithChildren<ChangeHandlingFormProps<Values>>) => React.JSX.Element;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ContributorAttrs } from '../../lib/authors';
3
+ export interface DeleteAuthorConfirmationDialogProps {
4
+ author: ContributorAttrs;
5
+ isOpen: boolean;
6
+ onDelete: () => void;
7
+ onCancel: () => void;
8
+ }
9
+ export declare const DeleteAuthorConfirmationDialog: React.FC<DeleteAuthorConfirmationDialogProps>;
@@ -0,0 +1,25 @@
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 { ContributorAttrs } from '../../lib/authors';
18
+ interface DraggableAuthorProps {
19
+ author: ContributorAttrs;
20
+ isSelected: boolean;
21
+ onClick: () => void;
22
+ moveAuthor: (from: number, to: number) => void;
23
+ }
24
+ export declare const DraggableAuthor: React.FC<DraggableAuthorProps>;
25
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface SaveAuthorConfirmationDialogProps {
3
+ isOpen: boolean;
4
+ onSave: () => void;
5
+ onCancel: () => void;
6
+ }
7
+ export declare const SaveAuthorConfirmationDialog: React.FC<SaveAuthorConfirmationDialogProps>;
@@ -59,5 +59,5 @@ declare class Tree extends React.Component<Props & ConnectedProps, State> {
59
59
  private handleContextMenu;
60
60
  private createMenu;
61
61
  }
62
- declare const DraggableTree: import("react-dnd").DndComponentClass<import("react-dnd").DndComponentClass<typeof Tree, import("react-dnd").Omit<Props & ConnectedDragSourceProps & ConnectedDropTargetProps, "itemType" | "connectDropTarget" | "isOverCurrent" | "canDrop">>, import("react-dnd").Omit<import("react-dnd").Omit<Props & ConnectedDragSourceProps & ConnectedDropTargetProps, "itemType" | "connectDropTarget" | "isOverCurrent" | "canDrop">, "item" | "connectDragSource" | "connectDragPreview" | "isDragging" | "canDrag">>;
62
+ declare const DraggableTree: import("react-dnd").DndComponentClass<import("react-dnd").DndComponentClass<typeof Tree, import("react-dnd").Omit<Props & ConnectedDragSourceProps & ConnectedDropTargetProps, "itemType" | "connectDropTarget" | "isOverCurrent" | "canDrop">>, import("react-dnd").Omit<import("react-dnd").Omit<Props & ConnectedDragSourceProps & ConnectedDropTargetProps, "itemType" | "connectDropTarget" | "isOverCurrent" | "canDrop">, "item" | "isDragging" | "connectDragSource" | "connectDragPreview" | "canDrag">>;
63
63
  export default DraggableTree;
@@ -51,8 +51,6 @@ export interface EditorProps {
51
51
  retrySync: (componentIDs: string[]) => Promise<void>;
52
52
  environment?: string;
53
53
  collabProvider?: CollabProvider;
54
- openAuthorEditing: () => void;
55
- selectAuthorForEditing: (authorId: string) => void;
56
54
  }
57
55
  export declare const createEditorState: (props: EditorProps) => EditorState;
58
56
  export declare const createEditorView: (props: EditorProps, root: HTMLElement, state: EditorState, dispatch: Dispatch) => EditorView;
@@ -57,8 +57,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
57
57
  deselectNode: () => void;
58
58
  destroy: () => void;
59
59
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
60
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
61
- deleteNode: (id: string) => void;
62
60
  } & import("../views/bibliography_element").BibliographyElementBlockView<any>>;
63
61
  blockquote_element: import("../types").NodeViewCreator<{
64
62
  gutterButtons: () => HTMLElement[];
@@ -95,8 +93,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
95
93
  deselectNode: () => void;
96
94
  destroy: () => void;
97
95
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
98
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
99
- deleteNode: (id: string) => void;
100
96
  } & import("../views/blockquote_element").BlockquoteElementView<any>>;
101
97
  bullet_list: import("../types").NodeViewCreator<{
102
98
  gutterButtons: () => HTMLElement[];
@@ -133,8 +129,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
133
129
  deselectNode: () => void;
134
130
  destroy: () => void;
135
131
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
136
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
137
- deleteNode: (id: string) => void;
138
132
  } & import("../views/bullet_list").BulletListView<any>>;
139
133
  citation: import("../types").NodeViewCreator<import("../views/citation_editable").CitationEditableView>;
140
134
  cross_reference: import("../types").NodeViewCreator<import("../views/cross_reference_editable").CrossReferenceEditableView>;
@@ -177,8 +171,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
177
171
  deselectNode: () => void;
178
172
  destroy: () => void;
179
173
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
180
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
181
- deleteNode: (id: string) => void;
182
174
  } & import("../views/equation_element").EquationElementView<any>>;
183
175
  figure: import("../types").NodeViewCreator<import("../views/figure_editable").FigureEditableView>;
184
176
  figure_element: import("../types").NodeViewCreator<{
@@ -216,8 +208,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
216
208
  deselectNode: () => void;
217
209
  destroy: () => void;
218
210
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
219
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
220
- deleteNode: (id: string) => void;
221
211
  } & import("../views/figure_element").FigureElementView>;
222
212
  footnote: import("../types").NodeViewCreator<{
223
213
  gutterButtons: () => HTMLElement[];
@@ -254,8 +244,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
254
244
  deselectNode: () => void;
255
245
  destroy: () => void;
256
246
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
257
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
258
- deleteNode: (id: string) => void;
259
247
  } & import("../views/footnote").FootnoteView<any>>;
260
248
  footnotes_element: import("../types").NodeViewCreator<import("../views/footnotes_element").FootnotesElementView<any>>;
261
249
  inline_equation: import("../types").NodeViewCreator<import("../views/inline_equation_editable").InlineEquationEditableView>;
@@ -299,8 +287,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
299
287
  deselectNode: () => void;
300
288
  destroy: () => void;
301
289
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
302
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
303
- deleteNode: (id: string) => void;
304
290
  } & import("../views/listing_element").ListingElementView<any>>;
305
291
  ordered_list: import("../types").NodeViewCreator<{
306
292
  gutterButtons: () => HTMLElement[];
@@ -337,8 +323,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
337
323
  deselectNode: () => void;
338
324
  destroy: () => void;
339
325
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
340
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
341
- deleteNode: (id: string) => void;
342
326
  } & import("../views/ordered_list").OrderedListView<any>>;
343
327
  paragraph: import("../types").NodeViewCreator<{
344
328
  gutterButtons: () => HTMLElement[];
@@ -375,8 +359,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
375
359
  deselectNode: () => void;
376
360
  destroy: () => void;
377
361
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
378
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
379
- deleteNode: (id: string) => void;
380
362
  } & import("../views/paragraph").ParagraphView<any>>;
381
363
  placeholder: import("../types").NodeViewCreator<import("../views/placeholder").PlaceholderView<any>>;
382
364
  placeholder_element: import("../types").NodeViewCreator<{
@@ -414,8 +396,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
414
396
  deselectNode: () => void;
415
397
  destroy: () => void;
416
398
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
417
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
418
- deleteNode: (id: string) => void;
419
399
  } & import("../views/placeholder_element").PlaceholderElementView<any>>;
420
400
  pullquote_element: import("../types").NodeViewCreator<{
421
401
  gutterButtons: () => HTMLElement[];
@@ -452,8 +432,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
452
432
  deselectNode: () => void;
453
433
  destroy: () => void;
454
434
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
455
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
456
- deleteNode: (id: string) => void;
457
435
  } & import("../views/pullquote_element").PullquoteElementView<any>>;
458
436
  section_title: import("../types").NodeViewCreator<{
459
437
  gutterButtons: () => HTMLElement[];
@@ -490,8 +468,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
490
468
  deselectNode: () => void;
491
469
  destroy: () => void;
492
470
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
493
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
494
- deleteNode: (id: string) => void;
495
471
  } & import("../views/section_title").SectionTitleView<any>>;
496
472
  section_label: import("../types").NodeViewCreator<import("../views/block_view").default<any>>;
497
473
  table_element: import("../types").NodeViewCreator<{
@@ -529,8 +505,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
529
505
  deselectNode: () => void;
530
506
  destroy: () => void;
531
507
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
532
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
533
- deleteNode: (id: string) => void;
534
508
  } & import("../views/table_element").TableElementView>;
535
509
  table_element_footer: import("../types").NodeViewCreator<import("../views/table_element_footer").TableElementFooterView<any>>;
536
510
  toc_element: import("../types").NodeViewCreator<{
@@ -568,8 +542,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
568
542
  deselectNode: () => void;
569
543
  destroy: () => void;
570
544
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
571
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
572
- deleteNode: (id: string) => void;
573
545
  } & import("../views/toc_element").TOCElementView<any>>;
574
546
  comments: () => {
575
547
  dom: HTMLDivElement;
@@ -21,5 +21,9 @@ export type Delete<T> = {
21
21
  type: 'delete';
22
22
  item: T;
23
23
  };
24
- export type Action<T> = Update<T> | Delete<T>;
24
+ export type Set<T> = {
25
+ type: 'set';
26
+ state: T[];
27
+ };
28
+ export type Action<T> = Update<T> | Delete<T> | Set<T>;
25
29
  export declare const arrayReducer: <T>(isEqual?: (a: T, b: T) => boolean) => (state: T[], action: Action<T>) => T[];
@@ -0,0 +1,23 @@
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 { BibliographicName } from '@manuscripts/json-schema';
17
+ import { AffiliationNode, ContributorNode } from '@manuscripts/transform';
18
+ export type AffiliationAttrs = Omit<AffiliationNode['attrs'], 'addressLine2' | 'addressLine3' | 'email'>;
19
+ export type ContributorAttrs = Omit<ContributorNode['attrs'], 'userID' | 'invitationID'>;
20
+ export declare const affiliationLabel: (affiliation: AffiliationAttrs) => string;
21
+ export declare const authorLabel: (author: ContributorAttrs) => string;
22
+ export declare const initials: (name: BibliographicName) => string;
23
+ export declare const authorComparator: (a: ContributorAttrs, b: ContributorAttrs) => number;
@@ -25,3 +25,4 @@ export declare function getChangeClasses(dataTracked?: TrackedAttrs[]): string[]
25
25
  export declare function isTracked(node: ProsemirrorNode): boolean;
26
26
  export declare function getActualAttrs<T extends ManuscriptNode>(node: T): T["attrs"];
27
27
  export declare const getAttrsTrackingButton: (changeID: string) => HTMLButtonElement;
28
+ export declare function isHidden(node: ProsemirrorNode): boolean;
@@ -23,4 +23,3 @@ export declare const findParentNodeWithId: (selection: Selection) => import("pro
23
23
  export declare const findParentNodeWithIdValue: (selection: Selection) => import("prosemirror-utils").ContentNodeWithPos | undefined;
24
24
  export declare const findParentSection: (selection: Selection) => import("prosemirror-utils").ContentNodeWithPos | undefined;
25
25
  export declare const findParentElement: (selection: Selection, validIds?: string[]) => import("prosemirror-utils").ContentNodeWithPos | undefined;
26
- export declare const isMetaNode: (nodeType: string) => boolean;
@@ -0,0 +1,25 @@
1
+ /*!
2
+ * © 2024 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, ManuscriptNode, ManuscriptNodeType } from '@manuscripts/transform';
17
+ import { Attrs } from 'prosemirror-model';
18
+ import * as utils from 'prosemirror-utils';
19
+ export declare const findChildByID: (view: ManuscriptEditorView, id: string) => utils.NodeWithPos | undefined;
20
+ export declare const findChildByType: (view: ManuscriptEditorView, type: ManuscriptNodeType) => utils.NodeWithPos | undefined;
21
+ export declare const findChildrenByType: (view: ManuscriptEditorView, type: ManuscriptNodeType) => utils.NodeWithPos[];
22
+ export declare const findChildrenAttrsByType: <T extends Attrs>(view: ManuscriptEditorView, type: ManuscriptNodeType) => T[];
23
+ export declare const updateNode: (view: ManuscriptEditorView, node: ManuscriptNode) => void;
24
+ export declare const updateNodeAttrs: (view: ManuscriptEditorView, type: ManuscriptNodeType, attrs: Attrs) => void;
25
+ export declare const deleteNode: (view: ManuscriptEditorView, id: string) => void;
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { ManuscriptEditorView, ManuscriptNode } from '@manuscripts/transform';
17
- import { Attrs, Node } from 'prosemirror-model';
18
17
  import { Decoration, NodeView } from 'prosemirror-view';
19
18
  import { CSLProps } from '../configs/ManuscriptsEditor';
20
19
  import { PopperManager } from '../lib/popper';
@@ -35,7 +34,7 @@ export declare class BaseNodeView<PropsType extends BaseNodeProps> implements No
35
34
  syncErrors: SyncError[];
36
35
  elementType: string;
37
36
  constructor(props: PropsType, node: ManuscriptNode, view: ManuscriptEditorView, getPos: () => number, decorations: readonly Decoration[]);
38
- update: (newNode: Node, decorations: readonly Decoration[]) => boolean;
37
+ update: (newNode: ManuscriptNode, decorations: readonly Decoration[]) => boolean;
39
38
  initialise: () => void;
40
39
  updateContents: () => void;
41
40
  setDomAttrs(node: ManuscriptNode, element: HTMLElement, omit?: string[]): void;
@@ -43,6 +42,4 @@ export declare class BaseNodeView<PropsType extends BaseNodeProps> implements No
43
42
  deselectNode: () => void;
44
43
  destroy: () => void;
45
44
  handleDecorations: (decorations: readonly Decoration[]) => void;
46
- updateNodeAttrs: (attrs: Attrs) => void;
47
- deleteNode: (id: string) => void;
48
45
  }
@@ -49,7 +49,5 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
49
49
  deselectNode: () => void;
50
50
  destroy: () => void;
51
51
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
52
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
53
- deleteNode: (id: string) => void;
54
52
  } & BibliographyElementBlockView<any>>;
55
53
  export default _default;
@@ -49,7 +49,5 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
49
49
  deselectNode: () => void;
50
50
  destroy: () => void;
51
51
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
52
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
53
- deleteNode: (id: string) => void;
54
52
  } & BlockquoteElementView<any>>;
55
53
  export default _default;
@@ -49,7 +49,5 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
49
49
  deselectNode: () => void;
50
50
  destroy: () => void;
51
51
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
52
- updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
53
- deleteNode: (id: string) => void;
54
52
  } & BulletListView<any>>;
55
53
  export default _default;