@manuscripts/body-editor 1.11.1-LEAN-3519.0 → 1.11.2

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.
@@ -129,12 +129,9 @@ exports.createBlock = createBlock;
129
129
  const insertGeneralFootnote = (tableNode, position, view, tableElementFooter) => {
130
130
  var _a;
131
131
  const { state, dispatch } = view;
132
- const paragraph = state.schema.nodes.paragraph.create({
132
+ const generalNote = state.schema.nodes.paragraph.create({
133
133
  placeholder: 'Add general note here',
134
134
  });
135
- const generalNote = state.schema.nodes.general_table_footnote.create({}, [
136
- paragraph,
137
- ]);
138
135
  const tableColGroup = (0, prosemirror_utils_1.findChildrenByType)(tableNode, transform_1.schema.nodes.table_colgroup)[0];
139
136
  const tr = state.tr;
140
137
  const pos = (tableElementFooter === null || tableElementFooter === void 0 ? void 0 : tableElementFooter.length)
@@ -47,7 +47,7 @@ const StyledButtonGroup = (0, styled_components_1.default)(style_guide_1.ButtonG
47
47
  `;
48
48
  const AuthorActions = ({ author, onSave, onDelete, onCancel, }) => {
49
49
  const [showDeleteDialog, setShowDeleteDialog] = (0, react_1.useState)(false);
50
- return (react_1.default.createElement(AuthorActionsContainer, null,
50
+ return (react_1.default.createElement(AuthorActionsContainer, { "data-cy": "author-action" },
51
51
  react_1.default.createElement(DeleteAuthorConfirmationDialog_1.DeleteAuthorConfirmationDialog, { author: author, isOpen: showDeleteDialog, onDelete: () => {
52
52
  setShowDeleteDialog(true);
53
53
  onDelete();
@@ -109,7 +109,7 @@ const AuthorAffiliations = ({ author, affiliations, onSave, onAdd, onRemove, })
109
109
  onSave(affiliation);
110
110
  onAdd(affiliation);
111
111
  };
112
- return (react_1.default.createElement(react_1.default.Fragment, null,
112
+ return (react_1.default.createElement("div", { "data-cy": "affiliations-editor" },
113
113
  authorAffiliations.map((a) => (react_1.default.createElement(AffiliationButton_1.AffiliationButton, { key: `${author.id}-${a.id}`, affiliation: a, onSave: onSave, onRemove: () => onRemove(a) }))),
114
114
  react_1.default.createElement(creatable_1.default, { options: options, isMulti: false, isClearable: true, value: null, inputValue: searchText, components: {
115
115
  IndicatorsContainer: exports.AddAffiliationIndicator,
@@ -30,7 +30,7 @@ const AuthorListContainer = styled_components_1.default.div `
30
30
  `;
31
31
  const AuthorList = ({ author, authors, onSelect, moveAuthor, }) => {
32
32
  return (react_1.default.createElement(react_dnd_1.DndProvider, { backend: react_dnd_html5_backend_1.HTML5Backend },
33
- react_1.default.createElement(AuthorListContainer, null, authors.map((a) => {
33
+ react_1.default.createElement(AuthorListContainer, { "data-cy": "authors-list" }, authors.map((a) => {
34
34
  return (react_1.default.createElement(DraggableAuthor_1.DraggableAuthor, { key: a.id, author: a, isSelected: a.id === (author === null || author === void 0 ? void 0 : author.id), onClick: () => onSelect(a), moveAuthor: moveAuthor }));
35
35
  }))));
36
36
  };
@@ -221,11 +221,11 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
221
221
  react_1.default.createElement(style_guide_1.ModalSidebarHeader, null,
222
222
  react_1.default.createElement(style_guide_1.ModalSidebarTitle, null, "Authors")),
223
223
  react_1.default.createElement(style_guide_1.SidebarContent, null,
224
- react_1.default.createElement(AddAuthorButton, { onClick: handleAddAuthor },
224
+ react_1.default.createElement(AddAuthorButton, { "data-cy": "add-author-button", onClick: handleAddAuthor },
225
225
  react_1.default.createElement(style_guide_1.AddIcon, { width: 40, height: 40 }),
226
226
  react_1.default.createElement(ActionTitle, null, "Add Author")),
227
227
  react_1.default.createElement(AuthorList_1.AuthorList, { author: selection, authors: authors, onSelect: handleSelect, moveAuthor: handleMoveAuthor }))),
228
- react_1.default.createElement(style_guide_1.ScrollableModalContent, null, selection ? (react_1.default.createElement(AuthorForms, null,
228
+ react_1.default.createElement(style_guide_1.ScrollableModalContent, { "data-cy": "author-modal-content" }, selection ? (react_1.default.createElement(AuthorForms, null,
229
229
  react_1.default.createElement(SaveAuthorConfirmationDialog_1.SaveAuthorConfirmationDialog, { isOpen: showConfirmationDialog, onSave: () => handleSaveAuthor(valuesRef.current), onCancel: handleResetAuthor }),
230
230
  react_1.default.createElement(AuthorActions_1.AuthorActions, { author: selection, onSave: () => handleSaveAuthor(valuesRef.current), onDelete: handleDeleteAuthor, onCancel: () => setOpen(false) }),
231
231
  react_1.default.createElement(FormLabel, null, "Details"),
@@ -142,15 +142,22 @@ const DraggableAuthor = ({ author, isSelected, onClick, moveAuthor, }) => {
142
142
  }),
143
143
  });
144
144
  dragRef(dropRef(ref));
145
- const dragClass = isDragging ? 'dragging' : '';
146
- const dropClass = isOver && dropSide ? `drop-${dropSide}` : '';
147
- const activeClass = isSelected ? 'active' : '';
148
- return (react_1.default.createElement(AuthorContainer, { ref: ref, className: `${dragClass} ${dropClass} ${activeClass}`, onClick: onClick },
149
- react_1.default.createElement(AvatarContainer, null,
145
+ const classes = [];
146
+ if (isDragging) {
147
+ classes.push('dragging');
148
+ }
149
+ if (isOver && dropSide) {
150
+ classes.push(`drop-${dropSide}`);
151
+ }
152
+ if (isSelected) {
153
+ classes.push('active');
154
+ }
155
+ return (react_1.default.createElement(AuthorContainer, { ref: ref, className: classes.join(' '), onClick: onClick, "data-cy": "author-item" },
156
+ react_1.default.createElement(AvatarContainer, { "data-cy": "author-avatar" },
150
157
  react_1.default.createElement(style_guide_1.Avatar, { size: 36, color: '#6e6e6e' }),
151
- react_1.default.createElement(AuthorNotes, null, author.isCorresponding && (react_1.default.createElement(AuthorBadge, null,
158
+ react_1.default.createElement(AuthorNotes, { "data-cy": "author-notes" }, author.isCorresponding && (react_1.default.createElement(AuthorBadge, null,
152
159
  react_1.default.createElement(style_guide_1.CorrespondingAuthorIcon, null))))),
153
- react_1.default.createElement(AuthorName, null, (0, authors_1.authorLabel)(author)),
160
+ react_1.default.createElement(AuthorName, { "data-cy": "author-name" }, (0, authors_1.authorLabel)(author)),
154
161
  isSelected && react_1.default.createElement(DragHandle, null)));
155
162
  };
156
163
  exports.DraggableAuthor = DraggableAuthor;
@@ -27,7 +27,6 @@ const footnotes_utils_1 = require("../plugins/footnotes/footnotes-utils");
27
27
  const ReactSubView_1 = __importDefault(require("../views/ReactSubView"));
28
28
  const popper_1 = require("./popper");
29
29
  const track_changes_utils_1 = require("./track-changes-utils");
30
- const utils_1 = require("./utils");
31
30
  const popper = new popper_1.PopperManager();
32
31
  const listTypes = [transform_1.schema.nodes.ordered_list, transform_1.schema.nodes.bullet_list];
33
32
  const readonlyTypes = [transform_1.schema.nodes.keywords, transform_1.schema.nodes.bibliography_element];
@@ -144,7 +143,7 @@ class ContextMenu {
144
143
  this.addPopperEventListeners();
145
144
  };
146
145
  this.showEditMenu = (target) => {
147
- var _a;
146
+ var _a, _b;
148
147
  const menu = document.createElement('div');
149
148
  menu.className = 'menu';
150
149
  const $pos = this.resolvePos();
@@ -180,9 +179,9 @@ class ContextMenu {
180
179
  const tableElementFooter = (0, prosemirror_utils_1.findChildrenByType)(this.node, transform_1.schema.nodes.table_element_footer);
181
180
  let isDeletedOrRejected = false;
182
181
  const hasGeneralNote = tableElementFooter.length &&
183
- (0, utils_1.getChildOfType)(tableElementFooter[0].node, transform_1.schema.nodes.general_table_footnote, true);
182
+ ((_a = tableElementFooter[0].node.firstChild) === null || _a === void 0 ? void 0 : _a.type) === transform_1.schema.nodes.paragraph;
184
183
  if (hasGeneralNote) {
185
- const generalFootnote = (_a = tableElementFooter[0]) === null || _a === void 0 ? void 0 : _a.node.firstChild;
184
+ const generalFootnote = (_b = tableElementFooter[0]) === null || _b === void 0 ? void 0 : _b.node.firstChild;
186
185
  if (generalFootnote) {
187
186
  isDeletedOrRejected =
188
187
  (0, track_changes_utils_1.isDeleted)(generalFootnote) || (0, track_changes_utils_1.isRejectedInsert)(generalFootnote);
@@ -82,7 +82,7 @@ const deleteFootnoteWidget = (node, props, id, tableElement) => (view, getPos) =
82
82
  }
83
83
  else {
84
84
  node.content.forEach((item) => {
85
- if (item.type === transform_1.schema.nodes.general_table_footnote && pos) {
85
+ if (item.type === transform_1.schema.nodes.paragraph && pos) {
86
86
  tr.delete(pos - 1, pos + item.nodeSize + 1);
87
87
  }
88
88
  });
@@ -120,12 +120,9 @@ export const createBlock = (nodeType, position, state, dispatch) => {
120
120
  export const insertGeneralFootnote = (tableNode, position, view, tableElementFooter) => {
121
121
  var _a;
122
122
  const { state, dispatch } = view;
123
- const paragraph = state.schema.nodes.paragraph.create({
123
+ const generalNote = state.schema.nodes.paragraph.create({
124
124
  placeholder: 'Add general note here',
125
125
  });
126
- const generalNote = state.schema.nodes.general_table_footnote.create({}, [
127
- paragraph,
128
- ]);
129
126
  const tableColGroup = findChildrenByType(tableNode, schema.nodes.table_colgroup)[0];
130
127
  const tr = state.tr;
131
128
  const pos = (tableElementFooter === null || tableElementFooter === void 0 ? void 0 : tableElementFooter.length)
@@ -18,7 +18,7 @@ const StyledButtonGroup = styled(ButtonGroup) `
18
18
  `;
19
19
  export const AuthorActions = ({ author, onSave, onDelete, onCancel, }) => {
20
20
  const [showDeleteDialog, setShowDeleteDialog] = useState(false);
21
- return (React.createElement(AuthorActionsContainer, null,
21
+ return (React.createElement(AuthorActionsContainer, { "data-cy": "author-action" },
22
22
  React.createElement(DeleteAuthorConfirmationDialog, { author: author, isOpen: showDeleteDialog, onDelete: () => {
23
23
  setShowDeleteDialog(true);
24
24
  onDelete();
@@ -79,7 +79,7 @@ export const AuthorAffiliations = ({ author, affiliations, onSave, onAdd, onRemo
79
79
  onSave(affiliation);
80
80
  onAdd(affiliation);
81
81
  };
82
- return (React.createElement(React.Fragment, null,
82
+ return (React.createElement("div", { "data-cy": "affiliations-editor" },
83
83
  authorAffiliations.map((a) => (React.createElement(AffiliationButton, { key: `${author.id}-${a.id}`, affiliation: a, onSave: onSave, onRemove: () => onRemove(a) }))),
84
84
  React.createElement(CreatableSelect, { options: options, isMulti: false, isClearable: true, value: null, inputValue: searchText, components: {
85
85
  IndicatorsContainer: AddAffiliationIndicator,
@@ -24,7 +24,7 @@ const AuthorListContainer = styled.div `
24
24
  `;
25
25
  export const AuthorList = ({ author, authors, onSelect, moveAuthor, }) => {
26
26
  return (React.createElement(DndProvider, { backend: HTML5Backend },
27
- React.createElement(AuthorListContainer, null, authors.map((a) => {
27
+ React.createElement(AuthorListContainer, { "data-cy": "authors-list" }, authors.map((a) => {
28
28
  return (React.createElement(DraggableAuthor, { key: a.id, author: a, isSelected: a.id === (author === null || author === void 0 ? void 0 : author.id), onClick: () => onSelect(a), moveAuthor: moveAuthor }));
29
29
  }))));
30
30
  };
@@ -192,11 +192,11 @@ export const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, a
192
192
  React.createElement(ModalSidebarHeader, null,
193
193
  React.createElement(ModalSidebarTitle, null, "Authors")),
194
194
  React.createElement(SidebarContent, null,
195
- React.createElement(AddAuthorButton, { onClick: handleAddAuthor },
195
+ React.createElement(AddAuthorButton, { "data-cy": "add-author-button", onClick: handleAddAuthor },
196
196
  React.createElement(AddIcon, { width: 40, height: 40 }),
197
197
  React.createElement(ActionTitle, null, "Add Author")),
198
198
  React.createElement(AuthorList, { author: selection, authors: authors, onSelect: handleSelect, moveAuthor: handleMoveAuthor }))),
199
- React.createElement(ScrollableModalContent, null, selection ? (React.createElement(AuthorForms, null,
199
+ React.createElement(ScrollableModalContent, { "data-cy": "author-modal-content" }, selection ? (React.createElement(AuthorForms, null,
200
200
  React.createElement(SaveAuthorConfirmationDialog, { isOpen: showConfirmationDialog, onSave: () => handleSaveAuthor(valuesRef.current), onCancel: handleResetAuthor }),
201
201
  React.createElement(AuthorActions, { author: selection, onSave: () => handleSaveAuthor(valuesRef.current), onDelete: handleDeleteAuthor, onCancel: () => setOpen(false) }),
202
202
  React.createElement(FormLabel, null, "Details"),
@@ -113,14 +113,21 @@ export const DraggableAuthor = ({ author, isSelected, onClick, moveAuthor, }) =>
113
113
  }),
114
114
  });
115
115
  dragRef(dropRef(ref));
116
- const dragClass = isDragging ? 'dragging' : '';
117
- const dropClass = isOver && dropSide ? `drop-${dropSide}` : '';
118
- const activeClass = isSelected ? 'active' : '';
119
- return (React.createElement(AuthorContainer, { ref: ref, className: `${dragClass} ${dropClass} ${activeClass}`, onClick: onClick },
120
- React.createElement(AvatarContainer, null,
116
+ const classes = [];
117
+ if (isDragging) {
118
+ classes.push('dragging');
119
+ }
120
+ if (isOver && dropSide) {
121
+ classes.push(`drop-${dropSide}`);
122
+ }
123
+ if (isSelected) {
124
+ classes.push('active');
125
+ }
126
+ return (React.createElement(AuthorContainer, { ref: ref, className: classes.join(' '), onClick: onClick, "data-cy": "author-item" },
127
+ React.createElement(AvatarContainer, { "data-cy": "author-avatar" },
121
128
  React.createElement(Avatar, { size: 36, color: '#6e6e6e' }),
122
- React.createElement(AuthorNotes, null, author.isCorresponding && (React.createElement(AuthorBadge, null,
129
+ React.createElement(AuthorNotes, { "data-cy": "author-notes" }, author.isCorresponding && (React.createElement(AuthorBadge, null,
123
130
  React.createElement(CorrespondingAuthorIcon, null))))),
124
- React.createElement(AuthorName, null, authorLabel(author)),
131
+ React.createElement(AuthorName, { "data-cy": "author-name" }, authorLabel(author)),
125
132
  isSelected && React.createElement(DragHandle, null)));
126
133
  };
@@ -21,7 +21,6 @@ import { buildTableFootnoteLabels } from '../plugins/footnotes/footnotes-utils';
21
21
  import ReactSubView from '../views/ReactSubView';
22
22
  import { PopperManager } from './popper';
23
23
  import { isDeleted, isRejectedInsert } from './track-changes-utils';
24
- import { getChildOfType } from './utils';
25
24
  const popper = new PopperManager();
26
25
  const listTypes = [schema.nodes.ordered_list, schema.nodes.bullet_list];
27
26
  const readonlyTypes = [schema.nodes.keywords, schema.nodes.bibliography_element];
@@ -137,7 +136,7 @@ export class ContextMenu {
137
136
  this.addPopperEventListeners();
138
137
  };
139
138
  this.showEditMenu = (target) => {
140
- var _a;
139
+ var _a, _b;
141
140
  const menu = document.createElement('div');
142
141
  menu.className = 'menu';
143
142
  const $pos = this.resolvePos();
@@ -173,9 +172,9 @@ export class ContextMenu {
173
172
  const tableElementFooter = findChildrenByType(this.node, schema.nodes.table_element_footer);
174
173
  let isDeletedOrRejected = false;
175
174
  const hasGeneralNote = tableElementFooter.length &&
176
- getChildOfType(tableElementFooter[0].node, schema.nodes.general_table_footnote, true);
175
+ ((_a = tableElementFooter[0].node.firstChild) === null || _a === void 0 ? void 0 : _a.type) === schema.nodes.paragraph;
177
176
  if (hasGeneralNote) {
178
- const generalFootnote = (_a = tableElementFooter[0]) === null || _a === void 0 ? void 0 : _a.node.firstChild;
177
+ const generalFootnote = (_b = tableElementFooter[0]) === null || _b === void 0 ? void 0 : _b.node.firstChild;
179
178
  if (generalFootnote) {
180
179
  isDeletedOrRejected =
181
180
  isDeleted(generalFootnote) || isRejectedInsert(generalFootnote);
@@ -75,7 +75,7 @@ const deleteFootnoteWidget = (node, props, id, tableElement) => (view, getPos) =
75
75
  }
76
76
  else {
77
77
  node.content.forEach((item) => {
78
- if (item.type === schema.nodes.general_table_footnote && pos) {
78
+ if (item.type === schema.nodes.paragraph && pos) {
79
79
  tr.delete(pos - 1, pos + item.nodeSize + 1);
80
80
  }
81
81
  });
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": "1.11.1-LEAN-3519.0",
4
+ "version": "1.11.2",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -30,9 +30,9 @@
30
30
  "@iarna/word-count": "^1.1.2",
31
31
  "@manuscripts/json-schema": "2.2.8",
32
32
  "@manuscripts/library": "1.3.7",
33
- "@manuscripts/style-guide": "1.12.12-LEAN-3519.0",
33
+ "@manuscripts/style-guide": "1.12.12",
34
34
  "@manuscripts/track-changes-plugin": "1.7.12",
35
- "@manuscripts/transform": "2.3.7-LEAN-3519.1",
35
+ "@manuscripts/transform": "2.3.6",
36
36
  "astrocite-eutils": "^0.16.4",
37
37
  "mathjax-full": "^3.2.2",
38
38
  "codemirror": "^5.58.1",
package/styles/Editor.css CHANGED
@@ -971,8 +971,7 @@
971
971
  fill: #353535;
972
972
  }
973
973
  .ProseMirror .table-footnotes-element > div,
974
- .ProseMirror .block-footnotes_element > .block > div,
975
- .ProseMirror .general-table-footnote
974
+ .ProseMirror .block-footnotes_element > .block > div
976
975
  {
977
976
  position: relative;
978
977
  }
@@ -996,27 +995,37 @@
996
995
  margin-top: 0px;
997
996
  }
998
997
 
998
+ .ProseMirror .footnote-selected, .table-footer > div:has(> p.footnote-selected) > p {
999
+ background-color: #f2fbfc;
1000
+ padding: 4px;
1001
+ }
999
1002
  .table-footer > div {
1000
1003
  position: relative;
1001
1004
  }
1002
1005
 
1003
- .general-table-footnote > p {
1004
- padding-bottom: 8px;
1005
- }
1006
-
1007
- .general-table-footnote:has(> p.footnote-selected) > p:last-child {
1008
- padding-bottom: 0;
1006
+ .table-footer > div > p {
1007
+ padding-bottom: 10px;
1009
1008
  }
1010
1009
 
1011
1010
  .ProseMirror .table-footnotes-element .footnote-selected,
1012
- .ProseMirror .block-footnotes_element .footnote-selected,
1013
- .ProseMirror .general-table-footnote:has(> p.footnote-selected)
1011
+ .ProseMirror .block-footnotes_element .footnote-selected
1014
1012
  {
1015
- background-color: #f2fbfc;
1016
- padding: 4px;
1017
1013
  border: 1px solid #bce7f6;
1018
1014
  }
1019
-
1015
+ .table-footer > div:has(> p.footnote-selected) > p {
1016
+ border-left: 1px solid #bce7f6;
1017
+ border-right: 1px solid #bce7f6;
1018
+ }
1019
+ .table-footer > div:has(> p.footnote-selected) > p:first-child {
1020
+ border-top: 1px solid #bce7f6;
1021
+ position: relative;
1022
+ }
1023
+ .table-footer > div:has(> p.footnote-selected) > p:last-of-type {
1024
+ border-bottom: 1px solid #bce7f6;
1025
+ }
1026
+ .table-footer > div:has(> p.footnote-selected) > p:last-child {
1027
+ border-bottom: 1px solid #bce7f6;
1028
+ }
1020
1029
  .ProseMirror .footnote-label {
1021
1030
  vertical-align: super;
1022
1031
  font-size: 75%;