@atlaskit/editor-plugin-show-diff 5.0.5 → 5.0.7

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 (68) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/pm-plugins/calculateDiffDecorations.js +12 -10
  3. package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +75 -0
  4. package/dist/cjs/pm-plugins/{deletedRowsHandler.js → decorations/createChangedRowDecorationWidgets.js} +31 -52
  5. package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +33 -0
  6. package/dist/cjs/pm-plugins/{decorations.js → decorations/createNodeChangedDecorationWidget.js} +29 -118
  7. package/dist/cjs/pm-plugins/{attributeDecorations.js → decorations/utils/getAttrChangeRanges.js} +1 -1
  8. package/dist/cjs/pm-plugins/{deletedBlocksHandler.js → decorations/utils/wrapBlockNodeView.js} +83 -21
  9. package/dist/cjs/pm-plugins/simplifyChanges.js +3 -4
  10. package/dist/es2019/pm-plugins/calculateDiffDecorations.js +6 -4
  11. package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +70 -0
  12. package/dist/es2019/pm-plugins/{deletedRowsHandler.js → decorations/createChangedRowDecorationWidgets.js} +28 -50
  13. package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +28 -0
  14. package/dist/es2019/pm-plugins/{decorations.js → decorations/createNodeChangedDecorationWidget.js} +16 -107
  15. package/dist/es2019/pm-plugins/{attributeDecorations.js → decorations/utils/getAttrChangeRanges.js} +1 -1
  16. package/dist/es2019/pm-plugins/{deletedBlocksHandler.js → decorations/utils/wrapBlockNodeView.js} +85 -18
  17. package/dist/es2019/pm-plugins/simplifyChanges.js +3 -4
  18. package/dist/esm/pm-plugins/calculateDiffDecorations.js +6 -4
  19. package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +69 -0
  20. package/dist/esm/pm-plugins/{deletedRowsHandler.js → decorations/createChangedRowDecorationWidgets.js} +30 -51
  21. package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +28 -0
  22. package/dist/esm/pm-plugins/{decorations.js → decorations/createNodeChangedDecorationWidget.js} +30 -119
  23. package/dist/esm/pm-plugins/{attributeDecorations.js → decorations/utils/getAttrChangeRanges.js} +1 -1
  24. package/dist/esm/pm-plugins/{deletedBlocksHandler.js → decorations/utils/wrapBlockNodeView.js} +80 -18
  25. package/dist/esm/pm-plugins/simplifyChanges.js +3 -4
  26. package/dist/types/pm-plugins/NodeViewSerializer.d.ts +1 -1
  27. package/dist/types/pm-plugins/calculateDiffDecorations.d.ts +2 -1
  28. package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.d.ts +16 -0
  29. package/dist/types/pm-plugins/decorations/createChangedRowDecorationWidgets.d.ts +17 -0
  30. package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.d.ts +16 -0
  31. package/dist/types/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +15 -0
  32. package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeView.d.ts +15 -0
  33. package/dist/types-ts4.5/pm-plugins/NodeViewSerializer.d.ts +1 -1
  34. package/dist/types-ts4.5/pm-plugins/calculateDiffDecorations.d.ts +2 -1
  35. package/dist/types-ts4.5/pm-plugins/decorations/createBlockChangedDecoration.d.ts +16 -0
  36. package/dist/types-ts4.5/pm-plugins/decorations/createChangedRowDecorationWidgets.d.ts +17 -0
  37. package/dist/types-ts4.5/pm-plugins/decorations/createInlineChangedDecoration.d.ts +16 -0
  38. package/dist/types-ts4.5/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +15 -0
  39. package/dist/types-ts4.5/pm-plugins/decorations/utils/wrapBlockNodeView.d.ts +15 -0
  40. package/package.json +4 -7
  41. package/dist/types/pm-plugins/decorations.d.ts +0 -46
  42. package/dist/types/pm-plugins/deletedBlocksHandler.d.ts +0 -14
  43. package/dist/types/pm-plugins/deletedRowsHandler.d.ts +0 -36
  44. package/dist/types-ts4.5/pm-plugins/decorations.d.ts +0 -46
  45. package/dist/types-ts4.5/pm-plugins/deletedBlocksHandler.d.ts +0 -14
  46. package/dist/types-ts4.5/pm-plugins/deletedRowsHandler.d.ts +0 -36
  47. /package/dist/cjs/pm-plugins/{colorSchemes → decorations/colorSchemes}/standard.js +0 -0
  48. /package/dist/cjs/pm-plugins/{colorSchemes → decorations/colorSchemes}/traditional.js +0 -0
  49. /package/dist/cjs/pm-plugins/{findSafeInsertPos.js → decorations/utils/findSafeInsertPos.js} +0 -0
  50. /package/dist/cjs/pm-plugins/{markDecorations.js → decorations/utils/getMarkChangeRanges.js} +0 -0
  51. /package/dist/es2019/pm-plugins/{colorSchemes → decorations/colorSchemes}/standard.js +0 -0
  52. /package/dist/es2019/pm-plugins/{colorSchemes → decorations/colorSchemes}/traditional.js +0 -0
  53. /package/dist/es2019/pm-plugins/{findSafeInsertPos.js → decorations/utils/findSafeInsertPos.js} +0 -0
  54. /package/dist/es2019/pm-plugins/{markDecorations.js → decorations/utils/getMarkChangeRanges.js} +0 -0
  55. /package/dist/esm/pm-plugins/{colorSchemes → decorations/colorSchemes}/standard.js +0 -0
  56. /package/dist/esm/pm-plugins/{colorSchemes → decorations/colorSchemes}/traditional.js +0 -0
  57. /package/dist/esm/pm-plugins/{findSafeInsertPos.js → decorations/utils/findSafeInsertPos.js} +0 -0
  58. /package/dist/esm/pm-plugins/{markDecorations.js → decorations/utils/getMarkChangeRanges.js} +0 -0
  59. /package/dist/types/pm-plugins/{colorSchemes → decorations/colorSchemes}/standard.d.ts +0 -0
  60. /package/dist/types/pm-plugins/{colorSchemes → decorations/colorSchemes}/traditional.d.ts +0 -0
  61. /package/dist/types/pm-plugins/{findSafeInsertPos.d.ts → decorations/utils/findSafeInsertPos.d.ts} +0 -0
  62. /package/dist/types/pm-plugins/{attributeDecorations.d.ts → decorations/utils/getAttrChangeRanges.d.ts} +0 -0
  63. /package/dist/types/pm-plugins/{markDecorations.d.ts → decorations/utils/getMarkChangeRanges.d.ts} +0 -0
  64. /package/dist/types-ts4.5/pm-plugins/{colorSchemes → decorations/colorSchemes}/standard.d.ts +0 -0
  65. /package/dist/types-ts4.5/pm-plugins/{colorSchemes → decorations/colorSchemes}/traditional.d.ts +0 -0
  66. /package/dist/types-ts4.5/pm-plugins/{findSafeInsertPos.d.ts → decorations/utils/findSafeInsertPos.d.ts} +0 -0
  67. /package/dist/types-ts4.5/pm-plugins/{attributeDecorations.d.ts → decorations/utils/getAttrChangeRanges.d.ts} +0 -0
  68. /package/dist/types-ts4.5/pm-plugins/{markDecorations.d.ts → decorations/utils/getMarkChangeRanges.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "5.0.5",
3
+ "version": "5.0.7",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,15 +32,15 @@
32
32
  "@atlaskit/editor-prosemirror": "^7.3.0",
33
33
  "@atlaskit/editor-tables": "^2.9.0",
34
34
  "@atlaskit/platform-feature-flags": "^1.1.0",
35
- "@atlaskit/tmp-editor-statsig": "^35.1.0",
36
- "@atlaskit/tokens": "^11.0.0",
35
+ "@atlaskit/tmp-editor-statsig": "^35.5.0",
36
+ "@atlaskit/tokens": "^11.1.0",
37
37
  "@babel/runtime": "^7.0.0",
38
38
  "lodash": "^4.17.21",
39
39
  "memoize-one": "^6.0.0",
40
40
  "prosemirror-changeset": "^2.3.1"
41
41
  },
42
42
  "peerDependencies": {
43
- "@atlaskit/editor-common": "^111.30.0",
43
+ "@atlaskit/editor-common": "^111.32.0",
44
44
  "react": "^18.2.0"
45
45
  },
46
46
  "techstack": {
@@ -80,9 +80,6 @@
80
80
  }
81
81
  },
82
82
  "platform-feature-flags": {
83
- "platform_editor_ai_aifc_patch_ga": {
84
- "type": "boolean"
85
- },
86
83
  "platform_editor_show_diff_scroll_navigation": {
87
84
  "type": "boolean"
88
85
  },
@@ -1,46 +0,0 @@
1
- import type { Change } from 'prosemirror-changeset';
2
- import type { IntlShape } from 'react-intl-next';
3
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
- import { Decoration } from '@atlaskit/editor-prosemirror/view';
5
- import type { NodeViewSerializer } from './NodeViewSerializer';
6
- /**
7
- * Inline decoration used for insertions as the content already exists in the document
8
- *
9
- * @param change Changeset "change" containing information about the change content + range
10
- * @returns Prosemirror inline decoration
11
- */
12
- export declare const createInlineChangedDecoration: ({ change, colorScheme, isActive, }: {
13
- change: {
14
- fromB: number;
15
- toB: number;
16
- };
17
- colorScheme?: "standard" | "traditional";
18
- isActive?: boolean;
19
- }) => Decoration;
20
- export declare const getDeletedContentStyleUnbounded: (colorScheme?: "standard" | "traditional") => string;
21
- export declare const getDeletedContentStyle: (colorScheme?: "standard" | "traditional", isActive?: boolean) => string;
22
- /**
23
- * Inline decoration used for insertions as the content already exists in the document
24
- *
25
- * @param change Changeset "change" containing information about the change content + range
26
- * @returns Prosemirror inline decoration
27
- */
28
- export declare const createBlockChangedDecoration: ({ change, colorScheme, }: {
29
- change: {
30
- from: number;
31
- name: string;
32
- to: number;
33
- };
34
- colorScheme?: "standard" | "traditional";
35
- }) => Decoration | undefined;
36
- interface DeletedContentDecorationProps {
37
- change: Pick<Change, 'fromA' | 'toA' | 'fromB' | 'deleted'>;
38
- colorScheme?: 'standard' | 'traditional';
39
- doc: PMNode;
40
- intl: IntlShape;
41
- isActive?: boolean;
42
- newDoc: PMNode;
43
- nodeViewSerializer: NodeViewSerializer;
44
- }
45
- export declare const createDeletedContentDecoration: ({ change, doc, nodeViewSerializer, colorScheme, newDoc, intl, isActive, }: DeletedContentDecorationProps) => Decoration[] | undefined;
46
- export {};
@@ -1,14 +0,0 @@
1
- import type { IntlShape } from 'react-intl-next';
2
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
- export declare const getDeletedStyleNode: (nodeName: string, colorScheme?: "standard" | "traditional") => string | undefined;
4
- /**
5
- * Handles special mediaSingle node rendering with lozenge on child media element
6
- * @returns true if mediaSingle was handled, false otherwise
7
- */
8
- export declare const handleMediaSingleWithLozenge: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, lozenge: HTMLElement, colorScheme: "standard" | "traditional" | undefined) => boolean;
9
- /**
10
- * Handles all block node rendering with appropriate deleted styling.
11
- * For heading nodes, applies styles directly to preserve natural margins.
12
- * For other block nodes, uses wrapper approach with optional lozenge.
13
- */
14
- export declare const handleBlockNodeView: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, colorScheme: "standard" | "traditional" | undefined, intl: IntlShape) => void;
@@ -1,36 +0,0 @@
1
- import type { Change } from 'prosemirror-changeset';
2
- import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
- import { Decoration } from '@atlaskit/editor-prosemirror/view';
4
- import type { NodeViewSerializer } from './NodeViewSerializer';
5
- interface DeletedRowInfo {
6
- fromA: number;
7
- fromB: number;
8
- rowIndex: number;
9
- rowNode: PMNode;
10
- toA: number;
11
- }
12
- type SimpleChange = Pick<Change, 'fromA' | 'toA' | 'fromB' | 'deleted'>;
13
- interface DeletedRowsHandlerProps {
14
- colorScheme?: 'standard' | 'traditional';
15
- deletedRows: DeletedRowInfo[];
16
- newDoc: PMNode;
17
- nodeViewSerializer: NodeViewSerializer;
18
- originalDoc: PMNode;
19
- }
20
- /**
21
- * Creates decorations for deleted table rows
22
- */
23
- export declare const createDeletedRowsDecorations: ({ deletedRows, originalDoc, newDoc, nodeViewSerializer, colorScheme, }: DeletedRowsHandlerProps) => Decoration[];
24
- /**
25
- * Main function to handle deleted rows - computes diff and creates decorations
26
- */
27
- export declare const handleDeletedRows: ({ changes, originalDoc, newDoc, nodeViewSerializer, colorScheme, }: {
28
- changes: SimpleChange[];
29
- colorScheme?: "standard" | "traditional";
30
- newDoc: PMNode;
31
- nodeViewSerializer: NodeViewSerializer;
32
- originalDoc: PMNode;
33
- }) => {
34
- decorations: Decoration[];
35
- };
36
- export {};
@@ -1,46 +0,0 @@
1
- import type { Change } from 'prosemirror-changeset';
2
- import type { IntlShape } from 'react-intl-next';
3
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
- import { Decoration } from '@atlaskit/editor-prosemirror/view';
5
- import type { NodeViewSerializer } from './NodeViewSerializer';
6
- /**
7
- * Inline decoration used for insertions as the content already exists in the document
8
- *
9
- * @param change Changeset "change" containing information about the change content + range
10
- * @returns Prosemirror inline decoration
11
- */
12
- export declare const createInlineChangedDecoration: ({ change, colorScheme, isActive, }: {
13
- change: {
14
- fromB: number;
15
- toB: number;
16
- };
17
- colorScheme?: "standard" | "traditional";
18
- isActive?: boolean;
19
- }) => Decoration;
20
- export declare const getDeletedContentStyleUnbounded: (colorScheme?: "standard" | "traditional") => string;
21
- export declare const getDeletedContentStyle: (colorScheme?: "standard" | "traditional", isActive?: boolean) => string;
22
- /**
23
- * Inline decoration used for insertions as the content already exists in the document
24
- *
25
- * @param change Changeset "change" containing information about the change content + range
26
- * @returns Prosemirror inline decoration
27
- */
28
- export declare const createBlockChangedDecoration: ({ change, colorScheme, }: {
29
- change: {
30
- from: number;
31
- name: string;
32
- to: number;
33
- };
34
- colorScheme?: "standard" | "traditional";
35
- }) => Decoration | undefined;
36
- interface DeletedContentDecorationProps {
37
- change: Pick<Change, 'fromA' | 'toA' | 'fromB' | 'deleted'>;
38
- colorScheme?: 'standard' | 'traditional';
39
- doc: PMNode;
40
- intl: IntlShape;
41
- isActive?: boolean;
42
- newDoc: PMNode;
43
- nodeViewSerializer: NodeViewSerializer;
44
- }
45
- export declare const createDeletedContentDecoration: ({ change, doc, nodeViewSerializer, colorScheme, newDoc, intl, isActive, }: DeletedContentDecorationProps) => Decoration[] | undefined;
46
- export {};
@@ -1,14 +0,0 @@
1
- import type { IntlShape } from 'react-intl-next';
2
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
- export declare const getDeletedStyleNode: (nodeName: string, colorScheme?: "standard" | "traditional") => string | undefined;
4
- /**
5
- * Handles special mediaSingle node rendering with lozenge on child media element
6
- * @returns true if mediaSingle was handled, false otherwise
7
- */
8
- export declare const handleMediaSingleWithLozenge: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, lozenge: HTMLElement, colorScheme: "standard" | "traditional" | undefined) => boolean;
9
- /**
10
- * Handles all block node rendering with appropriate deleted styling.
11
- * For heading nodes, applies styles directly to preserve natural margins.
12
- * For other block nodes, uses wrapper approach with optional lozenge.
13
- */
14
- export declare const handleBlockNodeView: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, colorScheme: "standard" | "traditional" | undefined, intl: IntlShape) => void;
@@ -1,36 +0,0 @@
1
- import type { Change } from 'prosemirror-changeset';
2
- import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
- import { Decoration } from '@atlaskit/editor-prosemirror/view';
4
- import type { NodeViewSerializer } from './NodeViewSerializer';
5
- interface DeletedRowInfo {
6
- fromA: number;
7
- fromB: number;
8
- rowIndex: number;
9
- rowNode: PMNode;
10
- toA: number;
11
- }
12
- type SimpleChange = Pick<Change, 'fromA' | 'toA' | 'fromB' | 'deleted'>;
13
- interface DeletedRowsHandlerProps {
14
- colorScheme?: 'standard' | 'traditional';
15
- deletedRows: DeletedRowInfo[];
16
- newDoc: PMNode;
17
- nodeViewSerializer: NodeViewSerializer;
18
- originalDoc: PMNode;
19
- }
20
- /**
21
- * Creates decorations for deleted table rows
22
- */
23
- export declare const createDeletedRowsDecorations: ({ deletedRows, originalDoc, newDoc, nodeViewSerializer, colorScheme, }: DeletedRowsHandlerProps) => Decoration[];
24
- /**
25
- * Main function to handle deleted rows - computes diff and creates decorations
26
- */
27
- export declare const handleDeletedRows: ({ changes, originalDoc, newDoc, nodeViewSerializer, colorScheme, }: {
28
- changes: SimpleChange[];
29
- colorScheme?: "standard" | "traditional";
30
- newDoc: PMNode;
31
- nodeViewSerializer: NodeViewSerializer;
32
- originalDoc: PMNode;
33
- }) => {
34
- decorations: Decoration[];
35
- };
36
- export {};