@manuscripts/body-editor 1.6.19-LEAN-3253-0 → 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;
|
|
@@ -19,7 +19,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.KeywordView = void 0;
|
|
22
|
-
const prosemirror_state_1 = require("prosemirror-state");
|
|
23
22
|
const DeleteKeywordDialog_1 = require("../components/keywords/DeleteKeywordDialog");
|
|
24
23
|
const track_changes_utils_1 = require("../lib/track-changes-utils");
|
|
25
24
|
const base_node_view_1 = require("./base_node_view");
|
|
@@ -68,7 +67,7 @@ class KeywordView extends base_node_view_1.BaseNodeView {
|
|
|
68
67
|
const pos = this.getPos();
|
|
69
68
|
const handleDelete = () => {
|
|
70
69
|
const tr = this.view.state.tr;
|
|
71
|
-
tr.
|
|
70
|
+
tr.delete(pos, pos + keyword.nodeSize);
|
|
72
71
|
this.view.dispatch(tr);
|
|
73
72
|
};
|
|
74
73
|
const componentProps = {
|
|
@@ -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/dist/es/views/keyword.js
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { TextSelection } from 'prosemirror-state';
|
|
17
16
|
import { DeleteKeywordDialog, } from '../components/keywords/DeleteKeywordDialog';
|
|
18
17
|
import { getChangeClasses } from '../lib/track-changes-utils';
|
|
19
18
|
import { BaseNodeView } from './base_node_view';
|
|
@@ -62,7 +61,7 @@ export class KeywordView extends BaseNodeView {
|
|
|
62
61
|
const pos = this.getPos();
|
|
63
62
|
const handleDelete = () => {
|
|
64
63
|
const tr = this.view.state.tr;
|
|
65
|
-
tr.
|
|
64
|
+
tr.delete(pos, pos + keyword.nodeSize);
|
|
66
65
|
this.view.dispatch(tr);
|
|
67
66
|
};
|
|
68
67
|
const componentProps = {
|
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.
|
|
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.
|
|
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",
|