@manuscripts/body-editor 1.6.19 → 1.6.20

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.
@@ -103,7 +103,7 @@ const getCitation = (node) => {
103
103
  };
104
104
  exports.getCitation = getCitation;
105
105
  const getBibliographyItem = (node) => {
106
- const attrs = getEffectiveAttrs(node);
106
+ const attrs = getEffectiveAttrs(node, true);
107
107
  if (!attrs) {
108
108
  return undefined;
109
109
  }
@@ -113,9 +113,15 @@ const getBibliographyItem = (node) => {
113
113
  };
114
114
  exports.getBibliographyItem = getBibliographyItem;
115
115
  const getLatest = (a, b) => a.updatedAt > b.updatedAt ? a : b;
116
- const getEffectiveAttrs = (node) => {
116
+ const getEffectiveAttrs = (node, excludeDeletedNode) => {
117
117
  const _a = node.attrs, { dataTracked } = _a, attrs = __rest(_a, ["dataTracked"]);
118
118
  const nodeChange = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.reduce(getLatest);
119
+ const isDeleted = nodeChange &&
120
+ nodeChange.operation === track_changes_plugin_1.CHANGE_OPERATION.delete &&
121
+ nodeChange.status !== track_changes_plugin_1.CHANGE_STATUS.rejected;
122
+ if (isDeleted && excludeDeletedNode) {
123
+ return undefined;
124
+ }
119
125
  const isRejected = nodeChange &&
120
126
  nodeChange.operation === track_changes_plugin_1.CHANGE_OPERATION.set_node_attributes &&
121
127
  nodeChange.status === track_changes_plugin_1.CHANGE_STATUS.rejected;
@@ -97,7 +97,7 @@ export const getCitation = (node) => {
97
97
  };
98
98
  };
99
99
  export const getBibliographyItem = (node) => {
100
- const attrs = getEffectiveAttrs(node);
100
+ const attrs = getEffectiveAttrs(node, true);
101
101
  if (!attrs) {
102
102
  return undefined;
103
103
  }
@@ -106,9 +106,15 @@ export const getBibliographyItem = (node) => {
106
106
  return pickBy(item, (v) => v !== undefined);
107
107
  };
108
108
  const getLatest = (a, b) => a.updatedAt > b.updatedAt ? a : b;
109
- const getEffectiveAttrs = (node) => {
109
+ const getEffectiveAttrs = (node, excludeDeletedNode) => {
110
110
  const _a = node.attrs, { dataTracked } = _a, attrs = __rest(_a, ["dataTracked"]);
111
111
  const nodeChange = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.reduce(getLatest);
112
+ const isDeleted = nodeChange &&
113
+ nodeChange.operation === CHANGE_OPERATION.delete &&
114
+ nodeChange.status !== CHANGE_STATUS.rejected;
115
+ if (isDeleted && excludeDeletedNode) {
116
+ return undefined;
117
+ }
112
118
  const isRejected = nodeChange &&
113
119
  nodeChange.operation === CHANGE_OPERATION.set_node_attributes &&
114
120
  nodeChange.status === CHANGE_STATUS.rejected;
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.6.19",
4
+ "version": "1.6.20",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -31,7 +31,7 @@
31
31
  "@manuscripts/assets": "^0.6.4",
32
32
  "@manuscripts/json-schema": "^2.2.2",
33
33
  "@manuscripts/library": "1.3.2",
34
- "@manuscripts/style-guide": "1.7.2",
34
+ "@manuscripts/style-guide": "1.7.3",
35
35
  "@manuscripts/track-changes-plugin": "^1.7.5",
36
36
  "@manuscripts/transform": "2.0.4",
37
37
  "astrocite-eutils": "^0.16.4",
@@ -109,4 +109,4 @@
109
109
  "resolutions": {
110
110
  "@types/react": "^17.0.2"
111
111
  }
112
- }
112
+ }