@manuscripts/body-editor 1.8.2 → 1.8.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.
@@ -147,9 +147,10 @@ const CrossReferenceItems = ({ targets, handleSelect, handleCancel, currentTarge
147
147
  react_1.default.createElement(style_guide_1.ButtonGroup, null,
148
148
  react_1.default.createElement(style_guide_1.SecondaryButton, { onClick: handleCancel }, "Cancel"),
149
149
  react_1.default.createElement(style_guide_1.PrimaryButton, { onClick: () => {
150
- var _a;
150
+ var _a, _b;
151
151
  return selectedItem &&
152
- handleSelect(selectedItem, (_a = customTextRef.current) === null || _a === void 0 ? void 0 : _a.value);
152
+ handleSelect(selectedItem, ((_a = customTextRef.current) === null || _a === void 0 ? void 0 : _a.value) ||
153
+ ((_b = targets.find(({ id }) => id === selectedItem)) === null || _b === void 0 ? void 0 : _b.label));
153
154
  }, disabled: !selectedItem }, "Insert")))));
154
155
  };
155
156
  exports.CrossReferenceItems = CrossReferenceItems;
@@ -121,16 +121,14 @@ class FigureElementView extends block_view_1.default {
121
121
  };
122
122
  }
123
123
  deleteSupplementNode(file) {
124
- if (file.type.id === 'supplementary') {
125
- const tr = this.view.state.tr;
126
- this.view.state.doc.descendants((node, pos) => {
127
- if (node.type === transform_1.schema.nodes.supplement &&
128
- node.attrs.href === file.id) {
129
- tr.delete(pos, pos + node.nodeSize);
130
- }
131
- });
132
- this.view.dispatch(tr);
133
- }
124
+ const tr = this.view.state.tr;
125
+ this.view.state.doc.descendants((node, pos) => {
126
+ if (node.type === transform_1.schema.nodes.supplement &&
127
+ node.attrs.href === file.id) {
128
+ tr.delete(pos, pos + node.nodeSize);
129
+ }
130
+ });
131
+ this.view.dispatch(tr);
134
132
  }
135
133
  }
136
134
  exports.FigureElementView = FigureElementView;
@@ -118,8 +118,9 @@ export const CrossReferenceItems = ({ targets, handleSelect, handleCancel, curre
118
118
  React.createElement(ButtonGroup, null,
119
119
  React.createElement(SecondaryButton, { onClick: handleCancel }, "Cancel"),
120
120
  React.createElement(PrimaryButton, { onClick: () => {
121
- var _a;
121
+ var _a, _b;
122
122
  return selectedItem &&
123
- handleSelect(selectedItem, (_a = customTextRef.current) === null || _a === void 0 ? void 0 : _a.value);
123
+ handleSelect(selectedItem, ((_a = customTextRef.current) === null || _a === void 0 ? void 0 : _a.value) ||
124
+ ((_b = targets.find(({ id }) => id === selectedItem)) === null || _b === void 0 ? void 0 : _b.label));
124
125
  }, disabled: !selectedItem }, "Insert")))));
125
126
  };
@@ -115,16 +115,14 @@ export class FigureElementView extends BlockView {
115
115
  };
116
116
  }
117
117
  deleteSupplementNode(file) {
118
- if (file.type.id === 'supplementary') {
119
- const tr = this.view.state.tr;
120
- this.view.state.doc.descendants((node, pos) => {
121
- if (node.type === schema.nodes.supplement &&
122
- node.attrs.href === file.id) {
123
- tr.delete(pos, pos + node.nodeSize);
124
- }
125
- });
126
- this.view.dispatch(tr);
127
- }
118
+ const tr = this.view.state.tr;
119
+ this.view.state.doc.descendants((node, pos) => {
120
+ if (node.type === schema.nodes.supplement &&
121
+ node.attrs.href === file.id) {
122
+ tr.delete(pos, pos + node.nodeSize);
123
+ }
124
+ });
125
+ this.view.dispatch(tr);
128
126
  }
129
127
  }
130
128
  export default createNodeView(FigureElementView);
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.8.2",
4
+ "version": "1.8.3",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -112,4 +112,4 @@
112
112
  "@types/react": "^17.0.2",
113
113
  "prosemirror-tables": "^1.3.5"
114
114
  }
115
- }
115
+ }