@manuscripts/style-guide 1.7.2 → 1.7.3

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.
@@ -175,6 +175,13 @@ const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts, onSave
175
175
  setSelection(item);
176
176
  setConfirm(false);
177
177
  };
178
+ const handleDelete = () => {
179
+ if (!selection) {
180
+ return;
181
+ }
182
+ onDelete(selection);
183
+ setSelection(undefined);
184
+ };
178
185
  const handleItemClick = (item) => {
179
186
  const values = valuesRef.current;
180
187
  if (values && selection && !(0, lodash_1.isEqual)(values, (0, exports.normalize)(selection))) {
@@ -214,6 +221,6 @@ const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts, onSave
214
221
  (citationCounts.get(item._id) || 0) > 0 ? (react_1.default.createElement(CitationCount, { "data-tooltip-id": "citation-count-tooltip" }, citationCounts.get(item._id))) : (react_1.default.createElement(CitationCount, { className: "unused" }, "0"))),
215
222
  react_1.default.createElement(ReferenceLine_1.ReferenceLine, { item: item }))))),
216
223
  react_1.default.createElement(Tooltip_1.Tooltip, { id: "citation-count-tooltip", place: "bottom" }, "Number of times used in the document"))),
217
- react_1.default.createElement(StyledModal_1.ScrollableModalContent, null, selection && (react_1.default.createElement(ReferenceForm_1.ReferenceForm, { values: (0, exports.normalize)(selection), showDelete: !citationCounts.get(selection._id), onChange: handleChange, onCancel: onCancel, onDelete: () => onDelete(selection), onSave: save, actionsRef: actionsRef })))))));
224
+ react_1.default.createElement(StyledModal_1.ScrollableModalContent, null, selection && (react_1.default.createElement(ReferenceForm_1.ReferenceForm, { values: (0, exports.normalize)(selection), showDelete: !citationCounts.get(selection._id), onChange: handleChange, onCancel: onCancel, onDelete: handleDelete, onSave: save, actionsRef: actionsRef })))))));
218
225
  };
219
226
  exports.ReferencesModal = ReferencesModal;
@@ -145,6 +145,13 @@ export const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts,
145
145
  setSelection(item);
146
146
  setConfirm(false);
147
147
  };
148
+ const handleDelete = () => {
149
+ if (!selection) {
150
+ return;
151
+ }
152
+ onDelete(selection);
153
+ setSelection(undefined);
154
+ };
148
155
  const handleItemClick = (item) => {
149
156
  const values = valuesRef.current;
150
157
  if (values && selection && !isEqual(values, normalize(selection))) {
@@ -184,5 +191,5 @@ export const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts,
184
191
  (citationCounts.get(item._id) || 0) > 0 ? (React.createElement(CitationCount, { "data-tooltip-id": "citation-count-tooltip" }, citationCounts.get(item._id))) : (React.createElement(CitationCount, { className: "unused" }, "0"))),
185
192
  React.createElement(ReferenceLine, { item: item }))))),
186
193
  React.createElement(Tooltip, { id: "citation-count-tooltip", place: "bottom" }, "Number of times used in the document"))),
187
- React.createElement(ScrollableModalContent, null, selection && (React.createElement(ReferenceForm, { values: normalize(selection), showDelete: !citationCounts.get(selection._id), onChange: handleChange, onCancel: onCancel, onDelete: () => onDelete(selection), onSave: save, actionsRef: actionsRef })))))));
194
+ React.createElement(ScrollableModalContent, null, selection && (React.createElement(ReferenceForm, { values: normalize(selection), showDelete: !citationCounts.get(selection._id), onChange: handleChange, onCancel: onCancel, onDelete: handleDelete, onSave: save, actionsRef: actionsRef })))))));
188
195
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/style-guide",
3
3
  "description": "Shared components for Manuscripts applications",
4
- "version": "1.7.2",
4
+ "version": "1.7.3",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -103,4 +103,4 @@
103
103
  "@types/react": "^17.0.2",
104
104
  "jackspeak": "2.1.1"
105
105
  }
106
- }
106
+ }