@manuscripts/track-changes-plugin 2.2.1 → 2.2.3
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.
|
@@ -46,7 +46,10 @@ function fixAndSetSelectionAfterTracking(newTr, oldTr, deletedNodeMapping, trCon
|
|
|
46
46
|
newTr.setSelection(new prosemirror_state_1.TextSelection(newPos));
|
|
47
47
|
}
|
|
48
48
|
if (wasNodeSelection) {
|
|
49
|
-
|
|
49
|
+
let mappedPos = newTr.mapping.map(oldTr.selection.from, -1);
|
|
50
|
+
if (oldTr.getMeta('uiEvent') === 'paste') {
|
|
51
|
+
mappedPos = oldTr.selection.from;
|
|
52
|
+
}
|
|
50
53
|
const sel = (0, exports.getSelectionStaticConstructor)(oldTr.selection);
|
|
51
54
|
newTr.setSelection(sel.create(newTr.doc, mappedPos));
|
|
52
55
|
}
|
|
@@ -22,7 +22,7 @@ const change_1 = require("../../types/change");
|
|
|
22
22
|
const isDeleteStep = (step) => step.from !== step.to && step.slice.content.size < step.to - step.from;
|
|
23
23
|
exports.isDeleteStep = isDeleteStep;
|
|
24
24
|
const isSplitStep = (step, selection, uiEvent) => {
|
|
25
|
-
var _a, _b, _c, _d;
|
|
25
|
+
var _a, _b, _c, _d, _e, _f;
|
|
26
26
|
const { from, to, slice } = step;
|
|
27
27
|
if (from !== to ||
|
|
28
28
|
slice.content.childCount < 2 ||
|
|
@@ -31,12 +31,14 @@ const isSplitStep = (step, selection, uiEvent) => {
|
|
|
31
31
|
}
|
|
32
32
|
const { $anchor: { parentOffset: startOffset }, $head: { parentOffset: endOffset }, $from, } = selection;
|
|
33
33
|
const parentSize = $from.node().content.size;
|
|
34
|
-
if (uiEvent === 'paste'
|
|
34
|
+
if (uiEvent === 'paste' &&
|
|
35
|
+
((_c = slice.content.firstChild) === null || _c === void 0 ? void 0 : _c.inlineContent) &&
|
|
36
|
+
((_d = slice.content.lastChild) === null || _d === void 0 ? void 0 : _d.inlineContent)) {
|
|
35
37
|
return !((startOffset === 0 && endOffset === 0) ||
|
|
36
38
|
(startOffset === parentSize && endOffset === parentSize));
|
|
37
39
|
}
|
|
38
40
|
const { content: { firstChild, lastChild }, openStart, openEnd, } = slice;
|
|
39
|
-
if ((((
|
|
41
|
+
if ((((_e = window.event) === null || _e === void 0 ? void 0 : _e.code) === 'Enter' || ((_f = window.event) === null || _f === void 0 ? void 0 : _f.code) === 'NumpadEnter') &&
|
|
40
42
|
(firstChild === null || firstChild === void 0 ? void 0 : firstChild.type.name) === 'list_item') {
|
|
41
43
|
return !(parentSize === startOffset && parentSize === endOffset) && (lastChild === null || lastChild === void 0 ? void 0 : lastChild.type.name) === 'list_item';
|
|
42
44
|
}
|
|
@@ -41,7 +41,10 @@ export function fixAndSetSelectionAfterTracking(newTr, oldTr, deletedNodeMapping
|
|
|
41
41
|
newTr.setSelection(new TextSelection(newPos));
|
|
42
42
|
}
|
|
43
43
|
if (wasNodeSelection) {
|
|
44
|
-
|
|
44
|
+
let mappedPos = newTr.mapping.map(oldTr.selection.from, -1);
|
|
45
|
+
if (oldTr.getMeta('uiEvent') === 'paste') {
|
|
46
|
+
mappedPos = oldTr.selection.from;
|
|
47
|
+
}
|
|
45
48
|
const sel = getSelectionStaticConstructor(oldTr.selection);
|
|
46
49
|
newTr.setSelection(sel.create(newTr.doc, mappedPos));
|
|
47
50
|
}
|
|
@@ -17,7 +17,7 @@ import { ChangeSet } from '../../ChangeSet';
|
|
|
17
17
|
import { CHANGE_OPERATION, CHANGE_STATUS } from '../../types/change';
|
|
18
18
|
export const isDeleteStep = (step) => step.from !== step.to && step.slice.content.size < step.to - step.from;
|
|
19
19
|
export const isSplitStep = (step, selection, uiEvent) => {
|
|
20
|
-
var _a, _b, _c, _d;
|
|
20
|
+
var _a, _b, _c, _d, _e, _f;
|
|
21
21
|
const { from, to, slice } = step;
|
|
22
22
|
if (from !== to ||
|
|
23
23
|
slice.content.childCount < 2 ||
|
|
@@ -26,12 +26,14 @@ export const isSplitStep = (step, selection, uiEvent) => {
|
|
|
26
26
|
}
|
|
27
27
|
const { $anchor: { parentOffset: startOffset }, $head: { parentOffset: endOffset }, $from, } = selection;
|
|
28
28
|
const parentSize = $from.node().content.size;
|
|
29
|
-
if (uiEvent === 'paste'
|
|
29
|
+
if (uiEvent === 'paste' &&
|
|
30
|
+
((_c = slice.content.firstChild) === null || _c === void 0 ? void 0 : _c.inlineContent) &&
|
|
31
|
+
((_d = slice.content.lastChild) === null || _d === void 0 ? void 0 : _d.inlineContent)) {
|
|
30
32
|
return !((startOffset === 0 && endOffset === 0) ||
|
|
31
33
|
(startOffset === parentSize && endOffset === parentSize));
|
|
32
34
|
}
|
|
33
35
|
const { content: { firstChild, lastChild }, openStart, openEnd, } = slice;
|
|
34
|
-
if ((((
|
|
36
|
+
if ((((_e = window.event) === null || _e === void 0 ? void 0 : _e.code) === 'Enter' || ((_f = window.event) === null || _f === void 0 ? void 0 : _f.code) === 'NumpadEnter') &&
|
|
35
37
|
(firstChild === null || firstChild === void 0 ? void 0 : firstChild.type.name) === 'list_item') {
|
|
36
38
|
return !(parentSize === startOffset && parentSize === endOffset) && (lastChild === null || lastChild === void 0 ? void 0 : lastChild.type.name) === 'list_item';
|
|
37
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/track-changes-plugin",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"author": "Atypon Systems LLC",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/Atypon-OpenSource/manuscripts-track-changes-plugin",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"prosemirror-model": "1.25.0",
|
|
32
32
|
"prosemirror-state": "1.4.3",
|
|
33
33
|
"prosemirror-transform": "1.10.4",
|
|
34
|
-
"prosemirror-view": "1.
|
|
34
|
+
"prosemirror-view": "1.41.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@manuscripts/eslint-config": "0.5.1",
|