@manuscripts/track-changes-plugin 0.4.4-LEAN-1839 → 0.4.4-LEAN-1839-v3
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.
- package/dist/index.cjs +10 -3
- package/dist/index.js +10 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1618,7 +1618,7 @@ function diffChangeSteps(deleted, inserted) {
|
|
|
1618
1618
|
* @returns
|
|
1619
1619
|
*/
|
|
1620
1620
|
const getSelectionStaticConstructor = (sel) => Object.getPrototypeOf(sel).constructor;
|
|
1621
|
-
const isHighlightMarkerNode = (node) => node.type === node.type.schema.nodes.highlight_marker;
|
|
1621
|
+
const isHighlightMarkerNode = (node) => node && node.type === node.type.schema.nodes.highlight_marker;
|
|
1622
1622
|
/**
|
|
1623
1623
|
* Inverts transactions to wrap their contents/operations with track data instead
|
|
1624
1624
|
*
|
|
@@ -1648,7 +1648,7 @@ function trackTransaction(tr, oldState, newTr, authorID) {
|
|
|
1648
1648
|
let iters = 0;
|
|
1649
1649
|
log.info('ORIGINAL transaction', tr);
|
|
1650
1650
|
tr.steps.forEach((step) => {
|
|
1651
|
-
var _a, _b;
|
|
1651
|
+
var _a, _b, _c, _d;
|
|
1652
1652
|
log.info('transaction step', step);
|
|
1653
1653
|
iters += 1;
|
|
1654
1654
|
if (iters > 20) {
|
|
@@ -1662,13 +1662,20 @@ function trackTransaction(tr, oldState, newTr, authorID) {
|
|
|
1662
1662
|
return;
|
|
1663
1663
|
}
|
|
1664
1664
|
else if (step instanceof prosemirrorTransform.ReplaceStep) {
|
|
1665
|
-
let [steps, startPos] = trackReplaceStep(step, oldState, newTr, emptyAttrs);
|
|
1666
1665
|
const { slice } = step;
|
|
1667
1666
|
if (((_b = (_a = slice === null || slice === void 0 ? void 0 : slice.content) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.length) === 1 &&
|
|
1668
1667
|
isHighlightMarkerNode(slice.content.content[0])) {
|
|
1669
1668
|
// don't track highlight marker nodes
|
|
1670
1669
|
return;
|
|
1671
1670
|
}
|
|
1671
|
+
let [steps, startPos] = trackReplaceStep(step, oldState, newTr, emptyAttrs);
|
|
1672
|
+
if (steps.length === 1) {
|
|
1673
|
+
const step = steps[0]; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
1674
|
+
if (isHighlightMarkerNode((step === null || step === void 0 ? void 0 : step.node) || ((_d = (_c = step === null || step === void 0 ? void 0 : step.slice) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.content[0]))) {
|
|
1675
|
+
// don't track deleted highlight marker nodes
|
|
1676
|
+
return;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1672
1679
|
log.info('CHANGES: ', steps);
|
|
1673
1680
|
// deleted and merged really...
|
|
1674
1681
|
const deleted = steps.filter((s) => s.type !== 'insert-slice');
|
package/dist/index.js
CHANGED
|
@@ -1610,7 +1610,7 @@ function diffChangeSteps(deleted, inserted) {
|
|
|
1610
1610
|
* @returns
|
|
1611
1611
|
*/
|
|
1612
1612
|
const getSelectionStaticConstructor = (sel) => Object.getPrototypeOf(sel).constructor;
|
|
1613
|
-
const isHighlightMarkerNode = (node) => node.type === node.type.schema.nodes.highlight_marker;
|
|
1613
|
+
const isHighlightMarkerNode = (node) => node && node.type === node.type.schema.nodes.highlight_marker;
|
|
1614
1614
|
/**
|
|
1615
1615
|
* Inverts transactions to wrap their contents/operations with track data instead
|
|
1616
1616
|
*
|
|
@@ -1640,7 +1640,7 @@ function trackTransaction(tr, oldState, newTr, authorID) {
|
|
|
1640
1640
|
let iters = 0;
|
|
1641
1641
|
log.info('ORIGINAL transaction', tr);
|
|
1642
1642
|
tr.steps.forEach((step) => {
|
|
1643
|
-
var _a, _b;
|
|
1643
|
+
var _a, _b, _c, _d;
|
|
1644
1644
|
log.info('transaction step', step);
|
|
1645
1645
|
iters += 1;
|
|
1646
1646
|
if (iters > 20) {
|
|
@@ -1654,13 +1654,20 @@ function trackTransaction(tr, oldState, newTr, authorID) {
|
|
|
1654
1654
|
return;
|
|
1655
1655
|
}
|
|
1656
1656
|
else if (step instanceof ReplaceStep) {
|
|
1657
|
-
let [steps, startPos] = trackReplaceStep(step, oldState, newTr, emptyAttrs);
|
|
1658
1657
|
const { slice } = step;
|
|
1659
1658
|
if (((_b = (_a = slice === null || slice === void 0 ? void 0 : slice.content) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.length) === 1 &&
|
|
1660
1659
|
isHighlightMarkerNode(slice.content.content[0])) {
|
|
1661
1660
|
// don't track highlight marker nodes
|
|
1662
1661
|
return;
|
|
1663
1662
|
}
|
|
1663
|
+
let [steps, startPos] = trackReplaceStep(step, oldState, newTr, emptyAttrs);
|
|
1664
|
+
if (steps.length === 1) {
|
|
1665
|
+
const step = steps[0]; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
1666
|
+
if (isHighlightMarkerNode((step === null || step === void 0 ? void 0 : step.node) || ((_d = (_c = step === null || step === void 0 ? void 0 : step.slice) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.content[0]))) {
|
|
1667
|
+
// don't track deleted highlight marker nodes
|
|
1668
|
+
return;
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1664
1671
|
log.info('CHANGES: ', steps);
|
|
1665
1672
|
// deleted and merged really...
|
|
1666
1673
|
const deleted = steps.filter((s) => s.type !== 'insert-slice');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/track-changes-plugin",
|
|
3
|
-
"version": "0.4.4-LEAN-1839",
|
|
3
|
+
"version": "0.4.4-LEAN-1839-v3",
|
|
4
4
|
"author": "Atypon Systems LLC",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/Atypon-OpenSource/manuscripts-quarterback/tree/main/quarterback-packages/track-changes-plugin",
|