@atlaskit/editor-plugin-table 2.14.1 → 3.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 3.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 3.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [`18e8e6cc9c8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/18e8e6cc9c8) - ED-19782: Clean up feature flag types from table optimisation related feature flags.
14
+
3
15
  ## 2.14.1
4
16
 
5
17
  ### Patch Changes
@@ -40,12 +40,6 @@ export interface PluginConfig {
40
40
  stickyHeaders?: boolean;
41
41
  allowCellOptionsInFloatingToolbar?: boolean;
42
42
  allowDistributeColumns?: boolean;
43
- tableCellOptimization?: boolean;
44
- tableRenderOptimization?: boolean;
45
- stickyHeadersOptimization?: boolean;
46
- initialRenderOptimization?: boolean;
47
- mouseMoveOptimization?: boolean;
48
- tableOverflowShadowsOptimization?: boolean;
49
43
  }
50
44
  export type { ColumnResizingPluginState } from '@atlaskit/editor-common/types';
51
45
  export type CellColumnPositioning = Pick<Rect, 'right' | 'left'>;
@@ -40,12 +40,6 @@ export interface PluginConfig {
40
40
  stickyHeaders?: boolean;
41
41
  allowCellOptionsInFloatingToolbar?: boolean;
42
42
  allowDistributeColumns?: boolean;
43
- tableCellOptimization?: boolean;
44
- tableRenderOptimization?: boolean;
45
- stickyHeadersOptimization?: boolean;
46
- initialRenderOptimization?: boolean;
47
- mouseMoveOptimization?: boolean;
48
- tableOverflowShadowsOptimization?: boolean;
49
43
  }
50
44
  export type { ColumnResizingPluginState } from '@atlaskit/editor-common/types';
51
45
  export type CellColumnPositioning = Pick<Rect, 'right' | 'left'>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.14.1",
3
+ "version": "3.0.1",
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": "^29.1.0",
31
- "@atlaskit/editor-common": "^74.59.0",
31
+ "@atlaskit/editor-common": "^75.0.0",
32
32
  "@atlaskit/editor-palette": "1.5.1",
33
33
  "@atlaskit/editor-plugin-analytics": "^0.2.0",
34
34
  "@atlaskit/editor-plugin-content-insertion": "^0.1.0",
package/report.api.md CHANGED
@@ -63,23 +63,11 @@ interface PluginConfig {
63
63
  // (undocumented)
64
64
  allowNumberColumn?: boolean;
65
65
  // (undocumented)
66
- initialRenderOptimization?: boolean;
67
- // (undocumented)
68
66
  isHeaderRowRequired?: boolean;
69
67
  // (undocumented)
70
- mouseMoveOptimization?: boolean;
71
- // (undocumented)
72
68
  permittedLayouts?: PermittedLayoutsDescriptor;
73
69
  // (undocumented)
74
70
  stickyHeaders?: boolean;
75
- // (undocumented)
76
- stickyHeadersOptimization?: boolean;
77
- // (undocumented)
78
- tableCellOptimization?: boolean;
79
- // (undocumented)
80
- tableOverflowShadowsOptimization?: boolean;
81
- // (undocumented)
82
- tableRenderOptimization?: boolean;
83
71
  }
84
72
 
85
73
  // @public (undocumented)
@@ -338,4 +338,73 @@ describe('table -> nodeviews -> TableContainer.tsx', () => {
338
338
  expect(selectionActionMock).toHaveBeenNthCalledWith(2, true);
339
339
  });
340
340
  });
341
+
342
+ describe('deletion', () => {
343
+ const selectionActionMock = jest.fn().mockReturnValue(() => {});
344
+ const actualGuidelineMock = jest.fn();
345
+ const guidelineActionMock = jest.fn().mockReturnValue(actualGuidelineMock);
346
+ const buildContainer = (attrs: TableAttributes) => {
347
+ const { table, editorView } = createNode(attrs);
348
+
349
+ const { container, unmount } = render(
350
+ <ResizableTableContainer
351
+ containerWidth={1800}
352
+ lineLength={720}
353
+ node={table}
354
+ className={''}
355
+ editorView={editorView}
356
+ getPos={() => 0}
357
+ tableRef={
358
+ {
359
+ querySelector: () => null,
360
+ insertBefore: () => {},
361
+ style: {},
362
+ } as any
363
+ }
364
+ pluginInjectionApi={
365
+ {
366
+ selection: {
367
+ commands: { displayGapCursor: selectionActionMock },
368
+ },
369
+ guideline: {
370
+ actions: { displayGuideline: guidelineActionMock },
371
+ },
372
+ // mock core so the selection command will execute
373
+ core: { actions: { execute: jest.fn() } },
374
+ } as any
375
+ }
376
+ />,
377
+ );
378
+
379
+ return { container, unmount, selectionActionMock, actualGuidelineMock };
380
+ };
381
+
382
+ afterEach(() => {
383
+ selectionActionMock.mockClear();
384
+ actualGuidelineMock.mockClear();
385
+ guidelineActionMock.mockClear();
386
+ });
387
+
388
+ // this is testing logic inside TableResizer, targeting the clean up in the useEffect
389
+ it('should call selection plugin action to display gapcursor when removed', () => {
390
+ const { container, unmount, selectionActionMock } = buildContainer({});
391
+
392
+ fireEvent.mouseDown(container.querySelector('.resizer-handle.right')!);
393
+ fireEvent.mouseMove(container.querySelector('.resizer-handle.right')!);
394
+
395
+ unmount();
396
+ expect(selectionActionMock).toHaveBeenCalledWith(true);
397
+ });
398
+
399
+ // this is testing logic inside TableResizer, targeting the clean up in the useEffect
400
+ it('should call guideline plugin action to remove guidelines when removed', () => {
401
+ const { container, unmount, actualGuidelineMock } = buildContainer({});
402
+
403
+ fireEvent.mouseDown(container.querySelector('.resizer-handle.right')!);
404
+ fireEvent.mouseMove(container.querySelector('.resizer-handle.right')!);
405
+
406
+ unmount();
407
+ expect(actualGuidelineMock).toHaveBeenCalledWith({ guidelines: [] });
408
+ });
409
+ });
341
410
  });
@@ -55,13 +55,6 @@ export interface PluginConfig {
55
55
  stickyHeaders?: boolean;
56
56
  allowCellOptionsInFloatingToolbar?: boolean;
57
57
  allowDistributeColumns?: boolean;
58
- // to be cleaned up in ED-19477 after confluence no longer consumes table optimisation flags
59
- tableCellOptimization?: boolean;
60
- tableRenderOptimization?: boolean;
61
- stickyHeadersOptimization?: boolean;
62
- initialRenderOptimization?: boolean;
63
- mouseMoveOptimization?: boolean;
64
- tableOverflowShadowsOptimization?: boolean;
65
58
  }
66
59
 
67
60
  export type { ColumnResizingPluginState } from '@atlaskit/editor-common/types';
@@ -52,23 +52,11 @@ interface PluginConfig {
52
52
  // (undocumented)
53
53
  allowNumberColumn?: boolean;
54
54
  // (undocumented)
55
- initialRenderOptimization?: boolean;
56
- // (undocumented)
57
55
  isHeaderRowRequired?: boolean;
58
56
  // (undocumented)
59
- mouseMoveOptimization?: boolean;
60
- // (undocumented)
61
57
  permittedLayouts?: PermittedLayoutsDescriptor;
62
58
  // (undocumented)
63
59
  stickyHeaders?: boolean;
64
- // (undocumented)
65
- stickyHeadersOptimization?: boolean;
66
- // (undocumented)
67
- tableCellOptimization?: boolean;
68
- // (undocumented)
69
- tableOverflowShadowsOptimization?: boolean;
70
- // (undocumented)
71
- tableRenderOptimization?: boolean;
72
60
  }
73
61
 
74
62
  // @public (undocumented)