@manuscripts/body-editor 1.7.19 → 1.7.21

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 (101) hide show
  1. package/dist/cjs/commands.js +7 -4
  2. package/dist/cjs/components/authors/AffiliationButton.js +105 -0
  3. package/dist/cjs/components/authors/AffiliationForm.js +50 -0
  4. package/dist/cjs/components/authors/AuthorActions.js +61 -0
  5. package/dist/cjs/components/authors/AuthorAffiliations.js +116 -0
  6. package/dist/cjs/components/authors/AuthorDetailsForm.js +97 -0
  7. package/dist/cjs/components/authors/AuthorFormPlaceholder.js +57 -0
  8. package/dist/cjs/components/authors/AuthorList.js +40 -0
  9. package/dist/cjs/components/authors/AuthorsModal.js +226 -0
  10. package/dist/cjs/components/authors/ChangeHandlingForm.js +37 -0
  11. package/dist/cjs/components/authors/DeleteAuthorConfirmationDialog.js +23 -0
  12. package/dist/cjs/components/authors/DraggableAuthor.js +170 -0
  13. package/dist/cjs/components/authors/SaveAuthorConfirmationDialog.js +21 -0
  14. package/dist/cjs/lib/array-reducer.js +2 -0
  15. package/dist/cjs/lib/authors.js +43 -0
  16. package/dist/cjs/lib/context-menu.js +8 -5
  17. package/dist/cjs/lib/track-changes-utils.js +5 -1
  18. package/dist/cjs/lib/utils.js +1 -5
  19. package/dist/cjs/lib/view.js +97 -0
  20. package/dist/cjs/plugins/footnotes/index.js +3 -3
  21. package/dist/cjs/views/base_node_view.js +0 -19
  22. package/dist/cjs/views/bibliography_element.js +3 -2
  23. package/dist/cjs/views/citation_editable.js +3 -2
  24. package/dist/cjs/views/contributors.js +78 -25
  25. package/dist/cjs/views/footnote.js +12 -2
  26. package/dist/cjs/views/footnote_editable.js +1 -1
  27. package/dist/cjs/views/footnotes_element.js +2 -1
  28. package/dist/cjs/views/footnotes_element_editable.js +2 -1
  29. package/dist/cjs/views/inline_footnote.js +5 -0
  30. package/dist/es/commands.js +7 -4
  31. package/dist/es/components/authors/AffiliationButton.js +75 -0
  32. package/dist/es/components/authors/AffiliationForm.js +43 -0
  33. package/dist/es/components/authors/AuthorActions.js +31 -0
  34. package/dist/es/components/authors/AuthorAffiliations.js +85 -0
  35. package/dist/es/components/authors/AuthorDetailsForm.js +67 -0
  36. package/dist/es/components/authors/AuthorFormPlaceholder.js +50 -0
  37. package/dist/es/components/authors/AuthorList.js +33 -0
  38. package/dist/es/components/authors/AuthorsModal.js +196 -0
  39. package/dist/es/components/authors/ChangeHandlingForm.js +10 -0
  40. package/dist/es/components/authors/DeleteAuthorConfirmationDialog.js +16 -0
  41. package/dist/es/components/authors/DraggableAuthor.js +140 -0
  42. package/dist/es/components/authors/SaveAuthorConfirmationDialog.js +14 -0
  43. package/dist/es/configs/editor-views.js +2 -2
  44. package/dist/es/lib/array-reducer.js +2 -0
  45. package/dist/es/lib/authors.js +36 -0
  46. package/dist/es/lib/context-menu.js +8 -5
  47. package/dist/es/lib/track-changes-utils.js +3 -0
  48. package/dist/es/lib/utils.js +1 -4
  49. package/dist/es/lib/view.js +64 -0
  50. package/dist/es/plugins/footnotes/index.js +3 -3
  51. package/dist/es/views/base_node_view.js +0 -19
  52. package/dist/es/views/bibliography_element.js +3 -2
  53. package/dist/es/views/citation_editable.js +3 -2
  54. package/dist/es/views/contributors.js +79 -26
  55. package/dist/es/views/footnote.js +10 -1
  56. package/dist/es/views/footnote_editable.js +2 -2
  57. package/dist/es/views/footnotes_element.js +2 -1
  58. package/dist/es/views/footnotes_element_editable.js +2 -1
  59. package/dist/es/views/inline_footnote.js +5 -0
  60. package/dist/types/components/authors/AffiliationButton.d.ts +8 -0
  61. package/dist/types/components/authors/AffiliationForm.d.ts +7 -0
  62. package/dist/types/components/authors/AuthorActions.d.ts +9 -0
  63. package/dist/types/components/authors/AuthorAffiliations.d.ts +11 -0
  64. package/dist/types/components/authors/AuthorDetailsForm.d.ts +30 -0
  65. package/dist/types/components/authors/AuthorFormPlaceholder.d.ts +2 -0
  66. package/dist/types/components/authors/AuthorList.d.ts +25 -0
  67. package/dist/types/components/authors/AuthorsModal.d.ts +26 -0
  68. package/dist/types/components/authors/ChangeHandlingForm.d.ts +5 -0
  69. package/dist/types/components/authors/DeleteAuthorConfirmationDialog.d.ts +9 -0
  70. package/dist/types/components/authors/DraggableAuthor.d.ts +25 -0
  71. package/dist/types/components/authors/SaveAuthorConfirmationDialog.d.ts +7 -0
  72. package/dist/types/components/outline/DraggableTree.d.ts +1 -1
  73. package/dist/types/configs/ManuscriptsEditor.d.ts +0 -2
  74. package/dist/types/configs/editor-views.d.ts +0 -28
  75. package/dist/types/lib/array-reducer.d.ts +5 -1
  76. package/dist/types/lib/authors.d.ts +23 -0
  77. package/dist/types/lib/track-changes-utils.d.ts +1 -0
  78. package/dist/types/lib/utils.d.ts +0 -1
  79. package/dist/types/lib/view.d.ts +25 -0
  80. package/dist/types/views/base_node_view.d.ts +1 -4
  81. package/dist/types/views/bibliography_element_editable.d.ts +0 -2
  82. package/dist/types/views/blockquote_element_editable.d.ts +0 -2
  83. package/dist/types/views/bullet_list_editable.d.ts +0 -2
  84. package/dist/types/views/contributors.d.ts +25 -8
  85. package/dist/types/views/editable_block.d.ts +0 -2
  86. package/dist/types/views/equation_element_editable.d.ts +0 -2
  87. package/dist/types/views/figure_element_editable.d.ts +0 -2
  88. package/dist/types/views/footnote.d.ts +2 -0
  89. package/dist/types/views/footnote_editable.d.ts +0 -2
  90. package/dist/types/views/footnotes_element_editable.d.ts +0 -2
  91. package/dist/types/views/listing_element_editable.d.ts +0 -2
  92. package/dist/types/views/ordered_list_editable.d.ts +0 -2
  93. package/dist/types/views/paragraph_editable.d.ts +0 -2
  94. package/dist/types/views/placeholder_element_editable.d.ts +0 -2
  95. package/dist/types/views/pullquote_element_editable.d.ts +0 -2
  96. package/dist/types/views/section_title_editable.d.ts +0 -2
  97. package/dist/types/views/table_element_editable.d.ts +0 -2
  98. package/dist/types/views/toc_element_editable.d.ts +0 -2
  99. package/package.json +3 -2
  100. package/styles/AdvancedEditor.css +3 -3
  101. package/styles/Editor.css +5 -5
@@ -0,0 +1,36 @@
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
+ export const affiliationLabel = (affiliation) => {
17
+ const institution = affiliation.institution;
18
+ if (!institution) {
19
+ return '(unknown institution)';
20
+ }
21
+ const department = affiliation.department;
22
+ return department ? `${institution} (${department})`.trim() : institution;
23
+ };
24
+ export const authorLabel = (author) => {
25
+ const name = author.bibliographicName;
26
+ const parts = [initials(name), name.family, name.suffix].filter(Boolean);
27
+ return parts.length ? parts.join(' ') : 'Unknown Author';
28
+ };
29
+ export const initials = (name) => name.given
30
+ ? name.given
31
+ .trim()
32
+ .split(' ')
33
+ .map((part) => part.substring(0, 1).toUpperCase() + '.')
34
+ .join('')
35
+ : '';
36
+ export const authorComparator = (a, b) => a.priority - b.priority;
@@ -19,6 +19,7 @@ import { findChildrenByType, hasParentNodeOfType } from 'prosemirror-utils';
19
19
  import { addComment, createBlock, insertGeneralFootnote, insertTableFootnote, } from '../commands';
20
20
  import ReactSubView from '../views/ReactSubView';
21
21
  import { PopperManager } from './popper';
22
+ import { isDeleted, isRejectedInsert } from './track-changes-utils';
22
23
  const popper = new PopperManager();
23
24
  const listTypes = [schema.nodes.ordered_list, schema.nodes.bullet_list];
24
25
  const readonlyTypes = [schema.nodes.keywords, schema.nodes.bibliography_element];
@@ -179,14 +180,16 @@ export class ContextMenu {
179
180
  if (isInTable) {
180
181
  menu.appendChild(this.createMenuSection((section) => {
181
182
  section.appendChild(this.createMenuItem('Add Reference Note', () => {
182
- var _a;
183
- const footnotesElement = findChildrenByType(this.node, schema.nodes.footnotes_element);
184
- if (!footnotesElement.length) {
183
+ var _a, _b;
184
+ const footnotesElement = (_a = findChildrenByType(this.node, schema.nodes.footnotes_element).pop()) === null || _a === void 0 ? void 0 : _a.node;
185
+ if (!footnotesElement ||
186
+ isDeleted(footnotesElement) ||
187
+ isRejectedInsert(footnotesElement)) {
185
188
  const { state, dispatch } = this.view;
186
189
  insertTableFootnote(this.node, this.getPos(), state, dispatch);
187
190
  }
188
191
  else {
189
- const footnotes = findChildrenByType(footnotesElement[0].node, schema.nodes.footnote).map((nodeWithPos) => {
192
+ const footnotes = findChildrenByType(footnotesElement, schema.nodes.footnote).map((nodeWithPos) => {
190
193
  return nodeWithPos.node;
191
194
  });
192
195
  const targetDom = this.view.domAtPos(this.view.state.selection.from);
@@ -218,7 +221,7 @@ export class ContextMenu {
218
221
  (_a = this.props) === null || _a === void 0 ? void 0 : _a.popper.destroy();
219
222
  },
220
223
  }, this.node, this.getPos, this.view, 'table-footnote-editor');
221
- (_a = this.props) === null || _a === void 0 ? void 0 : _a.popper.show(targetDom.node, popperContainer, 'bottom-end');
224
+ (_b = this.props) === null || _b === void 0 ? void 0 : _b.popper.show(targetDom.node, popperContainer, 'bottom-end');
222
225
  }
223
226
  }
224
227
  }));
@@ -87,3 +87,6 @@ export const getAttrsTrackingButton = (changeID) => {
87
87
  el.innerHTML = editAttrsTrackingIcon;
88
88
  return el;
89
89
  };
90
+ export function isHidden(node) {
91
+ return isDeleted(node) || isRejectedInsert(node);
92
+ }
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { isElementNodeType, isSectionNodeType, schema, } from '@manuscripts/transform';
16
+ import { isElementNodeType, isSectionNodeType, } from '@manuscripts/transform';
17
17
  import { findParentNode } from 'prosemirror-utils';
18
18
  export function* iterateChildren(node, recurse = false) {
19
19
  for (let i = 0; i < node.childCount; i++) {
@@ -50,6 +50,3 @@ export const findParentElement = (selection, validIds) => findParentNode((node)
50
50
  }
51
51
  return isElementNodeType(node.type) && node.attrs.id;
52
52
  })(selection);
53
- export const isMetaNode = (nodeType) => nodeType === schema.nodes.bibliography_item.name ||
54
- nodeType === schema.nodes.affiliation.name ||
55
- nodeType === schema.nodes.contributor.name;
@@ -0,0 +1,64 @@
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 { schema, } from '@manuscripts/transform';
17
+ import * as utils from 'prosemirror-utils';
18
+ import { getActualAttrs, isHidden } from './track-changes-utils';
19
+ const metaNodeTypes = [
20
+ schema.nodes.bibliography_item,
21
+ schema.nodes.affiliation,
22
+ schema.nodes.contributor,
23
+ ];
24
+ const updateMetaNode = 'track-changes-update-meta-node';
25
+ export const findChildByID = (view, id) => {
26
+ const doc = view.state.doc;
27
+ const children = utils.findChildren(doc, (n) => n.attrs.id === id);
28
+ return children.length ? children[0] : undefined;
29
+ };
30
+ export const findChildByType = (view, type) => {
31
+ const children = findChildrenByType(view, type);
32
+ return children.length ? children[0] : undefined;
33
+ };
34
+ export const findChildrenByType = (view, type) => {
35
+ const doc = view.state.doc;
36
+ return utils.findChildrenByType(doc, type).filter((n) => !isHidden(n.node));
37
+ };
38
+ export const findChildrenAttrsByType = (view, type) => {
39
+ return findChildrenByType(view, type).map((n) => getActualAttrs(n.node));
40
+ };
41
+ export const updateNode = (view, node) => {
42
+ updateNodeAttrs(view, node.type, node.attrs);
43
+ };
44
+ export const updateNodeAttrs = (view, type, attrs) => {
45
+ const copy = Object.assign({}, attrs);
46
+ delete copy.dataTracked;
47
+ const child = findChildByID(view, attrs.id);
48
+ if (child) {
49
+ const pos = child.pos;
50
+ const tr = view.state.tr.setNodeMarkup(pos, undefined, attrs);
51
+ if (metaNodeTypes.includes(type)) {
52
+ tr.setMeta(updateMetaNode, true);
53
+ }
54
+ view.dispatch(tr);
55
+ }
56
+ };
57
+ export const deleteNode = (view, id) => {
58
+ const child = findChildByID(view, id);
59
+ if (child) {
60
+ const pos = child.pos;
61
+ const node = child.node;
62
+ view.dispatch(view.state.tr.delete(pos, pos + node.nodeSize));
63
+ }
64
+ };
@@ -127,10 +127,10 @@ export default () => {
127
127
  }
128
128
  }
129
129
  if (node.type === schema.nodes.footnotes_element) {
130
- decorations.push(Decoration.node(pos, pos + node.nodeSize, {
131
- class: 'footnote-element',
132
- }));
133
130
  if ((parent === null || parent === void 0 ? void 0 : parent.type) === schema.nodes.table_element_footer) {
131
+ decorations.push(Decoration.node(pos, pos + node.nodeSize, {
132
+ class: 'table-footnotes-element',
133
+ }));
134
134
  tableInlineFootnoteIds = findTableInlineFootnoteIds(state.doc.resolve(pos));
135
135
  }
136
136
  else {
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { isMetaNode } from '../lib/utils';
17
16
  export class BaseNodeView {
18
17
  constructor(props, node, view, getPos, decorations) {
19
18
  this.props = props;
@@ -59,24 +58,6 @@ export class BaseNodeView {
59
58
  this.dom.classList.toggle('has-sync-error', this.syncErrors.length > 0);
60
59
  }
61
60
  };
62
- this.updateNodeAttrs = (attrs) => {
63
- this.view.state.doc.descendants((node, pos) => {
64
- if (node.attrs.id === attrs.id) {
65
- const tr = this.view.state.tr.setNodeMarkup(pos, undefined, attrs);
66
- if (isMetaNode(node.type.name)) {
67
- tr.setMeta('track-changes-update-meta-node', true);
68
- }
69
- this.view.dispatch(tr);
70
- }
71
- });
72
- };
73
- this.deleteNode = (id) => {
74
- this.view.state.doc.descendants((node, pos) => {
75
- if (node.attrs.id === id) {
76
- this.view.dispatch(this.view.state.tr.delete(pos, pos + node.nodeSize));
77
- }
78
- });
79
- };
80
61
  }
81
62
  setDomAttrs(node, element, omit = []) {
82
63
  Object.keys(node.attrs || {}).forEach((attr) => {
@@ -27,6 +27,7 @@ import { buildComment, Decoder, } from '@manuscripts/transform';
27
27
  import { commentIcon, editIcon } from '../assets';
28
28
  import { sanitize } from '../lib/dompurify';
29
29
  import { getAttrsTrackingButton, getChangeClasses, } from '../lib/track-changes-utils';
30
+ import { deleteNode, updateNode } from '../lib/view';
30
31
  import { getBibliographyPluginState } from '../plugins/bibliography';
31
32
  import { commentAnnotation } from '../plugins/comment_annotation';
32
33
  import { selectedSuggestionKey, SET_SUGGESTION_ID, } from '../plugins/selected-suggestion-ui';
@@ -145,10 +146,10 @@ export class BibliographyElementBlockView extends BlockView {
145
146
  };
146
147
  this.handleSave = (item) => {
147
148
  const node = this.decoder.decode(item);
148
- this.updateNodeAttrs(node.attrs);
149
+ updateNode(this.view, node);
149
150
  };
150
151
  this.handleDelete = (item) => {
151
- return this.deleteNode(item._id);
152
+ deleteNode(this.view, item._id);
152
153
  };
153
154
  this.addClickListenerToBibItem = (element, dataTracked) => {
154
155
  if (dataTracked.status !== CHANGE_STATUS.rejected) {
@@ -21,6 +21,7 @@ import { TextSelection } from 'prosemirror-state';
21
21
  import { findChildren, findChildrenByType } from 'prosemirror-utils';
22
22
  import { crossref } from '../citation-sources';
23
23
  import { isDeleted } from '../lib/track-changes-utils';
24
+ import { deleteNode, updateNodeAttrs } from '../lib/view';
24
25
  import { getBibliographyPluginState } from '../plugins/bibliography';
25
26
  import { CitationView } from './citation';
26
27
  import { CitationEditorWrapper } from './CitationEditorWrapper';
@@ -95,7 +96,7 @@ export class CitationEditableView extends CitationView {
95
96
  }
96
97
  else {
97
98
  const node = this.decoder.decode(item);
98
- this.updateNodeAttrs(node.attrs);
99
+ updateNodeAttrs(this.view, node.type, node.attrs);
99
100
  }
100
101
  };
101
102
  this.handleUncite = (id) => {
@@ -139,7 +140,7 @@ export class CitationEditableView extends CitationView {
139
140
  this.handleCancel();
140
141
  };
141
142
  this.handleDelete = (item) => {
142
- return this.deleteNode(item._id);
143
+ return deleteNode(this.view, item._id);
143
144
  };
144
145
  this.handleComment = () => {
145
146
  const comment = buildComment(this.node.attrs.id);
@@ -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
  }
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { getChangeClasses } from '../lib/track-changes-utils';
16
17
  import BlockView from './block_view';
17
18
  import { createNodeOrElementView } from './creators';
18
19
  export class FootnoteView extends BlockView {
@@ -21,4 +22,12 @@ export class FootnoteView extends BlockView {
21
22
  this.elementType = 'div';
22
23
  }
23
24
  }
24
- export default createNodeOrElementView(FootnoteView, 'div');
25
+ export const setTCClasses = (node, dom) => {
26
+ const dataTracked = node.attrs.dataTracked;
27
+ if (dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.length) {
28
+ const lastChange = dataTracked[dataTracked.length - 1];
29
+ const changeClasses = getChangeClasses([lastChange]);
30
+ dom.classList.add(...changeClasses);
31
+ }
32
+ };
33
+ export default createNodeOrElementView(FootnoteView, 'div', setTCClasses);
@@ -15,5 +15,5 @@
15
15
  */
16
16
  import { createNodeOrElementView } from './creators';
17
17
  import { EditableBlock } from './editable_block';
18
- import { FootnoteView } from './footnote';
19
- export default createNodeOrElementView(EditableBlock(FootnoteView), 'div');
18
+ import { FootnoteView, setTCClasses } from './footnote';
19
+ export default createNodeOrElementView(EditableBlock(FootnoteView), 'div', setTCClasses);
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import BlockView from './block_view';
17
17
  import { createNodeOrElementView } from './creators';
18
+ import { setTCClasses } from './footnote';
18
19
  export class FootnotesElementView extends BlockView {
19
20
  constructor() {
20
21
  super(...arguments);
@@ -30,4 +31,4 @@ export class FootnotesElementView extends BlockView {
30
31
  this.checkEditability();
31
32
  }
32
33
  }
33
- export default createNodeOrElementView(FootnotesElementView, 'div');
34
+ export default createNodeOrElementView(FootnotesElementView, 'div', setTCClasses);
@@ -15,5 +15,6 @@
15
15
  */
16
16
  import { createNodeOrElementView } from './creators';
17
17
  import { EditableBlock } from './editable_block';
18
+ import { setTCClasses } from './footnote';
18
19
  import { FootnotesElementView } from './footnotes_element';
19
- export default createNodeOrElementView(EditableBlock(FootnotesElementView), 'div');
20
+ export default createNodeOrElementView(EditableBlock(FootnotesElementView), 'div', setTCClasses);
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { getChangeClasses } from '../lib/track-changes-utils';
16
17
  import { BaseNodeView } from './base_node_view';
17
18
  import { createNodeView } from './creators';
18
19
  export class InlineFootnoteView extends BaseNodeView {
@@ -23,6 +24,10 @@ export class InlineFootnoteView extends BaseNodeView {
23
24
  };
24
25
  this.updateContents = () => {
25
26
  this.setDomAttrs(this.node, this.dom);
27
+ this.dom.className = [
28
+ 'footnote',
29
+ ...getChangeClasses(this.node.attrs.dataTracked),
30
+ ].join(' ');
26
31
  };
27
32
  this.initialise = () => {
28
33
  this.dom = this.createDOM();
@@ -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 {};