@atlaskit/editor-plugin-show-diff 4.1.4 → 5.0.0

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 (27) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/pm-plugins/calculateDiffDecorations.js +11 -11
  3. package/dist/cjs/pm-plugins/decorations.js +21 -21
  4. package/dist/cjs/pm-plugins/deletedBlocksHandler.js +22 -22
  5. package/dist/cjs/pm-plugins/deletedRowsHandler.js +7 -7
  6. package/dist/cjs/pm-plugins/main.js +2 -2
  7. package/dist/es2019/pm-plugins/calculateDiffDecorations.js +11 -11
  8. package/dist/es2019/pm-plugins/decorations.js +20 -20
  9. package/dist/es2019/pm-plugins/deletedBlocksHandler.js +22 -22
  10. package/dist/es2019/pm-plugins/deletedRowsHandler.js +7 -7
  11. package/dist/es2019/pm-plugins/main.js +2 -2
  12. package/dist/esm/pm-plugins/calculateDiffDecorations.js +11 -11
  13. package/dist/esm/pm-plugins/decorations.js +21 -21
  14. package/dist/esm/pm-plugins/deletedBlocksHandler.js +22 -22
  15. package/dist/esm/pm-plugins/deletedRowsHandler.js +7 -7
  16. package/dist/esm/pm-plugins/main.js +2 -2
  17. package/dist/types/pm-plugins/calculateDiffDecorations.d.ts +2 -2
  18. package/dist/types/pm-plugins/decorations.d.ts +6 -6
  19. package/dist/types/pm-plugins/deletedBlocksHandler.d.ts +8 -8
  20. package/dist/types/pm-plugins/deletedRowsHandler.d.ts +3 -3
  21. package/dist/types/showDiffPluginType.d.ts +2 -1
  22. package/dist/types-ts4.5/pm-plugins/calculateDiffDecorations.d.ts +2 -2
  23. package/dist/types-ts4.5/pm-plugins/decorations.d.ts +6 -6
  24. package/dist/types-ts4.5/pm-plugins/deletedBlocksHandler.d.ts +8 -8
  25. package/dist/types-ts4.5/pm-plugins/deletedRowsHandler.d.ts +3 -3
  26. package/dist/types-ts4.5/showDiffPluginType.d.ts +2 -1
  27. package/package.json +3 -3
@@ -12,9 +12,9 @@ import type { NodeViewSerializer } from './NodeViewSerializer';
12
12
  export declare const createInlineChangedDecoration: (change: {
13
13
  fromB: number;
14
14
  toB: number;
15
- }, colourScheme?: "standard" | "traditional", isActive?: boolean) => Decoration;
16
- export declare const getDeletedContentStyleUnbounded: (colourScheme?: "standard" | "traditional") => string;
17
- export declare const getDeletedContentStyle: (colourScheme?: "standard" | "traditional", isActive?: boolean) => string;
15
+ }, colorScheme?: "standard" | "traditional", isActive?: boolean) => Decoration;
16
+ export declare const getDeletedContentStyleUnbounded: (colorScheme?: "standard" | "traditional") => string;
17
+ export declare const getDeletedContentStyle: (colorScheme?: "standard" | "traditional", isActive?: boolean) => string;
18
18
  /**
19
19
  * Inline decoration used for insertions as the content already exists in the document
20
20
  *
@@ -25,15 +25,15 @@ export declare const createBlockChangedDecoration: (change: {
25
25
  from: number;
26
26
  name: string;
27
27
  to: number;
28
- }, colourScheme?: "standard" | "traditional") => Decoration | undefined;
28
+ }, colorScheme?: "standard" | "traditional") => Decoration | undefined;
29
29
  interface DeletedContentDecorationProps {
30
30
  change: Pick<Change, 'fromA' | 'toA' | 'fromB' | 'deleted'>;
31
- colourScheme?: 'standard' | 'traditional';
31
+ colorScheme?: 'standard' | 'traditional';
32
32
  doc: PMNode;
33
33
  intl: IntlShape;
34
34
  isActive?: boolean;
35
35
  newDoc: PMNode;
36
36
  nodeViewSerializer: NodeViewSerializer;
37
37
  }
38
- export declare const createDeletedContentDecoration: ({ change, doc, nodeViewSerializer, colourScheme, newDoc, intl, isActive, }: DeletedContentDecorationProps) => Decoration[] | undefined;
38
+ export declare const createDeletedContentDecoration: ({ change, doc, nodeViewSerializer, colorScheme, newDoc, intl, isActive, }: DeletedContentDecorationProps) => Decoration[] | undefined;
39
39
  export {};
@@ -7,7 +7,7 @@ export declare const deletedBlockOutline: string;
7
7
  export declare const deletedTraditionalBlockOutline: string;
8
8
  export declare const deletedBlockOutlineRounded: string;
9
9
  export declare const deletedTraditionalBlockOutlineRounded: string;
10
- export declare const getDeletedStyleNode: (nodeName: string, colourScheme?: "standard" | "traditional") => string | undefined;
10
+ export declare const getDeletedStyleNode: (nodeName: string, colorScheme?: "standard" | "traditional") => string | undefined;
11
11
  export declare const shouldShowRemovedLozenge: (nodeName: string) => boolean;
12
12
  export declare const shouldAddShowDiffDeletedNodeClass: (nodeName: string) => boolean;
13
13
  /**
@@ -26,34 +26,34 @@ export declare const createBlockNodeWrapper: () => HTMLDivElement;
26
26
  /**
27
27
  * Wraps content with deleted styling without opacity (for use when content is a direct child of dom)
28
28
  */
29
- export declare const createDeletedStyleWrapperWithoutOpacity: (colourScheme?: "standard" | "traditional", isActive?: boolean) => HTMLSpanElement;
29
+ export declare const createDeletedStyleWrapperWithoutOpacity: (colorScheme?: "standard" | "traditional", isActive?: boolean) => HTMLSpanElement;
30
30
  /**
31
31
  * Applies deleted styles directly to an HTML element by merging with existing styles
32
32
  */
33
- export declare const applyDeletedStylesToElement: (element: HTMLElement, targetNode: PMNode, colourScheme: "standard" | "traditional" | undefined) => void;
33
+ export declare const applyDeletedStylesToElement: (element: HTMLElement, targetNode: PMNode, colorScheme: "standard" | "traditional" | undefined) => void;
34
34
  /**
35
35
  * Creates a content wrapper with deleted styles for a block node
36
36
  */
37
- export declare const createBlockNodeContentWrapper: (nodeView: Node, targetNode: PMNode, colourScheme: "standard" | "traditional" | undefined) => HTMLElement;
37
+ export declare const createBlockNodeContentWrapper: (nodeView: Node, targetNode: PMNode, colorScheme: "standard" | "traditional" | undefined) => HTMLElement;
38
38
  /**
39
39
  * Handles embedCard node rendering with lozenge attached to the rich-media-item container.
40
40
  * Since embedCard content loads asynchronously, we use a MutationObserver
41
41
  * to wait for the rich-media-item to appear before attaching the lozenge.
42
42
  * @returns true if embedCard was handled
43
43
  */
44
- export declare const handleEmbedCardWithLozenge: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, lozenge: HTMLElement, colourScheme: "standard" | "traditional" | undefined) => boolean;
44
+ export declare const handleEmbedCardWithLozenge: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, lozenge: HTMLElement, colorScheme: "standard" | "traditional" | undefined) => boolean;
45
45
  /**
46
46
  * Handles special mediaSingle node rendering with lozenge on child media element
47
47
  * @returns true if mediaSingle was handled, false otherwise
48
48
  */
49
- export declare const handleMediaSingleWithLozenge: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, lozenge: HTMLElement, colourScheme: "standard" | "traditional" | undefined) => boolean;
49
+ export declare const handleMediaSingleWithLozenge: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, lozenge: HTMLElement, colorScheme: "standard" | "traditional" | undefined) => boolean;
50
50
  /**
51
51
  * Appends a block node with wrapper, lozenge, and appropriate styling
52
52
  */
53
- export declare const appendBlockNodeWithWrapper: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, colourScheme: "standard" | "traditional" | undefined, intl: IntlShape) => void;
53
+ export declare const appendBlockNodeWithWrapper: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, colorScheme: "standard" | "traditional" | undefined, intl: IntlShape) => void;
54
54
  /**
55
55
  * Handles all block node rendering with appropriate deleted styling.
56
56
  * For heading nodes, applies styles directly to preserve natural margins.
57
57
  * For other block nodes, uses wrapper approach with optional lozenge.
58
58
  */
59
- export declare const handleBlockNodeView: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, colourScheme: "standard" | "traditional" | undefined, intl: IntlShape) => void;
59
+ export declare const handleBlockNodeView: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, colorScheme: "standard" | "traditional" | undefined, intl: IntlShape) => void;
@@ -11,7 +11,7 @@ interface DeletedRowInfo {
11
11
  }
12
12
  type SimpleChange = Pick<Change, 'fromA' | 'toA' | 'fromB' | 'deleted'>;
13
13
  interface DeletedRowsHandlerProps {
14
- colourScheme?: 'standard' | 'traditional';
14
+ colorScheme?: 'standard' | 'traditional';
15
15
  deletedRows: DeletedRowInfo[];
16
16
  newDoc: PMNode;
17
17
  nodeViewSerializer: NodeViewSerializer;
@@ -20,11 +20,11 @@ interface DeletedRowsHandlerProps {
20
20
  /**
21
21
  * Creates decorations for deleted table rows
22
22
  */
23
- export declare const createDeletedRowsDecorations: ({ deletedRows, originalDoc, newDoc, nodeViewSerializer, colourScheme, }: DeletedRowsHandlerProps) => Decoration[];
23
+ export declare const createDeletedRowsDecorations: ({ deletedRows, originalDoc, newDoc, nodeViewSerializer, colorScheme, }: DeletedRowsHandlerProps) => Decoration[];
24
24
  /**
25
25
  * Main function to handle deleted rows - computes diff and creates decorations
26
26
  */
27
- export declare const handleDeletedRows: (changes: SimpleChange[], originalDoc: PMNode, newDoc: PMNode, nodeViewSerializer: NodeViewSerializer, colourScheme?: "standard" | "traditional") => {
27
+ export declare const handleDeletedRows: (changes: SimpleChange[], originalDoc: PMNode, newDoc: PMNode, nodeViewSerializer: NodeViewSerializer, colorScheme?: "standard" | "traditional") => {
28
28
  decorations: Decoration[];
29
29
  };
30
30
  export {};
@@ -3,13 +3,14 @@ import type { NextEditorPlugin, EditorCommand } from '@atlaskit/editor-common/ty
3
3
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
4
4
  import type { Node } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { Step } from '@atlaskit/editor-prosemirror/transform';
6
+ export type ColorScheme = 'standard' | 'traditional';
6
7
  export type DiffParams = {
7
8
  /**
8
9
  * Color scheme to use for displaying diffs.
9
10
  * 'standard' (default) uses purple for highlighting changes
10
11
  * 'traditional' uses green for additions and red for deletions
11
12
  */
12
- colourScheme?: 'standard' | 'traditional';
13
+ colorScheme?: ColorScheme;
13
14
  originalDoc: JSONDocNode;
14
15
  /**
15
16
  * Prosemirror steps. This is used to calculate and show the diff in the editor
@@ -3,12 +3,12 @@ import { type EditorState } from '@atlaskit/editor-prosemirror/state';
3
3
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { ShowDiffPluginState } from './main';
5
5
  import type { NodeViewSerializer } from './NodeViewSerializer';
6
- export declare const calculateDiffDecorations: import("memoize-one").MemoizedFn<({ state, pluginState, nodeViewSerializer, colourScheme, intl, activeIndexPos, }: {
6
+ export declare const calculateDiffDecorations: import("memoize-one").MemoizedFn<({ state, pluginState, nodeViewSerializer, colorScheme, intl, activeIndexPos, }: {
7
7
  activeIndexPos?: {
8
8
  from: number;
9
9
  to: number;
10
10
  };
11
- colourScheme?: "standard" | "traditional";
11
+ colorScheme?: "standard" | "traditional";
12
12
  intl: IntlShape;
13
13
  nodeViewSerializer: NodeViewSerializer;
14
14
  pluginState: Omit<ShowDiffPluginState, "decorations">;
@@ -12,9 +12,9 @@ import type { NodeViewSerializer } from './NodeViewSerializer';
12
12
  export declare const createInlineChangedDecoration: (change: {
13
13
  fromB: number;
14
14
  toB: number;
15
- }, colourScheme?: "standard" | "traditional", isActive?: boolean) => Decoration;
16
- export declare const getDeletedContentStyleUnbounded: (colourScheme?: "standard" | "traditional") => string;
17
- export declare const getDeletedContentStyle: (colourScheme?: "standard" | "traditional", isActive?: boolean) => string;
15
+ }, colorScheme?: "standard" | "traditional", isActive?: boolean) => Decoration;
16
+ export declare const getDeletedContentStyleUnbounded: (colorScheme?: "standard" | "traditional") => string;
17
+ export declare const getDeletedContentStyle: (colorScheme?: "standard" | "traditional", isActive?: boolean) => string;
18
18
  /**
19
19
  * Inline decoration used for insertions as the content already exists in the document
20
20
  *
@@ -25,15 +25,15 @@ export declare const createBlockChangedDecoration: (change: {
25
25
  from: number;
26
26
  name: string;
27
27
  to: number;
28
- }, colourScheme?: "standard" | "traditional") => Decoration | undefined;
28
+ }, colorScheme?: "standard" | "traditional") => Decoration | undefined;
29
29
  interface DeletedContentDecorationProps {
30
30
  change: Pick<Change, 'fromA' | 'toA' | 'fromB' | 'deleted'>;
31
- colourScheme?: 'standard' | 'traditional';
31
+ colorScheme?: 'standard' | 'traditional';
32
32
  doc: PMNode;
33
33
  intl: IntlShape;
34
34
  isActive?: boolean;
35
35
  newDoc: PMNode;
36
36
  nodeViewSerializer: NodeViewSerializer;
37
37
  }
38
- export declare const createDeletedContentDecoration: ({ change, doc, nodeViewSerializer, colourScheme, newDoc, intl, isActive, }: DeletedContentDecorationProps) => Decoration[] | undefined;
38
+ export declare const createDeletedContentDecoration: ({ change, doc, nodeViewSerializer, colorScheme, newDoc, intl, isActive, }: DeletedContentDecorationProps) => Decoration[] | undefined;
39
39
  export {};
@@ -7,7 +7,7 @@ export declare const deletedBlockOutline: string;
7
7
  export declare const deletedTraditionalBlockOutline: string;
8
8
  export declare const deletedBlockOutlineRounded: string;
9
9
  export declare const deletedTraditionalBlockOutlineRounded: string;
10
- export declare const getDeletedStyleNode: (nodeName: string, colourScheme?: "standard" | "traditional") => string | undefined;
10
+ export declare const getDeletedStyleNode: (nodeName: string, colorScheme?: "standard" | "traditional") => string | undefined;
11
11
  export declare const shouldShowRemovedLozenge: (nodeName: string) => boolean;
12
12
  export declare const shouldAddShowDiffDeletedNodeClass: (nodeName: string) => boolean;
13
13
  /**
@@ -26,34 +26,34 @@ export declare const createBlockNodeWrapper: () => HTMLDivElement;
26
26
  /**
27
27
  * Wraps content with deleted styling without opacity (for use when content is a direct child of dom)
28
28
  */
29
- export declare const createDeletedStyleWrapperWithoutOpacity: (colourScheme?: "standard" | "traditional", isActive?: boolean) => HTMLSpanElement;
29
+ export declare const createDeletedStyleWrapperWithoutOpacity: (colorScheme?: "standard" | "traditional", isActive?: boolean) => HTMLSpanElement;
30
30
  /**
31
31
  * Applies deleted styles directly to an HTML element by merging with existing styles
32
32
  */
33
- export declare const applyDeletedStylesToElement: (element: HTMLElement, targetNode: PMNode, colourScheme: "standard" | "traditional" | undefined) => void;
33
+ export declare const applyDeletedStylesToElement: (element: HTMLElement, targetNode: PMNode, colorScheme: "standard" | "traditional" | undefined) => void;
34
34
  /**
35
35
  * Creates a content wrapper with deleted styles for a block node
36
36
  */
37
- export declare const createBlockNodeContentWrapper: (nodeView: Node, targetNode: PMNode, colourScheme: "standard" | "traditional" | undefined) => HTMLElement;
37
+ export declare const createBlockNodeContentWrapper: (nodeView: Node, targetNode: PMNode, colorScheme: "standard" | "traditional" | undefined) => HTMLElement;
38
38
  /**
39
39
  * Handles embedCard node rendering with lozenge attached to the rich-media-item container.
40
40
  * Since embedCard content loads asynchronously, we use a MutationObserver
41
41
  * to wait for the rich-media-item to appear before attaching the lozenge.
42
42
  * @returns true if embedCard was handled
43
43
  */
44
- export declare const handleEmbedCardWithLozenge: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, lozenge: HTMLElement, colourScheme: "standard" | "traditional" | undefined) => boolean;
44
+ export declare const handleEmbedCardWithLozenge: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, lozenge: HTMLElement, colorScheme: "standard" | "traditional" | undefined) => boolean;
45
45
  /**
46
46
  * Handles special mediaSingle node rendering with lozenge on child media element
47
47
  * @returns true if mediaSingle was handled, false otherwise
48
48
  */
49
- export declare const handleMediaSingleWithLozenge: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, lozenge: HTMLElement, colourScheme: "standard" | "traditional" | undefined) => boolean;
49
+ export declare const handleMediaSingleWithLozenge: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, lozenge: HTMLElement, colorScheme: "standard" | "traditional" | undefined) => boolean;
50
50
  /**
51
51
  * Appends a block node with wrapper, lozenge, and appropriate styling
52
52
  */
53
- export declare const appendBlockNodeWithWrapper: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, colourScheme: "standard" | "traditional" | undefined, intl: IntlShape) => void;
53
+ export declare const appendBlockNodeWithWrapper: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, colorScheme: "standard" | "traditional" | undefined, intl: IntlShape) => void;
54
54
  /**
55
55
  * Handles all block node rendering with appropriate deleted styling.
56
56
  * For heading nodes, applies styles directly to preserve natural margins.
57
57
  * For other block nodes, uses wrapper approach with optional lozenge.
58
58
  */
59
- export declare const handleBlockNodeView: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, colourScheme: "standard" | "traditional" | undefined, intl: IntlShape) => void;
59
+ export declare const handleBlockNodeView: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, colorScheme: "standard" | "traditional" | undefined, intl: IntlShape) => void;
@@ -11,7 +11,7 @@ interface DeletedRowInfo {
11
11
  }
12
12
  type SimpleChange = Pick<Change, 'fromA' | 'toA' | 'fromB' | 'deleted'>;
13
13
  interface DeletedRowsHandlerProps {
14
- colourScheme?: 'standard' | 'traditional';
14
+ colorScheme?: 'standard' | 'traditional';
15
15
  deletedRows: DeletedRowInfo[];
16
16
  newDoc: PMNode;
17
17
  nodeViewSerializer: NodeViewSerializer;
@@ -20,11 +20,11 @@ interface DeletedRowsHandlerProps {
20
20
  /**
21
21
  * Creates decorations for deleted table rows
22
22
  */
23
- export declare const createDeletedRowsDecorations: ({ deletedRows, originalDoc, newDoc, nodeViewSerializer, colourScheme, }: DeletedRowsHandlerProps) => Decoration[];
23
+ export declare const createDeletedRowsDecorations: ({ deletedRows, originalDoc, newDoc, nodeViewSerializer, colorScheme, }: DeletedRowsHandlerProps) => Decoration[];
24
24
  /**
25
25
  * Main function to handle deleted rows - computes diff and creates decorations
26
26
  */
27
- export declare const handleDeletedRows: (changes: SimpleChange[], originalDoc: PMNode, newDoc: PMNode, nodeViewSerializer: NodeViewSerializer, colourScheme?: "standard" | "traditional") => {
27
+ export declare const handleDeletedRows: (changes: SimpleChange[], originalDoc: PMNode, newDoc: PMNode, nodeViewSerializer: NodeViewSerializer, colorScheme?: "standard" | "traditional") => {
28
28
  decorations: Decoration[];
29
29
  };
30
30
  export {};
@@ -3,13 +3,14 @@ import type { NextEditorPlugin, EditorCommand } from '@atlaskit/editor-common/ty
3
3
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
4
4
  import type { Node } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { Step } from '@atlaskit/editor-prosemirror/transform';
6
+ export type ColorScheme = 'standard' | 'traditional';
6
7
  export type DiffParams = {
7
8
  /**
8
9
  * Color scheme to use for displaying diffs.
9
10
  * 'standard' (default) uses purple for highlighting changes
10
11
  * 'traditional' uses green for additions and red for deletions
11
12
  */
12
- colourScheme?: 'standard' | 'traditional';
13
+ colorScheme?: ColorScheme;
13
14
  originalDoc: JSONDocNode;
14
15
  /**
15
16
  * Prosemirror steps. This is used to calculate and show the diff in the editor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "4.1.4",
3
+ "version": "5.0.0",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
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": "^32.11.0",
35
+ "@atlaskit/tmp-editor-statsig": "^32.12.0",
36
36
  "@atlaskit/tokens": "^11.0.0",
37
37
  "@babel/runtime": "^7.0.0",
38
38
  "lodash": "^4.17.21",
@@ -40,7 +40,7 @@
40
40
  "prosemirror-changeset": "^2.3.1"
41
41
  },
42
42
  "peerDependencies": {
43
- "@atlaskit/editor-common": "^111.24.0",
43
+ "@atlaskit/editor-common": "^111.25.0",
44
44
  "react": "^18.2.0"
45
45
  },
46
46
  "techstack": {