@manuscripts/body-editor 2.7.48 → 2.7.49

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.
@@ -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 = '2.7.48';
4
+ exports.VERSION = '2.7.49';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -105,11 +105,11 @@ class FootnoteView extends base_node_view_1.BaseNodeView {
105
105
  const pos = tr.mapping.map(this.getPos());
106
106
  const $pos = tr.doc.resolve(pos);
107
107
  const element = (0, prosemirror_utils_1.findParentNodeOfTypeClosestToPos)($pos, transform_1.schema.nodes.footnotes_element);
108
- if (element && getEffectiveChildCount(element.node) <= 1) {
109
- tr.delete(element.pos, element.pos + element.node.nodeSize);
110
- }
111
- else {
112
- tr.delete(pos, pos + this.node.nodeSize);
108
+ tr.delete(pos, pos + this.node.nodeSize);
109
+ if (element &&
110
+ getEffectiveChildCount(element.node) <= 1 &&
111
+ !(0, track_changes_utils_1.isPendingInsert)(this.node)) {
112
+ tr.delete(tr.mapping.map(element.pos), tr.mapping.map(element.pos + element.node.nodeSize));
113
113
  }
114
114
  };
115
115
  }
@@ -151,7 +151,7 @@ class FootnoteView extends base_node_view_1.BaseNodeView {
151
151
  icon: 'Scroll',
152
152
  });
153
153
  }
154
- if (can.editArticle) {
154
+ if (can.editArticle && !(0, track_changes_utils_1.isDeleted)(this.node)) {
155
155
  componentProps.actions.push({
156
156
  label: 'Delete',
157
157
  action: () => this.handleDelete(),
@@ -62,15 +62,15 @@ class GeneralTableFootnoteView extends base_node_view_1.BaseNodeView {
62
62
  const pos = this.getPos();
63
63
  const $pos = this.view.state.doc.resolve(pos);
64
64
  const footer = (0, prosemirror_utils_1.findParentNodeOfTypeClosestToPos)($pos, transform_1.schema.nodes.table_element_footer);
65
- const element = (0, prosemirror_utils_1.findChildrenByType)(footer.node, transform_1.schema.nodes.footnotes_element)[0];
65
+ const element = (0, prosemirror_utils_1.findChildrenByType)(footer.node, transform_1.schema.nodes.general_table_footnote)[0];
66
66
  if (element && !(0, track_changes_utils_1.isDeleted)(element.node)) {
67
- const from = pos;
68
- const to = from + this.node.nodeSize;
67
+ const from = tr.mapping.map(pos);
68
+ const to = tr.mapping.map(from + this.node.nodeSize);
69
69
  tr.delete(from, to);
70
70
  }
71
- else {
72
- const from = footer.pos;
73
- const to = from + footer.node.nodeSize;
71
+ if (footer.node.childCount <= 1 && !(0, track_changes_utils_1.isPendingInsert)(element.node)) {
72
+ const from = tr.mapping.map(footer.pos);
73
+ const to = tr.mapping.map(from + footer.node.nodeSize);
74
74
  tr.delete(from, to);
75
75
  }
76
76
  this.view.dispatch(tr);
@@ -86,11 +86,13 @@ class GeneralTableFootnoteView extends base_node_view_1.BaseNodeView {
86
86
  const componentProps = {
87
87
  actions: [],
88
88
  };
89
- componentProps.actions.push({
90
- label: 'Delete',
91
- action: () => this.handleDeleteClick(),
92
- icon: 'Delete',
93
- });
89
+ if (!(0, track_changes_utils_1.isDeleted)(this.node)) {
90
+ componentProps.actions.push({
91
+ label: 'Delete',
92
+ action: () => this.handleDeleteClick(),
93
+ icon: 'Delete',
94
+ });
95
+ }
94
96
  this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu', 'footnote-context-menu']);
95
97
  this.props.popper.show(element, this.contextMenu, 'right-start');
96
98
  }
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.7.48';
1
+ export const VERSION = '2.7.49';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -21,7 +21,7 @@ import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
21
21
  import { DeleteFootnoteDialog, } from '../components/views/DeleteFootnoteDialog';
22
22
  import { alertIcon } from '../icons';
23
23
  import { getFootnotesElementState } from '../lib/footnotes';
24
- import { isDeleted } from '../lib/track-changes-utils';
24
+ import { isDeleted, isPendingInsert } from '../lib/track-changes-utils';
25
25
  import { BaseNodeView } from './base_node_view';
26
26
  import { createNodeView } from './creators';
27
27
  import ReactSubView from './ReactSubView';
@@ -99,11 +99,11 @@ export class FootnoteView extends BaseNodeView {
99
99
  const pos = tr.mapping.map(this.getPos());
100
100
  const $pos = tr.doc.resolve(pos);
101
101
  const element = findParentNodeOfTypeClosestToPos($pos, schema.nodes.footnotes_element);
102
- if (element && getEffectiveChildCount(element.node) <= 1) {
103
- tr.delete(element.pos, element.pos + element.node.nodeSize);
104
- }
105
- else {
106
- tr.delete(pos, pos + this.node.nodeSize);
102
+ tr.delete(pos, pos + this.node.nodeSize);
103
+ if (element &&
104
+ getEffectiveChildCount(element.node) <= 1 &&
105
+ !isPendingInsert(this.node)) {
106
+ tr.delete(tr.mapping.map(element.pos), tr.mapping.map(element.pos + element.node.nodeSize));
107
107
  }
108
108
  };
109
109
  }
@@ -145,7 +145,7 @@ export class FootnoteView extends BaseNodeView {
145
145
  icon: 'Scroll',
146
146
  });
147
147
  }
148
- if (can.editArticle) {
148
+ if (can.editArticle && !isDeleted(this.node)) {
149
149
  componentProps.actions.push({
150
150
  label: 'Delete',
151
151
  action: () => this.handleDelete(),
@@ -17,7 +17,7 @@ import { ContextMenu } from '@manuscripts/style-guide';
17
17
  import { schema } from '@manuscripts/transform';
18
18
  import { findChildrenByType, findParentNodeOfTypeClosestToPos, } from 'prosemirror-utils';
19
19
  import { DeleteFootnoteDialog, } from '../components/views/DeleteFootnoteDialog';
20
- import { isDeleted } from '../lib/track-changes-utils';
20
+ import { isDeleted, isPendingInsert } from '../lib/track-changes-utils';
21
21
  import { BaseNodeView } from './base_node_view';
22
22
  import { createNodeView } from './creators';
23
23
  import ReactSubView from './ReactSubView';
@@ -56,15 +56,15 @@ export class GeneralTableFootnoteView extends BaseNodeView {
56
56
  const pos = this.getPos();
57
57
  const $pos = this.view.state.doc.resolve(pos);
58
58
  const footer = findParentNodeOfTypeClosestToPos($pos, schema.nodes.table_element_footer);
59
- const element = findChildrenByType(footer.node, schema.nodes.footnotes_element)[0];
59
+ const element = findChildrenByType(footer.node, schema.nodes.general_table_footnote)[0];
60
60
  if (element && !isDeleted(element.node)) {
61
- const from = pos;
62
- const to = from + this.node.nodeSize;
61
+ const from = tr.mapping.map(pos);
62
+ const to = tr.mapping.map(from + this.node.nodeSize);
63
63
  tr.delete(from, to);
64
64
  }
65
- else {
66
- const from = footer.pos;
67
- const to = from + footer.node.nodeSize;
65
+ if (footer.node.childCount <= 1 && !isPendingInsert(element.node)) {
66
+ const from = tr.mapping.map(footer.pos);
67
+ const to = tr.mapping.map(from + footer.node.nodeSize);
68
68
  tr.delete(from, to);
69
69
  }
70
70
  this.view.dispatch(tr);
@@ -80,11 +80,13 @@ export class GeneralTableFootnoteView extends BaseNodeView {
80
80
  const componentProps = {
81
81
  actions: [],
82
82
  };
83
- componentProps.actions.push({
84
- label: 'Delete',
85
- action: () => this.handleDeleteClick(),
86
- icon: 'Delete',
87
- });
83
+ if (!isDeleted(this.node)) {
84
+ componentProps.actions.push({
85
+ label: 'Delete',
86
+ action: () => this.handleDeleteClick(),
87
+ icon: 'Delete',
88
+ });
89
+ }
88
90
  this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu', 'footnote-context-menu']);
89
91
  this.props.popper.show(element, this.contextMenu, 'right-start');
90
92
  }
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.7.48";
1
+ export declare const VERSION = "2.7.49";
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": "2.7.48",
4
+ "version": "2.7.49",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
package/styles/Editor.css CHANGED
@@ -1023,9 +1023,6 @@
1023
1023
  .ProseMirror .footnote .delete-icon {
1024
1024
  visibility: hidden;
1025
1025
  }
1026
- .ProseMirror .footnote.footnote-selected .delete-icon {
1027
- visibility: visible;
1028
- }
1029
1026
  .ProseMirror .footnote .scroll-icon {
1030
1027
  cursor: pointer;
1031
1028
  visibility: hidden;