@manuscripts/body-editor 1.7.39-LEAN-3049.0 → 1.8.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.
@@ -112,6 +112,15 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
112
112
  setSelection(author);
113
113
  }
114
114
  };
115
+ const handleClose = () => {
116
+ const values = valuesRef.current;
117
+ if (values && selection && !(0, lodash_1.isEqual)(values, normalize(selection))) {
118
+ setShowConfirmationDialog(true);
119
+ }
120
+ else {
121
+ setOpen(false);
122
+ }
123
+ };
115
124
  const handleSaveAuthor = (values) => {
116
125
  if (!values || !selection) {
117
126
  return;
@@ -202,10 +211,10 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
202
211
  const handleChangeAuthor = (values) => {
203
212
  valuesRef.current = values;
204
213
  };
205
- return (react_1.default.createElement(style_guide_1.StyledModal, { isOpen: isOpen, onRequestClose: () => setOpen(false), shouldCloseOnOverlayClick: true },
214
+ return (react_1.default.createElement(style_guide_1.StyledModal, { isOpen: isOpen, onRequestClose: () => handleClose(), shouldCloseOnOverlayClick: true },
206
215
  react_1.default.createElement(style_guide_1.ModalContainer, null,
207
216
  react_1.default.createElement(style_guide_1.ModalHeader, null,
208
- react_1.default.createElement(style_guide_1.CloseButton, { onClick: () => setOpen(false), "data-cy": "modal-close-button" })),
217
+ react_1.default.createElement(style_guide_1.CloseButton, { onClick: () => handleClose(), "data-cy": "modal-close-button" })),
209
218
  react_1.default.createElement(style_guide_1.ModalBody, null,
210
219
  react_1.default.createElement(style_guide_1.ModalSidebar, { "data-cy": "authors-sidebar" },
211
220
  react_1.default.createElement(style_guide_1.ModalSidebarHeader, null,
@@ -83,6 +83,15 @@ export const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, a
83
83
  setSelection(author);
84
84
  }
85
85
  };
86
+ const handleClose = () => {
87
+ const values = valuesRef.current;
88
+ if (values && selection && !isEqual(values, normalize(selection))) {
89
+ setShowConfirmationDialog(true);
90
+ }
91
+ else {
92
+ setOpen(false);
93
+ }
94
+ };
86
95
  const handleSaveAuthor = (values) => {
87
96
  if (!values || !selection) {
88
97
  return;
@@ -173,10 +182,10 @@ export const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, a
173
182
  const handleChangeAuthor = (values) => {
174
183
  valuesRef.current = values;
175
184
  };
176
- return (React.createElement(StyledModal, { isOpen: isOpen, onRequestClose: () => setOpen(false), shouldCloseOnOverlayClick: true },
185
+ return (React.createElement(StyledModal, { isOpen: isOpen, onRequestClose: () => handleClose(), shouldCloseOnOverlayClick: true },
177
186
  React.createElement(ModalContainer, null,
178
187
  React.createElement(ModalHeader, null,
179
- React.createElement(CloseButton, { onClick: () => setOpen(false), "data-cy": "modal-close-button" })),
188
+ React.createElement(CloseButton, { onClick: () => handleClose(), "data-cy": "modal-close-button" })),
180
189
  React.createElement(ModalBody, null,
181
190
  React.createElement(ModalSidebar, { "data-cy": "authors-sidebar" },
182
191
  React.createElement(ModalSidebarHeader, null,
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.7.39-LEAN-3049.0",
4
+ "version": "1.8.0",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -31,9 +31,9 @@
31
31
  "@manuscripts/assets": "^0.6.4",
32
32
  "@manuscripts/json-schema": "^2.2.7",
33
33
  "@manuscripts/library": "^1.3.6",
34
- "@manuscripts/style-guide": "1.8.8-LEAN-3049.5",
34
+ "@manuscripts/style-guide": "1.11.1",
35
35
  "@manuscripts/track-changes-plugin": "1.7.9",
36
- "@manuscripts/transform": "2.1.14-LEAN-3049.0",
36
+ "@manuscripts/transform": "2.2.0",
37
37
  "astrocite-eutils": "^0.16.4",
38
38
  "axios": "^1.6.7",
39
39
  "mathjax-full": "^3.2.2",