@atlaskit/editor-plugin-table 7.5.4 → 7.5.6

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 (236) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/commands/column-resize.js +3 -3
  3. package/dist/cjs/commands/delete.js +2 -2
  4. package/dist/cjs/commands/insert.js +15 -15
  5. package/dist/cjs/commands-with-analytics.js +7 -7
  6. package/dist/cjs/event-handlers.js +27 -11
  7. package/dist/cjs/nodeviews/OverflowShadowsObserver.js +24 -15
  8. package/dist/cjs/nodeviews/TableCell.js +5 -30
  9. package/dist/cjs/nodeviews/TableComponent.js +120 -83
  10. package/dist/cjs/nodeviews/TableContainer.js +23 -21
  11. package/dist/cjs/nodeviews/TableResizer.js +13 -13
  12. package/dist/cjs/nodeviews/table.js +9 -9
  13. package/dist/cjs/plugin.js +60 -59
  14. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +13 -13
  15. package/dist/cjs/pm-plugins/keymap.js +6 -8
  16. package/dist/cjs/pm-plugins/main.js +7 -24
  17. package/dist/cjs/pm-plugins/sticky-headers/plugin.js +2 -3
  18. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +12 -12
  19. package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  20. package/dist/cjs/pm-plugins/table-resizing/utils/consts.js +4 -2
  21. package/dist/cjs/pm-plugins/table-resizing/utils/index.js +2 -2
  22. package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +3 -3
  23. package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +3 -3
  24. package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +11 -12
  25. package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +13 -13
  26. package/dist/cjs/pm-plugins/table-width.js +6 -2
  27. package/dist/cjs/toolbar.js +21 -21
  28. package/dist/cjs/transforms/column-width.js +4 -4
  29. package/dist/cjs/transforms/delete-columns.js +2 -2
  30. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +53 -55
  31. package/dist/cjs/ui/FloatingContextualMenu/index.js +2 -4
  32. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +2 -2
  33. package/dist/cjs/ui/FloatingDragMenu/index.js +6 -6
  34. package/dist/cjs/ui/FloatingInsertButton/index.js +6 -7
  35. package/dist/cjs/ui/TableFloatingColumnControls/index.js +8 -48
  36. package/dist/cjs/ui/TableFloatingControls/index.js +113 -223
  37. package/dist/cjs/utils/column-controls.js +5 -5
  38. package/dist/cjs/utils/create.js +2 -5
  39. package/dist/cjs/utils/dom.js +13 -15
  40. package/dist/cjs/utils/drag-menu.js +4 -4
  41. package/dist/es2019/commands/column-resize.js +3 -3
  42. package/dist/es2019/commands/delete.js +2 -2
  43. package/dist/es2019/commands/insert.js +12 -12
  44. package/dist/es2019/commands-with-analytics.js +6 -6
  45. package/dist/es2019/event-handlers.js +27 -11
  46. package/dist/es2019/nodeviews/OverflowShadowsObserver.js +24 -15
  47. package/dist/es2019/nodeviews/TableCell.js +1 -24
  48. package/dist/es2019/nodeviews/TableComponent.js +88 -63
  49. package/dist/es2019/nodeviews/TableContainer.js +20 -22
  50. package/dist/es2019/nodeviews/TableResizer.js +13 -13
  51. package/dist/es2019/nodeviews/table.js +9 -9
  52. package/dist/es2019/plugin.js +19 -20
  53. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +6 -6
  54. package/dist/es2019/pm-plugins/keymap.js +5 -8
  55. package/dist/es2019/pm-plugins/main.js +6 -23
  56. package/dist/es2019/pm-plugins/sticky-headers/plugin.js +1 -1
  57. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +5 -5
  58. package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  59. package/dist/es2019/pm-plugins/table-resizing/utils/consts.js +3 -1
  60. package/dist/es2019/pm-plugins/table-resizing/utils/index.js +1 -1
  61. package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +2 -2
  62. package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +3 -2
  63. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +12 -13
  64. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +13 -13
  65. package/dist/es2019/pm-plugins/table-width.js +6 -2
  66. package/dist/es2019/toolbar.js +15 -15
  67. package/dist/es2019/transforms/column-width.js +5 -5
  68. package/dist/es2019/transforms/delete-columns.js +2 -2
  69. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +9 -12
  70. package/dist/es2019/ui/FloatingContextualMenu/index.js +2 -4
  71. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +2 -2
  72. package/dist/es2019/ui/FloatingDragMenu/index.js +5 -5
  73. package/dist/es2019/ui/FloatingInsertButton/index.js +5 -6
  74. package/dist/es2019/ui/TableFloatingColumnControls/index.js +5 -27
  75. package/dist/es2019/ui/TableFloatingControls/index.js +119 -193
  76. package/dist/es2019/utils/column-controls.js +6 -6
  77. package/dist/es2019/utils/create.js +2 -5
  78. package/dist/es2019/utils/dom.js +13 -15
  79. package/dist/es2019/utils/drag-menu.js +4 -4
  80. package/dist/esm/commands/column-resize.js +3 -3
  81. package/dist/esm/commands/delete.js +2 -2
  82. package/dist/esm/commands/insert.js +15 -15
  83. package/dist/esm/commands-with-analytics.js +7 -7
  84. package/dist/esm/event-handlers.js +27 -11
  85. package/dist/esm/nodeviews/OverflowShadowsObserver.js +24 -15
  86. package/dist/esm/nodeviews/TableCell.js +5 -30
  87. package/dist/esm/nodeviews/TableComponent.js +119 -82
  88. package/dist/esm/nodeviews/TableContainer.js +24 -22
  89. package/dist/esm/nodeviews/TableResizer.js +13 -13
  90. package/dist/esm/nodeviews/table.js +9 -9
  91. package/dist/esm/plugin.js +60 -59
  92. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +13 -13
  93. package/dist/esm/pm-plugins/keymap.js +6 -8
  94. package/dist/esm/pm-plugins/main.js +7 -24
  95. package/dist/esm/pm-plugins/sticky-headers/plugin.js +2 -3
  96. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +12 -12
  97. package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  98. package/dist/esm/pm-plugins/table-resizing/utils/consts.js +3 -1
  99. package/dist/esm/pm-plugins/table-resizing/utils/index.js +1 -1
  100. package/dist/esm/pm-plugins/table-resizing/utils/misc.js +2 -2
  101. package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +4 -3
  102. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +13 -14
  103. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +13 -13
  104. package/dist/esm/pm-plugins/table-width.js +6 -2
  105. package/dist/esm/toolbar.js +21 -21
  106. package/dist/esm/transforms/column-width.js +5 -5
  107. package/dist/esm/transforms/delete-columns.js +2 -2
  108. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +53 -55
  109. package/dist/esm/ui/FloatingContextualMenu/index.js +2 -4
  110. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +2 -2
  111. package/dist/esm/ui/FloatingDragMenu/index.js +6 -6
  112. package/dist/esm/ui/FloatingInsertButton/index.js +6 -7
  113. package/dist/esm/ui/TableFloatingColumnControls/index.js +8 -48
  114. package/dist/esm/ui/TableFloatingControls/index.js +113 -224
  115. package/dist/esm/utils/column-controls.js +6 -6
  116. package/dist/esm/utils/create.js +2 -5
  117. package/dist/esm/utils/dom.js +13 -15
  118. package/dist/esm/utils/drag-menu.js +4 -4
  119. package/dist/types/commands/column-resize.d.ts +1 -1
  120. package/dist/types/commands/delete.d.ts +1 -1
  121. package/dist/types/commands/insert.d.ts +7 -7
  122. package/dist/types/commands-with-analytics.d.ts +3 -3
  123. package/dist/types/event-handlers.d.ts +4 -5
  124. package/dist/types/nodeviews/OverflowShadowsObserver.d.ts +3 -1
  125. package/dist/types/nodeviews/TableCell.d.ts +1 -5
  126. package/dist/types/nodeviews/TableComponent.d.ts +6 -3
  127. package/dist/types/nodeviews/TableContainer.d.ts +6 -4
  128. package/dist/types/nodeviews/TableResizer.d.ts +2 -2
  129. package/dist/types/nodeviews/table.d.ts +1 -1
  130. package/dist/types/nodeviews/types.d.ts +1 -0
  131. package/dist/types/plugin.d.ts +1 -0
  132. package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +1 -2
  133. package/dist/types/pm-plugins/keymap.d.ts +2 -2
  134. package/dist/types/pm-plugins/main.d.ts +1 -1
  135. package/dist/types/pm-plugins/sticky-headers/plugin.d.ts +2 -3
  136. package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -1
  137. package/dist/types/pm-plugins/table-resizing/utils/consts.d.ts +1 -0
  138. package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  139. package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +1 -1
  140. package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -1
  141. package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -4
  142. package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
  143. package/dist/types/pm-plugins/table-width.d.ts +1 -2
  144. package/dist/types/toolbar.d.ts +2 -2
  145. package/dist/types/transforms/column-width.d.ts +1 -1
  146. package/dist/types/transforms/delete-columns.d.ts +1 -1
  147. package/dist/types/types.d.ts +1 -3
  148. package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
  149. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -2
  150. package/dist/types/ui/FloatingDragMenu/index.d.ts +2 -3
  151. package/dist/types/ui/FloatingInsertButton/index.d.ts +1 -2
  152. package/dist/types/ui/TableFloatingColumnControls/index.d.ts +2 -1
  153. package/dist/types/ui/TableFloatingControls/index.d.ts +5 -22
  154. package/dist/types/utils/create.d.ts +1 -2
  155. package/dist/types/utils/dom.d.ts +10 -2
  156. package/dist/types/utils/drag-menu.d.ts +1 -1
  157. package/dist/types-ts4.5/commands/column-resize.d.ts +1 -1
  158. package/dist/types-ts4.5/commands/delete.d.ts +1 -1
  159. package/dist/types-ts4.5/commands/insert.d.ts +7 -7
  160. package/dist/types-ts4.5/commands-with-analytics.d.ts +3 -3
  161. package/dist/types-ts4.5/event-handlers.d.ts +4 -5
  162. package/dist/types-ts4.5/nodeviews/OverflowShadowsObserver.d.ts +3 -1
  163. package/dist/types-ts4.5/nodeviews/TableCell.d.ts +1 -5
  164. package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +6 -3
  165. package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +6 -4
  166. package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -2
  167. package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
  168. package/dist/types-ts4.5/nodeviews/types.d.ts +1 -0
  169. package/dist/types-ts4.5/plugin.d.ts +1 -0
  170. package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +1 -2
  171. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +2 -2
  172. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
  173. package/dist/types-ts4.5/pm-plugins/sticky-headers/plugin.d.ts +2 -3
  174. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -1
  175. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/consts.d.ts +1 -0
  176. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  177. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +1 -1
  178. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -1
  179. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -4
  180. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
  181. package/dist/types-ts4.5/pm-plugins/table-width.d.ts +1 -2
  182. package/dist/types-ts4.5/toolbar.d.ts +2 -2
  183. package/dist/types-ts4.5/transforms/column-width.d.ts +1 -1
  184. package/dist/types-ts4.5/transforms/delete-columns.d.ts +1 -1
  185. package/dist/types-ts4.5/types.d.ts +1 -3
  186. package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
  187. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -2
  188. package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +2 -3
  189. package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +1 -2
  190. package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +2 -1
  191. package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +5 -22
  192. package/dist/types-ts4.5/utils/create.d.ts +1 -2
  193. package/dist/types-ts4.5/utils/dom.d.ts +10 -2
  194. package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
  195. package/package.json +3 -4
  196. package/src/commands/column-resize.ts +4 -3
  197. package/src/commands/delete.ts +2 -2
  198. package/src/commands/insert.ts +15 -27
  199. package/src/commands-with-analytics.ts +6 -9
  200. package/src/event-handlers.ts +107 -105
  201. package/src/nodeviews/OverflowShadowsObserver.ts +32 -21
  202. package/src/nodeviews/TableCell.ts +0 -26
  203. package/src/nodeviews/TableComponent.tsx +107 -78
  204. package/src/nodeviews/TableContainer.tsx +26 -32
  205. package/src/nodeviews/TableResizer.tsx +15 -18
  206. package/src/nodeviews/table.tsx +6 -5
  207. package/src/nodeviews/types.ts +1 -0
  208. package/src/plugin.tsx +17 -32
  209. package/src/pm-plugins/drag-and-drop/plugin.ts +10 -15
  210. package/src/pm-plugins/keymap.ts +6 -13
  211. package/src/pm-plugins/main.ts +6 -25
  212. package/src/pm-plugins/sticky-headers/plugin.ts +2 -11
  213. package/src/pm-plugins/table-resizing/event-handlers.ts +6 -4
  214. package/src/pm-plugins/table-resizing/utils/colgroup.ts +2 -2
  215. package/src/pm-plugins/table-resizing/utils/consts.ts +2 -0
  216. package/src/pm-plugins/table-resizing/utils/index.ts +1 -1
  217. package/src/pm-plugins/table-resizing/utils/misc.ts +2 -2
  218. package/src/pm-plugins/table-resizing/utils/resize-column.ts +5 -2
  219. package/src/pm-plugins/table-resizing/utils/resize-state.ts +18 -13
  220. package/src/pm-plugins/table-resizing/utils/scale-table.ts +14 -14
  221. package/src/pm-plugins/table-width.ts +4 -6
  222. package/src/toolbar.tsx +16 -19
  223. package/src/transforms/column-width.ts +7 -6
  224. package/src/transforms/delete-columns.ts +2 -2
  225. package/src/types.ts +1 -4
  226. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +11 -16
  227. package/src/ui/FloatingContextualMenu/index.tsx +0 -2
  228. package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -3
  229. package/src/ui/FloatingDragMenu/index.tsx +4 -8
  230. package/src/ui/FloatingInsertButton/index.tsx +11 -22
  231. package/src/ui/TableFloatingColumnControls/index.tsx +5 -29
  232. package/src/ui/TableFloatingControls/index.tsx +155 -241
  233. package/src/utils/column-controls.ts +5 -6
  234. package/src/utils/create.ts +2 -5
  235. package/src/utils/dom.ts +12 -19
  236. package/src/utils/drag-menu.ts +7 -12
@@ -1,4 +1,5 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import rafSchedule from 'raf-schd';
2
3
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
3
4
  import { browser, closestElement, isElementInTableCell, isLastItemMediaGroup, setNodeSelection } from '@atlaskit/editor-common/utils';
4
5
  import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
@@ -248,7 +249,10 @@ export var handleMouseLeave = function handleMouseLeave(view, event) {
248
249
  }
249
250
  return false;
250
251
  };
251
- export var handleMouseMove = function handleMouseMove(view, event, elementContentRects) {
252
+
253
+ // IMPORTANT: The mouse move handler has been setup with RAF schedule to avoid Reflows which will occur as some methods
254
+ // need to access the mouse event offset position and also the target clientWidth vallue.
255
+ var handleMouseMoveDebounce = rafSchedule(function (view, event, offsetX) {
252
256
  if (!(event.target instanceof HTMLElement)) {
253
257
  return false;
254
258
  }
@@ -257,13 +261,12 @@ export var handleMouseMove = function handleMouseMove(view, event, elementConten
257
261
  var state = view.state,
258
262
  dispatch = view.dispatch;
259
263
  var _getPluginState6 = getPluginState(state),
260
- insertColumnButtonIndex = _getPluginState6.insertColumnButtonIndex,
261
- isDragAndDropEnabled = _getPluginState6.isDragAndDropEnabled;
264
+ insertColumnButtonIndex = _getPluginState6.insertColumnButtonIndex;
262
265
  var _getColumnOrRowIndex9 = getColumnOrRowIndex(element),
263
266
  _getColumnOrRowIndex10 = _slicedToArray(_getColumnOrRowIndex9, 2),
264
267
  startIndex = _getColumnOrRowIndex10[0],
265
268
  endIndex = _getColumnOrRowIndex10[1];
266
- var positionColumn = getMousePositionHorizontalRelativeByElement(event, elementContentRects, undefined, isDragAndDropEnabled) === 'right' ? endIndex : startIndex;
269
+ var positionColumn = getMousePositionHorizontalRelativeByElement(event, offsetX, undefined) === 'right' ? endIndex : startIndex;
267
270
  if (positionColumn !== insertColumnButtonIndex) {
268
271
  return showInsertColumnButton(positionColumn)(state, dispatch);
269
272
  }
@@ -283,7 +286,7 @@ export var handleMouseMove = function handleMouseMove(view, event, elementConten
283
286
  }
284
287
  }
285
288
  if (!isResizeHandleDecoration(element) && isCell(element)) {
286
- var _positionColumn = getMousePositionHorizontalRelativeByElement(event, elementContentRects, RESIZE_HANDLE_AREA_DECORATION_GAP);
289
+ var _positionColumn = getMousePositionHorizontalRelativeByElement(event, offsetX, RESIZE_HANDLE_AREA_DECORATION_GAP);
287
290
  if (_positionColumn !== null) {
288
291
  var _state4 = view.state,
289
292
  _dispatch5 = view.dispatch;
@@ -308,6 +311,19 @@ export var handleMouseMove = function handleMouseMove(view, event, elementConten
308
311
  }
309
312
  }
310
313
  return false;
314
+ });
315
+ export var handleMouseMove = function handleMouseMove(view, event) {
316
+ if (!(event.target instanceof HTMLElement)) {
317
+ return false;
318
+ }
319
+
320
+ // NOTE: When accessing offsetX in gecko from a deferred callback, it will return 0. However it will be non-zero if accessed
321
+ // within the scope of it's initial mouse move handler. Also Chrome does return the correct value, however it could trigger
322
+ // a reflow. So for now this will just grab the offsetX value immediately for gecko and chrome will calculate later
323
+ // in the deferred callback handler.
324
+ // Bug Tracking: https://bugzilla.mozilla.org/show_bug.cgi?id=1882903
325
+ handleMouseMoveDebounce(view, event, browser.gecko ? event.offsetX : NaN);
326
+ return false;
311
327
  };
312
328
  export function handleTripleClick(view, pos) {
313
329
  var state = view.state,
@@ -328,7 +344,7 @@ export function handleTripleClick(view, pos) {
328
344
  return false;
329
345
  }
330
346
  export var handleCut = function handleCut(oldTr, oldState, newState, editorAnalyticsAPI, editorView) {
331
- var tablePreserveWidth = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
347
+ var isTableScalingEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
332
348
  var oldSelection = oldState.tr.selection;
333
349
  var tr = newState.tr;
334
350
  if (oldSelection instanceof CellSelection) {
@@ -371,7 +387,7 @@ export var handleCut = function handleCut(oldTr, oldState, newState, editorAnaly
371
387
  isHeaderRowRequired = _getPluginState9.pluginConfig.isHeaderRowRequired;
372
388
  tr = deleteRows(rect, isHeaderRowRequired)(tr);
373
389
  } else if (tr.selection.isColSelection()) {
374
- tr = deleteColumns(rect, getAllowAddColumnCustomStep(oldState), editorView, tablePreserveWidth)(tr);
390
+ tr = deleteColumns(rect, getAllowAddColumnCustomStep(oldState), editorView, isTableScalingEnabled)(tr);
375
391
  }
376
392
  }
377
393
  }
@@ -383,12 +399,12 @@ export var isTableInFocus = function isTableInFocus(view) {
383
399
  var _getPluginState10, _getResizePluginState;
384
400
  return !!((_getPluginState10 = getPluginState(view.state)) !== null && _getPluginState10 !== void 0 && _getPluginState10.tableNode) && !((_getResizePluginState = getResizePluginState(view.state)) !== null && _getResizePluginState !== void 0 && _getResizePluginState.dragging);
385
401
  };
386
- export var whenTableInFocus = function whenTableInFocus(eventHandler, elementContentRects) {
402
+ export var whenTableInFocus = function whenTableInFocus(eventHandler) {
387
403
  return function (view, mouseEvent) {
388
404
  if (!isTableInFocus(view)) {
389
405
  return false;
390
406
  }
391
- return eventHandler(view, mouseEvent, elementContentRects);
407
+ return eventHandler(view, mouseEvent);
392
408
  };
393
409
  };
394
410
  var trackCellLocation = function trackCellLocation(view, mouseEvent) {
@@ -418,11 +434,11 @@ var trackCellLocation = function trackCellLocation(view, mouseEvent) {
418
434
  }
419
435
  hoverCell(htmlRowIndex, colIndex)(view.state, view.dispatch);
420
436
  };
421
- export var withCellTracking = function withCellTracking(eventHandler, elementContentRects) {
437
+ export var withCellTracking = function withCellTracking(eventHandler) {
422
438
  return function (view, mouseEvent) {
423
439
  if (getPluginState(view.state).isDragAndDropEnabled && !getDragDropPluginState(view.state).isDragging) {
424
440
  trackCellLocation(view, mouseEvent);
425
441
  }
426
- return eventHandler(view, mouseEvent, elementContentRects);
442
+ return eventHandler(view, mouseEvent);
427
443
  };
428
444
  };
@@ -1,6 +1,7 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import rafSchedule from 'raf-schd';
4
5
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
6
  import { TableCssClassName as ClassName, ShadowEvent } from '../types';
6
7
  import { tableInsertColumnButtonSize } from '../ui/consts';
@@ -42,8 +43,13 @@ export var OverflowShadowsObserver = /*#__PURE__*/function () {
42
43
  });
43
44
  _defineProperty(this, "observeShadowSentinels", function (isSticky) {
44
45
  var _this$table, _this$table2;
46
+ if (_this.isSticky === isSticky) {
47
+ return;
48
+ }
45
49
  _this.isSticky = !!isSticky;
46
50
 
51
+ // reset height
52
+ _this.stickyRowHeight = 0;
47
53
  // update sticky shadows
48
54
  _this.updateStickyShadowsHeightIfChanged();
49
55
  _this.leftShadowSentinel = (_this$table = _this.table) === null || _this$table === void 0 ? void 0 : _this$table.querySelector(".".concat(ClassName.TABLE_SHADOW_SENTINEL_LEFT));
@@ -60,8 +66,8 @@ export var OverflowShadowsObserver = /*#__PURE__*/function () {
60
66
  * e.g. bounds on an IntersectionObserverEntry, otherwise proceed with
61
67
  * reading it from sticky cell
62
68
  */
63
- _defineProperty(this, "updateStickyShadows", function (stickyRowHeight) {
64
- var _this$wrapper, _this$wrapper2, _this$wrapper3;
69
+ _defineProperty(this, "updateStickyShadows", rafSchedule(function (stickyRowHeight) {
70
+ var _this$wrapper;
65
71
  if (!_this.isSticky) {
66
72
  return;
67
73
  }
@@ -69,14 +75,21 @@ export var OverflowShadowsObserver = /*#__PURE__*/function () {
69
75
  if (!stickyCell || !((_this$wrapper = _this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement)) {
70
76
  return;
71
77
  }
72
- var heightStyleOrCompute = "".concat(stickyRowHeight || stickyCell.clientHeight + 1, "px");
73
- // Use getElementsByClassName here for a live node list to capture
74
- // sticky shadows
75
- var liveRightShadows = (_this$wrapper2 = _this.wrapper) === null || _this$wrapper2 === void 0 || (_this$wrapper2 = _this$wrapper2.parentElement) === null || _this$wrapper2 === void 0 ? void 0 : _this$wrapper2.getElementsByClassName("".concat(ClassName.TABLE_RIGHT_SHADOW));
76
- var liveLeftShadows = (_this$wrapper3 = _this.wrapper) === null || _this$wrapper3 === void 0 || (_this$wrapper3 = _this$wrapper3.parentElement) === null || _this$wrapper3 === void 0 ? void 0 : _this$wrapper3.getElementsByClassName("".concat(ClassName.TABLE_LEFT_SHADOW));
77
- updateShadowListForStickyStyles(heightStyleOrCompute, liveLeftShadows);
78
- updateShadowListForStickyStyles(heightStyleOrCompute, liveRightShadows);
79
- });
78
+
79
+ // Reflow Warning! - stickyCell.clientHeight
80
+ var newStickyRowHeight = stickyRowHeight || stickyCell.clientHeight + 1;
81
+ if (newStickyRowHeight !== _this.stickyRowHeight) {
82
+ var _this$wrapper2, _this$wrapper3;
83
+ _this.stickyRowHeight = newStickyRowHeight;
84
+ var heightStyleOrCompute = "".concat(newStickyRowHeight, "px");
85
+ // Use getElementsByClassName here for a live node list to capture
86
+ // sticky shadows
87
+ var liveRightShadows = (_this$wrapper2 = _this.wrapper) === null || _this$wrapper2 === void 0 || (_this$wrapper2 = _this$wrapper2.parentElement) === null || _this$wrapper2 === void 0 ? void 0 : _this$wrapper2.getElementsByClassName("".concat(ClassName.TABLE_RIGHT_SHADOW));
88
+ var liveLeftShadows = (_this$wrapper3 = _this.wrapper) === null || _this$wrapper3 === void 0 || (_this$wrapper3 = _this$wrapper3.parentElement) === null || _this$wrapper3 === void 0 ? void 0 : _this$wrapper3.getElementsByClassName("".concat(ClassName.TABLE_LEFT_SHADOW));
89
+ updateShadowListForStickyStyles(heightStyleOrCompute, liveLeftShadows);
90
+ updateShadowListForStickyStyles(heightStyleOrCompute, liveRightShadows);
91
+ }
92
+ }));
80
93
  this.updateShadowState = updateShadowState;
81
94
  this.table = _table;
82
95
  this.wrapper = wrapper;
@@ -92,11 +105,7 @@ export var OverflowShadowsObserver = /*#__PURE__*/function () {
92
105
  if (!stickyCell) {
93
106
  return;
94
107
  }
95
- var newStickyRowHeight = stickyCell.clientHeight + 1;
96
- if (newStickyRowHeight === this.stickyRowHeight) {
97
- this.stickyRowHeight = newStickyRowHeight;
98
- this.updateStickyShadows(this.stickyRowHeight);
99
- }
108
+ this.updateStickyShadows();
100
109
  }
101
110
  }, {
102
111
  key: "getStickyCell",
@@ -6,35 +6,17 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
8
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
- import uuid from 'uuid';
10
9
  import { getCellAttrs, getCellDomAttrs } from '@atlaskit/adf-schema';
11
- import { getPluginState } from '../pm-plugins/plugin-factory';
12
10
  import TableNodeView from './TableNodeViewBase';
13
11
  var DEFAULT_COL_SPAN = 1;
14
12
  var DEFAULT_ROW_SPAN = 1;
15
13
  var TableCell = /*#__PURE__*/function (_ref) {
16
14
  _inherits(TableCell, _ref);
17
15
  var _super = _createSuper(TableCell);
18
- function TableCell(node, view, getPos, eventDispatcher, observer) {
19
- var _this;
16
+ function TableCell(node, view, getPos, eventDispatcher) {
20
17
  _classCallCheck(this, TableCell);
21
- _this = _super.call(this, node, view, getPos, eventDispatcher);
22
- _this.observer = observer;
23
- var _getPluginState = getPluginState(view.state),
24
- pluginConfig = _getPluginState.pluginConfig,
25
- isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
26
- _this.isStickyHeaderEnabled = !!pluginConfig.stickyHeaders;
27
- _this.isDragAndDropEnabled = !!isDragAndDropEnabled;
28
- if (observer) {
29
- _this.contentDOM.id = uuid();
30
- observer.observe(_this.contentDOM);
31
- }
32
- return _this;
18
+ return _super.call(this, node, view, getPos, eventDispatcher);
33
19
  }
34
-
35
- // @ts-ignore
36
-
37
- // @ts-ignore
38
20
  _createClass(TableCell, [{
39
21
  key: "update",
40
22
  value: function update(node) {
@@ -44,17 +26,10 @@ var TableCell = /*#__PURE__*/function (_ref) {
44
26
  }
45
27
  return didUpdate;
46
28
  }
47
- }, {
48
- key: "destroy",
49
- value: function destroy() {
50
- if (this.observer) {
51
- this.observer.unobserve(this.contentDOM);
52
- }
53
- }
54
29
  }, {
55
30
  key: "updateNodeView",
56
31
  value: function updateNodeView(node) {
57
- var _this2 = this;
32
+ var _this = this;
58
33
  if (this.node.type !== node.type) {
59
34
  return false;
60
35
  }
@@ -85,10 +60,10 @@ var TableCell = /*#__PURE__*/function (_ref) {
85
60
  var _ref5 = _slicedToArray(_ref4, 2),
86
61
  key = _ref5[0],
87
62
  value = _ref5[1];
88
- return _this2.dom.setAttribute(key, value || '');
63
+ return _this.dom.setAttribute(key, value || '');
89
64
  });
90
65
  removedAttrs.forEach(function (key) {
91
- return _this2.dom.removeAttribute(key);
66
+ return _this.dom.removeAttribute(key);
92
67
  });
93
68
  return true;
94
69
  }