@atlaskit/editor-plugin-table 5.3.0 → 5.3.2

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 (186) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/plugins/table/commands/hover.js +17 -8
  3. package/dist/cjs/plugins/table/commands/index.js +6 -0
  4. package/dist/cjs/plugins/table/commands/misc.js +1 -7
  5. package/dist/cjs/plugins/table/event-handlers.js +29 -2
  6. package/dist/cjs/plugins/table/index.js +1 -1
  7. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +5 -3
  8. package/dist/cjs/plugins/table/nodeviews/table.js +4 -2
  9. package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +7 -3
  10. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +7 -2
  11. package/dist/cjs/plugins/table/pm-plugins/default-table-selection.js +14 -1
  12. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +36 -7
  13. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +69 -7
  14. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/reducer.js +2 -0
  15. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/utils/index.js +12 -0
  16. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/utils/monitor.js +59 -0
  17. package/dist/cjs/plugins/table/pm-plugins/main.js +5 -5
  18. package/dist/cjs/plugins/table/reducer.js +2 -1
  19. package/dist/cjs/plugins/table/types.js +14 -1
  20. package/dist/cjs/plugins/table/ui/DragHandle/index.js +50 -0
  21. package/dist/cjs/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +53 -14
  22. package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.js +114 -0
  23. package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +53 -0
  24. package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/index.js +11 -106
  25. package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +16 -6
  26. package/dist/cjs/plugins/table/ui/common-styles.js +9 -6
  27. package/dist/cjs/plugins/table/ui/consts.js +3 -1
  28. package/dist/cjs/plugins/table/ui/ui-styles.js +21 -9
  29. package/dist/cjs/plugins/table/utils/decoration.js +111 -19
  30. package/dist/cjs/plugins/table/utils/dom.js +7 -1
  31. package/dist/cjs/plugins/table/utils/index.js +38 -1
  32. package/dist/cjs/plugins/table/utils/merged-cells.js +66 -0
  33. package/dist/es2019/plugins/table/commands/hover.js +12 -8
  34. package/dist/es2019/plugins/table/commands/index.js +1 -1
  35. package/dist/es2019/plugins/table/commands/misc.js +1 -7
  36. package/dist/es2019/plugins/table/event-handlers.js +28 -2
  37. package/dist/es2019/plugins/table/index.js +1 -1
  38. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +5 -3
  39. package/dist/es2019/plugins/table/nodeviews/table.js +4 -2
  40. package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +8 -6
  41. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +7 -2
  42. package/dist/es2019/plugins/table/pm-plugins/default-table-selection.js +13 -0
  43. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +35 -7
  44. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +69 -4
  45. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/reducer.js +2 -0
  46. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/utils/index.js +1 -0
  47. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/utils/monitor.js +56 -0
  48. package/dist/es2019/plugins/table/pm-plugins/main.js +6 -5
  49. package/dist/es2019/plugins/table/reducer.js +2 -1
  50. package/dist/es2019/plugins/table/types.js +14 -1
  51. package/dist/es2019/plugins/table/ui/DragHandle/index.js +41 -0
  52. package/dist/es2019/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +54 -10
  53. package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.js +86 -0
  54. package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +43 -0
  55. package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/index.js +2 -88
  56. package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +17 -7
  57. package/dist/es2019/plugins/table/ui/common-styles.js +49 -13
  58. package/dist/es2019/plugins/table/ui/consts.js +2 -0
  59. package/dist/es2019/plugins/table/ui/ui-styles.js +171 -15
  60. package/dist/es2019/plugins/table/utils/decoration.js +106 -18
  61. package/dist/es2019/plugins/table/utils/dom.js +2 -0
  62. package/dist/es2019/plugins/table/utils/index.js +4 -3
  63. package/dist/es2019/plugins/table/utils/merged-cells.js +48 -0
  64. package/dist/esm/plugins/table/commands/hover.js +16 -8
  65. package/dist/esm/plugins/table/commands/index.js +1 -1
  66. package/dist/esm/plugins/table/commands/misc.js +1 -7
  67. package/dist/esm/plugins/table/event-handlers.js +29 -2
  68. package/dist/esm/plugins/table/index.js +1 -1
  69. package/dist/esm/plugins/table/nodeviews/TableComponent.js +5 -3
  70. package/dist/esm/plugins/table/nodeviews/table.js +4 -2
  71. package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +8 -6
  72. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +7 -2
  73. package/dist/esm/plugins/table/pm-plugins/default-table-selection.js +13 -0
  74. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +36 -7
  75. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +65 -4
  76. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/reducer.js +2 -0
  77. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/utils/index.js +1 -0
  78. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/utils/monitor.js +53 -0
  79. package/dist/esm/plugins/table/pm-plugins/main.js +7 -7
  80. package/dist/esm/plugins/table/reducer.js +2 -1
  81. package/dist/esm/plugins/table/types.js +14 -1
  82. package/dist/esm/plugins/table/ui/DragHandle/index.js +41 -0
  83. package/dist/esm/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +54 -15
  84. package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.js +104 -0
  85. package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +46 -0
  86. package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/index.js +2 -104
  87. package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +17 -7
  88. package/dist/esm/plugins/table/ui/common-styles.js +11 -8
  89. package/dist/esm/plugins/table/ui/consts.js +2 -0
  90. package/dist/esm/plugins/table/ui/ui-styles.js +21 -9
  91. package/dist/esm/plugins/table/utils/decoration.js +110 -18
  92. package/dist/esm/plugins/table/utils/dom.js +6 -0
  93. package/dist/esm/plugins/table/utils/index.js +4 -3
  94. package/dist/esm/plugins/table/utils/merged-cells.js +60 -0
  95. package/dist/types/plugins/table/commands/hover.d.ts +2 -1
  96. package/dist/types/plugins/table/commands/index.d.ts +1 -1
  97. package/dist/types/plugins/table/event-handlers.d.ts +1 -0
  98. package/dist/types/plugins/table/nodeviews/types.d.ts +4 -3
  99. package/dist/types/plugins/table/pm-plugins/decorations/plugin.d.ts +2 -1
  100. package/dist/types/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +1 -1
  101. package/dist/types/plugins/table/pm-plugins/default-table-selection.d.ts +12 -0
  102. package/dist/types/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +5 -1
  103. package/dist/types/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +6 -1
  104. package/dist/types/plugins/table/pm-plugins/drag-and-drop/utils/index.d.ts +1 -0
  105. package/dist/types/plugins/table/pm-plugins/drag-and-drop/utils/monitor.d.ts +3 -0
  106. package/dist/types/plugins/table/pm-plugins/main.d.ts +1 -1
  107. package/dist/types/plugins/table/types.d.ts +35 -2
  108. package/dist/types/plugins/table/ui/DragHandle/index.d.ts +11 -0
  109. package/dist/types/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +4 -1
  110. package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.d.ts +17 -0
  111. package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +16 -0
  112. package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +2 -17
  113. package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +3 -2
  114. package/dist/types/plugins/table/ui/consts.d.ts +2 -0
  115. package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -0
  116. package/dist/types/plugins/table/utils/decoration.d.ts +4 -2
  117. package/dist/types/plugins/table/utils/dom.d.ts +2 -0
  118. package/dist/types/plugins/table/utils/index.d.ts +3 -2
  119. package/dist/types/plugins/table/utils/merged-cells.d.ts +3 -0
  120. package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +2 -1
  121. package/dist/types-ts4.5/plugins/table/commands/index.d.ts +1 -1
  122. package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +1 -0
  123. package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +4 -3
  124. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +2 -1
  125. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +1 -1
  126. package/dist/types-ts4.5/plugins/table/pm-plugins/default-table-selection.d.ts +12 -0
  127. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +5 -1
  128. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +6 -1
  129. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/utils/index.d.ts +1 -0
  130. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/utils/monitor.d.ts +3 -0
  131. package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +1 -1
  132. package/dist/types-ts4.5/plugins/table/types.d.ts +35 -2
  133. package/dist/types-ts4.5/plugins/table/ui/DragHandle/index.d.ts +11 -0
  134. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +4 -1
  135. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.d.ts +17 -0
  136. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +16 -0
  137. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +2 -17
  138. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +3 -2
  139. package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +2 -0
  140. package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +1 -0
  141. package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +4 -2
  142. package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +2 -0
  143. package/dist/types-ts4.5/plugins/table/utils/index.d.ts +3 -2
  144. package/dist/types-ts4.5/plugins/table/utils/merged-cells.d.ts +3 -0
  145. package/package.json +6 -2
  146. package/src/__tests__/unit/event-handlers.ts +74 -1
  147. package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +35 -15
  148. package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +146 -42
  149. package/src/__tests__/unit/ui/NumberColumn.tsx +148 -0
  150. package/src/__tests__/unit/ui/RowControls.tsx +4 -4
  151. package/src/__tests__/unit/ui/RowDragControls.tsx +118 -0
  152. package/src/__tests__/unit/ui/TableFloatingControls.tsx +9 -5
  153. package/src/plugins/table/commands/hover.ts +16 -7
  154. package/src/plugins/table/commands/index.ts +1 -0
  155. package/src/plugins/table/commands/misc.ts +0 -5
  156. package/src/plugins/table/event-handlers.ts +49 -2
  157. package/src/plugins/table/index.tsx +1 -1
  158. package/src/plugins/table/nodeviews/TableComponent.tsx +3 -2
  159. package/src/plugins/table/nodeviews/table.tsx +2 -0
  160. package/src/plugins/table/nodeviews/types.ts +4 -3
  161. package/src/plugins/table/pm-plugins/decorations/plugin.ts +13 -4
  162. package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +10 -5
  163. package/src/plugins/table/pm-plugins/default-table-selection.ts +10 -0
  164. package/src/plugins/table/pm-plugins/drag-and-drop/actions.ts +6 -1
  165. package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +58 -8
  166. package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +77 -4
  167. package/src/plugins/table/pm-plugins/drag-and-drop/reducer.ts +2 -0
  168. package/src/plugins/table/pm-plugins/drag-and-drop/utils/index.ts +1 -0
  169. package/src/plugins/table/pm-plugins/drag-and-drop/utils/monitor.ts +72 -0
  170. package/src/plugins/table/pm-plugins/main.ts +9 -4
  171. package/src/plugins/table/reducer.ts +2 -1
  172. package/src/plugins/table/types.ts +37 -3
  173. package/src/plugins/table/ui/DragHandle/index.tsx +57 -0
  174. package/src/plugins/table/ui/TableFloatingControls/NumberColumn/index.tsx +68 -30
  175. package/src/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.tsx +129 -0
  176. package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +75 -0
  177. package/src/plugins/table/ui/TableFloatingControls/RowControls/index.tsx +2 -135
  178. package/src/plugins/table/ui/TableFloatingControls/index.tsx +43 -24
  179. package/src/plugins/table/ui/common-styles.ts +54 -11
  180. package/src/plugins/table/ui/consts.ts +2 -0
  181. package/src/plugins/table/ui/ui-styles.ts +173 -14
  182. package/src/plugins/table/utils/decoration.ts +176 -27
  183. package/src/plugins/table/utils/dom.ts +8 -0
  184. package/src/plugins/table/utils/index.ts +5 -0
  185. package/src/plugins/table/utils/merged-cells.ts +67 -0
  186. package/tsconfig.app.json +3 -0
@@ -5,7 +5,7 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
5
  import { B300, N0, N300, N40A, N60A, Y200, Y50 } from '@atlaskit/theme/colors';
6
6
  import { borderRadius } from '@atlaskit/theme/constants';
7
7
  import { TableCssClassName as ClassName } from '../types';
8
- import { columnControlsDecorationHeight, columnControlsSelectedZIndex, columnControlsZIndex, lineMarkerSize, resizeHandlerAreaWidth, resizeHandlerZIndex, resizeLineWidth, tableBorderColor, tableBorderDeleteColor, tableBorderSelectedColor, tableCellDeleteColor, tableCellHoverDeleteIconBackground, tableCellHoverDeleteIconColor, tableCellSelectedDeleteIconBackground, tableCellSelectedDeleteIconColor, tableDeleteButtonSize, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableOverflowShadowWidth, tableOverflowShadowWidthWide, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
8
+ import { columnControlsDecorationHeight, columnControlsSelectedZIndex, columnControlsZIndex, insertLineWidth, lineMarkerSize, resizeHandlerAreaWidth, resizeHandlerZIndex, resizeLineWidth, tableBorderColor, tableBorderDeleteColor, tableBorderSelectedColor, tableCellDeleteColor, tableCellHoverDeleteIconBackground, tableCellHoverDeleteIconColor, tableCellSelectedDeleteIconBackground, tableCellSelectedDeleteIconColor, tableDeleteButtonSize, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableOverflowShadowWidth, tableOverflowShadowWidthWide, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
9
9
  const InsertLine = (props, cssString) => css`
10
10
  .${ClassName.CONTROLS_INSERT_LINE} {
11
11
  background: ${tableBorderSelectedColor(props)};
@@ -300,6 +300,17 @@ export const floatingColumnControls = props => {
300
300
  `;
301
301
  };
302
302
  export const columnControlsDecoration = props => {
303
+ if (getBooleanFF('platform.editor.table.drag-and-drop')) {
304
+ return css`
305
+ .${ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG} {
306
+ position: absolute;
307
+ // kinda a hacky way to center an element with absolute positioning inside a relative element
308
+ top: 25%;
309
+ left: 50%;
310
+ transform: translate(-50%, -100%);
311
+ }
312
+ `;
313
+ }
303
314
  if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
304
315
  return css`
305
316
  .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
@@ -564,21 +575,35 @@ const getLastColumnResizerOverrides = () => {
564
575
  }
565
576
  ` : '';
566
577
  };
567
- export const resizeHandle = props => css`
568
- .${ClassName.TABLE_CONTAINER} {
569
- .${ClassName.RESIZE_HANDLE_DECORATION} {
570
- background-color: transparent;
571
- position: absolute;
572
- width: ${resizeHandlerAreaWidth}px;
573
- height: 100%;
574
- top: 0;
575
- right: -${resizeHandlerAreaWidth / 2}px;
576
- cursor: col-resize;
577
- z-index: ${resizeHandlerZIndex};
578
- }
579
-
580
- ${getLastColumnResizerOverrides()}
578
+ const resizeHandleOverrides = props => {
579
+ if (getBooleanFF('platform.editor.table.drag-and-drop')) {
580
+ return css`
581
+ th.${ClassName.WITH_RESIZE_LINE}::before,
582
+ td.${ClassName.WITH_RESIZE_LINE}::before {
583
+ content: ' ';
584
+ position: absolute;
585
+ left: ${"var(--ds-space-negative-025, -2px)"};
586
+ top: -1px;
587
+ width: ${resizeLineWidth}px;
588
+ height: calc(100% + 2px);
589
+ background-color: ${tableBorderSelectedColor(props)};
590
+ z-index: ${columnControlsZIndex * 2};
591
+ }
581
592
 
593
+ th.${ClassName.WITH_RESIZE_LINE_LAST_COLUMN}::before,
594
+ td.${ClassName.WITH_RESIZE_LINE_LAST_COLUMN}::before {
595
+ content: ' ';
596
+ position: absolute;
597
+ right: -1px;
598
+ top: -1px;
599
+ width: ${resizeLineWidth}px;
600
+ height: calc(100% + 2px);
601
+ background-color: ${tableBorderSelectedColor(props)};
602
+ z-index: ${columnControlsZIndex * 2};
603
+ }
604
+ `;
605
+ }
606
+ return css`
582
607
  td.${ClassName.WITH_RESIZE_LINE}::before {
583
608
  content: ' ';
584
609
  position: absolute;
@@ -622,6 +647,24 @@ export const resizeHandle = props => css`
622
647
  z-index: ${columnControlsZIndex * 2};
623
648
  top: -${tableToolbarSize + tableCellBorderWidth}px;
624
649
  }
650
+ `;
651
+ };
652
+ export const resizeHandle = props => css`
653
+ .${ClassName.TABLE_CONTAINER} {
654
+ .${ClassName.RESIZE_HANDLE_DECORATION} {
655
+ background-color: transparent;
656
+ position: absolute;
657
+ width: ${resizeHandlerAreaWidth}px;
658
+ height: 100%;
659
+ top: 0;
660
+ right: -${resizeHandlerAreaWidth / 2}px;
661
+ cursor: col-resize;
662
+ z-index: ${resizeHandlerZIndex};
663
+ }
664
+
665
+ ${getLastColumnResizerOverrides()}
666
+
667
+ ${resizeHandleOverrides(props)}
625
668
 
626
669
  table
627
670
  tr:first-of-type
@@ -635,4 +678,117 @@ export const resizeHandle = props => css`
635
678
  height: calc(100% + ${tableToolbarSize + tableCellBorderWidth}px);
636
679
  }
637
680
  }
681
+ `;
682
+ export const insertLine = props => css`
683
+ .${ClassName.TABLE_CONTAINER} {
684
+ td.${ClassName.WITH_FIRST_COLUMN_INSERT_LINE}::before {
685
+ content: ' ';
686
+ position: absolute;
687
+ left: -1px;
688
+ top: -1px;
689
+ width: ${insertLineWidth}px;
690
+ height: calc(100% + ${tableCellBorderWidth * 2}px);
691
+ background-color: ${tableBorderSelectedColor(props)};
692
+ z-index: ${columnControlsZIndex * 2};
693
+ }
694
+
695
+ th.${ClassName.WITH_FIRST_COLUMN_INSERT_LINE}::before {
696
+ content: ' ';
697
+ left: -1px;
698
+ position: absolute;
699
+ width: ${insertLineWidth}px;
700
+ height: calc(100% + ${tableCellBorderWidth * 2}px);
701
+ background-color: ${tableBorderSelectedColor(props)};
702
+ z-index: ${columnControlsZIndex * 2};
703
+ top: -${tableCellBorderWidth}px;
704
+ }
705
+
706
+ td.${ClassName.WITH_COLUMN_INSERT_LINE}::before {
707
+ content: ' ';
708
+ position: absolute;
709
+ left: ${"var(--ds-space-negative-025, -2px)"};
710
+ top: -1px;
711
+ width: ${insertLineWidth}px;
712
+ height: calc(100% + ${tableCellBorderWidth * 2}px);
713
+ background-color: ${tableBorderSelectedColor(props)};
714
+ z-index: ${columnControlsZIndex * 2};
715
+ }
716
+
717
+ th.${ClassName.WITH_COLUMN_INSERT_LINE}::before {
718
+ content: ' ';
719
+ left: ${"var(--ds-space-negative-025, -2px)"};
720
+ position: absolute;
721
+ width: ${insertLineWidth}px;
722
+ height: calc(100% + ${tableCellBorderWidth * 2}px);
723
+ background-color: ${tableBorderSelectedColor(props)};
724
+ z-index: ${columnControlsZIndex * 2};
725
+ top: -${tableCellBorderWidth}px;
726
+ }
727
+
728
+ td.${ClassName.WITH_LAST_COLUMN_INSERT_LINE}::before {
729
+ content: ' ';
730
+ position: absolute;
731
+ right: -1px;
732
+ top: -1px;
733
+ width: ${insertLineWidth}px;
734
+ height: calc(100% + ${tableCellBorderWidth * 2}px);
735
+ background-color: ${tableBorderSelectedColor(props)};
736
+ z-index: ${columnControlsZIndex * 2};
737
+ }
738
+
739
+ th.${ClassName.WITH_LAST_COLUMN_INSERT_LINE}::before {
740
+ content: ' ';
741
+ right: -1px;
742
+ position: absolute;
743
+ width: ${insertLineWidth}px;
744
+ height: calc(100% + ${tableCellBorderWidth * 2}px);
745
+ background-color: ${tableBorderSelectedColor(props)};
746
+ z-index: ${columnControlsZIndex * 2};
747
+ top: -${tableCellBorderWidth}px;
748
+ }
749
+
750
+ td.${ClassName.WITH_ROW_INSERT_LINE}::before {
751
+ content: ' ';
752
+ position: absolute;
753
+ left: ${"var(--ds-space-negative-025, -2px)"};
754
+ top: -1px;
755
+ height: ${insertLineWidth}px;
756
+ width: calc(100% + ${tableCellBorderWidth * 2}px);
757
+ background-color: ${tableBorderSelectedColor(props)};
758
+ z-index: ${columnControlsZIndex * 2};
759
+ }
760
+
761
+ th.${ClassName.WITH_ROW_INSERT_LINE}::before {
762
+ content: ' ';
763
+ left: ${"var(--ds-space-negative-025, -2px)"};
764
+ position: absolute;
765
+ height: ${insertLineWidth}px;
766
+ width: calc(100% + ${tableCellBorderWidth * 2}px);
767
+ background-color: ${tableBorderSelectedColor(props)};
768
+ z-index: ${columnControlsZIndex * 2};
769
+ top: -1px;
770
+ }
771
+
772
+ td.${ClassName.WITH_LAST_ROW_INSERT_LINE}::before {
773
+ content: ' ';
774
+ position: absolute;
775
+ left: ${"var(--ds-space-negative-025, -2px)"};
776
+ bottom: 0;
777
+ height: ${insertLineWidth}px;
778
+ width: calc(100% + 2px);
779
+ background-color: ${tableBorderSelectedColor(props)};
780
+ z-index: ${columnControlsZIndex * 2};
781
+ }
782
+
783
+ th.${ClassName.WITH_LAST_ROW_INSERT_LINE}::before {
784
+ content: ' ';
785
+ left: ${"var(--ds-space-negative-025, -2px)"};
786
+ bottom: 0;
787
+ position: absolute;
788
+ height: ${insertLineWidth}px;
789
+ width: calc(100% + ${tableCellBorderWidth * 2}px);
790
+ background-color: ${tableBorderSelectedColor(props)};
791
+ z-index: ${columnControlsZIndex * 2};
792
+ }
793
+ }
638
794
  `;
@@ -8,8 +8,10 @@ import { nonNullable } from '@atlaskit/editor-common/utils';
8
8
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
9
9
  import { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
10
10
  import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
11
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
12
  import { TableCssClassName as ClassName, TableDecorations } from '../types';
12
13
  import { ColumnResizeWidget } from '../ui/ColumnResizeWidget';
14
+ import { DragHandle } from '../ui/DragHandle';
13
15
  const filterDecorationByKey = (key, decorationSet) => decorationSet.find(undefined, undefined, spec => spec.key.indexOf(key) > -1);
14
16
  export const findColumnControlSelectedDecoration = decorationSet => filterDecorationByKey(TableDecorations.COLUMN_SELECTED, decorationSet);
15
17
  export const findControlsHoverDecoration = decorationSet => filterDecorationByKey(TableDecorations.ALL_CONTROLS_HOVER, decorationSet);
@@ -128,30 +130,54 @@ export const createColumnSelectedDecoration = tr => {
128
130
  });
129
131
  });
130
132
  };
131
- export const createColumnControlsDecoration = selection => {
133
+ export const createColumnControlsDecoration = (selection, hoverLocation) => {
134
+ // todo: issue here where table may not be selected yet
132
135
  const cells = getCellsInRow(0)(selection) || [];
133
- let index = 0;
134
- return cells.map(cell => {
135
- const colspan = cell.node.attrs.colspan || 1;
136
- // It's important these values are scoped locally as the widget callback could be executed anytime in the future
137
- // and we want to avoid value leak
138
- const startIndex = index;
139
- const endIndex = startIndex + colspan;
140
-
141
- // The next cell start index will commence from the current cell end index.
142
- index = endIndex;
143
- return Decoration.widget(cell.pos + 1, () => {
136
+ const table = findTable(selection);
137
+ if (getBooleanFF('platform.editor.table.drag-and-drop') && hoverLocation && !Number.isNaN(hoverLocation === null || hoverLocation === void 0 ? void 0 : hoverLocation.colIndex) && table) {
138
+ const colIndex = hoverLocation.colIndex;
139
+ const cell = cells[colIndex];
140
+ return [Decoration.widget(cell.pos + 1, () => {
144
141
  const element = document.createElement('div');
145
- element.classList.add(ClassName.COLUMN_CONTROLS_DECORATIONS);
146
- element.dataset.startIndex = `${startIndex}`;
147
- element.dataset.endIndex = `${endIndex}`;
142
+ element.classList.add(ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG);
143
+ ReactDOM.render( /*#__PURE__*/createElement(DragHandle, {
144
+ tableLocalId: table.node.attrs.localId,
145
+ direction: 'column',
146
+ indexes: [colIndex]
147
+ }), element);
148
148
  return element;
149
149
  }, {
150
- key: `${TableDecorations.COLUMN_CONTROLS_DECORATIONS}_${endIndex}`,
150
+ key: `${TableDecorations.COLUMN_CONTROLS_DECORATIONS}_${colIndex}`,
151
151
  // this decoration should be the first one, even before gap cursor.
152
- side: -100
152
+ side: -100,
153
+ destroy: node => {
154
+ ReactDOM.unmountComponentAtNode(node);
155
+ }
156
+ })];
157
+ } else {
158
+ let index = 0;
159
+ return cells.map(cell => {
160
+ const colspan = cell.node.attrs.colspan || 1;
161
+ // It's important these values are scoped locally as the widget callback could be executed anytime in the future
162
+ // and we want to avoid value leak
163
+ const startIndex = index;
164
+ const endIndex = startIndex + colspan;
165
+
166
+ // The next cell start index will commence from the current cell end index.
167
+ index = endIndex;
168
+ return Decoration.widget(cell.pos + 1, () => {
169
+ const element = document.createElement('div');
170
+ element.classList.add(ClassName.COLUMN_CONTROLS_DECORATIONS);
171
+ element.dataset.startIndex = `${startIndex}`;
172
+ element.dataset.endIndex = `${endIndex}`;
173
+ return element;
174
+ }, {
175
+ key: `${TableDecorations.COLUMN_CONTROLS_DECORATIONS}_${endIndex}`,
176
+ // this decoration should be the first one, even before gap cursor.
177
+ side: -100
178
+ });
153
179
  });
154
- });
180
+ }
155
181
  };
156
182
  export const updateDecorations = (node, decorationSet, decorations, key) => {
157
183
  const filteredDecorations = filterDecorationByKey(key, decorationSet);
@@ -404,4 +430,66 @@ export const createColumnLineResize = (selection, cellColumnPositioning) => {
404
430
  key: `${TableDecorations.COLUMN_RESIZING_HANDLE_LINE}_${cellColumnPositioning.right}_${index}`
405
431
  });
406
432
  }).filter(nonNullable);
433
+ };
434
+ export const createColumnInsertLine = (columnIndex, selection) => {
435
+ const table = findTable(selection);
436
+ if (!table) {
437
+ return [];
438
+ }
439
+ const map = TableMap.get(table.node);
440
+ const isFirstColumn = columnIndex === 0;
441
+ const isLastColumn = columnIndex === map.width;
442
+ if (isLastColumn) {
443
+ columnIndex -= 1;
444
+ }
445
+ const decorationClassName = isFirstColumn ? ClassName.WITH_FIRST_COLUMN_INSERT_LINE : isLastColumn ? ClassName.WITH_LAST_COLUMN_INSERT_LINE : ClassName.WITH_COLUMN_INSERT_LINE;
446
+ const cellPositions = makeArray(map.height).map(rowIndex => map.map[map.width * rowIndex + columnIndex]).filter((cellPosition, rowIndex) => {
447
+ if (isLastColumn) {
448
+ return true; // If is the last column no filter applied
449
+ }
450
+
451
+ const nextPosition = map.map[map.width * rowIndex + columnIndex - 1];
452
+ return cellPosition !== nextPosition; // Removed it if next position is merged
453
+ });
454
+
455
+ const cells = cellPositions.map(pos => ({
456
+ pos: pos + table.start,
457
+ node: table.node.nodeAt(pos)
458
+ }));
459
+ return cells.map((cell, index) => {
460
+ if (!cell || !cell.node) {
461
+ return;
462
+ }
463
+ return Decoration.node(cell.pos, cell.pos + cell.node.nodeSize, {
464
+ class: decorationClassName
465
+ }, {
466
+ key: `${TableDecorations.COLUMN_INSERT_LINE}_${index}`
467
+ });
468
+ }).filter(nonNullable);
469
+ };
470
+ export const createRowInsertLine = (rowIndex, selection) => {
471
+ const table = findTable(selection);
472
+ if (!table) {
473
+ return [];
474
+ }
475
+ const map = TableMap.get(table.node);
476
+ const isLastRow = rowIndex === map.height;
477
+ if (isLastRow) {
478
+ rowIndex -= 1;
479
+ }
480
+ const cells = getCellsInRow(rowIndex)(selection);
481
+ if (!cells) {
482
+ return [];
483
+ }
484
+ const decorationClassName = isLastRow ? ClassName.WITH_LAST_ROW_INSERT_LINE : ClassName.WITH_ROW_INSERT_LINE;
485
+ return cells.map((cell, index) => {
486
+ if (!cell || !cell.node) {
487
+ return;
488
+ }
489
+ return Decoration.node(cell.pos, cell.pos + cell.node.nodeSize, {
490
+ class: decorationClassName
491
+ }, {
492
+ key: `${TableDecorations.ROW_INSERT_LINE}_${index}`
493
+ });
494
+ }).filter(nonNullable);
407
495
  };
@@ -9,7 +9,9 @@ export const isCornerButton = node => containsClassName(node, ClassName.CONTROLS
9
9
  export const isInsertRowButton = node => containsClassName(node, ClassName.CONTROLS_INSERT_ROW) || closestElement(node, `.${ClassName.CONTROLS_INSERT_ROW}`) || containsClassName(node, ClassName.CONTROLS_BUTTON_OVERLAY) && closestElement(node, `.${ClassName.ROW_CONTROLS}`);
10
10
  export const getColumnOrRowIndex = target => [parseInt(target.getAttribute('data-start-index') || '-1', 10), parseInt(target.getAttribute('data-end-index') || '-1', 10)];
11
11
  export const isColumnControlsDecorations = node => containsClassName(node, ClassName.COLUMN_CONTROLS_DECORATIONS);
12
+ export const isColumnDragControlsDecorations = node => containsClassName(node, ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG) || closestElement(node, `.${ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG}`);
12
13
  export const isRowControlsButton = node => containsClassName(node, ClassName.ROW_CONTROLS_BUTTON) || containsClassName(node, ClassName.NUMBERED_COLUMN_BUTTON);
14
+ export const isRowDragControlsButton = node => containsClassName(node, ClassName.ROW_CONTROLS_WITH_DRAG) || closestElement(node, `.${ClassName.ROW_CONTROLS_WITH_DRAG}`);
13
15
  export const isResizeHandleDecoration = node => containsClassName(node, ClassName.RESIZE_HANDLE_DECORATION);
14
16
  export const isTableControlsButton = node => containsClassName(node, ClassName.CONTROLS_BUTTON) || containsClassName(node, ClassName.ROW_CONTROLS_BUTTON_WRAP);
15
17
  export const isTableContainerOrWrapper = node => containsClassName(node, ClassName.TABLE_CONTAINER) || containsClassName(node, ClassName.TABLE_NODE_WRAPPER);
@@ -1,10 +1,11 @@
1
1
  export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, isSelectionUpdated } from './selection';
2
- export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnLineResize } from './decoration';
2
+ export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine } from './decoration';
3
3
  export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isLayoutSupported, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow } from './nodes';
4
4
  export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell } from './paste';
5
- export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler } from './dom';
5
+ export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isColumnDragControlsDecorations, isRowDragControlsButton, isRowControlsButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler } from './dom';
6
6
  export { getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames } from './column-controls';
7
7
  export { getRowHeights, isRowDeleteButtonVisible, getRowDeleteButtonParams, getRowsParams, getRowClassNames, copyPreviousRow } from './row-controls';
8
8
  export { getSelectedTableInfo, getSelectedCellInfo } from './analytics';
9
9
  export { getMergedCellsPositions } from './table';
10
- export { updatePluginStateDecorations } from './update-plugin-state-decorations';
10
+ export { updatePluginStateDecorations } from './update-plugin-state-decorations';
11
+ export { hasMergedCellsInColumn, hasMergedCellsInRow } from './merged-cells';
@@ -0,0 +1,48 @@
1
+ import { findTable, TableMap } from '@atlaskit/editor-tables';
2
+ const hasMergedCells = (indexes, normalizeRect) => selection => {
3
+ const table = findTable(selection);
4
+ if (!table) {
5
+ return false;
6
+ }
7
+ const map = TableMap.get(table.node);
8
+ const cellPositions = new Set();
9
+ const mergedCells = new Set();
10
+ map.map.forEach(value => {
11
+ if (cellPositions.has(value)) {
12
+ mergedCells.add(value);
13
+ } else {
14
+ cellPositions.add(value);
15
+ }
16
+ });
17
+ if (!mergedCells.size) {
18
+ return false;
19
+ }
20
+ return (Array.isArray(indexes) ? indexes : [indexes]).map(index => normalizeRect(index, map)).filter(rect => rect.left < rect.right && rect.top < rect.bottom).some(rect => {
21
+ const n = (rect.right - rect.left) * (rect.bottom - rect.top);
22
+ const cells = map.cellsInRect(rect);
23
+ if (cells.length !== n) {
24
+ // We can quickly assume that if the amount of cells from the map is different to what the rect says
25
+ // then there is most likely merged cells across this area which is removing cells
26
+ return true;
27
+ }
28
+ return cells.some(nodePos => mergedCells.has(nodePos));
29
+ });
30
+ };
31
+ export const hasMergedCellsInColumn = columnIndexes => hasMergedCells(columnIndexes, (index, map) => {
32
+ const x = Math.max(Math.min(index, map.width - 1), 0); // clamped index
33
+ return {
34
+ left: x,
35
+ right: x === index ? x + 1 : x,
36
+ top: 0,
37
+ bottom: map.height
38
+ };
39
+ });
40
+ export const hasMergedCellsInRow = rowIndexes => hasMergedCells(rowIndexes, (index, map) => {
41
+ const y = Math.max(Math.min(index, map.height - 1), 0); // clamped index
42
+ return {
43
+ left: 0,
44
+ right: map.width,
45
+ top: y,
46
+ bottom: y === index ? y + 1 : y
47
+ };
48
+ });
@@ -4,15 +4,9 @@ import { findTable, getCellsInColumn, getCellsInRow } from '@atlaskit/editor-tab
4
4
  import { createCommand } from '../pm-plugins/plugin-factory';
5
5
  import { TableDecorations } from '../types';
6
6
  import { createCellHoverDecoration, createColumnLineResize, createControlsHoverDecoration, getMergedCellsPositions, updatePluginStateDecorations } from '../utils';
7
- // #endregion
8
-
9
- // #region Utils
10
7
  var makeArray = function makeArray(n) {
11
8
  return Array.from(Array(n).keys());
12
9
  };
13
- // #endregion
14
-
15
- // #region Commands
16
10
  export var hoverMergedCells = function hoverMergedCells() {
17
11
  return createCommand(function (state) {
18
12
  var mergedCellsPositions = getMergedCellsPositions(state.tr);
@@ -32,7 +26,7 @@ export var hoverMergedCells = function hoverMergedCells() {
32
26
  });
33
27
  var decorations = createCellHoverDecoration(mergedCells);
34
28
  return {
35
- type: 'HOVER_CELLS',
29
+ type: 'HOVER_MERGED_CELLS',
36
30
  data: {
37
31
  decorationSet: updatePluginStateDecorations(state, decorations, TableDecorations.CELL_CONTROLS_HOVER)
38
32
  }
@@ -137,4 +131,18 @@ export var hideResizeHandleLine = function hideResizeHandleLine() {
137
131
  };
138
132
  });
139
133
  };
140
- // #endregion
134
+ export var hoverCell = function hoverCell(rowIndex, colIndex) {
135
+ return createCommand(function () {
136
+ return {
137
+ type: 'HOVER_CELL',
138
+ data: {
139
+ hoveredCell: {
140
+ rowIndex: rowIndex,
141
+ colIndex: colIndex
142
+ }
143
+ }
144
+ };
145
+ }, function (tr) {
146
+ return tr.setMeta('addToHistory', false);
147
+ });
148
+ };
@@ -1,4 +1,4 @@
1
- export { hoverColumns, hoverRows, hoverTable, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine } from './hover';
1
+ export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine } from './hover';
2
2
  export { insertColumn, insertRow, createTable } from './insert';
3
3
  export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './toggle';
4
4
  export { clearMultipleCells } from './clear';
@@ -16,11 +16,6 @@ import { TableCssClassName as ClassName, TableDecorations } from '../types';
16
16
  import { createColumnControlsDecoration, createColumnSelectedDecoration } from '../utils/decoration';
17
17
  import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isIsolating } from '../utils/nodes';
18
18
  import { updatePluginStateDecorations } from '../utils/update-plugin-state-decorations';
19
- // #endregion
20
-
21
- // #endregion
22
-
23
- // #region Commands
24
19
  export var setEditorFocus = function setEditorFocus(editorHasFocus) {
25
20
  return createCommand({
26
21
  type: 'SET_EDITOR_FOCUS',
@@ -439,5 +434,4 @@ export var addBoldInEmptyHeaderCells = function addBoldInEmptyHeaderCells(tableC
439
434
  }
440
435
  return false;
441
436
  };
442
- };
443
- // #endregion
437
+ };
@@ -5,7 +5,7 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
6
6
  import { TableMap } from '@atlaskit/editor-tables/table-map';
7
7
  import { cellAround, findCellRectClosestToPos, findTable, getSelectionRect, removeTable } from '@atlaskit/editor-tables/utils';
8
- import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverColumns, selectColumn, setEditorFocus, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from './commands';
8
+ import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverCell, hoverColumns, selectColumn, setEditorFocus, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from './commands';
9
9
  import { getPluginState } from './pm-plugins/plugin-factory';
10
10
  import { getPluginState as getResizePluginState } from './pm-plugins/table-resizing/plugin-factory';
11
11
  import { deleteColumns, deleteRows } from './transforms';
@@ -164,11 +164,15 @@ export var handleMouseLeave = function handleMouseLeave(view, event) {
164
164
  dispatch = view.dispatch;
165
165
  var _getPluginState2 = getPluginState(state),
166
166
  insertColumnButtonIndex = _getPluginState2.insertColumnButtonIndex,
167
- insertRowButtonIndex = _getPluginState2.insertRowButtonIndex;
167
+ insertRowButtonIndex = _getPluginState2.insertRowButtonIndex,
168
+ isDragAndDropEnabled = _getPluginState2.isDragAndDropEnabled;
168
169
  var target = event.target;
169
170
  if (isTableControlsButton(target)) {
170
171
  return true;
171
172
  }
173
+ if (isDragAndDropEnabled) {
174
+ hoverCell(undefined, undefined)(state, dispatch);
175
+ }
172
176
  if ((typeof insertColumnButtonIndex !== 'undefined' || typeof insertRowButtonIndex !== 'undefined') && hideInsertColumnOrRowButton()(state, dispatch)) {
173
177
  return true;
174
178
  }
@@ -309,4 +313,27 @@ export var whenTableInFocus = function whenTableInFocus(eventHandler, elementCon
309
313
  }
310
314
  return eventHandler(view, mouseEvent, elementContentRects);
311
315
  };
316
+ };
317
+ var trackCellLocation = function trackCellLocation(view, mouseEvent) {
318
+ var target = mouseEvent.target;
319
+ var maybeTableCell = isElementInTableCell(target);
320
+ if (!maybeTableCell) {
321
+ return;
322
+ }
323
+ var colIndex = maybeTableCell.cellIndex;
324
+ var rowElement = closestElement(target, 'tr');
325
+ var rowIndex = rowElement && rowElement.rowIndex;
326
+ var _getPluginState8 = getPluginState(view.state),
327
+ hoveredCell = _getPluginState8.hoveredCell;
328
+ if (hoveredCell.colIndex !== colIndex || hoveredCell.rowIndex !== rowIndex) {
329
+ hoverCell(rowIndex, colIndex)(view.state, view.dispatch);
330
+ }
331
+ };
332
+ export var withCellTracking = function withCellTracking(eventHandler, elementContentRects) {
333
+ return function (view, mouseEvent) {
334
+ if (getPluginState(view.state).isDragAndDropEnabled) {
335
+ trackCellLocation(view, mouseEvent);
336
+ }
337
+ return eventHandler(view, mouseEvent, elementContentRects);
338
+ };
312
339
  };
@@ -107,7 +107,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
107
107
  tableOptions = _ref3.tableOptions,
108
108
  getEditorFeatureFlags = _ref3.getEditorFeatureFlags,
109
109
  dragAndDropEnabled = _ref3.dragAndDropEnabled;
110
- return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthEnabled, tableResizingEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api);
110
+ return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, breakoutEnabled, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api);
111
111
  }
112
112
  }, {
113
113
  name: 'tablePMColResizing',
@@ -462,7 +462,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
462
462
  // doesn't work well with WithPluginState
463
463
  var _getPluginState2 = getPluginState(view.state),
464
464
  isInDanger = _getPluginState2.isInDanger,
465
- hoveredRows = _getPluginState2.hoveredRows;
465
+ hoveredRows = _getPluginState2.hoveredRows,
466
+ hoveredCell = _getPluginState2.hoveredCell;
466
467
  var tableRef = this.table || undefined;
467
468
  var headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined;
468
469
  var hasHeaderRow = containsHeaderRow(node);
@@ -473,10 +474,12 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
473
474
  tableRef: tableRef,
474
475
  tableActive: tableActive,
475
476
  hoveredRows: hoveredRows,
477
+ hoveredCell: hoveredCell,
476
478
  isInDanger: isInDanger,
477
479
  isResizing: isResizing,
478
480
  isNumberColumnEnabled: node.attrs.isNumberColumnEnabled,
479
481
  isHeaderRowEnabled: isHeaderRowEnabled,
482
+ isDragAndDropEnabled: options === null || options === void 0 ? void 0 : options.isDragAndDropEnabled,
480
483
  ordering: ordering,
481
484
  isHeaderColumnEnabled: isHeaderColumnEnabled,
482
485
  hasHeaderRow: hasHeaderRow
@@ -484,8 +487,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
484
487
  ,
485
488
  selection: view.state.selection,
486
489
  headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
487
- stickyHeader: this.state.stickyHeader,
488
- getEditorFeatureFlags: this.props.getEditorFeatureFlags
490
+ stickyHeader: this.state.stickyHeader
489
491
  }));
490
492
  var colControls = /*#__PURE__*/React.createElement("div", {
491
493
  className: ClassName.COLUMN_CONTROLS_WRAPPER
@@ -249,7 +249,8 @@ export var createTableView = function createTableView(node, view, getPos, portal
249
249
  isBreakoutEnabled = _getPluginState2.isBreakoutEnabled,
250
250
  isFullWidthModeEnabled = _getPluginState2.isFullWidthModeEnabled,
251
251
  wasFullWidthModeEnabled = _getPluginState2.wasFullWidthModeEnabled,
252
- isTableResizingEnabled = _getPluginState2.isTableResizingEnabled;
252
+ isTableResizingEnabled = _getPluginState2.isTableResizingEnabled,
253
+ isDragAndDropEnabled = _getPluginState2.isDragAndDropEnabled;
253
254
  var _getPluginConfig = getPluginConfig(pluginConfig),
254
255
  allowColumnResizing = _getPluginConfig.allowColumnResizing;
255
256
  var hasIntlContext = true;
@@ -264,7 +265,8 @@ export var createTableView = function createTableView(node, view, getPos, portal
264
265
  isBreakoutEnabled: isBreakoutEnabled,
265
266
  isFullWidthModeEnabled: isFullWidthModeEnabled,
266
267
  wasFullWidthModeEnabled: wasFullWidthModeEnabled,
267
- isTableResizingEnabled: isTableResizingEnabled
268
+ isTableResizingEnabled: isTableResizingEnabled,
269
+ isDragAndDropEnabled: isDragAndDropEnabled
268
270
  },
269
271
  getEditorContainerWidth: getEditorContainerWidth,
270
272
  getEditorFeatureFlags: getEditorFeatureFlags,