@manuscripts/body-editor 2.8.81 → 2.8.82

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.
@@ -78,7 +78,8 @@ const buildTree = ({ node, pos, index, parent, }) => {
78
78
  }
79
79
  if (isManuscriptNode(node) ||
80
80
  ((!childNode.isAtom || (0, transform_1.isElementNodeType)(childNode.type)) &&
81
- childNode.attrs.id)) {
81
+ childNode.attrs.id &&
82
+ !(0, track_changes_utils_1.isDeleted)(childNode))) {
82
83
  items.push((0, exports.buildTree)({
83
84
  node: childNode,
84
85
  pos: startPos + offset,
@@ -114,7 +115,7 @@ const DraggableTree = ({ tree, view, depth, can, }) => {
114
115
  type: 'outline',
115
116
  item: tree,
116
117
  canDrag: () => {
117
- return depth !== 0 && !disableDragAndDrop;
118
+ return depth !== 0 && !disableDragAndDrop && !(0, track_changes_utils_1.isDeleted)(node);
118
119
  },
119
120
  collect: (monitor) => ({
120
121
  isDragging: monitor.isDragging(),
@@ -162,7 +163,7 @@ const DraggableTree = ({ tree, view, depth, can, }) => {
162
163
  const side = (0, dnd_1.getDropSide)(ref.current, monitor);
163
164
  const pos = side === 'before' ? tree.pos - 1 : tree.endPos - 1;
164
165
  let sourcePos = item.pos - 1;
165
- const node = item.node.type.schema.nodes[item.node.type.name].create(Object.assign(Object.assign({}, item.node.attrs), { id: '' }), item.node.content);
166
+ const node = item.node.type.schema.nodes[item.node.type.name].create(Object.assign({}, item.node.attrs), item.node.content);
166
167
  const tr = view.state.tr.insert(pos, node);
167
168
  sourcePos = tr.mapping.map(sourcePos);
168
169
  tr.delete(sourcePos, sourcePos + item.node.nodeSize);
@@ -37,6 +37,7 @@ const editor_props_1 = __importDefault(require("../plugins/editor-props"));
37
37
  const elements_1 = __importDefault(require("../plugins/elements"));
38
38
  const footnotes_1 = __importDefault(require("../plugins/footnotes"));
39
39
  const lock_body_1 = __importDefault(require("../plugins/lock-body"));
40
+ const move_node_1 = __importDefault(require("../plugins/move-node"));
40
41
  const objects_1 = __importDefault(require("../plugins/objects"));
41
42
  const paragraphs_1 = __importDefault(require("../plugins/paragraphs"));
42
43
  const persist_1 = __importDefault(require("../plugins/persist"));
@@ -85,6 +86,7 @@ exports.default = (props) => {
85
86
  (0, alt_titles_1.default)(),
86
87
  (0, accessibility_element_1.default)(),
87
88
  (0, prevent_empty_1.default)(),
89
+ (0, move_node_1.default)(),
88
90
  ];
89
91
  if (props.collabProvider) {
90
92
  allPlugins.push((0, prosemirror_collab_1.collab)({ version: props.collabProvider.currentVersion }));
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2025 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
19
+ const prosemirror_state_1 = require("prosemirror-state");
20
+ const prosemirror_view_1 = require("prosemirror-view");
21
+ exports.default = () => {
22
+ return new prosemirror_state_1.Plugin({
23
+ props: {
24
+ decorations(state) {
25
+ const decos = [];
26
+ state.doc.descendants((node, pos) => {
27
+ var _a;
28
+ const moveTrack = (_a = node.attrs.dataTracked) === null || _a === void 0 ? void 0 : _a.find((t) => t.operation === track_changes_plugin_1.CHANGE_OPERATION.delete &&
29
+ t.status === track_changes_plugin_1.CHANGE_STATUS.pending &&
30
+ t.moveNodeId);
31
+ if (moveTrack) {
32
+ decos.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {
33
+ class: 'move-deleted-node',
34
+ 'data-move-id': moveTrack.moveNodeId,
35
+ 'data-original-id': node.attrs.id,
36
+ }));
37
+ }
38
+ });
39
+ return prosemirror_view_1.DecorationSet.create(state.doc, decos);
40
+ },
41
+ },
42
+ });
43
+ };
@@ -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.8.81';
4
+ exports.VERSION = '2.8.82';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -52,7 +52,8 @@ export const buildTree = ({ node, pos, index, parent, }) => {
52
52
  }
53
53
  if (isManuscriptNode(node) ||
54
54
  ((!childNode.isAtom || isElementNodeType(childNode.type)) &&
55
- childNode.attrs.id)) {
55
+ childNode.attrs.id &&
56
+ !isDeleted(childNode))) {
56
57
  items.push(buildTree({
57
58
  node: childNode,
58
59
  pos: startPos + offset,
@@ -87,7 +88,7 @@ export const DraggableTree = ({ tree, view, depth, can, }) => {
87
88
  type: 'outline',
88
89
  item: tree,
89
90
  canDrag: () => {
90
- return depth !== 0 && !disableDragAndDrop;
91
+ return depth !== 0 && !disableDragAndDrop && !isDeleted(node);
91
92
  },
92
93
  collect: (monitor) => ({
93
94
  isDragging: monitor.isDragging(),
@@ -135,7 +136,7 @@ export const DraggableTree = ({ tree, view, depth, can, }) => {
135
136
  const side = getDropSide(ref.current, monitor);
136
137
  const pos = side === 'before' ? tree.pos - 1 : tree.endPos - 1;
137
138
  let sourcePos = item.pos - 1;
138
- const node = item.node.type.schema.nodes[item.node.type.name].create(Object.assign(Object.assign({}, item.node.attrs), { id: '' }), item.node.content);
139
+ const node = item.node.type.schema.nodes[item.node.type.name].create(Object.assign({}, item.node.attrs), item.node.content);
139
140
  const tr = view.state.tr.insert(pos, node);
140
141
  sourcePos = tr.mapping.map(sourcePos);
141
142
  tr.delete(sourcePos, sourcePos + item.node.nodeSize);
@@ -32,6 +32,7 @@ import editorProps from '../plugins/editor-props';
32
32
  import elements from '../plugins/elements';
33
33
  import footnotes from '../plugins/footnotes';
34
34
  import lock_body from '../plugins/lock-body';
35
+ import move_node from '../plugins/move-node';
35
36
  import objects from '../plugins/objects';
36
37
  import paragraphs from '../plugins/paragraphs';
37
38
  import persist from '../plugins/persist';
@@ -80,6 +81,7 @@ export default (props) => {
80
81
  alt_titles(),
81
82
  accessibility_element(),
82
83
  prevent_empty(),
84
+ move_node(),
83
85
  ];
84
86
  if (props.collabProvider) {
85
87
  allPlugins.push(collab({ version: props.collabProvider.currentVersion }));
@@ -0,0 +1,41 @@
1
+ /*!
2
+ * © 2025 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { CHANGE_OPERATION, CHANGE_STATUS, } from '@manuscripts/track-changes-plugin';
17
+ import { Plugin } from 'prosemirror-state';
18
+ import { Decoration, DecorationSet } from 'prosemirror-view';
19
+ export default () => {
20
+ return new Plugin({
21
+ props: {
22
+ decorations(state) {
23
+ const decos = [];
24
+ state.doc.descendants((node, pos) => {
25
+ var _a;
26
+ const moveTrack = (_a = node.attrs.dataTracked) === null || _a === void 0 ? void 0 : _a.find((t) => t.operation === CHANGE_OPERATION.delete &&
27
+ t.status === CHANGE_STATUS.pending &&
28
+ t.moveNodeId);
29
+ if (moveTrack) {
30
+ decos.push(Decoration.node(pos, pos + node.nodeSize, {
31
+ class: 'move-deleted-node',
32
+ 'data-move-id': moveTrack.moveNodeId,
33
+ 'data-original-id': node.attrs.id,
34
+ }));
35
+ }
36
+ });
37
+ return DecorationSet.create(state.doc, decos);
38
+ },
39
+ },
40
+ });
41
+ };
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.8.81';
1
+ export const VERSION = '2.8.82';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * © 2025 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Plugin } from 'prosemirror-state';
17
+ declare const _default: () => Plugin<any>;
18
+ export default _default;
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.8.81";
1
+ export declare const VERSION = "2.8.82";
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.8.81",
4
+ "version": "2.8.82",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -32,7 +32,7 @@
32
32
  "@manuscripts/json-schema": "2.2.11",
33
33
  "@manuscripts/library": "1.3.14",
34
34
  "@manuscripts/style-guide": "2.1.13",
35
- "@manuscripts/track-changes-plugin": "1.10.7",
35
+ "@manuscripts/track-changes-plugin": "1.10.8",
36
36
  "@manuscripts/transform": "3.0.67",
37
37
  "@popperjs/core": "^2.11.8",
38
38
  "astrocite-eutils": "^0.16.4",
@@ -813,6 +813,8 @@ figure.block:has(.equation.selected-suggestion) {
813
813
  .tracking-visible
814
814
  .ProseMirror
815
815
  [data-track-op='node_split'][data-track-status='pending']
816
+ .block, .tracking-visible
817
+ .selected-suggestion[data-track-op='move'][data-track-status='pending']
816
818
  .block {
817
819
  box-shadow: inset 3px 0 0 var(--updated-border-color);
818
820
  }
@@ -822,7 +824,9 @@ figure.block:has(.equation.selected-suggestion) {
822
824
  .tracking-visible
823
825
  .block:has(figure.selected-suggestion[data-track-op='set_attrs']),
824
826
  .tracking-visible .selected-suggestion[data-track-op='node_split'] .block,
825
- .tracking-visible figure.block:has(.equation.set_attrs.selected-suggestion) {
827
+ .tracking-visible figure.block:has(.equation.set_attrs.selected-suggestion), .tracking-visible
828
+ .selected-suggestion[data-track-op='move'][data-track-status='pending']
829
+ .block {
826
830
  box-shadow: inset 6px 0 0 var(--updated-border-color),
827
831
  inset 9px 0 0 var(--updated-bg-color) !important;
828
832
  animation: fadeOutBackground 3s forwards;
@@ -838,6 +842,11 @@ figure.block:has(.equation.selected-suggestion) {
838
842
  display: none;
839
843
  }
840
844
 
845
+ .ProseMirror .move-deleted-node {
846
+ display: none !important;
847
+ }
848
+
849
+
841
850
  .citation-wrapper {
842
851
  position: relative;
843
852
  }