@atlaskit/editor-plugin-show-diff 16.0.14 → 16.0.17

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +1 -1
  3. package/dist/cjs/pm-plugins/decorations/createAnchorDecorationWidgets.js +19 -13
  4. package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +2 -1
  5. package/dist/cjs/pm-plugins/decorations/createChangedRowDecorationWidgets.js +94 -28
  6. package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +2 -1
  7. package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +14 -1
  8. package/dist/cjs/pm-plugins/decorations/decorationKeys.js +12 -2
  9. package/dist/cjs/pm-plugins/main.js +2 -2
  10. package/dist/cjs/pm-plugins/scrollToDiff.js +20 -0
  11. package/dist/cjs/ui/ContributorTag/buildContributorTagDom.js +5 -4
  12. package/dist/cjs/ui/IndicatorBar/IndicatorBar.js +1 -1
  13. package/dist/cjs/ui/IndicatorBar/IndicatorBarContentComponent.js +1 -1
  14. package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +1 -1
  15. package/dist/es2019/pm-plugins/decorations/createAnchorDecorationWidgets.js +7 -3
  16. package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +4 -3
  17. package/dist/es2019/pm-plugins/decorations/createChangedRowDecorationWidgets.js +73 -13
  18. package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +3 -2
  19. package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +15 -2
  20. package/dist/es2019/pm-plugins/decorations/decorationKeys.js +10 -0
  21. package/dist/es2019/pm-plugins/main.js +2 -2
  22. package/dist/es2019/pm-plugins/scrollToDiff.js +21 -3
  23. package/dist/es2019/ui/ContributorTag/buildContributorTagDom.js +5 -4
  24. package/dist/es2019/ui/IndicatorBar/IndicatorBar.js +1 -1
  25. package/dist/es2019/ui/IndicatorBar/IndicatorBarContentComponent.js +1 -1
  26. package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +1 -1
  27. package/dist/esm/pm-plugins/decorations/createAnchorDecorationWidgets.js +19 -13
  28. package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +3 -2
  29. package/dist/esm/pm-plugins/decorations/createChangedRowDecorationWidgets.js +95 -29
  30. package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +3 -2
  31. package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +15 -2
  32. package/dist/esm/pm-plugins/decorations/decorationKeys.js +10 -0
  33. package/dist/esm/pm-plugins/main.js +2 -2
  34. package/dist/esm/pm-plugins/scrollToDiff.js +21 -2
  35. package/dist/esm/ui/ContributorTag/buildContributorTagDom.js +5 -4
  36. package/dist/esm/ui/IndicatorBar/IndicatorBar.js +1 -1
  37. package/dist/esm/ui/IndicatorBar/IndicatorBarContentComponent.js +1 -1
  38. package/dist/types/pm-plugins/decorations/createChangedRowDecorationWidgets.d.ts +6 -1
  39. package/dist/types/pm-plugins/decorations/decorationKeys.d.ts +9 -0
  40. package/dist/types/pm-plugins/scrollToDiff.d.ts +5 -1
  41. package/dist/types/showDiffPluginType.d.ts +2 -0
  42. package/dist/types/ui/ContributorTag/buildContributorTagDom.d.ts +4 -4
  43. package/package.json +4 -3
  44. package/dist/cjs/pm-plugins/areDocsEqualByBlockStructureAndText.js +0 -55
  45. package/dist/es2019/pm-plugins/areDocsEqualByBlockStructureAndText.js +0 -50
  46. package/dist/esm/pm-plugins/areDocsEqualByBlockStructureAndText.js +0 -50
  47. package/dist/types/pm-plugins/areDocsEqualByBlockStructureAndText.d.ts +0 -12
@@ -1,50 +0,0 @@
1
- import { Transform } from '@atlaskit/editor-prosemirror/transform';
2
-
3
- /**
4
- * Returns a copy of the document with all marks removed from all text.
5
- * This normalises mark fragmentation — e.g. annotation marks reordering can split
6
- * a single text run into many text nodes, making structural comparison unreliable.
7
- * After stripping, ProseMirror will merge adjacent text nodes so childCounts are stable.
8
- */
9
- function stripMarks(doc) {
10
- const tr = new Transform(doc);
11
- tr.removeMark(0, doc.content.size);
12
- return tr.doc;
13
- }
14
-
15
- /**
16
- * Returns true if both (mark-stripped) nodes have the same block tree structure (node type and child count at every level)
17
- */
18
- function isBlockStructureEqual(node1, node2) {
19
- if (node1.type !== node2.type || node1.childCount !== node2.childCount) {
20
- return false;
21
- }
22
- for (let i = 0; i < node1.childCount; i++) {
23
- if (!isBlockStructureEqual(node1.child(i), node2.child(i))) {
24
- return false;
25
- }
26
- }
27
- return true;
28
- }
29
-
30
- /**
31
- * Looser equality for "safe diff" cases: same full text content and same block structure
32
- * (e.g. text moved across text-node boundaries). Used when strict areNodesEqualIgnoreAttrs fails.
33
- * This is safe because we ensure decorations get applied to valid positions.
34
- *
35
- * Marks are intentionally ignored — two documents that differ only in mark application
36
- * (e.g. bold/italic boundaries or annotation mark ordering) are considered equal here.
37
- * Both documents are mark-stripped before comparison so that mark-driven text fragmentation
38
- * does not produce false inequalities.
39
- */
40
- export function areDocsEqualByBlockStructureAndText(doc1, doc2) {
41
- if (doc1.textContent !== doc2.textContent) {
42
- return false;
43
- }
44
- // Strip marks before comparing so that mark-driven text fragmentation
45
- // (e.g. annotation mark reordering producing different childCounts) does not
46
- // cause false inequalities.
47
- const stripped1 = stripMarks(doc1);
48
- const stripped2 = stripMarks(doc2);
49
- return doc1.nodeSize === doc2.nodeSize && isBlockStructureEqual(stripped1, stripped2);
50
- }
@@ -1,50 +0,0 @@
1
- import { Transform } from '@atlaskit/editor-prosemirror/transform';
2
-
3
- /**
4
- * Returns a copy of the document with all marks removed from all text.
5
- * This normalises mark fragmentation — e.g. annotation marks reordering can split
6
- * a single text run into many text nodes, making structural comparison unreliable.
7
- * After stripping, ProseMirror will merge adjacent text nodes so childCounts are stable.
8
- */
9
- function stripMarks(doc) {
10
- var tr = new Transform(doc);
11
- tr.removeMark(0, doc.content.size);
12
- return tr.doc;
13
- }
14
-
15
- /**
16
- * Returns true if both (mark-stripped) nodes have the same block tree structure (node type and child count at every level)
17
- */
18
- function isBlockStructureEqual(node1, node2) {
19
- if (node1.type !== node2.type || node1.childCount !== node2.childCount) {
20
- return false;
21
- }
22
- for (var i = 0; i < node1.childCount; i++) {
23
- if (!isBlockStructureEqual(node1.child(i), node2.child(i))) {
24
- return false;
25
- }
26
- }
27
- return true;
28
- }
29
-
30
- /**
31
- * Looser equality for "safe diff" cases: same full text content and same block structure
32
- * (e.g. text moved across text-node boundaries). Used when strict areNodesEqualIgnoreAttrs fails.
33
- * This is safe because we ensure decorations get applied to valid positions.
34
- *
35
- * Marks are intentionally ignored — two documents that differ only in mark application
36
- * (e.g. bold/italic boundaries or annotation mark ordering) are considered equal here.
37
- * Both documents are mark-stripped before comparison so that mark-driven text fragmentation
38
- * does not produce false inequalities.
39
- */
40
- export function areDocsEqualByBlockStructureAndText(doc1, doc2) {
41
- if (doc1.textContent !== doc2.textContent) {
42
- return false;
43
- }
44
- // Strip marks before comparing so that mark-driven text fragmentation
45
- // (e.g. annotation mark reordering producing different childCounts) does not
46
- // cause false inequalities.
47
- var stripped1 = stripMarks(doc1);
48
- var stripped2 = stripMarks(doc2);
49
- return doc1.nodeSize === doc2.nodeSize && isBlockStructureEqual(stripped1, stripped2);
50
- }
@@ -1,12 +0,0 @@
1
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
- /**
3
- * Looser equality for "safe diff" cases: same full text content and same block structure
4
- * (e.g. text moved across text-node boundaries). Used when strict areNodesEqualIgnoreAttrs fails.
5
- * This is safe because we ensure decorations get applied to valid positions.
6
- *
7
- * Marks are intentionally ignored — two documents that differ only in mark application
8
- * (e.g. bold/italic boundaries or annotation mark ordering) are considered equal here.
9
- * Both documents are mark-stripped before comparison so that mark-driven text fragmentation
10
- * does not produce false inequalities.
11
- */
12
- export declare function areDocsEqualByBlockStructureAndText(doc1: PMNode, doc2: PMNode): boolean;