@atlaskit/editor-plugin-table 5.4.7 → 5.4.8

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 (50) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/plugins/table/commands/misc.js +14 -12
  3. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +2 -4
  4. package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +9 -3
  5. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -3
  6. package/dist/cjs/plugins/table/types.js +2 -1
  7. package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +4 -1
  8. package/dist/cjs/plugins/table/ui/common-styles.js +6 -9
  9. package/dist/cjs/plugins/table/ui/ui-styles.js +12 -16
  10. package/dist/cjs/plugins/table/utils/decoration.js +20 -25
  11. package/dist/es2019/plugins/table/commands/misc.js +5 -4
  12. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +2 -4
  13. package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +9 -3
  14. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -3
  15. package/dist/es2019/plugins/table/types.js +2 -1
  16. package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +4 -1
  17. package/dist/es2019/plugins/table/ui/common-styles.js +20 -20
  18. package/dist/es2019/plugins/table/ui/ui-styles.js +18 -21
  19. package/dist/es2019/plugins/table/utils/decoration.js +20 -25
  20. package/dist/esm/plugins/table/commands/misc.js +13 -13
  21. package/dist/esm/plugins/table/nodeviews/TableComponent.js +2 -4
  22. package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +9 -3
  23. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -3
  24. package/dist/esm/plugins/table/types.js +2 -1
  25. package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +4 -1
  26. package/dist/esm/plugins/table/ui/common-styles.js +6 -9
  27. package/dist/esm/plugins/table/ui/ui-styles.js +12 -16
  28. package/dist/esm/plugins/table/utils/decoration.js +20 -25
  29. package/dist/types/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -2
  30. package/dist/types/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +1 -1
  31. package/dist/types/plugins/table/pm-plugins/decorations/utils/types.d.ts +10 -4
  32. package/dist/types/plugins/table/types.d.ts +2 -1
  33. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -2
  34. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +1 -1
  35. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/types.d.ts +10 -4
  36. package/dist/types-ts4.5/plugins/table/types.d.ts +2 -1
  37. package/package.json +1 -1
  38. package/src/__tests__/unit/event-handlers.ts +37 -38
  39. package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +46 -36
  40. package/src/plugins/table/commands/misc.ts +9 -7
  41. package/src/plugins/table/nodeviews/TableComponent.tsx +20 -22
  42. package/src/plugins/table/pm-plugins/decorations/plugin.ts +7 -2
  43. package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +20 -11
  44. package/src/plugins/table/pm-plugins/decorations/utils/compose-decorations.ts +2 -4
  45. package/src/plugins/table/pm-plugins/decorations/utils/types.ts +14 -7
  46. package/src/plugins/table/types.ts +2 -1
  47. package/src/plugins/table/ui/TableFloatingControls/index.tsx +73 -67
  48. package/src/plugins/table/ui/common-styles.ts +20 -23
  49. package/src/plugins/table/ui/ui-styles.ts +18 -21
  50. package/src/plugins/table/utils/decoration.ts +27 -32
@@ -9,47 +9,57 @@ import {
9
9
  tdEmpty,
10
10
  tr,
11
11
  } from '@atlaskit/editor-test-helpers/doc-builder';
12
- import { ffTest } from '@atlassian/feature-flags-test-utils';
12
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
13
13
 
14
14
  import { buildColumnControlsDecorations } from '../../../../plugins/table/pm-plugins/decorations/utils';
15
15
  import { TableDecorations } from '../../../../plugins/table/types';
16
16
 
17
+ // Mock Feature flags instead of using ffTest because we don't use the feature flag directly
18
+ jest.mock('@atlaskit/platform-feature-flags', () => ({
19
+ getBooleanFF: jest.fn().mockImplementation(() => false),
20
+ }));
21
+
22
+ afterEach(() => {
23
+ (getBooleanFF as jest.Mock).mockReset();
24
+ });
25
+
17
26
  describe('tables: column controls decorations', () => {
18
- describe(`should return a decorationSet with 2 ${TableDecorations.COLUMN_CONTROLS_DECORATIONS} type when drag and drop disabled`, () => {
19
- ffTest(
20
- 'platform.editor.table.drag-and-drop',
21
- () => {
22
- const decorationKey = TableDecorations.COLUMN_CONTROLS_DECORATIONS;
23
- const state = createEditorState(doc(table()(tr(tdCursor, tdEmpty))));
24
- const nextDecorationSet = buildColumnControlsDecorations({
25
- decorationSet: DecorationSet.empty,
26
- tr: state.tr,
27
- });
28
-
29
- const decorations = nextDecorationSet.find(
30
- undefined,
31
- undefined,
32
- (spec: any) => spec.key.indexOf(decorationKey) > -1,
33
- );
34
-
35
- expect(decorations).toHaveLength(0);
36
- },
37
- () => {
38
- const decorationKey = TableDecorations.COLUMN_CONTROLS_DECORATIONS;
39
- const state = createEditorState(doc(table()(tr(tdCursor, tdEmpty))));
40
- const nextDecorationSet = buildColumnControlsDecorations({
41
- decorationSet: DecorationSet.empty,
42
- tr: state.tr,
43
- });
44
-
45
- const decorations = nextDecorationSet.find(
46
- undefined,
47
- undefined,
48
- (spec: any) => spec.key.indexOf(decorationKey) > -1,
49
- );
50
-
51
- expect(decorations).toHaveLength(2);
52
- },
27
+ it(`should return an empty decorationSet ${TableDecorations.COLUMN_CONTROLS_DECORATIONS} type when drag and drop is enabled`, () => {
28
+ (getBooleanFF as jest.Mock).mockImplementation(
29
+ (name) => name === 'platform.editor.table.drag-and-drop',
53
30
  );
31
+ const decorationKey = TableDecorations.COLUMN_CONTROLS_DECORATIONS;
32
+ const state = createEditorState(doc(table()(tr(tdCursor, tdEmpty))));
33
+ const nextDecorationSet = buildColumnControlsDecorations({
34
+ decorationSet: DecorationSet.empty,
35
+ tr: state.tr,
36
+ options: { isDragAndDropEnabled: true },
37
+ });
38
+
39
+ const decorations = nextDecorationSet.find(
40
+ undefined,
41
+ undefined,
42
+ (spec: any) => spec.key.indexOf(decorationKey) > -1,
43
+ );
44
+
45
+ expect(decorations).toHaveLength(0);
46
+ });
47
+
48
+ it(`should return an empty decorationSet ${TableDecorations.COLUMN_CONTROLS_DECORATIONS} type when drag and drop is disabled`, () => {
49
+ const decorationKey = TableDecorations.COLUMN_CONTROLS_DECORATIONS;
50
+ const state = createEditorState(doc(table()(tr(tdCursor, tdEmpty))));
51
+ const nextDecorationSet = buildColumnControlsDecorations({
52
+ decorationSet: DecorationSet.empty,
53
+ tr: state.tr,
54
+ options: { isDragAndDropEnabled: false },
55
+ });
56
+
57
+ const decorations = nextDecorationSet.find(
58
+ undefined,
59
+ undefined,
60
+ (spec: any) => spec.key.indexOf(decorationKey) > -1,
61
+ );
62
+
63
+ expect(decorations).toHaveLength(2);
54
64
  });
55
65
  });
@@ -1,4 +1,3 @@
1
- // #region Imports
2
1
  import type { CellAttributes } from '@atlaskit/adf-schema';
3
2
  import type { Command } from '@atlaskit/editor-common/types';
4
3
  import {
@@ -76,11 +75,7 @@ export const setTableRef = (ref?: HTMLTableElement) =>
76
75
  closestElement(tableRef, `.${ClassName.TABLE_NODE_WRAPPER}`) ||
77
76
  undefined;
78
77
  const layout = tableNode ? tableNode.attrs.layout : undefined;
79
- const decorationSet = updatePluginStateDecorations(
80
- state,
81
- createColumnControlsDecoration(state.selection),
82
- TableDecorations.COLUMN_CONTROLS_DECORATIONS,
83
- );
78
+ const { isDragAndDropEnabled } = getPluginState(state);
84
79
 
85
80
  return {
86
81
  type: 'SET_TABLE_REF',
@@ -93,7 +88,14 @@ export const setTableRef = (ref?: HTMLTableElement) =>
93
88
  isNumberColumnEnabled: checkIfNumberColumnEnabled(state.selection),
94
89
  isHeaderRowEnabled: checkIfHeaderRowEnabled(state.selection),
95
90
  isHeaderColumnEnabled: checkIfHeaderColumnEnabled(state.selection),
96
- decorationSet,
91
+ // decoration set is drawn by the decoration plugin, skip this for DnD as all controls are floating
92
+ decorationSet: !isDragAndDropEnabled
93
+ ? updatePluginStateDecorations(
94
+ state,
95
+ createColumnControlsDecoration(state.selection),
96
+ TableDecorations.COLUMN_CONTROLS_DECORATIONS,
97
+ )
98
+ : undefined,
97
99
  resizeHandleRowIndex: undefined,
98
100
  resizeHandleColumnIndex: undefined,
99
101
  },
@@ -483,28 +483,26 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
483
483
 
484
484
  const hasHeaderRow = containsHeaderRow(node);
485
485
  const rowControls = (
486
- <div className={ClassName.ROW_CONTROLS_WRAPPER}>
487
- <TableFloatingControls
488
- editorView={view}
489
- tableRef={tableRef}
490
- tableNode={node}
491
- tableActive={tableActive}
492
- hoveredRows={hoveredRows}
493
- hoveredCell={hoveredCell}
494
- isInDanger={isInDanger}
495
- isResizing={isResizing}
496
- isNumberColumnEnabled={node.attrs.isNumberColumnEnabled}
497
- isHeaderRowEnabled={isHeaderRowEnabled}
498
- isDragAndDropEnabled={isDragAndDropEnabled}
499
- ordering={ordering}
500
- isHeaderColumnEnabled={isHeaderColumnEnabled}
501
- hasHeaderRow={hasHeaderRow}
502
- // pass `selection` and `tableHeight` to control re-render
503
- selection={view.state.selection}
504
- headerRowHeight={headerRow ? headerRow.offsetHeight : undefined}
505
- stickyHeader={this.state.stickyHeader}
506
- />
507
- </div>
486
+ <TableFloatingControls
487
+ editorView={view}
488
+ tableRef={tableRef}
489
+ tableNode={node}
490
+ tableActive={tableActive}
491
+ hoveredRows={hoveredRows}
492
+ hoveredCell={hoveredCell}
493
+ isInDanger={isInDanger}
494
+ isResizing={isResizing}
495
+ isNumberColumnEnabled={node.attrs.isNumberColumnEnabled}
496
+ isHeaderRowEnabled={isHeaderRowEnabled}
497
+ isDragAndDropEnabled={isDragAndDropEnabled}
498
+ ordering={ordering}
499
+ isHeaderColumnEnabled={isHeaderColumnEnabled}
500
+ hasHeaderRow={hasHeaderRow}
501
+ // pass `selection` and `tableHeight` to control re-render
502
+ selection={view.state.selection}
503
+ headerRowHeight={headerRow ? headerRow.offsetHeight : undefined}
504
+ stickyHeader={this.state.stickyHeader}
505
+ />
508
506
  );
509
507
 
510
508
  const colControls = isDragAndDropEnabled ? (
@@ -8,7 +8,6 @@ import type {
8
8
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
9
9
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
10
10
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
11
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
12
11
 
13
12
  import { pluginKey as tablePluginKey } from '../plugin-key';
14
13
  import { pluginKey as tableWidthPluginKey } from '../table-width';
@@ -31,11 +30,13 @@ export const handleDocOrSelectionChanged = (
31
30
  ): DecorationSet => {
32
31
  const isResizing = tableWidthPluginKey.getState(newState)?.resizing;
33
32
  const wasResizing = tableWidthPluginKey.getState(oldState)?.resizing;
33
+ const { isDragAndDropEnabled = false } =
34
+ tablePluginKey.getState(newState) || {};
34
35
 
35
36
  const changedResizing = isResizing !== wasResizing;
36
37
 
37
38
  // Remove column controls when resizing and don't add column decoration controls when DnD enabled
38
- if (isResizing || getBooleanFF('platform.editor.table.drag-and-drop')) {
39
+ if (isResizing) {
39
40
  return DecorationSet.empty;
40
41
  } else if (
41
42
  tr.docChanged ||
@@ -45,6 +46,9 @@ export const handleDocOrSelectionChanged = (
45
46
  return buildColumnControlsDecorations({
46
47
  decorationSet,
47
48
  tr,
49
+ options: {
50
+ isDragAndDropEnabled,
51
+ },
48
52
  });
49
53
  } else if (tr.selectionSet) {
50
54
  const isTransactionFromMouseClick =
@@ -70,6 +74,7 @@ export const createPlugin = () => {
70
74
 
71
75
  apply: (tr, decorationSet, oldState, newState) => {
72
76
  let pluginState = decorationSet;
77
+ // main table plugin --->
73
78
  const meta = tr.getMeta(tablePluginKey);
74
79
 
75
80
  if (meta && meta.data && meta.data.decorationSet) {
@@ -17,7 +17,10 @@ import {
17
17
  } from '../../../utils/decoration';
18
18
 
19
19
  import { composeDecorations } from './compose-decorations';
20
- import type { DecorationTransformer } from './types';
20
+ import type {
21
+ BuildDecorationTransformerParams,
22
+ DecorationTransformer,
23
+ } from './types';
21
24
 
22
25
  const isColumnSelected = (tr: Transaction | ReadonlyTransaction): boolean =>
23
26
  tr.selection instanceof CellSelection && tr.selection.isColSelection();
@@ -25,13 +28,12 @@ const isColumnSelected = (tr: Transaction | ReadonlyTransaction): boolean =>
25
28
  // @see: https://product-fabric.atlassian.net/browse/ED-3796
26
29
  const removeControlsHoverDecoration: DecorationTransformer = ({
27
30
  decorationSet,
28
- }): DecorationSet =>
29
- decorationSet.remove(findControlsHoverDecoration(decorationSet));
31
+ }) => decorationSet.remove(findControlsHoverDecoration(decorationSet));
30
32
 
31
33
  const maybeUpdateColumnSelectedDecoration: DecorationTransformer = ({
32
34
  decorationSet,
33
35
  tr,
34
- }): DecorationSet => {
36
+ }) => {
35
37
  if (!isColumnSelected(tr)) {
36
38
  return decorationSet;
37
39
  }
@@ -47,10 +49,9 @@ const maybeUpdateColumnSelectedDecoration: DecorationTransformer = ({
47
49
  const maybeUpdateColumnControlsDecoration: DecorationTransformer = ({
48
50
  decorationSet,
49
51
  tr,
50
- }): DecorationSet => {
52
+ }) => {
51
53
  const table = findTable(tr.selection);
52
54
 
53
- // avoid re-drawing state if dnd decorations don't need to be updated
54
55
  if (!table) {
55
56
  return decorationSet;
56
57
  }
@@ -66,14 +67,13 @@ const maybeUpdateColumnControlsDecoration: DecorationTransformer = ({
66
67
  // @see: https://product-fabric.atlassian.net/browse/ED-7304
67
68
  const removeColumnControlsSelectedDecoration: DecorationTransformer = ({
68
69
  decorationSet,
69
- }): DecorationSet =>
70
- decorationSet.remove(findColumnControlSelectedDecoration(decorationSet));
70
+ }) => decorationSet.remove(findColumnControlSelectedDecoration(decorationSet));
71
71
 
72
72
  const hasColumnSelectedDecorations = (decorationSet: DecorationSet): boolean =>
73
73
  !!findColumnControlSelectedDecoration(decorationSet).length;
74
74
 
75
75
  export const maybeUpdateColumnControlsSelectedDecoration: DecorationTransformer =
76
- ({ decorationSet, tr }): DecorationSet => {
76
+ ({ decorationSet, tr }) => {
77
77
  if (!hasColumnSelectedDecorations(decorationSet)) {
78
78
  return decorationSet;
79
79
  }
@@ -81,10 +81,19 @@ export const maybeUpdateColumnControlsSelectedDecoration: DecorationTransformer
81
81
  return removeColumnControlsSelectedDecoration({ decorationSet, tr });
82
82
  };
83
83
 
84
- export const buildColumnControlsDecorations: DecorationTransformer = ({
84
+ export const buildColumnControlsDecorations = ({
85
85
  decorationSet,
86
86
  tr,
87
- }): DecorationSet => {
87
+ options,
88
+ }: BuildDecorationTransformerParams): DecorationSet => {
89
+ if (options.isDragAndDropEnabled) {
90
+ return composeDecorations([
91
+ removeColumnControlsSelectedDecoration,
92
+ removeControlsHoverDecoration,
93
+ maybeUpdateColumnSelectedDecoration,
94
+ ])({ decorationSet, tr });
95
+ }
96
+
88
97
  return composeDecorations([
89
98
  removeColumnControlsSelectedDecoration,
90
99
  removeControlsHoverDecoration,
@@ -1,10 +1,8 @@
1
- import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
2
-
3
- import { DecorationTransformer } from './types';
1
+ import type { DecorationTransformer } from './types';
4
2
 
5
3
  export const composeDecorations =
6
4
  (transformers: Array<DecorationTransformer>): DecorationTransformer =>
7
- ({ decorationSet, tr }): DecorationSet =>
5
+ ({ decorationSet, tr }) =>
8
6
  transformers.reduce(
9
7
  (decorationSet, transform) => transform({ decorationSet, tr }),
10
8
  decorationSet,
@@ -1,14 +1,21 @@
1
1
  // @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
2
- import {
2
+ import type {
3
3
  ReadonlyTransaction,
4
4
  Transaction,
5
5
  } from '@atlaskit/editor-prosemirror/state';
6
- import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
6
+ import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
7
7
 
8
- export type DecorationTransformer = ({
9
- decorationSet,
10
- tr,
11
- }: {
8
+ export type DecorationTransformer = (
9
+ params: DecorationTransformerParams,
10
+ ) => DecorationSet;
11
+
12
+ export type DecorationTransformerParams = {
12
13
  decorationSet: DecorationSet;
13
14
  tr: Transaction | ReadonlyTransaction;
14
- }) => DecorationSet;
15
+ };
16
+
17
+ export type BuildDecorationTransformerParams = DecorationTransformerParams & {
18
+ options: {
19
+ isDragAndDropEnabled: boolean;
20
+ };
21
+ };
@@ -309,7 +309,8 @@ export const TableCssClassName = {
309
309
  CORNER_CONTROLS_INSERT_COLUMN_MARKER: `${tablePrefixSelector}-corner-controls__insert-column-marker`,
310
310
  CONTROLS_CORNER_BUTTON: `${tablePrefixSelector}-corner-button`,
311
311
 
312
- /** Controls with drag handle */
312
+ /** drag and drop controls */
313
+ DRAG_ROW_CONTROLS_WRAPPER: `${tablePrefixSelector}-drag-row-controls-wrapper`,
313
314
  DRAG_ROW_CONTROLS: `${tablePrefixSelector}-drag-row-controls`,
314
315
  DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER: `${tablePrefixSelector}-drag-row-floating-insert-dot-wrapper`,
315
316
  DRAG_ROW_FLOATING_INSERT_DOT: `${tablePrefixSelector}-drag-row-floating-insert-dot`,
@@ -158,75 +158,81 @@ export default class TableFloatingControls extends Component<Props, State> {
158
158
  ? stickyHeader.top
159
159
  : undefined;
160
160
 
161
+ const wrapperClassName = isDragAndDropEnabled
162
+ ? ClassName.DRAG_ROW_CONTROLS_WRAPPER
163
+ : ClassName.ROW_CONTROLS_WRAPPER;
164
+
161
165
  return (
162
- <div onMouseDown={(e) => !isDragAndDropEnabled && e.preventDefault()}>
163
- {isNumberColumnEnabled ? (
164
- <NumberColumn
165
- editorView={editorView}
166
- hoverRows={this.hoverRows}
167
- tableRef={tableRef}
168
- tableActive={tableActive}
169
- hoveredRows={hoveredRows}
170
- hasHeaderRow={hasHeaderRow}
171
- isInDanger={isInDanger}
172
- isResizing={isResizing}
173
- selectRow={this.selectRow}
174
- updateCellHoverLocation={this.updateCellHoverLocation}
175
- stickyTop={stickyTop}
176
- isDragAndDropEnabled={isDragAndDropEnabled}
177
- />
178
- ) : null}
166
+ <div className={wrapperClassName}>
167
+ <div onMouseDown={(e) => !isDragAndDropEnabled && e.preventDefault()}>
168
+ {isNumberColumnEnabled ? (
169
+ <NumberColumn
170
+ editorView={editorView}
171
+ hoverRows={this.hoverRows}
172
+ tableRef={tableRef}
173
+ tableActive={tableActive}
174
+ hoveredRows={hoveredRows}
175
+ hasHeaderRow={hasHeaderRow}
176
+ isInDanger={isInDanger}
177
+ isResizing={isResizing}
178
+ selectRow={this.selectRow}
179
+ updateCellHoverLocation={this.updateCellHoverLocation}
180
+ stickyTop={stickyTop}
181
+ isDragAndDropEnabled={isDragAndDropEnabled}
182
+ />
183
+ ) : null}
179
184
 
180
- {tableActive && (
181
- <>
182
- {isDragAndDropEnabled ? (
183
- <>
184
- <DragCornerControls
185
- editorView={editorView}
186
- tableRef={tableRef}
187
- isInDanger={isInDanger}
188
- isResizing={isResizing}
189
- />
190
- <DragControls
191
- tableRef={tableRef}
192
- tableNode={tableNode}
193
- hoveredCell={hoveredCell}
194
- editorView={editorView}
195
- tableActive={tableActive}
196
- isInDanger={isInDanger}
197
- isResizing={isResizing}
198
- tableWidth={this.state.tableWrapperWidth}
199
- hoverRows={this.hoverRows}
200
- selectRow={this.selectRow}
201
- updateCellHoverLocation={this.updateCellHoverLocation}
202
- />
203
- </>
204
- ) : (
205
- <>
206
- <CornerControls
207
- editorView={editorView}
208
- tableRef={tableRef}
209
- isInDanger={isInDanger}
210
- isResizing={isResizing}
211
- isHeaderRowEnabled={isHeaderRowEnabled}
212
- isHeaderColumnEnabled={isHeaderColumnEnabled}
213
- hoveredRows={hoveredRows}
214
- stickyTop={tableActive ? stickyTop : undefined}
215
- />
216
- <RowControls
217
- editorView={editorView}
218
- tableRef={tableRef}
219
- hoverRows={this.hoverRows}
220
- hoveredRows={hoveredRows}
221
- isInDanger={isInDanger}
222
- isResizing={isResizing}
223
- selectRow={this.selectRow}
224
- stickyTop={tableActive ? stickyTop : undefined}
225
- />
226
- </>
227
- )}
228
- </>
229
- )}
185
+ {tableActive && (
186
+ <>
187
+ {isDragAndDropEnabled ? (
188
+ <>
189
+ <DragCornerControls
190
+ editorView={editorView}
191
+ tableRef={tableRef}
192
+ isInDanger={isInDanger}
193
+ isResizing={isResizing}
194
+ />
195
+ <DragControls
196
+ tableRef={tableRef}
197
+ tableNode={tableNode}
198
+ hoveredCell={hoveredCell}
199
+ editorView={editorView}
200
+ tableActive={tableActive}
201
+ isInDanger={isInDanger}
202
+ isResizing={isResizing}
203
+ tableWidth={this.state.tableWrapperWidth}
204
+ hoverRows={this.hoverRows}
205
+ selectRow={this.selectRow}
206
+ updateCellHoverLocation={this.updateCellHoverLocation}
207
+ />
208
+ </>
209
+ ) : (
210
+ <>
211
+ <CornerControls
212
+ editorView={editorView}
213
+ tableRef={tableRef}
214
+ isInDanger={isInDanger}
215
+ isResizing={isResizing}
216
+ isHeaderRowEnabled={isHeaderRowEnabled}
217
+ isHeaderColumnEnabled={isHeaderColumnEnabled}
218
+ hoveredRows={hoveredRows}
219
+ stickyTop={tableActive ? stickyTop : undefined}
220
+ />
221
+ <RowControls
222
+ editorView={editorView}
223
+ tableRef={tableRef}
224
+ hoverRows={this.hoverRows}
225
+ hoveredRows={hoveredRows}
226
+ isInDanger={isInDanger}
227
+ isResizing={isResizing}
228
+ selectRow={this.selectRow}
229
+ stickyTop={tableActive ? stickyTop : undefined}
230
+ />
231
+ </>
232
+ )}
233
+ </>
234
+ )}
235
+ </div>
230
236
  </div>
231
237
  );
232
238
  }
@@ -265,26 +265,6 @@ const tableStickyHeaderFirefoxFixStyle = (
265
265
  }
266
266
  };
267
267
 
268
- const tableRowControlStyles = () => {
269
- return getBooleanFF('platform.editor.table.drag-and-drop')
270
- ? css`
271
- .${ClassName.ROW_CONTROLS_WRAPPER} {
272
- position: absolute;
273
- margin-top: ${tableMarginTop}px;
274
- left: -${tableToolbarSize + 1}px;
275
- z-index: ${rowControlsZIndex + 4};
276
- }
277
- `
278
- : css`
279
- .${ClassName.ROW_CONTROLS_WRAPPER} {
280
- position: absolute;
281
- /* top of corner control is table margin top - corner control height + 1 pixel of table border. */
282
- top: ${tableMarginTop - cornerControlHeight + 1}px;
283
- left: -${tableToolbarSize}px;
284
- }
285
- `;
286
- };
287
-
288
268
  const tableWrapperStyles = () => {
289
269
  if (getBooleanFF('platform.editor.custom-table-width')) {
290
270
  return css`
@@ -558,7 +538,8 @@ export const tableStyles = (
558
538
  .less-padding {
559
539
  padding: 0 ${tablePadding}px;
560
540
 
561
- .${ClassName.ROW_CONTROLS_WRAPPER} {
541
+ .${ClassName.DRAG_ROW_CONTROLS_WRAPPER},
542
+ .${ClassName.ROW_CONTROLS_WRAPPER} {
562
543
  padding: 0 ${tablePadding}px;
563
544
 
564
545
  // https://product-fabric.atlassian.net/browse/ED-16386
@@ -1056,8 +1037,24 @@ export const tableStyles = (
1056
1037
  }
1057
1038
  }
1058
1039
  }
1059
- ${tableRowControlStyles()}
1060
- .${ClassName.ROW_CONTROLS_WRAPPER}.${ClassName.TABLE_LEFT_SHADOW} {
1040
+
1041
+ // override for DnD controls
1042
+ .${ClassName.DRAG_ROW_CONTROLS_WRAPPER} {
1043
+ position: absolute;
1044
+ margin-top: ${tableMarginTop}px;
1045
+ left: -${tableToolbarSize + 1}px;
1046
+ z-index: ${rowControlsZIndex + 4};
1047
+ }
1048
+
1049
+ .${ClassName.ROW_CONTROLS_WRAPPER} {
1050
+ position: absolute;
1051
+ /* top of corner control is table margin top - corner control height + 1 pixel of table border. */
1052
+ top: ${tableMarginTop - cornerControlHeight + 1}px;
1053
+ left: -${tableToolbarSize}px;
1054
+ }
1055
+
1056
+ .${ClassName.DRAG_ROW_CONTROLS_WRAPPER}.${ClassName.TABLE_LEFT_SHADOW},
1057
+ .${ClassName.ROW_CONTROLS_WRAPPER}.${ClassName.TABLE_LEFT_SHADOW} {
1061
1058
  z-index: ${akEditorUnitZIndex};
1062
1059
  }
1063
1060
 
@@ -500,27 +500,24 @@ export const floatingColumnControls = (props: ThemeProps) => {
500
500
  };
501
501
 
502
502
  export const rowControlsWrapperDotStyle = (props: ThemeProps) => {
503
- if (getBooleanFF('platform.editor.table.drag-and-drop')) {
504
- return css`
505
- div.${ClassName.WITH_CONTROLS}>.${ClassName.ROW_CONTROLS_WRAPPER}::after {
506
- display: none;
507
- }
508
- `;
509
- } else {
510
- return css`
511
- div.${ClassName.WITH_CONTROLS}>.${ClassName.ROW_CONTROLS_WRAPPER}::after {
512
- content: ' ';
513
- background-color: ${tableBorderColor(props)};
514
- position: absolute;
515
- height: ${lineMarkerSize}px;
516
- width: ${lineMarkerSize}px;
517
- border-radius: 50%;
518
- pointer-events: none;
519
- top: -${tableToolbarSize + tableCellBorderWidth}px;
520
- right: -1px;
521
- }
522
- `;
523
- }
503
+ return css`
504
+ // override for DnD controls
505
+ div.${ClassName.WITH_CONTROLS}>.${ClassName.DRAG_ROW_CONTROLS_WRAPPER}::after {
506
+ display: none;
507
+ }
508
+
509
+ div.${ClassName.WITH_CONTROLS}>.${ClassName.ROW_CONTROLS_WRAPPER}::after {
510
+ content: ' ';
511
+ background-color: ${tableBorderColor(props)};
512
+ position: absolute;
513
+ height: ${lineMarkerSize}px;
514
+ width: ${lineMarkerSize}px;
515
+ border-radius: 50%;
516
+ pointer-events: none;
517
+ top: -${tableToolbarSize + tableCellBorderWidth}px;
518
+ right: -1px;
519
+ }
520
+ `;
524
521
  };
525
522
 
526
523
  export const columnControlsDecoration = (props: ThemeProps) => {