@manuscripts/track-changes-plugin 2.2.0 → 2.2.2
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.2",
|
|
4
4
|
"author": "Atypon Systems LLC",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/Atypon-OpenSource/manuscripts-track-changes-plugin",
|
|
@@ -36,30 +36,33 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@manuscripts/eslint-config": "0.5.1",
|
|
38
38
|
"@manuscripts/transform": "3.0.48",
|
|
39
|
+
"@eslint/eslintrc": "3.3.1",
|
|
40
|
+
"@eslint/js": "9.39.1",
|
|
39
41
|
"@types/debug": "4.1.12",
|
|
40
42
|
"@types/jest": "30.0.0",
|
|
41
43
|
"@types/node": "20.17.46",
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "
|
|
43
|
-
"@typescript-eslint/parser": "
|
|
44
|
-
"eslint": "
|
|
45
|
-
"eslint-config-prettier": "
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "8.46.4",
|
|
45
|
+
"@typescript-eslint/parser": "8.46.4",
|
|
46
|
+
"eslint": "9.39.1",
|
|
47
|
+
"eslint-config-prettier": "10.1.8",
|
|
48
|
+
"eslint-plugin-diff": "2.0.3",
|
|
46
49
|
"eslint-plugin-header": "3.1.1",
|
|
47
|
-
"eslint-plugin-import": "2.
|
|
48
|
-
"eslint-plugin-jest": "
|
|
50
|
+
"eslint-plugin-import": "2.32.0",
|
|
51
|
+
"eslint-plugin-jest": "29.1.0",
|
|
49
52
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
50
|
-
"eslint-plugin-mdx": "
|
|
53
|
+
"eslint-plugin-mdx": "3.6.2",
|
|
51
54
|
"eslint-plugin-node": "11.1.0",
|
|
52
|
-
"eslint-plugin-prettier": "
|
|
53
|
-
"eslint-plugin-promise": "
|
|
55
|
+
"eslint-plugin-prettier": "5.5.4",
|
|
56
|
+
"eslint-plugin-promise": "7.2.1",
|
|
54
57
|
"eslint-plugin-react": "7.37.5",
|
|
55
|
-
"eslint-plugin-react-hooks": "
|
|
56
|
-
"eslint-plugin-simple-import-sort": "
|
|
58
|
+
"eslint-plugin-react-hooks": "7.0.1",
|
|
59
|
+
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
57
60
|
"husky": "8.0.3",
|
|
58
61
|
"jest": "30.0.5",
|
|
59
62
|
"jest-environment-jsdom": "30.0.5",
|
|
60
63
|
"jsdom": "26.1.0",
|
|
61
64
|
"npm-run-all": "4.1.5",
|
|
62
|
-
"prettier": "
|
|
65
|
+
"prettier": "3.6.2",
|
|
63
66
|
"prosemirror-example-setup": "1.2.3",
|
|
64
67
|
"prosemirror-schema-list": "1.5.1",
|
|
65
68
|
"ts-jest": "29.4.0",
|