@atlaskit/editor-plugin-table 5.3.7 → 5.3.9

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 (97) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +6 -5
  3. package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +3 -2
  4. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -2
  5. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +1 -1
  6. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +3 -2
  7. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/utils/monitor.js +6 -1
  8. package/dist/cjs/plugins/table/types.js +1 -1
  9. package/dist/cjs/plugins/table/ui/DragHandle/index.js +6 -4
  10. package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +62 -0
  11. package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +70 -0
  12. package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +12 -77
  13. package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/index.js +58 -16
  14. package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
  15. package/dist/cjs/plugins/table/ui/icons/index.js +19 -0
  16. package/dist/cjs/plugins/table/ui/ui-styles.js +19 -15
  17. package/dist/cjs/plugins/table/utils/decoration.js +3 -24
  18. package/dist/cjs/plugins/table/utils/dom.js +1 -4
  19. package/dist/cjs/plugins/table/utils/index.js +0 -6
  20. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +6 -5
  21. package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +3 -2
  22. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -2
  23. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +1 -1
  24. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +3 -2
  25. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/utils/monitor.js +6 -1
  26. package/dist/es2019/plugins/table/types.js +1 -1
  27. package/dist/es2019/plugins/table/ui/DragHandle/index.js +5 -3
  28. package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +52 -0
  29. package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +62 -0
  30. package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +8 -74
  31. package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/index.js +58 -15
  32. package/dist/es2019/plugins/table/ui/common-styles.js +2 -5
  33. package/dist/es2019/plugins/table/ui/icons/index.js +2 -0
  34. package/dist/es2019/plugins/table/ui/ui-styles.js +28 -30
  35. package/dist/es2019/plugins/table/utils/decoration.js +3 -24
  36. package/dist/es2019/plugins/table/utils/dom.js +0 -1
  37. package/dist/es2019/plugins/table/utils/index.js +1 -1
  38. package/dist/esm/plugins/table/nodeviews/TableComponent.js +6 -5
  39. package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +3 -2
  40. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -2
  41. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +1 -1
  42. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +3 -2
  43. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/utils/monitor.js +6 -1
  44. package/dist/esm/plugins/table/types.js +1 -1
  45. package/dist/esm/plugins/table/ui/DragHandle/index.js +5 -3
  46. package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +55 -0
  47. package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +61 -0
  48. package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +9 -72
  49. package/dist/esm/plugins/table/ui/TableFloatingColumnControls/index.js +58 -16
  50. package/dist/esm/plugins/table/ui/common-styles.js +2 -2
  51. package/dist/esm/plugins/table/ui/icons/index.js +2 -0
  52. package/dist/esm/plugins/table/ui/ui-styles.js +18 -14
  53. package/dist/esm/plugins/table/utils/decoration.js +3 -24
  54. package/dist/esm/plugins/table/utils/dom.js +0 -3
  55. package/dist/esm/plugins/table/utils/index.js +1 -1
  56. package/dist/types/plugins/table/types.d.ts +2 -1
  57. package/dist/types/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +16 -0
  58. package/dist/types/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +9 -0
  59. package/dist/types/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +2 -3
  60. package/dist/types/plugins/table/ui/TableFloatingColumnControls/index.d.ts +5 -0
  61. package/dist/types/plugins/table/ui/icons/index.d.ts +2 -0
  62. package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -0
  63. package/dist/types/plugins/table/utils/decoration.d.ts +2 -2
  64. package/dist/types/plugins/table/utils/dom.d.ts +0 -1
  65. package/dist/types/plugins/table/utils/index.d.ts +1 -1
  66. package/dist/types-ts4.5/plugins/table/types.d.ts +2 -1
  67. package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +16 -0
  68. package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +9 -0
  69. package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +2 -3
  70. package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/index.d.ts +5 -0
  71. package/dist/types-ts4.5/plugins/table/ui/icons/index.d.ts +2 -0
  72. package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +1 -0
  73. package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +2 -2
  74. package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +0 -1
  75. package/dist/types-ts4.5/plugins/table/utils/index.d.ts +1 -1
  76. package/package.json +2 -1
  77. package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +2 -2
  78. package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +84 -34
  79. package/src/__tests__/unit/ui/TableFloatingColumnControls.tsx +61 -12
  80. package/src/plugins/table/nodeviews/TableComponent.tsx +16 -15
  81. package/src/plugins/table/pm-plugins/decorations/plugin.ts +3 -2
  82. package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +1 -1
  83. package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +1 -4
  84. package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +7 -2
  85. package/src/plugins/table/pm-plugins/drag-and-drop/utils/monitor.ts +5 -0
  86. package/src/plugins/table/types.ts +2 -1
  87. package/src/plugins/table/ui/DragHandle/index.tsx +3 -1
  88. package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +92 -0
  89. package/src/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +74 -0
  90. package/src/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +12 -80
  91. package/src/plugins/table/ui/TableFloatingColumnControls/index.tsx +69 -17
  92. package/src/plugins/table/ui/common-styles.ts +2 -4
  93. package/src/plugins/table/ui/icons/index.ts +2 -0
  94. package/src/plugins/table/ui/ui-styles.ts +29 -30
  95. package/src/plugins/table/utils/decoration.ts +3 -45
  96. package/src/plugins/table/utils/dom.ts +0 -4
  97. package/src/plugins/table/utils/index.ts +0 -1
@@ -1,37 +1,26 @@
1
- import React, { useEffect, useMemo, useRef } from 'react';
1
+ import React from 'react';
2
2
 
3
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
5
- import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
6
-
7
- import type { DraggableSourceData } from '../../../types';
8
3
  import { TableCssClassName as ClassName } from '../../../types';
9
- import { getColumnsWidths, getRowHeights } from '../../../utils';
4
+
5
+ import { ColumnDropTarget } from './ColumnDropTarget';
10
6
 
11
7
  export interface Props {
12
- editorView: EditorView;
13
8
  tableRef: HTMLTableElement;
14
9
  stickyTop?: number;
15
10
  tableHeight?: number;
16
11
  localId?: string;
12
+ rowHeights?: number[];
13
+ colWidths?: (number | undefined)[];
17
14
  }
18
15
 
19
16
  export const ColumnDropTargets: React.FC<Props> = ({
20
- editorView,
21
17
  tableRef,
22
18
  tableHeight,
23
19
  stickyTop,
24
20
  localId,
21
+ rowHeights,
22
+ colWidths,
25
23
  }) => {
26
- const colWidths = getColumnsWidths(editorView);
27
- const rowHeights = useMemo(() => {
28
- // NOTE: we don't care so much as to what tableHeight is, we only care that it changed and is a sane value.
29
- if (tableRef && !!tableHeight) {
30
- return getRowHeights(tableRef);
31
- }
32
- return [0];
33
- }, [tableRef, tableHeight]);
34
-
35
24
  if (!tableRef) {
36
25
  return null;
37
26
  }
@@ -45,12 +34,15 @@ export const ColumnDropTargets: React.FC<Props> = ({
45
34
  hasHeaderRow && stickyTop !== undefined ? rowHeights?.[0] ?? 0 : 0;
46
35
 
47
36
  return (
48
- <div className={ClassName.COLUMN_DROP_TARGET_CONTROLS}>
37
+ <div
38
+ className={ClassName.COLUMN_DROP_TARGET_CONTROLS}
39
+ contentEditable={false}
40
+ >
49
41
  <div
50
42
  className={ClassName.COLUMN_CONTROLS_INNER}
51
43
  data-testid="table-floating-column-controls-drop-targets"
52
44
  >
53
- {colWidths.map((width, index) => {
45
+ {colWidths?.map((width, index) => {
54
46
  return (
55
47
  <ColumnDropTarget
56
48
  key={index}
@@ -66,63 +58,3 @@ export const ColumnDropTargets: React.FC<Props> = ({
66
58
  </div>
67
59
  );
68
60
  };
69
-
70
- export default ColumnDropTargets;
71
-
72
- const ColumnDropTarget: React.FC<{
73
- index: number;
74
- localId?: string;
75
- width?: number;
76
- height?: number;
77
- marginTop?: number;
78
- }> = ({ index, localId, width, height, marginTop }) => {
79
- const dropTargetRef = useRef<HTMLDivElement | null>(null);
80
-
81
- useEffect(() => {
82
- if (!dropTargetRef.current) {
83
- return;
84
- }
85
-
86
- return dropTargetForElements({
87
- element: dropTargetRef.current,
88
- canDrop({ source }) {
89
- const data = source.data as DraggableSourceData;
90
- return (
91
- // Only draggables of row type can be dropped on this target
92
- data.type === 'table-column' &&
93
- // Only draggables which came from the same table can be dropped on this target
94
- data.localId === localId &&
95
- // Only draggables which DO NOT include this drop targets index can be dropped
96
- !!data.indexes?.length &&
97
- data.indexes?.indexOf(index) === -1
98
- );
99
- },
100
- getData({ input, element }) {
101
- const data = {
102
- localId,
103
- type: 'table-column',
104
- targetIndex: index,
105
- };
106
- return attachClosestEdge(data, {
107
- input,
108
- element,
109
- allowedEdges: ['left', 'right'],
110
- });
111
- },
112
- });
113
- }, [index, localId]);
114
-
115
- return (
116
- <div
117
- ref={dropTargetRef}
118
- style={{
119
- width: width && `${width - 1}px`,
120
- height: height && `${height}px`,
121
- marginTop: marginTop && `${marginTop}px`,
122
- }}
123
- data-drop-target-index={index}
124
- data-drop-target-localid={localId}
125
- data-testid="table-floating-column-controls-drop-target"
126
- ></div>
127
- );
128
- };
@@ -1,13 +1,20 @@
1
1
  import React, { useEffect, useMemo, useState } from 'react';
2
2
 
3
+ import ReactDOM from 'react-dom';
4
+
3
5
  import type { TableColumnOrdering } from '@atlaskit/custom-steps';
4
6
  import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
7
+ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
5
8
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
6
9
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
- import { findTable } from '@atlaskit/editor-tables';
10
+ import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
8
11
 
9
12
  import type { RowStickyState } from '../../pm-plugins/sticky-headers';
13
+ import type { CellHoverCoordinates, DraggableSourceData } from '../../types';
14
+ import { TableCssClassName as ClassName } from '../../types';
15
+ import { getColumnsWidths, getRowHeights } from '../../utils';
10
16
 
17
+ import { ColumnControls } from './ColumnControls';
11
18
  import { ColumnDropTargets } from './ColumnDropTargets';
12
19
 
13
20
  export interface Props {
@@ -15,10 +22,13 @@ export interface Props {
15
22
  getEditorFeatureFlags: GetEditorFeatureFlags;
16
23
  selection?: Selection;
17
24
  tableRef?: HTMLTableElement;
25
+ getNode: () => PmNode;
18
26
  tableActive?: boolean;
19
27
  hasHeaderRow?: boolean;
20
28
  headerRowHeight?: number;
21
29
  hoveredRows?: number[];
30
+ hoveredCell?: CellHoverCoordinates;
31
+ isResizing?: boolean;
22
32
  ordering?: TableColumnOrdering;
23
33
  stickyHeader?: RowStickyState;
24
34
  }
@@ -26,8 +36,11 @@ export interface Props {
26
36
  export const TableFloatingColumnControls: React.FC<Props> = ({
27
37
  editorView,
28
38
  tableRef,
39
+ getNode,
29
40
  tableActive,
30
41
  hasHeaderRow,
42
+ hoveredCell,
43
+ isResizing,
31
44
  stickyHeader,
32
45
  selection,
33
46
  }) => {
@@ -35,6 +48,10 @@ export const TableFloatingColumnControls: React.FC<Props> = ({
35
48
  { width: 0, height: 0 },
36
49
  );
37
50
 
51
+ const [hasDropTargets, setHasDropTargets] = useState(false);
52
+ const node = getNode();
53
+ const currentNodeLocalId = node?.attrs.localId;
54
+
38
55
  useEffect(() => {
39
56
  if (tableRef && window?.ResizeObserver) {
40
57
  const resizeObserver = new ResizeObserver((entries) => {
@@ -58,43 +75,78 @@ export const TableFloatingColumnControls: React.FC<Props> = ({
58
75
  }
59
76
  }, [tableRef]);
60
77
 
61
- const selectedLocalId = useMemo(() => {
62
- if (!selection) {
63
- return undefined;
64
- }
78
+ useEffect(() => {
79
+ return monitorForElements({
80
+ canMonitor({ source }) {
81
+ const { type, localId, indexes } =
82
+ source.data as Partial<DraggableSourceData>;
83
+ return (
84
+ type === 'table-column' &&
85
+ !!indexes?.length &&
86
+ localId === currentNodeLocalId
87
+ );
88
+ },
89
+ onDragStart() {
90
+ setHasDropTargets(true);
91
+ },
92
+ onDrop() {
93
+ setHasDropTargets(false);
94
+ },
95
+ });
96
+ }, [editorView, currentNodeLocalId]);
65
97
 
66
- const tableNode = findTable(selection);
67
- if (!tableNode) {
68
- return undefined;
98
+ const rowHeights = useMemo(() => {
99
+ // NOTE: we don't care so much as to what tableHeight is, we only care that it changed and is a sane value.
100
+ if (tableRef && !!tableRect.height) {
101
+ return getRowHeights(tableRef);
69
102
  }
70
-
71
- return tableNode.node.attrs.localId;
72
- }, [selection]);
103
+ return [0];
104
+ }, [tableRef, tableRect.height]);
73
105
 
74
106
  if (!tableRef) {
75
107
  return null;
76
108
  }
77
109
 
110
+ const colWidths = getColumnsWidths(editorView);
111
+
78
112
  const stickyTop =
79
113
  stickyHeader && stickyHeader.sticky && hasHeaderRow
80
114
  ? stickyHeader.top
81
115
  : undefined;
82
116
 
83
- return (
117
+ const mountTo = (tableRef && tableRef?.parentElement) || document.body;
118
+
119
+ return ReactDOM.createPortal(
84
120
  <div
85
- onMouseDown={(e) => e.preventDefault()}
121
+ className={ClassName.COLUMN_CONTROLS_WRAPPER}
122
+ style={{
123
+ pointerEvents: 'none',
124
+ }}
86
125
  data-testid="table-floating-column-controls-wrapper"
87
126
  >
88
- {tableActive && (
127
+ <ColumnControls
128
+ editorView={editorView}
129
+ hoveredCell={hoveredCell}
130
+ tableRef={tableRef}
131
+ isResizing={isResizing}
132
+ tableActive={tableActive}
133
+ stickyTop={tableActive ? stickyTop : undefined}
134
+ localId={currentNodeLocalId}
135
+ rowHeights={rowHeights}
136
+ colWidths={colWidths}
137
+ />
138
+ {hasDropTargets && (
89
139
  <ColumnDropTargets
90
- editorView={editorView}
91
140
  tableRef={tableRef}
92
141
  stickyTop={tableActive ? stickyTop : undefined}
93
142
  tableHeight={tableRect.height}
94
- localId={selectedLocalId}
143
+ localId={currentNodeLocalId}
144
+ rowHeights={rowHeights}
145
+ colWidths={colWidths}
95
146
  />
96
147
  )}
97
- </div>
148
+ </div>,
149
+ mountTo,
98
150
  );
99
151
  };
100
152
 
@@ -69,6 +69,7 @@ import {
69
69
  insertRowButtonWrapper,
70
70
  OverflowShadow,
71
71
  resizeHandle,
72
+ rowControlsWrapperDotStyle,
72
73
  } from './ui-styles';
73
74
 
74
75
  const cornerControlHeight = tableToolbarSize + 1;
@@ -573,6 +574,7 @@ export const tableStyles = (
573
574
  ${breakoutWidthStyling()}
574
575
 
575
576
  ${columnControlsDecoration(props)};
577
+ ${rowControlsWrapperDotStyle(props)};
576
578
 
577
579
  /* Corner controls */
578
580
  .${ClassName.CORNER_CONTROLS} {
@@ -833,10 +835,6 @@ export const tableStyles = (
833
835
  margin-top: 0;
834
836
  }
835
837
 
836
- .${ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG} + * {
837
- margin-top: 0;
838
- }
839
-
840
838
  /*
841
839
  * Headings have a top margin by default, but we don't want this on the
842
840
  * first heading within table header cells.
@@ -0,0 +1,2 @@
1
+ export { DragHandleIcon } from './DragHandleIcon';
2
+ export { DragInMotionIcon } from './DragInMotionIcon';
@@ -380,27 +380,50 @@ export const floatingColumnControls = (props: ThemeProps) => {
380
380
  .${ClassName.COLUMN_DROP_TARGET_CONTROLS} {
381
381
  box-sizing: border-box;
382
382
  position: absolute;
383
+ top: 0;
383
384
 
384
385
  .${ClassName.COLUMN_CONTROLS_INNER} {
385
386
  display: flex;
386
387
  flex-direction: row;
387
388
  }
388
389
  }
390
+
391
+ .${ClassName.COLUMN_CONTROLS_WITH_DRAG} {
392
+ box-sizing: border-box;
393
+
394
+ .${ClassName.COLUMN_CONTROLS_INNER} {
395
+ display: grid;
396
+ justify-items: center;
397
+ }
398
+ }
389
399
  `;
390
400
  };
391
401
 
392
- export const columnControlsDecoration = (props: ThemeProps) => {
402
+ export const rowControlsWrapperDotStyle = (props: ThemeProps) => {
393
403
  if (getBooleanFF('platform.editor.table.drag-and-drop')) {
394
404
  return css`
395
- .${ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG} {
405
+ div.${ClassName.WITH_CONTROLS}>.${ClassName.ROW_CONTROLS_WRAPPER}::after {
406
+ display: none;
407
+ }
408
+ `;
409
+ } else {
410
+ return css`
411
+ div.${ClassName.WITH_CONTROLS}>.${ClassName.ROW_CONTROLS_WRAPPER}::after {
412
+ content: ' ';
413
+ background-color: ${tableBorderColor(props)};
396
414
  position: absolute;
397
- // kinda a hacky way to center an element with absolute positioning inside a relative element
398
- top: 25%;
399
- left: 50%;
400
- transform: translate(-50%, -100%);
415
+ height: ${lineMarkerSize}px;
416
+ width: ${lineMarkerSize}px;
417
+ border-radius: 50%;
418
+ pointer-events: none;
419
+ top: -${tableToolbarSize + tableCellBorderWidth}px;
420
+ right: -1px;
401
421
  }
402
422
  `;
403
423
  }
424
+ };
425
+
426
+ export const columnControlsDecoration = (props: ThemeProps) => {
404
427
  if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
405
428
  return css`
406
429
  .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
@@ -452,18 +475,6 @@ export const columnControlsDecoration = (props: ThemeProps) => {
452
475
  // floating dot for adding column button - overriding style on last column to avoid scroll
453
476
  ${getFloatingDotOverrides(props)}
454
477
 
455
- div.${ClassName.WITH_CONTROLS}>.${ClassName.ROW_CONTROLS_WRAPPER}::after {
456
- content: ' ';
457
- background-color: ${tableBorderColor(props)};
458
- position: absolute;
459
- height: ${lineMarkerSize}px;
460
- width: ${lineMarkerSize}px;
461
- border-radius: 50%;
462
- pointer-events: none;
463
- top: -${tableToolbarSize + tableCellBorderWidth}px;
464
- right: -1px;
465
- }
466
-
467
478
  .${ClassName.WITH_CONTROLS} .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
468
479
  display: block;
469
480
  }
@@ -572,18 +583,6 @@ export const columnControlsDecoration = (props: ThemeProps) => {
572
583
  // floating dot for adding column button - overriding style on last column to avoid scroll
573
584
  ${getFloatingDotOverrides(props)}
574
585
 
575
- div.${ClassName.WITH_CONTROLS}>.${ClassName.ROW_CONTROLS_WRAPPER}::after {
576
- content: ' ';
577
- background-color: ${tableBorderColor(props)};
578
- position: absolute;
579
- height: ${lineMarkerSize}px;
580
- width: ${lineMarkerSize}px;
581
- border-radius: 50%;
582
- pointer-events: none;
583
- top: -${tableToolbarSize + tableCellBorderWidth}px;
584
- right: -1px;
585
- }
586
-
587
586
  .${ClassName.WITH_CONTROLS} .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
588
587
  display: block;
589
588
  }
@@ -24,14 +24,9 @@ import {
24
24
  } from '@atlaskit/editor-tables/utils';
25
25
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
26
26
 
27
- import type {
28
- Cell,
29
- CellColumnPositioning,
30
- CellHoverCoordinates,
31
- } from '../types';
27
+ import type { Cell, CellColumnPositioning } from '../types';
32
28
  import { TableCssClassName as ClassName, TableDecorations } from '../types';
33
29
  import { ColumnResizeWidget } from '../ui/ColumnResizeWidget';
34
- import { DragHandle } from '../ui/DragHandle';
35
30
 
36
31
  const filterDecorationByKey = (
37
32
  key: TableDecorations,
@@ -212,48 +207,11 @@ export const createColumnSelectedDecoration = (
212
207
 
213
208
  export const createColumnControlsDecoration = (
214
209
  selection: Selection,
215
- hoverLocation?: CellHoverCoordinates,
216
210
  ): Decoration[] => {
217
- // todo: issue here where table may not be selected yet
218
211
  const cells: ContentNodeWithPos[] = getCellsInRow(0)(selection) || [];
219
- const table = findTable(selection);
220
212
 
221
- if (
222
- getBooleanFF('platform.editor.table.drag-and-drop') &&
223
- hoverLocation &&
224
- !Number.isNaN(hoverLocation?.colIndex) &&
225
- table
226
- ) {
227
- const colIndex = hoverLocation.colIndex as number;
228
- const cell = cells[colIndex];
229
- return [
230
- Decoration.widget(
231
- cell.pos + 1,
232
- () => {
233
- const element = document.createElement('div');
234
- element.classList.add(
235
- ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG,
236
- );
237
- ReactDOM.render(
238
- createElement(DragHandle, {
239
- tableLocalId: table.node.attrs.localId,
240
- direction: 'column',
241
- indexes: [colIndex],
242
- }),
243
- element,
244
- );
245
- return element;
246
- },
247
- {
248
- key: `${TableDecorations.COLUMN_CONTROLS_DECORATIONS}_${colIndex}`,
249
- // this decoration should be the first one, even before gap cursor.
250
- side: -100,
251
- destroy: (node) => {
252
- ReactDOM.unmountComponentAtNode(node as HTMLDivElement);
253
- },
254
- },
255
- ),
256
- ];
213
+ if (getBooleanFF('platform.editor.table.drag-and-drop')) {
214
+ return [];
257
215
  } else {
258
216
  let index = 0;
259
217
  return cells.map((cell) => {
@@ -36,10 +36,6 @@ export const isColumnControlsDecorations = (
36
36
  node: HTMLElement | null,
37
37
  ): boolean => containsClassName(node, ClassName.COLUMN_CONTROLS_DECORATIONS);
38
38
 
39
- export const isColumnDragControlsDecorations = (node: HTMLElement | null) =>
40
- containsClassName(node, ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG) ||
41
- closestElement(node, `.${ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG}`);
42
-
43
39
  export const isRowControlsButton = (node: HTMLElement | null): boolean =>
44
40
  containsClassName(node, ClassName.ROW_CONTROLS_BUTTON) ||
45
41
  containsClassName(node, ClassName.NUMBERED_COLUMN_BUTTON);
@@ -46,7 +46,6 @@ export {
46
46
  isColumnControlsDecorations,
47
47
  isTableControlsButton,
48
48
  isTableContainerOrWrapper,
49
- isColumnDragControlsDecorations,
50
49
  isRowDragControlsButton,
51
50
  isRowControlsButton,
52
51
  getColumnOrRowIndex,