@manuscripts/body-editor 3.2.8 → 3.2.11

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.
@@ -107,7 +107,7 @@ const AuthorDetailsForm = ({ values, onChange, onSave, actionsRef, isEmailRequir
107
107
  : 'Email address';
108
108
  return (react_1.default.createElement(TextFieldWithError, { id: 'email', type: "email", required: isEmailRequired, placeholder: placeholder, ...props.field }));
109
109
  }),
110
- react_1.default.createElement(formik_1.Field, { name: 'role' }, (props) => (react_1.default.createElement(style_guide_1.TextField, { id: 'role', placeholder: 'Role', ...props.field }))),
110
+ react_1.default.createElement(formik_1.Field, { name: 'role' }, (props) => (react_1.default.createElement(style_guide_1.TextField, { id: 'role', placeholder: 'Job Title', ...props.field }))),
111
111
  react_1.default.createElement(exports.CheckboxContainer, null,
112
112
  react_1.default.createElement(style_guide_1.CheckboxLabel, null,
113
113
  react_1.default.createElement(formik_1.Field, { name: 'isCorresponding' }, (props) => (react_1.default.createElement(style_guide_1.CheckboxField, { id: 'isCorresponding', checked: props.field.value, ...props.field }))),
@@ -30,7 +30,7 @@ const FigureOptions = ({ can, getDoc, getFiles, onDownload, onUpload, onDetach,
30
30
  react_1.default.createElement(style_guide_1.DotsIcon, null)),
31
31
  isOpen && (react_1.default.createElement(OptionsDropdownList, { direction: 'right', width: 128, top: 5 },
32
32
  react_1.default.createElement(NestedDropdown, { disabled: !showReplace, parentToggleOpen: toggleOpen, buttonText: replaceBtnText, moveLeft: true, list: react_1.default.createElement(react_1.default.Fragment, null,
33
- getSupplements(getFiles, getDoc, groupFiles).map((file, index) => (react_1.default.createElement(ListItemButton, { key: file.id, id: index.toString(), onClick: () => onReplace && onReplace(file) },
33
+ getSupplements(getFiles, getDoc, groupFiles).map((file, index) => (react_1.default.createElement(ListItemButton, { key: file.id, id: index.toString(), onClick: () => onReplace && onReplace(file, true) },
34
34
  (0, style_guide_1.getFileIcon)(file.name),
35
35
  react_1.default.createElement(ListItemText, null, file.name)))),
36
36
  getOtherFiles(getFiles, getDoc, groupFiles).map((file, index) => (react_1.default.createElement(ListItemButton, { key: file.id, id: index.toString(), onClick: () => onReplace && onReplace(file) },
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MATHJAX_VERSION = exports.VERSION = void 0;
4
- exports.VERSION = '3.2.8';
4
+ exports.VERSION = '3.2.11';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -259,8 +259,24 @@ class FigureEditableView extends figure_1.FigureView {
259
259
  };
260
260
  }
261
261
  if (can.replaceFile) {
262
- handleReplace = (file) => {
262
+ handleReplace = (file, isSupplement = false) => {
263
263
  this.setSrc(file.id);
264
+ if (isSupplement) {
265
+ const tr = this.view.state.tr;
266
+ this.view.state.doc.descendants((node, pos) => {
267
+ if (node.type === node.type.schema.nodes.supplement) {
268
+ const href = node.attrs.href;
269
+ if (href === file.id) {
270
+ tr.delete(pos, pos + node.nodeSize);
271
+ this.view.dispatch(tr);
272
+ }
273
+ }
274
+ if (node.type !== node.type.schema.nodes.supplements &&
275
+ node.type !== node.type.schema.nodes.manuscript) {
276
+ return false;
277
+ }
278
+ });
279
+ }
264
280
  };
265
281
  }
266
282
  if (can.uploadFile) {
@@ -78,7 +78,7 @@ export const AuthorDetailsForm = ({ values, onChange, onSave, actionsRef, isEmai
78
78
  : 'Email address';
79
79
  return (React.createElement(TextFieldWithError, { id: 'email', type: "email", required: isEmailRequired, placeholder: placeholder, ...props.field }));
80
80
  }),
81
- React.createElement(Field, { name: 'role' }, (props) => (React.createElement(TextField, { id: 'role', placeholder: 'Role', ...props.field }))),
81
+ React.createElement(Field, { name: 'role' }, (props) => (React.createElement(TextField, { id: 'role', placeholder: 'Job Title', ...props.field }))),
82
82
  React.createElement(CheckboxContainer, null,
83
83
  React.createElement(CheckboxLabel, null,
84
84
  React.createElement(Field, { name: 'isCorresponding' }, (props) => (React.createElement(CheckboxField, { id: 'isCorresponding', checked: props.field.value, ...props.field }))),
@@ -24,7 +24,7 @@ export const FigureOptions = ({ can, getDoc, getFiles, onDownload, onUpload, onD
24
24
  React.createElement(DotsIcon, null)),
25
25
  isOpen && (React.createElement(OptionsDropdownList, { direction: 'right', width: 128, top: 5 },
26
26
  React.createElement(NestedDropdown, { disabled: !showReplace, parentToggleOpen: toggleOpen, buttonText: replaceBtnText, moveLeft: true, list: React.createElement(React.Fragment, null,
27
- getSupplements(getFiles, getDoc, groupFiles).map((file, index) => (React.createElement(ListItemButton, { key: file.id, id: index.toString(), onClick: () => onReplace && onReplace(file) },
27
+ getSupplements(getFiles, getDoc, groupFiles).map((file, index) => (React.createElement(ListItemButton, { key: file.id, id: index.toString(), onClick: () => onReplace && onReplace(file, true) },
28
28
  getFileIcon(file.name),
29
29
  React.createElement(ListItemText, null, file.name)))),
30
30
  getOtherFiles(getFiles, getDoc, groupFiles).map((file, index) => (React.createElement(ListItemButton, { key: file.id, id: index.toString(), onClick: () => onReplace && onReplace(file) },
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.2.8';
1
+ export const VERSION = '3.2.11';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -253,8 +253,24 @@ export class FigureEditableView extends FigureView {
253
253
  };
254
254
  }
255
255
  if (can.replaceFile) {
256
- handleReplace = (file) => {
256
+ handleReplace = (file, isSupplement = false) => {
257
257
  this.setSrc(file.id);
258
+ if (isSupplement) {
259
+ const tr = this.view.state.tr;
260
+ this.view.state.doc.descendants((node, pos) => {
261
+ if (node.type === node.type.schema.nodes.supplement) {
262
+ const href = node.attrs.href;
263
+ if (href === file.id) {
264
+ tr.delete(pos, pos + node.nodeSize);
265
+ this.view.dispatch(tr);
266
+ }
267
+ }
268
+ if (node.type !== node.type.schema.nodes.supplements &&
269
+ node.type !== node.type.schema.nodes.manuscript) {
270
+ return false;
271
+ }
272
+ });
273
+ }
258
274
  };
259
275
  }
260
276
  if (can.uploadFile) {
@@ -10,7 +10,7 @@ export interface FigureOptionsProps extends FigureDropdownProps {
10
10
  onDownload?: () => void;
11
11
  onUpload?: () => void;
12
12
  onDetach?: () => void;
13
- onReplace?: (file: FileAttachment) => void;
13
+ onReplace?: (file: FileAttachment, isSupplement?: boolean) => void;
14
14
  getDoc: () => ManuscriptNode;
15
15
  onDelete?: () => void;
16
16
  }
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.2.8";
1
+ export declare const VERSION = "3.2.11";
2
2
  export declare const MATHJAX_VERSION = "3.2.2";
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": "3.2.8",
4
+ "version": "3.2.11",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",