@atlaskit/editor-plugin-table 2.1.3 → 2.1.5

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 (91) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/plugins/table/commands/hover.js +1 -1
  3. package/dist/cjs/plugins/table/commands/sort.js +12 -14
  4. package/dist/cjs/plugins/table/index.js +28 -30
  5. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +2 -2
  6. package/dist/cjs/plugins/table/nodeviews/update-overflow-shadows.js +1 -1
  7. package/dist/cjs/plugins/table/pm-plugins/main.js +1 -1
  8. package/dist/cjs/plugins/table/pm-plugins/table-add-width.js +2 -2
  9. package/dist/cjs/plugins/table/pm-plugins/table-local-id.js +1 -1
  10. package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin.js +1 -1
  11. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +3 -3
  12. package/dist/cjs/plugins/table/toolbar.js +2 -2
  13. package/dist/cjs/plugins/table/transforms/column-width.js +1 -1
  14. package/dist/cjs/plugins/table/ui/LayoutButton/index.js +1 -1
  15. package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
  16. package/dist/cjs/plugins/table/ui/ui-styles.js +1 -1
  17. package/dist/cjs/plugins/table/utils/column-controls.js +2 -2
  18. package/dist/cjs/plugins/table/utils/decoration.js +1 -1
  19. package/dist/cjs/version.json +1 -1
  20. package/dist/es2019/plugins/table/commands/hover.js +1 -1
  21. package/dist/es2019/plugins/table/commands/sort.js +14 -16
  22. package/dist/es2019/plugins/table/index.js +1 -4
  23. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +2 -2
  24. package/dist/es2019/plugins/table/nodeviews/update-overflow-shadows.js +1 -1
  25. package/dist/es2019/plugins/table/pm-plugins/main.js +1 -1
  26. package/dist/es2019/plugins/table/pm-plugins/table-add-width.js +2 -3
  27. package/dist/es2019/plugins/table/pm-plugins/table-local-id.js +1 -1
  28. package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin.js +1 -1
  29. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/dom.js +3 -3
  30. package/dist/es2019/plugins/table/toolbar.js +2 -2
  31. package/dist/es2019/plugins/table/transforms/column-width.js +1 -1
  32. package/dist/es2019/plugins/table/ui/LayoutButton/index.js +1 -1
  33. package/dist/es2019/plugins/table/ui/common-styles.js +1 -1
  34. package/dist/es2019/plugins/table/ui/ui-styles.js +1 -1
  35. package/dist/es2019/plugins/table/utils/column-controls.js +2 -2
  36. package/dist/es2019/plugins/table/utils/decoration.js +1 -1
  37. package/dist/es2019/version.json +1 -1
  38. package/dist/esm/plugins/table/commands/hover.js +1 -1
  39. package/dist/esm/plugins/table/commands/sort.js +12 -14
  40. package/dist/esm/plugins/table/index.js +28 -30
  41. package/dist/esm/plugins/table/nodeviews/TableComponent.js +2 -2
  42. package/dist/esm/plugins/table/nodeviews/update-overflow-shadows.js +1 -1
  43. package/dist/esm/plugins/table/pm-plugins/main.js +1 -1
  44. package/dist/esm/plugins/table/pm-plugins/table-add-width.js +2 -3
  45. package/dist/esm/plugins/table/pm-plugins/table-local-id.js +1 -1
  46. package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin.js +1 -1
  47. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/dom.js +3 -3
  48. package/dist/esm/plugins/table/toolbar.js +2 -2
  49. package/dist/esm/plugins/table/transforms/column-width.js +1 -1
  50. package/dist/esm/plugins/table/ui/LayoutButton/index.js +1 -1
  51. package/dist/esm/plugins/table/ui/common-styles.js +1 -1
  52. package/dist/esm/plugins/table/ui/ui-styles.js +1 -1
  53. package/dist/esm/plugins/table/utils/column-controls.js +2 -2
  54. package/dist/esm/plugins/table/utils/decoration.js +1 -1
  55. package/dist/esm/version.json +1 -1
  56. package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +1 -1
  57. package/dist/types/plugins/table/nodeviews/update-overflow-shadows.d.ts +1 -2
  58. package/dist/types/plugins/table/pm-plugins/table-add-width.d.ts +1 -2
  59. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +1 -1
  60. package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -1
  61. package/dist/types/plugins/table/utils/column-controls.d.ts +1 -1
  62. package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
  63. package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +1 -1
  64. package/dist/types-ts4.5/plugins/table/nodeviews/update-overflow-shadows.d.ts +1 -2
  65. package/dist/types-ts4.5/plugins/table/pm-plugins/table-add-width.d.ts +1 -2
  66. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +1 -1
  67. package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +1 -1
  68. package/dist/types-ts4.5/plugins/table/utils/column-controls.d.ts +1 -1
  69. package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +1 -1
  70. package/package.json +4 -4
  71. package/src/__tests__/unit/utils/column-controls.ts +4 -4
  72. package/src/plugins/table/commands/hover.ts +1 -1
  73. package/src/plugins/table/commands/sort.ts +13 -13
  74. package/src/plugins/table/index.tsx +3 -8
  75. package/src/plugins/table/nodeviews/TableComponent.tsx +1 -2
  76. package/src/plugins/table/nodeviews/update-overflow-shadows.ts +0 -2
  77. package/src/plugins/table/pm-plugins/main.ts +1 -1
  78. package/src/plugins/table/pm-plugins/table-add-width.ts +2 -3
  79. package/src/plugins/table/pm-plugins/table-local-id.ts +1 -1
  80. package/src/plugins/table/pm-plugins/table-resizing/plugin.ts +1 -1
  81. package/src/plugins/table/pm-plugins/table-resizing/utils/dom.ts +1 -3
  82. package/src/plugins/table/toolbar.tsx +0 -2
  83. package/src/plugins/table/transforms/column-width.ts +1 -1
  84. package/src/plugins/table/transforms/delete-columns.ts +1 -1
  85. package/src/plugins/table/ui/LayoutButton/index.tsx +1 -1
  86. package/src/plugins/table/ui/common-styles.ts +1 -1
  87. package/src/plugins/table/ui/ui-styles.ts +1 -1
  88. package/src/plugins/table/utils/column-controls.ts +2 -5
  89. package/src/plugins/table/utils/decoration.ts +1 -4
  90. package/src/plugins/table/utils/row-controls.ts +1 -1
  91. package/tmp/api-report-tmp.d.ts +0 -104
@@ -15,7 +15,7 @@ export var findColumnControlSelectedDecoration = function findColumnControlSelec
15
15
  export var findControlsHoverDecoration = function findControlsHoverDecoration(decorationSet) {
16
16
  return filterDecorationByKey(TableDecorations.ALL_CONTROLS_HOVER, decorationSet);
17
17
  };
18
- export var createCellHoverDecoration = function createCellHoverDecoration(cells, type) {
18
+ export var createCellHoverDecoration = function createCellHoverDecoration(cells) {
19
19
  return cells.map(function (cell) {
20
20
  return Decoration.node(cell.pos, cell.pos + cell.node.nodeSize, {
21
21
  class: ClassName.HOVERED_CELL_WARNING
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "sideEffects": false
5
5
  }
@@ -46,7 +46,7 @@ declare class TableComponent extends React.Component<ComponentProps, TableState>
46
46
  constructor(props: ComponentProps);
47
47
  componentDidMount(): void;
48
48
  componentWillUnmount(): void;
49
- componentDidUpdate(prevProps: ComponentProps): void;
49
+ componentDidUpdate(): void;
50
50
  private updateShadows;
51
51
  private updateShadowState;
52
52
  private createShadowSentinels;
@@ -1,8 +1,7 @@
1
- import { EditorState } from 'prosemirror-state';
2
1
  import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
3
2
  export declare const updateShadowListForStickyStyles: (heightStyle: string, shadows: HTMLCollection) => void;
4
3
  /**
5
4
  * Update overflow shadows for a given wrapper & table.
6
5
  * if `overflowShadowOptimization` is enabled, this will exit early.
7
6
  */
8
- export declare const updateOverflowShadows: (getEditorFeatureFlags: GetEditorFeatureFlags) => (editorState: EditorState, wrapper?: HTMLElement | null, table?: HTMLElement | null, rightShadows?: NodeListOf<HTMLElement> | null, leftShadows?: NodeListOf<HTMLElement> | null) => false | undefined;
7
+ export declare const updateOverflowShadows: (getEditorFeatureFlags: GetEditorFeatureFlags) => (wrapper?: HTMLElement | null, table?: HTMLElement | null, rightShadows?: NodeListOf<HTMLElement> | null, leftShadows?: NodeListOf<HTMLElement> | null) => false | undefined;
@@ -2,7 +2,6 @@
2
2
  * A plugin for scan the document, add width value to table's width attribute when necessary
3
3
  *
4
4
  */
5
- import { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
6
5
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
- declare const createPlugin: (dispatch: Dispatch, fullWidthEnabled: boolean) => SafePlugin<any>;
6
+ declare const createPlugin: (fullWidthEnabled: boolean) => SafePlugin<any>;
8
7
  export { createPlugin };
@@ -6,7 +6,7 @@ export declare const isClickNear: (event: MouseEvent, click: {
6
6
  x: number;
7
7
  y: number;
8
8
  }) => boolean;
9
- export declare const getResizeCellPos: (view: EditorView, event: MouseEvent, lastColumnResizable: boolean) => number | null;
9
+ export declare const getResizeCellPos: (view: EditorView, event: MouseEvent) => number | null;
10
10
  export declare const updateStickyMargins: (table: HTMLElement) => void;
11
11
  export declare const applyColWidthsToStickyRow: (colGroup: HTMLTableColElement | null, headerRow: HTMLTableRowElement) => void;
12
12
  export declare const syncStickyRowToTable: (tableRef?: HTMLElement | null) => void;
@@ -5,7 +5,7 @@ export declare const HeaderButtonHover: () => import("@emotion/react").Serialize
5
5
  export declare const HeaderButtonDanger: () => import("@emotion/react").SerializedStyles;
6
6
  export declare const insertColumnButtonWrapper: import("@emotion/react").SerializedStyles;
7
7
  export declare const insertRowButtonWrapper: import("@emotion/react").SerializedStyles;
8
- export declare const columnControlsLineMarker: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
8
+ export declare const columnControlsLineMarker: () => import("@emotion/react").SerializedStyles;
9
9
  export declare const DeleteButton: import("@emotion/react").SerializedStyles;
10
10
  export declare const OverflowShadow: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
11
11
  export declare const columnControlsDecoration: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
@@ -7,4 +7,4 @@ export declare const getColumnDeleteButtonParams: (columnsWidths: Array<number |
7
7
  indexes: number[];
8
8
  } | null;
9
9
  export declare const getColumnClassNames: (index: number, selection: Selection, hoveredColumns?: number[], isInDanger?: boolean, isResizing?: boolean) => string;
10
- export declare const colWidthsForRow: (colGroup: HTMLTableColElement | null, tr: HTMLTableRowElement) => string;
10
+ export declare const colWidthsForRow: (tr: HTMLTableRowElement) => string;
@@ -4,7 +4,7 @@ import { Decoration, DecorationSet } from 'prosemirror-view';
4
4
  import { Cell, CellColumnPositioning, TableDecorations } from '../types';
5
5
  export declare const findColumnControlSelectedDecoration: (decorationSet: DecorationSet) => Decoration[];
6
6
  export declare const findControlsHoverDecoration: (decorationSet: DecorationSet) => Decoration[];
7
- export declare const createCellHoverDecoration: (cells: Cell[], type: 'warning') => Decoration[];
7
+ export declare const createCellHoverDecoration: (cells: Cell[]) => Decoration[];
8
8
  export declare const createControlsHoverDecoration: (cells: Cell[], type: 'row' | 'column' | 'table', tr: Transaction | ReadonlyTransaction, danger?: boolean, selected?: boolean) => Decoration[];
9
9
  export declare const createColumnSelectedDecoration: (tr: Transaction | ReadonlyTransaction) => Decoration[];
10
10
  export declare const createColumnControlsDecoration: (selection: Selection) => Decoration[];
@@ -46,7 +46,7 @@ declare class TableComponent extends React.Component<ComponentProps, TableState>
46
46
  constructor(props: ComponentProps);
47
47
  componentDidMount(): void;
48
48
  componentWillUnmount(): void;
49
- componentDidUpdate(prevProps: ComponentProps): void;
49
+ componentDidUpdate(): void;
50
50
  private updateShadows;
51
51
  private updateShadowState;
52
52
  private createShadowSentinels;
@@ -1,8 +1,7 @@
1
- import { EditorState } from 'prosemirror-state';
2
1
  import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
3
2
  export declare const updateShadowListForStickyStyles: (heightStyle: string, shadows: HTMLCollection) => void;
4
3
  /**
5
4
  * Update overflow shadows for a given wrapper & table.
6
5
  * if `overflowShadowOptimization` is enabled, this will exit early.
7
6
  */
8
- export declare const updateOverflowShadows: (getEditorFeatureFlags: GetEditorFeatureFlags) => (editorState: EditorState, wrapper?: HTMLElement | null, table?: HTMLElement | null, rightShadows?: NodeListOf<HTMLElement> | null, leftShadows?: NodeListOf<HTMLElement> | null) => false | undefined;
7
+ export declare const updateOverflowShadows: (getEditorFeatureFlags: GetEditorFeatureFlags) => (wrapper?: HTMLElement | null, table?: HTMLElement | null, rightShadows?: NodeListOf<HTMLElement> | null, leftShadows?: NodeListOf<HTMLElement> | null) => false | undefined;
@@ -2,7 +2,6 @@
2
2
  * A plugin for scan the document, add width value to table's width attribute when necessary
3
3
  *
4
4
  */
5
- import { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
6
5
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
- declare const createPlugin: (dispatch: Dispatch, fullWidthEnabled: boolean) => SafePlugin<any>;
6
+ declare const createPlugin: (fullWidthEnabled: boolean) => SafePlugin<any>;
8
7
  export { createPlugin };
@@ -6,7 +6,7 @@ export declare const isClickNear: (event: MouseEvent, click: {
6
6
  x: number;
7
7
  y: number;
8
8
  }) => boolean;
9
- export declare const getResizeCellPos: (view: EditorView, event: MouseEvent, lastColumnResizable: boolean) => number | null;
9
+ export declare const getResizeCellPos: (view: EditorView, event: MouseEvent) => number | null;
10
10
  export declare const updateStickyMargins: (table: HTMLElement) => void;
11
11
  export declare const applyColWidthsToStickyRow: (colGroup: HTMLTableColElement | null, headerRow: HTMLTableRowElement) => void;
12
12
  export declare const syncStickyRowToTable: (tableRef?: HTMLElement | null) => void;
@@ -5,7 +5,7 @@ export declare const HeaderButtonHover: () => import("@emotion/react").Serialize
5
5
  export declare const HeaderButtonDanger: () => import("@emotion/react").SerializedStyles;
6
6
  export declare const insertColumnButtonWrapper: import("@emotion/react").SerializedStyles;
7
7
  export declare const insertRowButtonWrapper: import("@emotion/react").SerializedStyles;
8
- export declare const columnControlsLineMarker: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
8
+ export declare const columnControlsLineMarker: () => import("@emotion/react").SerializedStyles;
9
9
  export declare const DeleteButton: import("@emotion/react").SerializedStyles;
10
10
  export declare const OverflowShadow: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
11
11
  export declare const columnControlsDecoration: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
@@ -7,4 +7,4 @@ export declare const getColumnDeleteButtonParams: (columnsWidths: Array<number |
7
7
  indexes: number[];
8
8
  } | null;
9
9
  export declare const getColumnClassNames: (index: number, selection: Selection, hoveredColumns?: number[], isInDanger?: boolean, isResizing?: boolean) => string;
10
- export declare const colWidthsForRow: (colGroup: HTMLTableColElement | null, tr: HTMLTableRowElement) => string;
10
+ export declare const colWidthsForRow: (tr: HTMLTableRowElement) => string;
@@ -4,7 +4,7 @@ import { Decoration, DecorationSet } from 'prosemirror-view';
4
4
  import { Cell, CellColumnPositioning, TableDecorations } from '../types';
5
5
  export declare const findColumnControlSelectedDecoration: (decorationSet: DecorationSet) => Decoration[];
6
6
  export declare const findControlsHoverDecoration: (decorationSet: DecorationSet) => Decoration[];
7
- export declare const createCellHoverDecoration: (cells: Cell[], type: 'warning') => Decoration[];
7
+ export declare const createCellHoverDecoration: (cells: Cell[]) => Decoration[];
8
8
  export declare const createControlsHoverDecoration: (cells: Cell[], type: 'row' | 'column' | 'table', tr: Transaction | ReadonlyTransaction, danger?: boolean, selected?: boolean) => Decoration[];
9
9
  export declare const createColumnSelectedDecoration: (tr: Transaction | ReadonlyTransaction) => Decoration[];
10
10
  export declare const createColumnControlsDecoration: (selection: Selection) => Decoration[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@atlaskit/adf-schema": "^26.2.0",
31
- "@atlaskit/editor-common": "^74.19.0",
31
+ "@atlaskit/editor-common": "^74.21.0",
32
32
  "@atlaskit/editor-palette": "1.5.1",
33
33
  "@atlaskit/editor-plugin-analytics": "^0.1.0",
34
34
  "@atlaskit/editor-plugin-content-insertion": "^0.0.6",
@@ -37,7 +37,7 @@
37
37
  "@atlaskit/icon": "^21.12.0",
38
38
  "@atlaskit/platform-feature-flags": "^0.2.1",
39
39
  "@atlaskit/theme": "^12.5.0",
40
- "@atlaskit/tokens": "^1.11.0",
40
+ "@atlaskit/tokens": "^1.12.0",
41
41
  "@atlaskit/tooltip": "^17.8.0",
42
42
  "@babel/runtime": "^7.0.0",
43
43
  "@emotion/react": "^11.7.1",
@@ -64,7 +64,7 @@
64
64
  "@atlaskit/editor-plugin-decorations": "^0.1.0",
65
65
  "@atlaskit/editor-plugin-feature-flags": "^0.1.0",
66
66
  "@atlaskit/editor-plugin-grid": "^0.1.0",
67
- "@atlaskit/editor-plugin-hyperlink": "^0.0.0",
67
+ "@atlaskit/editor-plugin-hyperlink": "^0.1.0",
68
68
  "@atlaskit/editor-plugin-width": "^0.1.0",
69
69
  "@atlaskit/editor-test-helpers": "^18.10.0",
70
70
  "@atlaskit/visual-regression": "*",
@@ -32,16 +32,16 @@ describe('table utilities', () => {
32
32
 
33
33
  describe('pctWidthsForRow', () => {
34
34
  it('returns nothing for an empty table and empty row', () => {
35
- expect(colWidthsForRow(colgroup, createRow(0))).toEqual('');
35
+ expect(colWidthsForRow(createRow(0))).toEqual('');
36
36
  });
37
37
 
38
38
  describe('unresized table/no colgroup', () => {
39
39
  it('returns 100% for single cell', () => {
40
- expect(colWidthsForRow(colgroup, createRow(1))).toEqual('100%');
40
+ expect(colWidthsForRow(createRow(1))).toEqual('100%');
41
41
  });
42
42
 
43
43
  it('returns split 50% for two cells', () => {
44
- expect(colWidthsForRow(colgroup, createRow(2))).toEqual('50% 50%');
44
+ expect(colWidthsForRow(createRow(2))).toEqual('50% 50%');
45
45
  });
46
46
 
47
47
  it('works for merged cells', () => {
@@ -54,7 +54,7 @@ describe('table utilities', () => {
54
54
  // giving 4 visual rows, and only 2 in DOM
55
55
 
56
56
  // colgroup is still empty
57
- expect(colWidthsForRow(colgroup, rowWithColspan)).toEqual('75% 25%');
57
+ expect(colWidthsForRow(rowWithColspan)).toEqual('75% 25%');
58
58
  });
59
59
  });
60
60
  });
@@ -40,7 +40,7 @@ export const hoverMergedCells = () =>
40
40
  node: table.node.nodeAt(pos)!,
41
41
  }));
42
42
 
43
- const decorations = createCellHoverDecoration(mergedCells, 'warning');
43
+ const decorations = createCellHoverDecoration(mergedCells);
44
44
 
45
45
  return {
46
46
  type: 'HOVER_CELLS',
@@ -21,24 +21,24 @@ import {
21
21
  TableSortOrder as SortOrder,
22
22
  } from '@atlaskit/adf-schema/steps';
23
23
 
24
- function createGetInlineCardTextFromStore(state: EditorState) {
25
- return (attrs: CardAttributes): string | null => {
26
- const { data } = attrs as DataType;
27
- if (data && ((data as any).name || (data as any).title)) {
28
- return (data as any).name || (data as any).title;
29
- }
30
-
31
- const { url: cardUrl } = attrs as UrlType;
32
- return cardUrl;
33
- };
34
- }
24
+ const createGetInlineCardTextFromStore = (
25
+ attrs: CardAttributes,
26
+ ): string | null => {
27
+ const { data } = attrs as DataType;
28
+ if (data && ((data as any).name || (data as any).title)) {
29
+ return (data as any).name || (data as any).title;
30
+ }
31
+
32
+ const { url: cardUrl } = attrs as UrlType;
33
+ return cardUrl;
34
+ };
35
35
 
36
36
  export const sortByColumn = (
37
37
  columnIndex: number,
38
38
  order: SortOrder = SortOrder.DESC,
39
39
  ): Command =>
40
40
  createCommand(
41
- (state) => ({
41
+ () => ({
42
42
  type: 'SORT_TABLE',
43
43
  data: {
44
44
  ordering: {
@@ -70,7 +70,7 @@ export const sortByColumn = (
70
70
  }
71
71
  const compareNodesInOrder = createCompareNodes(
72
72
  {
73
- getInlineCardTextFromStore: createGetInlineCardTextFromStore(state),
73
+ getInlineCardTextFromStore: createGetInlineCardTextFromStore,
74
74
  },
75
75
  order,
76
76
  );
@@ -66,7 +66,7 @@ import type {
66
66
  GetEditorFeatureFlags,
67
67
  NextEditorPlugin,
68
68
  } from '@atlaskit/editor-common/types';
69
- import { EditorState, Transaction } from 'prosemirror-state';
69
+ import { Transaction } from 'prosemirror-state';
70
70
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
71
71
  import type { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
72
72
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
@@ -218,11 +218,9 @@ const tablesPlugin: NextEditorPlugin<
218
218
  plugin: () =>
219
219
  tableEditing({
220
220
  reportFixedTable: ({
221
- state,
222
221
  tr,
223
222
  reason,
224
223
  }: {
225
- state: EditorState;
226
224
  tr: Transaction;
227
225
  reason: string;
228
226
  }) => {
@@ -258,12 +256,9 @@ const tablesPlugin: NextEditorPlugin<
258
256
  },
259
257
  {
260
258
  name: 'tableAddWidth',
261
- plugin: ({ dispatch }) =>
259
+ plugin: () =>
262
260
  getBooleanFF('platform.editor.custom-table-width') && options
263
- ? createTableAddWidthPlugin(
264
- dispatch,
265
- options.fullWidthEnabled || false,
266
- )
261
+ ? createTableAddWidthPlugin(options.fullWidthEnabled || false)
267
262
  : undefined,
268
263
  },
269
264
 
@@ -198,7 +198,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
198
198
  );
199
199
  }
200
200
 
201
- componentDidUpdate(prevProps: ComponentProps) {
201
+ componentDidUpdate() {
202
202
  const { view, getNode, isMediaFullscreen, allowColumnResizing } =
203
203
  this.props;
204
204
  const { isInDanger } = getPluginState(view.state);
@@ -268,7 +268,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
268
268
  );
269
269
 
270
270
  updateOverflowShadows(this.props.getEditorFeatureFlags)(
271
- this.props.view.state,
272
271
  this.wrapper,
273
272
  this.table,
274
273
  rightShadows,
@@ -1,4 +1,3 @@
1
- import { EditorState } from 'prosemirror-state';
2
1
  import { TableCssClassName as ClassName } from '../types';
3
2
  import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
4
3
  export const updateShadowListForStickyStyles = (
@@ -25,7 +24,6 @@ export const updateShadowListForStickyStyles = (
25
24
  export const updateOverflowShadows =
26
25
  (getEditorFeatureFlags: GetEditorFeatureFlags) =>
27
26
  (
28
- editorState: EditorState,
29
27
  wrapper?: HTMLElement | null,
30
28
  table?: HTMLElement | null,
31
29
  rightShadows?: NodeListOf<HTMLElement> | null,
@@ -343,7 +343,7 @@ export const createPlugin = (
343
343
  const maybeTr = closestElement(domRef as HTMLElement | undefined, 'tr');
344
344
  return maybeTr ? maybeTr.classList.contains('sticky') : false;
345
345
  },
346
- handleTextInput: ({ state, dispatch }, from, to, text) => {
346
+ handleTextInput: ({ state, dispatch }, _from, _to, text) => {
347
347
  const tr = replaceSelectedTable(
348
348
  state,
349
349
  text,
@@ -2,7 +2,6 @@
2
2
  * A plugin for scan the document, add width value to table's width attribute when necessary
3
3
  *
4
4
  */
5
- import { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
6
5
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
6
  import {
8
7
  akEditorFullWidthLayoutWidth,
@@ -17,7 +16,7 @@ type __ReplaceStep = ReplaceStep & {
17
16
  from: number;
18
17
  };
19
18
 
20
- const createPlugin = (dispatch: Dispatch, fullWidthEnabled: boolean) =>
19
+ const createPlugin = (fullWidthEnabled: boolean) =>
21
20
  new SafePlugin({
22
21
  appendTransaction: (transactions, _oldState, newState) => {
23
22
  // When document first load in Confluence, initially it is an empty document
@@ -58,7 +57,7 @@ const createPlugin = (dispatch: Dispatch, fullWidthEnabled: boolean) =>
58
57
  const tr = newState.tr;
59
58
  const { table } = newState.schema.nodes;
60
59
 
61
- newState.doc.forEach((node, offset, index) => {
60
+ newState.doc.forEach((node, offset) => {
62
61
  if (node.type === table) {
63
62
  const width = node.attrs.width;
64
63
  const layout = node.attrs.layout;
@@ -156,7 +156,7 @@ const createPlugin = (dispatch: Dispatch) =>
156
156
  continue;
157
157
  }
158
158
 
159
- step.slice.content.descendants((node, pos) => {
159
+ step.slice.content.descendants((node) => {
160
160
  if (node.type === table) {
161
161
  addedTableNodes.add(node);
162
162
  }
@@ -52,7 +52,7 @@ export function createPlugin(
52
52
  const resizeHandlePos =
53
53
  // we're setting `resizeHandlePos` via command in unit tests
54
54
  getPluginState(state).resizeHandlePos ||
55
- getResizeCellPos(view, event as MouseEvent, lastColumnResizable);
55
+ getResizeCellPos(view, event as MouseEvent);
56
56
 
57
57
  const { dragging } = getPluginState(state);
58
58
  if (resizeHandlePos !== null && !dragging) {
@@ -65,7 +65,6 @@ export const updateControls =
65
65
  );
66
66
 
67
67
  updateOverflowShadows(getEditorFeatureFlags)(
68
- state,
69
68
  wrapper,
70
69
  tableRef,
71
70
  rightShadows,
@@ -85,7 +84,6 @@ export const isClickNear = (
85
84
  export const getResizeCellPos = (
86
85
  view: EditorView,
87
86
  event: MouseEvent,
88
- lastColumnResizable: boolean,
89
87
  ): number | null => {
90
88
  const target = event.target as HTMLElement;
91
89
 
@@ -124,7 +122,7 @@ export const applyColWidthsToStickyRow = (
124
122
  headerRow: HTMLTableRowElement,
125
123
  ) => {
126
124
  // sync column widths for the sticky row
127
- const newCols = colWidthsForRow(colGroup, headerRow);
125
+ const newCols = colWidthsForRow(headerRow);
128
126
 
129
127
  if (newCols) {
130
128
  headerRow.style.gridTemplateColumns = newCols;
@@ -464,7 +464,6 @@ export const getToolbarConfig =
464
464
  state,
465
465
  menu,
466
466
  intl,
467
- getEditorContainerWidth,
468
467
  editorAnalyticsAPI,
469
468
  tableCellOptionsInFloatingToolbar,
470
469
  );
@@ -614,7 +613,6 @@ const getColorPicker = (
614
613
  state: EditorState,
615
614
  menu: FloatingToolbarItem<Command>,
616
615
  { formatMessage }: ToolbarMenuContext,
617
- getEditorContainerWidth: GetEditorContainerWidth,
618
616
  editorAnalyticsAPI: EditorAnalyticsAPI | null | undefined,
619
617
  tableCellOptionsInFloatingToolbar?: boolean,
620
618
  ): Array<FloatingToolbarItem<Command>> => {
@@ -207,7 +207,7 @@ export const rescaleColumns =
207
207
  const widths: Array<number> = new Array(noOfColumns).fill(
208
208
  tableCellMinWidth,
209
209
  );
210
- const cols = widths.map((width, index) => ({
210
+ const cols = widths.map((_, index) => ({
211
211
  width: tableCellMinWidth,
212
212
  minWidth: tableCellMinWidth,
213
213
  index,
@@ -24,7 +24,7 @@ const deleteColumnsCustomStep =
24
24
  // Delete the columns
25
25
  let mapStart = tr.mapping.maps.length;
26
26
  const originalDoc = tr.doc;
27
- const deletedColumns = [];
27
+ const deletedColumns: number[] = [];
28
28
  for (let i = rect.left; i < rect.right; i++) {
29
29
  const step = AddColumnStep.create(originalDoc, table.pos, i, true);
30
30
  deletedColumns.push(i);
@@ -54,7 +54,7 @@ class LayoutButton extends React.Component<Props & WrappedComponentProps, any> {
54
54
  private stickyButtonRef = createRef<HTMLDivElement>();
55
55
 
56
56
  private resizeObserver: ResizeObserver = new ResizeObserver((entries) => {
57
- entries.forEach((entry) => {
57
+ entries.forEach(() => {
58
58
  const resizeButton = this.stickyButtonRef.current;
59
59
  const tableWrapper = this.props.targetRef;
60
60
  if (resizeButton && tableWrapper) {
@@ -185,7 +185,7 @@ export const tableStyles = (
185
185
 
186
186
  .ProseMirror {
187
187
  ${tableSharedStyle(props)};
188
- ${columnControlsLineMarker(props)};
188
+ ${columnControlsLineMarker()};
189
189
  ${hoveredDeleteButton};
190
190
  ${hoveredCell};
191
191
  ${hoveredWarningCell};
@@ -208,7 +208,7 @@ export const insertRowButtonWrapper = css`
208
208
  `)}
209
209
  `;
210
210
 
211
- export const columnControlsLineMarker = (props: ThemeProps) => css`
211
+ export const columnControlsLineMarker = () => css`
212
212
  .${ClassName.TABLE_CONTAINER}.${ClassName.WITH_CONTROLS}
213
213
  table
214
214
  tr:first-of-type
@@ -172,10 +172,7 @@ const getRelativeDomCellWidths = ({
172
172
  );
173
173
  };
174
174
 
175
- export const colWidthsForRow = (
176
- colGroup: HTMLTableColElement | null,
177
- tr: HTMLTableRowElement,
178
- ) => {
175
+ export const colWidthsForRow = (tr: HTMLTableRowElement) => {
179
176
  // get the colspans
180
177
  const rowColSpans = maphElem(tr, (cell) =>
181
178
  Number(cell.getAttribute('colspan') || 1 /* default to span of 1 */),
@@ -202,7 +199,7 @@ export const colWidthsForRow = (
202
199
 
203
200
  // reverse engineer cell widths from table widths
204
201
  let domBasedCellWidths: number[] = [];
205
- cellInfos.map((cell, idx) => {
202
+ cellInfos.map((cell) => {
206
203
  domBasedCellWidths.push(...getRelativeDomCellWidths(cell));
207
204
  });
208
205
 
@@ -40,10 +40,7 @@ export const findControlsHoverDecoration = (
40
40
  ): Decoration[] =>
41
41
  filterDecorationByKey(TableDecorations.ALL_CONTROLS_HOVER, decorationSet);
42
42
 
43
- export const createCellHoverDecoration = (
44
- cells: Cell[],
45
- type: 'warning',
46
- ): Decoration[] =>
43
+ export const createCellHoverDecoration = (cells: Cell[]): Decoration[] =>
47
44
  cells.map((cell) =>
48
45
  Decoration.node(
49
46
  cell.pos,
@@ -170,7 +170,7 @@ export const copyPreviousRow =
170
170
  );
171
171
 
172
172
  let cells = [] as PMNode[];
173
- let fixRowspans = [];
173
+ let fixRowspans: { pos: number; node: PMNode }[] = [];
174
174
  for (let i = 0; i < cellsPositionsInOriginalRow.length; ) {
175
175
  const pos = cellsPositionsInOriginalRow[i];
176
176
  const documentCellPos = pos + table.start;