@atlaskit/editor-plugin-table 0.1.2 → 0.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 (62) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/plugins/table/commands/misc.js +4 -2
  3. package/dist/cjs/plugins/table/create-plugin-config.js +0 -1
  4. package/dist/cjs/plugins/table/event-handlers.js +5 -6
  5. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-resizing.js +2 -2
  6. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +3 -5
  7. package/dist/cjs/plugins/table/reducer.js +3 -2
  8. package/dist/cjs/plugins/table/types.js +2 -1
  9. package/dist/cjs/plugins/table/ui/common-styles.js +8 -1
  10. package/dist/cjs/plugins/table/ui/ui-styles.js +4 -4
  11. package/dist/cjs/plugins/table/utils/column-controls.js +1 -1
  12. package/dist/cjs/plugins/table/utils/decoration.js +16 -5
  13. package/dist/cjs/version.json +1 -1
  14. package/dist/es2019/plugins/table/commands/misc.js +4 -2
  15. package/dist/es2019/plugins/table/create-plugin-config.js +0 -1
  16. package/dist/es2019/plugins/table/event-handlers.js +6 -7
  17. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-resizing.js +2 -2
  18. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/dom.js +3 -8
  19. package/dist/es2019/plugins/table/reducer.js +3 -2
  20. package/dist/es2019/plugins/table/types.js +2 -1
  21. package/dist/es2019/plugins/table/ui/common-styles.js +16 -17
  22. package/dist/es2019/plugins/table/ui/ui-styles.js +67 -24
  23. package/dist/es2019/plugins/table/utils/column-controls.js +1 -1
  24. package/dist/es2019/plugins/table/utils/decoration.js +16 -5
  25. package/dist/es2019/version.json +1 -1
  26. package/dist/esm/plugins/table/commands/misc.js +4 -2
  27. package/dist/esm/plugins/table/create-plugin-config.js +0 -1
  28. package/dist/esm/plugins/table/event-handlers.js +6 -7
  29. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-resizing.js +2 -2
  30. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/dom.js +3 -8
  31. package/dist/esm/plugins/table/reducer.js +3 -2
  32. package/dist/esm/plugins/table/types.js +2 -1
  33. package/dist/esm/plugins/table/ui/common-styles.js +8 -1
  34. package/dist/esm/plugins/table/ui/ui-styles.js +5 -5
  35. package/dist/esm/plugins/table/utils/column-controls.js +1 -1
  36. package/dist/esm/plugins/table/utils/decoration.js +16 -5
  37. package/dist/esm/version.json +1 -1
  38. package/dist/types/plugins/table/commands/misc.d.ts +1 -1
  39. package/dist/types/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +1 -1
  40. package/dist/types/plugins/table/types.d.ts +3 -1
  41. package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
  42. package/package.json +2 -2
  43. package/src/__tests__/unit/event-handlers.ts +1 -1
  44. package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +5 -4
  45. package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +8 -0
  46. package/src/__tests__/visual-regression/__fixtures__/sticky-header-with-horizontal-scroll.json +5228 -0
  47. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-1-snap.png +3 -0
  48. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-2-snap.png +3 -0
  49. package/src/__tests__/visual-regression/cell-options-menu.ts +110 -99
  50. package/src/__tests__/visual-regression/index.ts +56 -44
  51. package/src/__tests__/visual-regression/sticky-header.ts +55 -0
  52. package/src/plugins/table/commands/misc.ts +10 -2
  53. package/src/plugins/table/create-plugin-config.ts +0 -1
  54. package/src/plugins/table/event-handlers.ts +9 -7
  55. package/src/plugins/table/pm-plugins/decorations/utils/column-resizing.ts +4 -2
  56. package/src/plugins/table/pm-plugins/table-resizing/utils/dom.ts +5 -11
  57. package/src/plugins/table/reducer.ts +3 -1
  58. package/src/plugins/table/types.ts +7 -2
  59. package/src/plugins/table/ui/common-styles.ts +16 -20
  60. package/src/plugins/table/ui/ui-styles.ts +66 -25
  61. package/src/plugins/table/utils/column-controls.ts +1 -1
  62. package/src/plugins/table/utils/decoration.ts +17 -4
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c5e3b7ade5e92b861452ef14e9774592b6252c91a89e955a33e56e3678cf54c
3
+ size 20560
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f1a5a555cab8c01960d1dd4009d44eb51abf0fbd27674404e0bc8ddc9152c345
3
+ size 19785
@@ -1,99 +1,110 @@
1
- export {};
2
-
3
- // import {
4
- // PuppeteerPage,
5
- // waitForNoTooltip,
6
- // } from '@atlaskit/visual-regression/helper';
7
- // import { insertTable } from '../../../../__tests__/__helpers/page-objects/_table';
8
-
9
- // import {
10
- // snapshot,
11
- // initFullPageEditorWithAdf,
12
- // } from '../../../../__tests__/visual-regression/_utils';
13
-
14
- it.skip('TODO: restore vr `packages/editor/editor-plugin-table/src/plugins/table/__tests__/visual-regression/cell-options-menu.ts`', () => {});
15
-
16
- // const firstCellSelector = 'table tbody th p';
17
- // const cellOptionsSelector = '[aria-label="Cell options"]';
18
- // const deleteColumnCellOptionSelector = '[aria-label="Delete column"]';
19
- // const deleteRowCellOptionSelector = '[aria-label="Delete row"]';
20
-
21
- // const emptyDocAdf = {
22
- // version: 1,
23
- // type: 'doc',
24
- // content: [],
25
- // };
26
-
27
- // describe('Table cell options menu', () => {
28
- // let page: PuppeteerPage;
29
-
30
- // beforeEach(async () => {
31
- // page = global.page;
32
- // await initFullPageEditorWithAdf(page, emptyDocAdf);
33
- // await insertTable(page);
34
- // page.waitForSelector(firstCellSelector);
35
-
36
- // // move the focus to the first table cell
37
- // await page.type(firstCellSelector, 'focus table cell');
38
- // });
39
-
40
- // describe('delete column menu item', () => {
41
- // it('visual hints should be added to the table column on hover', async () => {
42
- // // open the table cell options menu
43
- // await page.waitForSelector(cellOptionsSelector);
44
- // await page.click(cellOptionsSelector);
45
-
46
- // // hover over the table cell options Delete column entry
47
- // await page.waitForSelector(deleteColumnCellOptionSelector);
48
- // await page.hover(deleteColumnCellOptionSelector);
49
-
50
- // await waitForNoTooltip(page);
51
-
52
- // await snapshot(page);
53
- // });
54
-
55
- // it('should remove the table column on click', async () => {
56
- // // open the table cell options menu
57
- // await page.waitForSelector(cellOptionsSelector);
58
- // await page.click(cellOptionsSelector);
59
-
60
- // // click the table cell options Delete column entry
61
- // await page.waitForSelector(deleteColumnCellOptionSelector);
62
- // await page.click(deleteColumnCellOptionSelector);
63
-
64
- // await waitForNoTooltip(page);
65
-
66
- // await snapshot(page);
67
- // });
68
- // });
69
-
70
- // describe('delete row menu item', () => {
71
- // it('visual hints should be added to the table row on hover', async () => {
72
- // // open the table cell options menu
73
- // await page.waitForSelector(cellOptionsSelector);
74
- // await page.click(cellOptionsSelector);
75
-
76
- // // hover over the table cell options Delete row entry
77
- // await page.waitForSelector(deleteRowCellOptionSelector);
78
- // await page.hover(deleteRowCellOptionSelector);
79
-
80
- // await waitForNoTooltip(page);
81
-
82
- // await snapshot(page);
83
- // });
84
-
85
- // it('should remove the table row on click', async () => {
86
- // // open the table cell options menu
87
- // await page.waitForSelector(cellOptionsSelector);
88
- // await page.click(cellOptionsSelector);
89
-
90
- // // click the table cell options Delete row entry
91
- // await page.waitForSelector(deleteColumnCellOptionSelector);
92
- // await page.click(deleteRowCellOptionSelector);
93
-
94
- // await waitForNoTooltip(page);
95
-
96
- // await snapshot(page);
97
- // });
98
- // });
99
- // });
1
+ import {
2
+ PuppeteerPage,
3
+ waitForNoTooltip,
4
+ } from '@atlaskit/visual-regression/helper';
5
+ import { insertTable } from '@atlaskit/editor-test-helpers/page-objects/table';
6
+ import {
7
+ snapshot,
8
+ initFullPageEditorWithAdf,
9
+ } from '@atlaskit/editor-test-helpers/vr-utils/base-utils';
10
+
11
+ const firstCellSelector = 'table tbody th p';
12
+ const cellOptionsSelector = '[aria-label="Cell options"]';
13
+ const deleteColumnCellOptionSelector = '[aria-label="Delete column"]';
14
+ const deleteRowCellOptionSelector = '[aria-label="Delete row"]';
15
+
16
+ const emptyDocAdf = {
17
+ version: 1,
18
+ type: 'doc',
19
+ content: [],
20
+ };
21
+
22
+ describe('Table cell options menu', () => {
23
+ let page: PuppeteerPage;
24
+
25
+ beforeEach(async () => {
26
+ page = global.page;
27
+ await initFullPageEditorWithAdf(
28
+ page,
29
+ emptyDocAdf,
30
+ undefined,
31
+ undefined,
32
+ {},
33
+ undefined,
34
+ undefined,
35
+ true,
36
+ false,
37
+ undefined,
38
+ {
39
+ group: 'editor',
40
+ packageName: 'editor-plugin-table',
41
+ exampleName: 'testing',
42
+ },
43
+ );
44
+ await insertTable(page);
45
+ page.waitForSelector(firstCellSelector);
46
+
47
+ // move the focus to the first table cell
48
+ await page.type(firstCellSelector, 'focus table cell');
49
+ });
50
+
51
+ describe('delete column menu item', () => {
52
+ it('visual hints should be added to the table column on hover', async () => {
53
+ // open the table cell options menu
54
+ await page.waitForSelector(cellOptionsSelector);
55
+ await page.click(cellOptionsSelector);
56
+
57
+ // hover over the table cell options Delete column entry
58
+ await page.waitForSelector(deleteColumnCellOptionSelector);
59
+ await page.hover(deleteColumnCellOptionSelector);
60
+
61
+ await waitForNoTooltip(page);
62
+
63
+ await snapshot(page);
64
+ });
65
+
66
+ it('should remove the table column on click', async () => {
67
+ // open the table cell options menu
68
+ await page.waitForSelector(cellOptionsSelector);
69
+ await page.click(cellOptionsSelector);
70
+
71
+ // click the table cell options Delete column entry
72
+ await page.waitForSelector(deleteColumnCellOptionSelector);
73
+ await page.click(deleteColumnCellOptionSelector);
74
+
75
+ await waitForNoTooltip(page);
76
+
77
+ await snapshot(page);
78
+ });
79
+ });
80
+
81
+ describe('delete row menu item', () => {
82
+ it('visual hints should be added to the table row on hover', async () => {
83
+ // open the table cell options menu
84
+ await page.waitForSelector(cellOptionsSelector);
85
+ await page.click(cellOptionsSelector);
86
+
87
+ // hover over the table cell options Delete row entry
88
+ await page.waitForSelector(deleteRowCellOptionSelector);
89
+ await page.hover(deleteRowCellOptionSelector);
90
+
91
+ await waitForNoTooltip(page);
92
+
93
+ await snapshot(page);
94
+ });
95
+
96
+ it('should remove the table row on click', async () => {
97
+ // open the table cell options menu
98
+ await page.waitForSelector(cellOptionsSelector);
99
+ await page.click(cellOptionsSelector);
100
+
101
+ // click the table cell options Delete row entry
102
+ await page.waitForSelector(deleteColumnCellOptionSelector);
103
+ await page.click(deleteRowCellOptionSelector);
104
+
105
+ await waitForNoTooltip(page);
106
+
107
+ await snapshot(page);
108
+ });
109
+ });
110
+ });
@@ -1,44 +1,56 @@
1
- export {};
2
-
3
- // import { PuppeteerPage } from '@atlaskit/visual-regression/helper';
4
- // import { Device } from '@atlaskit/editor-test-helpers/vr-utils/device-viewport';
5
- // import {
6
- // snapshot,
7
- // initFullPageEditorWithAdf,
8
- // } from '../../../../__tests__/visual-regression/_utils';
9
- // import tableWith100ListItemsADF from './__fixtures__/table-with-100-numbered-list-items.json';
10
- // import {
11
- // scrollToBottom,
12
- // scrollToElement,
13
- // } from '../../../../__tests__/__helpers/page-objects/_editor';
14
-
15
- // async function initEditor(page: PuppeteerPage, adf: Object) {
16
- // await initFullPageEditorWithAdf(page, adf, Device.LaptopMDPI, undefined, {});
17
- // }
18
-
19
- it.skip('TODO: restore vr `packages/editor/editor-plugin-table/src/plugins/table/__tests__/visual-regression/index.ts`', () => {});
20
-
21
- // describe('Snapshot Test: Table', () => {
22
- // let page: PuppeteerPage;
23
-
24
- // beforeEach(() => {
25
- // page = global.page;
26
- // });
27
-
28
- // describe('numbered list', () => {
29
- // it('should not overflow table cell, when there are more than 100 ordered list items', async () => {
30
- // await initEditor(page, tableWith100ListItemsADF);
31
-
32
- // // initial elements
33
- // await snapshot(page);
34
-
35
- // // 100th elements
36
- // await scrollToElement(page, 'ol > li:nth-of-type(120)');
37
- // await snapshot(page);
38
-
39
- // // 1000th elements
40
- // await scrollToBottom(page);
41
- // await snapshot(page);
42
- // });
43
- // });
44
- // });
1
+ import { PuppeteerPage } from '@atlaskit/visual-regression/helper';
2
+ import { Device } from '@atlaskit/editor-test-helpers/vr-utils/device-viewport';
3
+ import {
4
+ snapshot,
5
+ initFullPageEditorWithAdf,
6
+ } from '@atlaskit/editor-test-helpers/vr-utils/base-utils';
7
+ import tableWith100ListItemsADF from './__fixtures__/table-with-100-numbered-list-items.json';
8
+ import {
9
+ scrollToBottom,
10
+ scrollToElement,
11
+ } from '@atlaskit/editor-test-helpers/page-objects/editor';
12
+
13
+ async function initEditor(page: PuppeteerPage, adf: Object) {
14
+ await initFullPageEditorWithAdf(
15
+ page,
16
+ adf,
17
+ Device.LaptopMDPI,
18
+ undefined,
19
+ {},
20
+ undefined,
21
+ undefined,
22
+ true,
23
+ false,
24
+ undefined,
25
+ {
26
+ group: 'editor',
27
+ packageName: 'editor-plugin-table',
28
+ exampleName: 'testing',
29
+ },
30
+ );
31
+ }
32
+
33
+ describe('Snapshot Test: Table', () => {
34
+ let page: PuppeteerPage;
35
+
36
+ beforeAll(async () => {
37
+ page = global.page;
38
+ });
39
+
40
+ describe('numbered list', () => {
41
+ it('should not overflow table cell, when there are more than 100 ordered list items', async () => {
42
+ await initEditor(page, tableWith100ListItemsADF);
43
+
44
+ // initial elements
45
+ await snapshot(page);
46
+
47
+ // 100th elements
48
+ await scrollToElement(page, 'ol > li:nth-of-type(120)');
49
+ await snapshot(page);
50
+
51
+ // 1000th elements
52
+ await scrollToBottom(page);
53
+ await snapshot(page);
54
+ });
55
+ });
56
+ });
@@ -0,0 +1,55 @@
1
+ import { PuppeteerPage } from '@atlaskit/visual-regression/helper';
2
+ import {
3
+ snapshot,
4
+ initEditorWithAdf,
5
+ Appearance,
6
+ } from '@atlaskit/editor-test-helpers/vr-utils/base-utils';
7
+ import stickyHeaderWithHorizontalScroll from './__fixtures__/sticky-header-with-horizontal-scroll.json';
8
+ import { scrollToElement } from '@atlaskit/editor-test-helpers/page-objects/editor';
9
+ import { clickFirstCell } from '@atlaskit/editor-test-helpers/page-objects/table';
10
+
11
+ const initEditor = async (page: PuppeteerPage, adf: any) => {
12
+ await initEditorWithAdf(
13
+ page,
14
+ {
15
+ appearance: Appearance.fullPage,
16
+ adf,
17
+ viewport: { width: 1280, height: 868 },
18
+ editorProps: {
19
+ allowTables: {
20
+ stickyHeaders: true,
21
+ allowColumnResizing: true,
22
+ },
23
+ },
24
+ },
25
+ {
26
+ group: 'editor',
27
+ packageName: 'editor-plugin-table',
28
+ exampleName: 'testing',
29
+ },
30
+ );
31
+ };
32
+
33
+ describe('Snapshot Test: Table', () => {
34
+ let page: PuppeteerPage;
35
+
36
+ beforeEach(async () => {
37
+ page = global.page;
38
+ });
39
+
40
+ describe('sticky header', () => {
41
+ it('should align with table cell when active', async () => {
42
+ await initEditor(page, stickyHeaderWithHorizontalScroll);
43
+
44
+ await clickFirstCell(page, true);
45
+
46
+ // scroll to bottom center to see scroll shadows
47
+ await scrollToElement(page, 'ol > li');
48
+ await snapshot(page);
49
+
50
+ // scroll to bottom right
51
+ await scrollToElement(page, 'ul > li');
52
+ await snapshot(page);
53
+ });
54
+ });
55
+ });
@@ -90,6 +90,7 @@ export const setTableRef = (ref?: HTMLTableElement) =>
90
90
  isHeaderRowEnabled: checkIfHeaderRowEnabled(state.selection),
91
91
  isHeaderColumnEnabled: checkIfHeaderColumnEnabled(state.selection),
92
92
  decorationSet,
93
+ resizeHandleRowIndex: undefined,
93
94
  resizeHandleColumnIndex: undefined,
94
95
  },
95
96
  };
@@ -434,7 +435,10 @@ export const hideInsertColumnOrRowButton = () =>
434
435
  (tr) => tr.setMeta('addToHistory', false),
435
436
  );
436
437
 
437
- export const addResizeHandleDecorations = (columnIndex: number) =>
438
+ export const addResizeHandleDecorations = (
439
+ rowIndex: number,
440
+ columnIndex: number,
441
+ ) =>
438
442
  createCommand(
439
443
  (state) => {
440
444
  const tableNode = findTable(state.selection);
@@ -449,10 +453,14 @@ export const addResizeHandleDecorations = (columnIndex: number) =>
449
453
  return {
450
454
  type: 'ADD_RESIZE_HANDLE_DECORATIONS',
451
455
  data: {
452
- decorationSet: buildColumnResizingDecorations(columnIndex)({
456
+ decorationSet: buildColumnResizingDecorations(
457
+ rowIndex,
458
+ columnIndex,
459
+ )({
453
460
  tr: state.tr,
454
461
  decorationSet: getDecorations(state),
455
462
  }),
463
+ resizeHandleRowIndex: rowIndex,
456
464
  resizeHandleColumnIndex: columnIndex,
457
465
  },
458
466
  };
@@ -9,7 +9,6 @@ export const pluginConfig = (config: PluginConfig = {}) => {
9
9
  allowHeaderRow: true,
10
10
  allowMergeCells: true,
11
11
  allowNumberColumn: true,
12
- stickToolbarToBottom: true,
13
12
  permittedLayouts: 'all' as PermittedLayoutsDescriptor,
14
13
  allowControls: true,
15
14
  ...config,
@@ -55,7 +55,6 @@ import {
55
55
  getMousePositionHorizontalRelativeByElement,
56
56
  getMousePositionVerticalRelativeByElement,
57
57
  getSelectedCellInfo,
58
- hasResizeHandler,
59
58
  isCell,
60
59
  isColumnControlsDecorations,
61
60
  isCornerButton,
@@ -358,7 +357,8 @@ export const handleMouseMove =
358
357
 
359
358
  if (positionColumn !== null) {
360
359
  const { state, dispatch } = view;
361
- const { resizeHandleColumnIndex } = getPluginState(state);
360
+ const { resizeHandleColumnIndex, resizeHandleRowIndex } =
361
+ getPluginState(state);
362
362
  const tableCell = closestElement(
363
363
  element,
364
364
  'td, th',
@@ -372,14 +372,16 @@ export const handleMouseMove =
372
372
  const columnEndIndexTarget =
373
373
  positionColumn === 'left' ? rect.left : rect.right;
374
374
 
375
+ const rowIndexTarget = rect.top;
376
+
375
377
  if (
376
378
  columnEndIndexTarget !== resizeHandleColumnIndex ||
377
- !hasResizeHandler({ target: element, columnEndIndexTarget })
379
+ rowIndexTarget !== resizeHandleRowIndex
378
380
  ) {
379
- return addResizeHandleDecorations(columnEndIndexTarget)(
380
- state,
381
- dispatch,
382
- );
381
+ return addResizeHandleDecorations(
382
+ rowIndexTarget,
383
+ columnEndIndexTarget,
384
+ )(state, dispatch);
383
385
  }
384
386
  }
385
387
  }
@@ -32,12 +32,14 @@ const updateLastCellElement =
32
32
  );
33
33
 
34
34
  export const buildColumnResizingDecorations =
35
- (columnEndIndex: number): DecorationTransformer =>
35
+ (rowEndIndex: number, columnEndIndex: number): DecorationTransformer =>
36
36
  ({ tr, decorationSet }): DecorationSet => {
37
37
  const [columnResizesDecorations, lastCellElementsDecorations] =
38
38
  columnEndIndex < 0
39
39
  ? emptyDecorations
40
- : createResizeHandleDecoration(tr, { right: columnEndIndex });
40
+ : createResizeHandleDecoration(tr, rowEndIndex, {
41
+ right: columnEndIndex,
42
+ });
41
43
 
42
44
  return composeDecorations([
43
45
  updateColumnResizeHandle(columnResizesDecorations),
@@ -4,10 +4,8 @@ import { EditorView } from 'prosemirror-view';
4
4
  import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
5
5
  import {
6
6
  tableCellBorderWidth,
7
- tableCellPadding,
8
7
  tableMarginTop,
9
8
  } from '@atlaskit/editor-common/styles';
10
- import { browser } from '@atlaskit/editor-common/utils';
11
9
 
12
10
  import {
13
11
  closestElement,
@@ -114,15 +112,11 @@ export const updateStickyMargins = (table: HTMLElement) => {
114
112
 
115
113
  const paddingTop =
116
114
  parsePx(window.getComputedStyle(row).paddingTop || '') || 0;
117
- const firstRowHeight = row.clientHeight - paddingTop - 2; /* border */
118
-
119
- // firefox handles margin and padding differently
120
- // when applied with tables
121
- table.style.marginTop = `${
122
- browser.gecko
123
- ? firstRowHeight + tableCellPadding - tableCellBorderWidth
124
- : tableMarginTop + firstRowHeight
125
- }px`;
115
+
116
+ const firstRowHeight =
117
+ row.getBoundingClientRect().height - paddingTop - tableCellBorderWidth;
118
+
119
+ table.style.marginTop = `${tableMarginTop + firstRowHeight}px`;
126
120
  };
127
121
 
128
122
  export const applyColWidthsToStickyRow = (
@@ -80,12 +80,14 @@ export default (
80
80
  ...pluginState,
81
81
  ...action.data,
82
82
  resizeHandleColumnIndex: undefined,
83
+ resizeHandleRowIndex: undefined,
83
84
  };
84
85
 
85
86
  case 'ADD_RESIZE_HANDLE_DECORATIONS':
86
87
  if (
87
88
  action.data.resizeHandleColumnIndex ===
88
- pluginState.resizeHandleColumnIndex
89
+ pluginState.resizeHandleColumnIndex &&
90
+ action.data.resizeHandleRowIndex === pluginState.resizeHandleRowIndex
89
91
  ) {
90
92
  return pluginState;
91
93
  }
@@ -46,7 +46,6 @@ export interface PluginConfig {
46
46
  allowAddColumnWithCustomStep?: boolean;
47
47
  allowCollapse?: boolean;
48
48
  isHeaderRowRequired?: boolean;
49
- stickToolbarToBottom?: boolean;
50
49
  permittedLayouts?: PermittedLayoutsDescriptor;
51
50
  allowControls?: boolean;
52
51
  stickyHeaders?: boolean;
@@ -116,6 +115,7 @@ export interface TablePluginState {
116
115
  isFullWidthModeEnabled?: boolean;
117
116
  layout?: TableLayout;
118
117
  ordering?: TableColumnOrdering;
118
+ resizeHandleRowIndex?: number;
119
119
  resizeHandleColumnIndex?: number;
120
120
  tableCellOptimization?: boolean;
121
121
  // for table wrap/collapse
@@ -172,7 +172,11 @@ export type TablePluginAction =
172
172
  }
173
173
  | {
174
174
  type: 'ADD_RESIZE_HANDLE_DECORATIONS';
175
- data: { decorationSet: DecorationSet; resizeHandleColumnIndex: number };
175
+ data: {
176
+ decorationSet: DecorationSet;
177
+ resizeHandleRowIndex: number;
178
+ resizeHandleColumnIndex: number;
179
+ };
176
180
  }
177
181
  | { type: 'CLEAR_HOVER_SELECTION'; data: { decorationSet: DecorationSet } }
178
182
  | { type: 'SHOW_RESIZE_HANDLE_LINE'; data: { decorationSet: DecorationSet } }
@@ -302,6 +306,7 @@ export const TableCssClassName = {
302
306
  LAST_ITEM_IN_CELL: `${tablePrefixSelector}-last-item-in-cell`,
303
307
 
304
308
  WITH_RESIZE_LINE: `${tablePrefixSelector}-column-resize-line`,
309
+ WITH_RESIZE_LINE_LAST_COLUMN: `${tablePrefixSelector}-column-resize-line-last-column`,
305
310
  };
306
311
 
307
312
  export interface ToolbarMenuConfig {
@@ -67,6 +67,13 @@ import { token } from '@atlaskit/tokens';
67
67
 
68
68
  const cornerControlHeight = tableToolbarSize + 1;
69
69
 
70
+ /*
71
+ compensating for half of the insert column button
72
+ that is aligned to the right edge initially on hover of the top right column control when table overflown,
73
+ its center should be aligned with the edge
74
+ */
75
+ const insertColumnButtonOffset = tableInsertColumnButtonSize / 2;
76
+
70
77
  const rangeSelectionStyles = `
71
78
  .${ClassName.NODEVIEW_WRAPPER}.${akEditorSelectedNodeClassName} table tbody tr {
72
79
  th,td {
@@ -280,7 +287,7 @@ export const tableStyles = (props: ThemeProps) => css`
280
287
  /* add a little bit so the scroll lines up with the table */
281
288
  .${ClassName.TABLE_STICKY} tr.sticky::after {
282
289
  content: ' ';
283
- width: 1px;
290
+ width: ${insertColumnButtonOffset + 1}px;
284
291
  }
285
292
 
286
293
  /* To fix jumpiness caused in Chrome Browsers for sticky headers */
@@ -394,18 +401,6 @@ export const tableStyles = (props: ThemeProps) => css`
394
401
  `,
395
402
  )};
396
403
  }
397
-
398
- .${ClassName.CORNER_CONTROLS_INSERT_COLUMN_MARKER} {
399
- position: relative;
400
-
401
- ${InsertMarker(
402
- props,
403
- `
404
- right: -1px;
405
- top: -12px;
406
- `,
407
- )};
408
- }
409
404
  }
410
405
 
411
406
  .${ClassName.CORNER_CONTROLS}.sticky {
@@ -592,6 +587,12 @@ export const tableStyles = (props: ThemeProps) => css`
592
587
  /* Table */
593
588
  .${ClassName.TABLE_NODE_WRAPPER} > table {
594
589
  table-layout: fixed;
590
+ white-space: normal;
591
+ border-top: none;
592
+
593
+ > tbody > tr {
594
+ white-space: pre-wrap;
595
+ }
595
596
 
596
597
  .${ClassName.COLUMN_CONTROLS_DECORATIONS} + * {
597
598
  margin-top: 0;
@@ -676,13 +677,8 @@ export const tableStyles = (props: ThemeProps) => css`
676
677
  left: -${tableToolbarSize}px;
677
678
  }
678
679
  .${ClassName.TABLE_NODE_WRAPPER} {
679
- /*
680
- compensating for half of the insert column button
681
- that is aligned to the right edge initially on hover of the top right column control when table overflown,
682
- its center should be aligned with the edge
683
- */
684
- padding-right: ${tableInsertColumnButtonSize / 2}px;
685
- margin-right: -${tableInsertColumnButtonSize / 2}px;
680
+ padding-right: ${insertColumnButtonOffset}px;
681
+ margin-right: -${insertColumnButtonOffset}px;
686
682
  padding-bottom: ${tableScrollbarOffset}px;
687
683
  margin-bottom: -${tableScrollbarOffset}px;
688
684
  /* fixes gap cursor height */