@atlaskit/editor-plugin-show-diff 3.1.5 → 3.2.1

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 (30) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/afm-cc/tsconfig.json +6 -0
  3. package/afm-jira/tsconfig.json +3 -0
  4. package/afm-products/tsconfig.json +3 -0
  5. package/dist/cjs/pm-plugins/calculateDiffDecorations.js +12 -7
  6. package/dist/cjs/pm-plugins/decorations.js +242 -10
  7. package/dist/cjs/pm-plugins/deletedRowsHandler.js +214 -0
  8. package/dist/cjs/pm-plugins/main.js +6 -5
  9. package/dist/cjs/showDiffPlugin.js +4 -3
  10. package/dist/es2019/pm-plugins/calculateDiffDecorations.js +12 -7
  11. package/dist/es2019/pm-plugins/decorations.js +238 -9
  12. package/dist/es2019/pm-plugins/deletedRowsHandler.js +185 -0
  13. package/dist/es2019/pm-plugins/main.js +4 -3
  14. package/dist/es2019/showDiffPlugin.js +4 -2
  15. package/dist/esm/pm-plugins/calculateDiffDecorations.js +12 -7
  16. package/dist/esm/pm-plugins/decorations.js +242 -10
  17. package/dist/esm/pm-plugins/deletedRowsHandler.js +207 -0
  18. package/dist/esm/pm-plugins/main.js +4 -3
  19. package/dist/esm/showDiffPlugin.js +4 -3
  20. package/dist/types/pm-plugins/calculateDiffDecorations.d.ts +3 -1
  21. package/dist/types/pm-plugins/decorations.d.ts +4 -2
  22. package/dist/types/pm-plugins/deletedRowsHandler.d.ts +30 -0
  23. package/dist/types/pm-plugins/main.d.ts +2 -1
  24. package/dist/types-ts4.5/pm-plugins/calculateDiffDecorations.d.ts +3 -1
  25. package/dist/types-ts4.5/pm-plugins/decorations.d.ts +4 -2
  26. package/dist/types-ts4.5/pm-plugins/deletedRowsHandler.d.ts +30 -0
  27. package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -1
  28. package/package.json +13 -3
  29. package/afm-post-office/tsconfig.json +0 -27
  30. package/afm-townsquare/tsconfig.json +0 -27
@@ -1,4 +1,5 @@
1
1
  import type { Change } from 'prosemirror-changeset';
2
+ import type { IntlShape } from 'react-intl-next';
2
3
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
4
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
4
5
  import type { NodeViewSerializer } from './NodeViewSerializer';
@@ -24,11 +25,12 @@ export declare const createBlockChangedDecoration: (change: {
24
25
  to: number;
25
26
  }, colourScheme?: "standard" | "traditional") => Decoration;
26
27
  interface DeletedContentDecorationProps {
27
- change: Change;
28
+ change: Pick<Change, 'fromA' | 'toA' | 'fromB' | 'deleted'>;
28
29
  colourScheme?: 'standard' | 'traditional';
29
30
  doc: PMNode;
31
+ intl: IntlShape;
30
32
  newDoc: PMNode;
31
33
  nodeViewSerializer: NodeViewSerializer;
32
34
  }
33
- export declare const createDeletedContentDecoration: ({ change, doc, nodeViewSerializer, colourScheme, newDoc, }: DeletedContentDecorationProps) => Decoration | undefined;
35
+ export declare const createDeletedContentDecoration: ({ change, doc, nodeViewSerializer, colourScheme, newDoc, intl, }: DeletedContentDecorationProps) => Decoration[] | undefined;
34
36
  export {};
@@ -0,0 +1,30 @@
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
+ colourScheme?: '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, colourScheme, }: DeletedRowsHandlerProps) => Decoration[];
24
+ /**
25
+ * Main function to handle deleted rows - computes diff and creates decorations
26
+ */
27
+ export declare const handleDeletedRows: (changes: SimpleChange[], originalDoc: PMNode, newDoc: PMNode, nodeViewSerializer: NodeViewSerializer, colourScheme?: "standard" | "traditional") => {
28
+ decorations: Decoration[];
29
+ };
30
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { IntlShape } from 'react-intl-next';
1
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
3
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
@@ -11,4 +12,4 @@ export type ShowDiffPluginState = {
11
12
  originalDoc: PMNode | undefined;
12
13
  steps: ProseMirrorStep[];
13
14
  };
14
- export declare const createPlugin: (config: DiffParams | undefined) => SafePlugin<ShowDiffPluginState>;
15
+ export declare const createPlugin: (config: DiffParams | undefined, getIntl: () => IntlShape) => SafePlugin<ShowDiffPluginState>;
@@ -1,9 +1,11 @@
1
+ import type { IntlShape } from 'react-intl-next';
1
2
  import { type EditorState } from '@atlaskit/editor-prosemirror/state';
2
3
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
4
  import type { ShowDiffPluginState } from './main';
4
5
  import type { NodeViewSerializer } from './NodeViewSerializer';
5
- export declare const calculateDiffDecorations: import("memoize-one").MemoizedFn<({ state, pluginState, nodeViewSerializer, colourScheme, }: {
6
+ export declare const calculateDiffDecorations: import("memoize-one").MemoizedFn<({ state, pluginState, nodeViewSerializer, colourScheme, intl, }: {
6
7
  colourScheme?: "standard" | "traditional";
8
+ intl: IntlShape;
7
9
  nodeViewSerializer: NodeViewSerializer;
8
10
  pluginState: Omit<ShowDiffPluginState, "decorations">;
9
11
  state: EditorState;
@@ -1,4 +1,5 @@
1
1
  import type { Change } from 'prosemirror-changeset';
2
+ import type { IntlShape } from 'react-intl-next';
2
3
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
4
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
4
5
  import type { NodeViewSerializer } from './NodeViewSerializer';
@@ -24,11 +25,12 @@ export declare const createBlockChangedDecoration: (change: {
24
25
  to: number;
25
26
  }, colourScheme?: "standard" | "traditional") => Decoration;
26
27
  interface DeletedContentDecorationProps {
27
- change: Change;
28
+ change: Pick<Change, 'fromA' | 'toA' | 'fromB' | 'deleted'>;
28
29
  colourScheme?: 'standard' | 'traditional';
29
30
  doc: PMNode;
31
+ intl: IntlShape;
30
32
  newDoc: PMNode;
31
33
  nodeViewSerializer: NodeViewSerializer;
32
34
  }
33
- export declare const createDeletedContentDecoration: ({ change, doc, nodeViewSerializer, colourScheme, newDoc, }: DeletedContentDecorationProps) => Decoration | undefined;
35
+ export declare const createDeletedContentDecoration: ({ change, doc, nodeViewSerializer, colourScheme, newDoc, intl, }: DeletedContentDecorationProps) => Decoration[] | undefined;
34
36
  export {};
@@ -0,0 +1,30 @@
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
+ colourScheme?: '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, colourScheme, }: DeletedRowsHandlerProps) => Decoration[];
24
+ /**
25
+ * Main function to handle deleted rows - computes diff and creates decorations
26
+ */
27
+ export declare const handleDeletedRows: (changes: SimpleChange[], originalDoc: PMNode, newDoc: PMNode, nodeViewSerializer: NodeViewSerializer, colourScheme?: "standard" | "traditional") => {
28
+ decorations: Decoration[];
29
+ };
30
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { IntlShape } from 'react-intl-next';
1
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
3
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
@@ -11,4 +12,4 @@ export type ShowDiffPluginState = {
11
12
  originalDoc: PMNode | undefined;
12
13
  steps: ProseMirrorStep[];
13
14
  };
14
- export declare const createPlugin: (config: DiffParams | undefined) => SafePlugin<ShowDiffPluginState>;
15
+ export declare const createPlugin: (config: DiffParams | undefined, getIntl: () => IntlShape) => SafePlugin<ShowDiffPluginState>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "3.1.5",
3
+ "version": "3.2.1",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,14 +30,16 @@
30
30
  "dependencies": {
31
31
  "@atlaskit/adf-schema": "^51.3.2",
32
32
  "@atlaskit/editor-prosemirror": "7.0.0",
33
- "@atlaskit/tokens": "^7.0.0",
33
+ "@atlaskit/editor-tables": "^2.9.0",
34
+ "@atlaskit/platform-feature-flags": "^1.1.0",
35
+ "@atlaskit/tokens": "^7.1.0",
34
36
  "@babel/runtime": "^7.0.0",
35
37
  "lodash": "^4.17.21",
36
38
  "memoize-one": "^6.0.0",
37
39
  "prosemirror-changeset": "^2.2.1"
38
40
  },
39
41
  "peerDependencies": {
40
- "@atlaskit/editor-common": "^110.18.0",
42
+ "@atlaskit/editor-common": "^110.21.0",
41
43
  "react": "^18.2.0"
42
44
  },
43
45
  "techstack": {
@@ -75,5 +77,13 @@
75
77
  "import-no-extraneous-disable-for-examples-and-docs"
76
78
  ]
77
79
  }
80
+ },
81
+ "platform-feature-flags": {
82
+ "platform_editor_ai_aifc_patch_beta_2": {
83
+ "type": "boolean"
84
+ },
85
+ "platform_editor_ai_aifc_patch_ga": {
86
+ "type": "boolean"
87
+ }
78
88
  }
79
89
  }
@@ -1,27 +0,0 @@
1
- {
2
- "extends": "../../../../tsconfig.entry-points.post-office.json",
3
- "compilerOptions": {
4
- "target": "es5",
5
- "outDir": "../../../../../post-office/tsDist/@atlaskit__editor-plugin-show-diff/app",
6
- "rootDir": "../",
7
- "composite": true
8
- },
9
- "include": [
10
- "../src/**/*.ts",
11
- "../src/**/*.tsx"
12
- ],
13
- "exclude": [
14
- "../src/**/__tests__/*",
15
- "../src/**/*.test.*",
16
- "../src/**/test.*",
17
- "../src/**/examples.*"
18
- ],
19
- "references": [
20
- {
21
- "path": "../../../design-system/tokens/afm-post-office/tsconfig.json"
22
- },
23
- {
24
- "path": "../../editor-common/afm-post-office/tsconfig.json"
25
- }
26
- ]
27
- }
@@ -1,27 +0,0 @@
1
- {
2
- "extends": "../../../../tsconfig.entry-points.townsquare.json",
3
- "compilerOptions": {
4
- "target": "es5",
5
- "outDir": "../../../../../townsquare/tsDist/@atlaskit__editor-plugin-show-diff/app",
6
- "rootDir": "../",
7
- "composite": true
8
- },
9
- "include": [
10
- "../src/**/*.ts",
11
- "../src/**/*.tsx"
12
- ],
13
- "exclude": [
14
- "../src/**/__tests__/*",
15
- "../src/**/*.test.*",
16
- "../src/**/test.*",
17
- "../src/**/examples.*"
18
- ],
19
- "references": [
20
- {
21
- "path": "../../../design-system/tokens/afm-townsquare/tsconfig.json"
22
- },
23
- {
24
- "path": "../../editor-common/afm-townsquare/tsconfig.json"
25
- }
26
- ]
27
- }