@atlaskit/editor-plugin-table 8.4.14 → 9.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/nodeviews/TableRow.js +24 -14
  3. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +9 -84
  4. package/dist/cjs/pm-plugins/table-resizing/plugin.js +2 -2
  5. package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +3 -144
  6. package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +1 -2
  7. package/dist/cjs/pm-plugins/view-mode-sort/utils.js +3 -0
  8. package/dist/cjs/tablePlugin.js +3 -5
  9. package/dist/cjs/ui/DragPreview/index.js +1 -0
  10. package/dist/cjs/ui/FloatingContextualButton/index.js +1 -2
  11. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +2 -4
  12. package/dist/cjs/ui/TableFullWidthLabel/index.js +1 -0
  13. package/dist/cjs/ui/event-handlers.js +18 -7
  14. package/dist/cjs/ui/toolbar.js +1 -4
  15. package/dist/es2019/nodeviews/TableContainer.js +1 -1
  16. package/dist/es2019/nodeviews/TableRow.js +24 -14
  17. package/dist/es2019/pm-plugins/commands/column-resize.js +1 -1
  18. package/dist/es2019/pm-plugins/commands/insert.js +3 -3
  19. package/dist/es2019/pm-plugins/commands/misc.js +1 -1
  20. package/dist/es2019/pm-plugins/drag-and-drop/commands.js +1 -1
  21. package/dist/es2019/pm-plugins/table-analytics.js +1 -1
  22. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +12 -84
  23. package/dist/es2019/pm-plugins/table-resizing/plugin.js +2 -2
  24. package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +2 -2
  25. package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +2 -139
  26. package/dist/es2019/pm-plugins/table-resizing/utils/resize-logic.js +1 -1
  27. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +1 -2
  28. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +1 -1
  29. package/dist/es2019/pm-plugins/transforms/delete-columns.js +1 -1
  30. package/dist/es2019/pm-plugins/transforms/fix-tables.js +1 -1
  31. package/dist/es2019/pm-plugins/transforms/replace-table.js +1 -1
  32. package/dist/es2019/pm-plugins/transforms/split.js +2 -2
  33. package/dist/es2019/pm-plugins/utils/analytics.js +4 -4
  34. package/dist/es2019/pm-plugins/utils/column-controls.js +1 -1
  35. package/dist/es2019/pm-plugins/utils/drag-menu.js +1 -1
  36. package/dist/es2019/pm-plugins/utils/merged-cells.js +4 -4
  37. package/dist/es2019/pm-plugins/utils/nodes.js +3 -3
  38. package/dist/es2019/pm-plugins/utils/row-controls.js +2 -2
  39. package/dist/es2019/pm-plugins/view-mode-sort/index.js +2 -2
  40. package/dist/es2019/pm-plugins/view-mode-sort/utils.js +4 -1
  41. package/dist/es2019/tablePlugin.js +3 -5
  42. package/dist/es2019/ui/DragPreview/index.js +4 -3
  43. package/dist/es2019/ui/FloatingContextualButton/index.js +1 -2
  44. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +4 -6
  45. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +4 -4
  46. package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +2 -2
  47. package/dist/es2019/ui/TableFullWidthLabel/index.js +1 -0
  48. package/dist/es2019/ui/event-handlers.js +12 -1
  49. package/dist/es2019/ui/toolbar.js +1 -4
  50. package/dist/esm/nodeviews/TableRow.js +24 -14
  51. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +11 -85
  52. package/dist/esm/pm-plugins/table-resizing/plugin.js +2 -2
  53. package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +2 -143
  54. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +1 -2
  55. package/dist/esm/pm-plugins/view-mode-sort/utils.js +3 -0
  56. package/dist/esm/tablePlugin.js +3 -5
  57. package/dist/esm/ui/DragPreview/index.js +1 -0
  58. package/dist/esm/ui/FloatingContextualButton/index.js +1 -2
  59. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +2 -4
  60. package/dist/esm/ui/TableFullWidthLabel/index.js +1 -0
  61. package/dist/esm/ui/event-handlers.js +12 -1
  62. package/dist/esm/ui/toolbar.js +1 -4
  63. package/dist/types/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
  64. package/dist/types/pm-plugins/table-resizing/plugin.d.ts +1 -1
  65. package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +0 -24
  66. package/dist/types/tablePluginType.d.ts +0 -1
  67. package/dist/types-ts4.5/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
  68. package/dist/types-ts4.5/pm-plugins/table-resizing/plugin.d.ts +1 -1
  69. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +0 -24
  70. package/dist/types-ts4.5/tablePluginType.d.ts +0 -1
  71. package/package.json +5 -5
  72. package/src/nodeviews/TableComponent.tsx +1 -1
  73. package/src/nodeviews/TableContainer.tsx +1 -1
  74. package/src/nodeviews/TableRow.ts +34 -14
  75. package/src/pm-plugins/commands/column-resize.ts +1 -1
  76. package/src/pm-plugins/commands/hover.ts +2 -2
  77. package/src/pm-plugins/commands/insert.ts +3 -3
  78. package/src/pm-plugins/commands/misc.ts +1 -1
  79. package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +1 -1
  80. package/src/pm-plugins/drag-and-drop/commands.ts +6 -2
  81. package/src/pm-plugins/table-analytics.ts +1 -1
  82. package/src/pm-plugins/table-resizing/event-handlers.ts +35 -121
  83. package/src/pm-plugins/table-resizing/plugin.ts +0 -4
  84. package/src/pm-plugins/table-resizing/utils/colgroup.ts +1 -1
  85. package/src/pm-plugins/table-resizing/utils/misc.ts +2 -2
  86. package/src/pm-plugins/table-resizing/utils/resize-column.ts +1 -219
  87. package/src/pm-plugins/table-resizing/utils/resize-logic.ts +1 -1
  88. package/src/pm-plugins/table-resizing/utils/resize-state.ts +1 -3
  89. package/src/pm-plugins/table-resizing/utils/scale-table.ts +1 -1
  90. package/src/pm-plugins/transforms/column-width.ts +1 -1
  91. package/src/pm-plugins/transforms/delete-columns.ts +1 -1
  92. package/src/pm-plugins/transforms/fix-tables.ts +1 -1
  93. package/src/pm-plugins/transforms/replace-table.ts +1 -1
  94. package/src/pm-plugins/transforms/split.ts +2 -2
  95. package/src/pm-plugins/utils/analytics.ts +4 -4
  96. package/src/pm-plugins/utils/column-controls.ts +1 -1
  97. package/src/pm-plugins/utils/drag-menu.ts +1 -1
  98. package/src/pm-plugins/utils/merged-cells.ts +4 -4
  99. package/src/pm-plugins/utils/nodes.ts +3 -3
  100. package/src/pm-plugins/utils/row-controls.ts +2 -2
  101. package/src/pm-plugins/view-mode-sort/index.ts +2 -2
  102. package/src/pm-plugins/view-mode-sort/utils.ts +3 -1
  103. package/src/tablePlugin.tsx +3 -10
  104. package/src/tablePluginType.ts +0 -1
  105. package/src/ui/DragPreview/index.tsx +4 -3
  106. package/src/ui/FloatingContextualButton/index.tsx +1 -2
  107. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +4 -6
  108. package/src/ui/FloatingDragMenu/DragMenu.tsx +4 -4
  109. package/src/ui/FloatingDragMenu/DropdownMenu.tsx +2 -2
  110. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -1
  111. package/src/ui/TableFloatingColumnControls/index.tsx +1 -1
  112. package/src/ui/TableFullWidthLabel/index.tsx +1 -0
  113. package/src/ui/event-handlers.ts +19 -1
  114. package/src/ui/toolbar.tsx +1 -11
  115. package/tsconfig.app.json +0 -1
  116. package/tsconfig.dev.json +0 -1
@@ -1,13 +1,6 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
1
  // Resize a given column by an amount from the current state
5
- import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
6
- import { akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
7
- import { TableCssClassName as ClassName } from '../../../types';
8
- import { ALIGN_CENTER, ALIGN_START, shouldChangeAlignmentToCenterResized } from '../../utils/alignment';
9
- import { getTableScalingPercent } from './misc';
10
- import { growColumn, shrinkColumn, updateAffectedColumn } from './resize-logic';
2
+
3
+ import { growColumn, shrinkColumn } from './resize-logic';
11
4
  import { updateColgroup } from './resize-state';
12
5
  export var resizeColumn = function resizeColumn(resizeState, colIndex, amount, tableRef, tableNode, selectedColumns) {
13
6
  var isTableScalingEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
@@ -19,138 +12,4 @@ export var resizeColumn = function resizeColumn(resizeState, colIndex, amount, t
19
12
  var newState = resizeAmount > 0 ? growColumn(resizeState, colIndex, resizeAmount, selectedColumns) : resizeAmount < 0 ? shrinkColumn(resizeState, colIndex, resizeAmount, selectedColumns) : resizeState;
20
13
  updateColgroup(newState, tableRef, tableNode, isTableScalingEnabled, scalePercent);
21
14
  return newState;
22
- };
23
- export var resizeColumnAndTable = function resizeColumnAndTable(_ref) {
24
- var resizeState = _ref.resizeState,
25
- colIndex = _ref.colIndex,
26
- amount = _ref.amount,
27
- tableRef = _ref.tableRef,
28
- tableNode = _ref.tableNode,
29
- lineLength = _ref.lineLength,
30
- editorWidth = _ref.width,
31
- isTableAlignmentEnabled = _ref.isTableAlignmentEnabled;
32
- var editorContainerWidth = getEditorContainerWidth(editorWidth);
33
- var isTableLeftAligned = tableNode.attrs.layout === ALIGN_START;
34
- var isNumberColumnEnabled = tableNode.attrs.isNumberColumnEnabled;
35
- var isOverflow = resizeState.tableWidth > resizeState.maxSize;
36
- var resizeAmount = isTableLeftAligned ? amount : amount * 2;
37
- var willTableHitEditorEdge = resizeState.maxSize + resizeAmount > editorContainerWidth;
38
- var willResizedTableStayInOverflow = isOverflow && resizeState.tableWidth + resizeAmount / 2 > resizeState.maxSize;
39
-
40
- // STEP 1: Update col width
41
- if (willTableHitEditorEdge || willResizedTableStayInOverflow) {
42
- var _tableRef$closest;
43
- var tableContainerWidth = (_tableRef$closest = tableRef.closest('.pm-table-container')) === null || _tableRef$closest === void 0 ? void 0 : _tableRef$closest.clientWidth;
44
- resizeAmount = amount < 0 ? amount :
45
- // Ignored via go/ees005
46
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
47
- resizeAmount - (resizeState.maxSize + resizeAmount - tableContainerWidth) / 2;
48
- } else {
49
- var diff = -(resizeState.tableWidth - resizeState.maxSize);
50
- var rest = amount - diff;
51
- var final = isTableLeftAligned ? diff + rest : diff + rest * 2;
52
- resizeAmount = final;
53
- }
54
- var newState = updateAffectedColumn(resizeState, colIndex, resizeAmount);
55
-
56
- // STEP 2: Update table container width
57
- // columns have a min width, so delta !== resizeAmount when this is reached, use this for calculations
58
- var delta = newState.cols[colIndex].width - resizeState.cols[colIndex].width;
59
- newState.maxSize = Math.round(isOverflow ? willResizedTableStayInOverflow ?
60
- // CASE 1A: table will stay in overflow
61
- // do not grow the table because resize is happening in the overflow region
62
- // and the overall table container needs to be retained
63
- isNumberColumnEnabled ? resizeState.maxSize + akEditorTableNumberColumnWidth : resizeState.maxSize :
64
- // CASE 1B: table will no longer be in overflow, so adjust container width
65
- // ensure the table is resized without any 'big jumps' by working out
66
- // the difference between the new table width and the max size and adding the resize
67
- isNumberColumnEnabled ? resizeState.maxSize + akEditorTableNumberColumnWidth + (resizeState.tableWidth - resizeState.maxSize + akEditorTableNumberColumnWidth + delta) : resizeState.maxSize + (resizeState.tableWidth - resizeState.maxSize + delta) : willTableHitEditorEdge ?
68
- // CASE 2: table will hit editor edge
69
- editorContainerWidth :
70
- // CASE 3: table is being resized from a non-overflow state
71
- isNumberColumnEnabled ? resizeState.maxSize + akEditorTableNumberColumnWidth + delta : resizeState.maxSize + delta);
72
-
73
- // do not apply scaling logic because resize state is already scaled
74
- updateColgroup(newState, tableRef, tableNode, false, 1);
75
- updateTablePreview(tableRef, newState.maxSize, shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, tableNode, lineLength, newState.maxSize));
76
- return newState;
77
- };
78
- var updateTablePreview = function updateTablePreview(tableRef, newTableWidth, shouldChangeAlignment) {
79
- var resizingContainer = tableRef.closest(".".concat(ClassName.TABLE_RESIZER_CONTAINER));
80
- var resizingItem = resizingContainer === null || resizingContainer === void 0 ? void 0 : resizingContainer.querySelector('.resizer-item');
81
- var alignmentContainer = resizingContainer === null || resizingContainer === void 0 ? void 0 : resizingContainer.parentElement;
82
- if (resizingItem) {
83
- var newWidth = "".concat(newTableWidth, "px");
84
- // Ignored via go/ees005
85
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
86
- resizingContainer.style.width = newWidth;
87
- // Ignored via go/ees005
88
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
89
- resizingItem.style.width = newWidth;
90
- if (shouldChangeAlignment && alignmentContainer) {
91
- alignmentContainer.style.justifyContent = ALIGN_CENTER;
92
- }
93
- }
94
- };
95
- var getEditorContainerWidth = function getEditorContainerWidth(editorWidth) {
96
- return Math.min(editorWidth - akEditorGutterPaddingDynamic() * 2, akEditorFullWidthLayoutWidth);
97
- };
98
-
99
- /**
100
- * Apply a scaling factor to resize state
101
- */
102
- export var scaleResizeState = function scaleResizeState(_ref2) {
103
- var resizeState = _ref2.resizeState,
104
- tableRef = _ref2.tableRef,
105
- tableNode = _ref2.tableNode,
106
- editorWidth = _ref2.editorWidth,
107
- shouldUseIncreasedScalingPercent = _ref2.shouldUseIncreasedScalingPercent;
108
- var isNumberColumnEnabled = tableNode.attrs.isNumberColumnEnabled;
109
- var isTableScaled = isNumberColumnEnabled || resizeState.maxSize > getEditorContainerWidth(editorWidth);
110
-
111
- // Tables with number column can cause the table to be in two different states:
112
- // 1. The table sum of col widths will be smaller than the max size, which is incorrect. For this
113
- // avoid scaling and take the document width
114
- // 2. The table sum of col widths will be the same size as max width, which happens when the table
115
- // is scaled using preserve table width logic, for this apply a scaled width
116
- // return early if table isn't scaled
117
- if (!isTableScaled || isNumberColumnEnabled && resizeState.maxSize > resizeState.tableWidth) {
118
- return resizeState;
119
- }
120
- var scalePercent = getTableScalingPercent(tableNode, tableRef, shouldUseIncreasedScalingPercent);
121
- var scaledTableWidth = Math.round(resizeState.tableWidth * scalePercent);
122
- var cols = resizeState.cols.map(function (col) {
123
- return _objectSpread(_objectSpread({}, col), {}, {
124
- minWidth: tableCellMinWidth,
125
- width: Math.max(Math.round(col.width * scalePercent), tableCellMinWidth)
126
- });
127
- });
128
- var calculatedTableWidth = cols.reduce(function (prev, curr) {
129
- return prev + curr.width;
130
- }, 0);
131
-
132
- // using Math.round can cause the sum of col widths to be larger than the table width
133
- // distribute the difference to the first column
134
- if (calculatedTableWidth > scaledTableWidth) {
135
- var diff = calculatedTableWidth - scaledTableWidth;
136
- var hasDiffBeenDistributed = false;
137
- cols = cols.map(function (col) {
138
- if (!hasDiffBeenDistributed && col.width - diff >= col.minWidth) {
139
- hasDiffBeenDistributed = true;
140
- return _objectSpread(_objectSpread({}, col), {}, {
141
- width: col.width - diff
142
- });
143
- }
144
- return col;
145
- });
146
- }
147
- var maxSize = isNumberColumnEnabled ? Math.round((resizeState.maxSize + akEditorTableNumberColumnWidth) * scalePercent) : Math.round(resizeState.maxSize * scalePercent);
148
- return _objectSpread(_objectSpread({}, resizeState), {}, {
149
- widths: cols.map(function (col) {
150
- return col.width;
151
- }),
152
- tableWidth: scaledTableWidth,
153
- maxSize: maxSize,
154
- cols: cols
155
- });
156
15
  };
@@ -332,7 +332,6 @@ export var getNewResizeStateFromSelectedColumns = function getNewResizeStateFrom
332
332
  layout: layout,
333
333
  getEditorContainerWidth: getEditorContainerWidth
334
334
  });
335
- var resizeState;
336
335
  var isTableScalingEnabledOnCurrentTable = isTableScalingEnabled;
337
336
  var isTableScalingWithFixedColumnWidthsOptionEnabled = isTableScalingEnabled && isTableFixedColumnWidthsOptionEnabled;
338
337
  if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
@@ -343,7 +342,7 @@ export var getNewResizeStateFromSelectedColumns = function getNewResizeStateFrom
343
342
  isTableScalingEnabledOnCurrentTable = true;
344
343
  shouldUseIncreasedScalingPercent = true;
345
344
  }
346
- resizeState = getResizeState({
345
+ var resizeState = getResizeState({
347
346
  minWidth: tableCellMinWidth,
348
347
  maxSize: maxSize,
349
348
  table: table.node,
@@ -67,6 +67,9 @@ export var toggleSort = function toggleSort(view, event, pluginState) {
67
67
  if (!tableId || !tableNode || (tableNode === null || tableNode === void 0 || (_tableNode$type = tableNode.type) === null || _tableNode$type === void 0 ? void 0 : _tableNode$type.name) !== 'table') {
68
68
  return;
69
69
  }
70
+
71
+ // Ignored via go/ees005
72
+ // eslint-disable-next-line prefer-const
70
73
  var _ref = (pluginState === null || pluginState === void 0 ? void 0 : pluginState[tableId]) || {},
71
74
  index = _ref.index,
72
75
  direction = _ref.direction,
@@ -247,14 +247,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
247
247
  fullWidthEnabled = _ref5.fullWidthEnabled,
248
248
  tableOptions = _ref5.tableOptions,
249
249
  getEditorFeatureFlags = _ref5.getEditorFeatureFlags,
250
- isTableScalingEnabled = _ref5.isTableScalingEnabled,
251
- isNewColumnResizingEnabled = _ref5.isNewColumnResizingEnabled;
250
+ isTableScalingEnabled = _ref5.isTableScalingEnabled;
252
251
  var _pluginConfig2 = pluginConfig(tableOptions),
253
- allowColumnResizing = _pluginConfig2.allowColumnResizing,
254
- allowTableAlignment = _pluginConfig2.allowTableAlignment;
252
+ allowColumnResizing = _pluginConfig2.allowColumnResizing;
255
253
  return allowColumnResizing ? createFlexiResizingPlugin(dispatch, {
256
254
  lastColumnResizable: !fullWidthEnabled
257
- }, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled, allowTableAlignment, !!(options !== null && options !== void 0 && options.isCommentEditor)) : undefined;
255
+ }, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled || false, !!(options !== null && options !== void 0 && options.isCommentEditor)) : undefined;
258
256
  }
259
257
  }, {
260
258
  name: 'tableEditing',
@@ -29,6 +29,7 @@ export var DragPreview = function DragPreview(_ref) {
29
29
  marginLeft: "".concat(marginLeft, "px"),
30
30
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
31
31
  marginTop: "".concat(marginTop, "px"),
32
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
32
33
  transform: transform
33
34
  }
34
35
  }));
@@ -48,8 +48,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
48
48
  }
49
49
  };
50
50
  var domAtPos = editorView.domAtPos.bind(editorView);
51
- var targetCellRef;
52
- targetCellRef = findDomRefAtPos(targetCellPosition, domAtPos);
51
+ var targetCellRef = findDomRefAtPos(targetCellPosition, domAtPos);
53
52
  useEffect(function () {
54
53
  if (isCellMenuOpenByKeyboard && !isContextualMenuOpen) {
55
54
  var state = editorView.state,
@@ -105,14 +105,12 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
105
105
  var _node$attrs, _node$attrs2;
106
106
  var node = isOpen && targetCellPosition ? state.doc.nodeAt(targetCellPosition) : null;
107
107
  var background = hexToEditorBackgroundPaletteColor((node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff');
108
- var selectedRowIndex;
109
- var selectedColumnIndex;
110
108
  var selectedRowAndColumnFromPalette = getSelectedRowAndColumnFromPalette(cellBackgroundColorPalette,
111
109
  // Ignored via go/ees005
112
110
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
113
111
  background, colorPalletteColumns);
114
- selectedRowIndex = selectedRowAndColumnFromPalette.selectedRowIndex;
115
- selectedColumnIndex = selectedRowAndColumnFromPalette.selectedColumnIndex;
112
+ var selectedRowIndex = selectedRowAndColumnFromPalette.selectedRowIndex;
113
+ var selectedColumnIndex = selectedRowAndColumnFromPalette.selectedColumnIndex;
116
114
  return {
117
115
  content: isDragAndDropEnabled ? formatMessage(messages.backgroundColor) : formatMessage(messages.cellBackground),
118
116
  value: {
@@ -8,6 +8,7 @@ var tableFullWidthLabelWrapperStyles = xcss({
8
8
  backgroundColor: 'elevation.surface.overlay',
9
9
  borderRadius: 'border.radius',
10
10
  boxShadow: 'elevation.shadow.overlay',
11
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
11
12
  lineHeight: 1,
12
13
  boxSizing: 'border-box',
13
14
  alignItems: 'center'
@@ -1,8 +1,10 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import rafSchedule from 'raf-schd';
3
3
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
4
+ import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
4
5
  import { browser, closestElement, isElementInTableCell, isLastItemMediaGroup, setNodeSelection } from '@atlaskit/editor-common/utils';
5
6
  import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
7
+ import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
6
8
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
7
9
  import { TableMap } from '@atlaskit/editor-tables/table-map';
8
10
  import { cellAround, findCellRectClosestToPos, findTable, getSelectionRect, removeTable } from '@atlaskit/editor-tables/utils';
@@ -140,7 +142,16 @@ export var handleMouseOver = function handleMouseOver(view, mouseEvent) {
140
142
  _dispatch2 = view.dispatch;
141
143
  return hoverColumns([_startIndex], false)(_state, _dispatch2);
142
144
  }
143
- if ((isCell(target) || isCornerButton(target)) && (typeof insertColumnButtonIndex === 'number' || typeof insertRowButtonIndex === 'number')) {
145
+ var isNestedTable = getParentOfTypeCount(state.schema.nodes.table)(state.selection.$from) > 1;
146
+ if (isNestedTable) {
147
+ // if the table is nested inside a table, we only call hideInsertColumnOrRowButton if the table nearest to the mouse target is NOT the parent table
148
+ var nearestTable = closestElement(target, 'table');
149
+ var nestedTable = findParentNodeOfTypeClosestToPos(state.doc.resolve(state.selection.from), [state.schema.nodes.table]);
150
+ var parentTable = findParentNodeOfTypeClosestToPos(state.doc.resolve((nestedTable === null || nestedTable === void 0 ? void 0 : nestedTable.pos) || 0), [state.schema.nodes.table]);
151
+ if ((nearestTable === null || nearestTable === void 0 ? void 0 : nearestTable.dataset.tableLocalId) !== (parentTable === null || parentTable === void 0 ? void 0 : parentTable.node.attrs.localId)) {
152
+ return hideInsertColumnOrRowButton()(state, dispatch);
153
+ }
154
+ } else if ((isCell(target) || isCornerButton(target)) && (typeof insertColumnButtonIndex === 'number' || typeof insertRowButtonIndex === 'number')) {
144
155
  return hideInsertColumnOrRowButton()(state, dispatch);
145
156
  }
146
157
  if (isResizeHandleDecoration(target)) {
@@ -365,10 +365,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
365
365
 
366
366
  // We don't want to show floating toolbar while resizing the table
367
367
  var isWidthResizing = tableWidthState === null || tableWidthState === void 0 ? void 0 : tableWidthState.resizing;
368
-
369
- // Hide floating toolbar when resizing column and internal column width is on
370
- var shouldHideToolbarForInternalColumnWidth = Boolean((options === null || options === void 0 ? void 0 : options.isNewColumnResizingEnabled) && resizeState && resizeState.dragging);
371
- if (tableObject && pluginState.editorHasFocus && !isWidthResizing && !shouldHideToolbarForInternalColumnWidth) {
368
+ if (tableObject && pluginState.editorHasFocus && !isWidthResizing) {
372
369
  var nodeType = state.schema.nodes.table;
373
370
  var isNested = pluginState.tablePos && isTableNested(state, pluginState.tablePos);
374
371
  var isTableScalingWithFixedColumnWidthsOptionShown = isTableScalingEnabled && isTableFixedColumnWidthsOptionEnabled && !isNested;
@@ -3,4 +3,4 @@ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
3
  import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
4
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { PluginInjectionAPI } from '../../types';
6
- export declare const handleMouseDown: (view: EditorView, event: MouseEvent, localResizeHandlePos: number, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, isTableScalingEnabled: boolean, api: PluginInjectionAPI | undefined | null, nodeViewPortalProviderAPI: PortalProviderAPI, editorAnalyticsAPI?: EditorAnalyticsAPI, isNewColumnResizingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isCommentEditor?: boolean) => boolean;
6
+ export declare const handleMouseDown: (view: EditorView, event: MouseEvent, localResizeHandlePos: number, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, isTableScalingEnabled: boolean, api: PluginInjectionAPI | undefined | null, nodeViewPortalProviderAPI: PortalProviderAPI, editorAnalyticsAPI?: EditorAnalyticsAPI, isCommentEditor?: boolean) => boolean;
@@ -4,4 +4,4 @@ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
6
6
  import type { ColumnResizingPluginState, PluginInjectionAPI } from '../../types';
7
- export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, api: PluginInjectionAPI | undefined | null, nodeViewPortalProviderAPI: PortalProviderAPI, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isNewColumnResizingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isCommentEditor?: boolean): SafePlugin<ColumnResizingPluginState>;
7
+ export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, api: PluginInjectionAPI | undefined | null, nodeViewPortalProviderAPI: PortalProviderAPI, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isCommentEditor?: boolean): SafePlugin<ColumnResizingPluginState>;
@@ -1,27 +1,3 @@
1
- import { type EditorContainerWidth } from '@atlaskit/editor-common/types';
2
1
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
2
  import type { ResizeState } from './types';
4
3
  export declare const resizeColumn: (resizeState: ResizeState, colIndex: number, amount: number, tableRef: HTMLElement | null, tableNode: PmNode, selectedColumns?: number[], isTableScalingEnabled?: boolean, scalePercent?: number) => ResizeState;
5
- type ResizeInformation = {
6
- resizeState: ResizeState;
7
- colIndex: number;
8
- amount: number;
9
- };
10
- type TableReferences = {
11
- tableRef: HTMLElement;
12
- tableNode: PmNode;
13
- };
14
- type TableResizingPluginOptions = {
15
- isTableAlignmentEnabled?: boolean;
16
- };
17
- type ResizeColumnAndTable = ResizeInformation & TableResizingPluginOptions & TableReferences & EditorContainerWidth;
18
- export declare const resizeColumnAndTable: ({ resizeState, colIndex, amount, tableRef, tableNode, lineLength, width: editorWidth, isTableAlignmentEnabled, }: ResizeColumnAndTable) => ResizeState;
19
- /**
20
- * Apply a scaling factor to resize state
21
- */
22
- export declare const scaleResizeState: ({ resizeState, tableRef, tableNode, editorWidth, shouldUseIncreasedScalingPercent, }: TableReferences & {
23
- resizeState: ResizeState;
24
- editorWidth: number;
25
- shouldUseIncreasedScalingPercent: boolean;
26
- }) => ResizeState;
27
- export {};
@@ -18,7 +18,6 @@ export interface TablePluginOptions {
18
18
  fullWidthEnabled?: boolean;
19
19
  wasFullWidthEnabled?: boolean;
20
20
  getEditorFeatureFlags?: GetEditorFeatureFlags;
21
- isNewColumnResizingEnabled?: boolean;
22
21
  isCommentEditor?: boolean;
23
22
  isChromelessEditor?: boolean;
24
23
  }
@@ -3,4 +3,4 @@ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
3
  import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
4
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { PluginInjectionAPI } from '../../types';
6
- export declare const handleMouseDown: (view: EditorView, event: MouseEvent, localResizeHandlePos: number, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, isTableScalingEnabled: boolean, api: PluginInjectionAPI | undefined | null, nodeViewPortalProviderAPI: PortalProviderAPI, editorAnalyticsAPI?: EditorAnalyticsAPI, isNewColumnResizingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isCommentEditor?: boolean) => boolean;
6
+ export declare const handleMouseDown: (view: EditorView, event: MouseEvent, localResizeHandlePos: number, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, isTableScalingEnabled: boolean, api: PluginInjectionAPI | undefined | null, nodeViewPortalProviderAPI: PortalProviderAPI, editorAnalyticsAPI?: EditorAnalyticsAPI, isCommentEditor?: boolean) => boolean;
@@ -4,4 +4,4 @@ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
6
6
  import type { ColumnResizingPluginState, PluginInjectionAPI } from '../../types';
7
- export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, api: PluginInjectionAPI | undefined | null, nodeViewPortalProviderAPI: PortalProviderAPI, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isNewColumnResizingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isCommentEditor?: boolean): SafePlugin<ColumnResizingPluginState>;
7
+ export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, api: PluginInjectionAPI | undefined | null, nodeViewPortalProviderAPI: PortalProviderAPI, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isCommentEditor?: boolean): SafePlugin<ColumnResizingPluginState>;
@@ -1,27 +1,3 @@
1
- import { type EditorContainerWidth } from '@atlaskit/editor-common/types';
2
1
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
2
  import type { ResizeState } from './types';
4
3
  export declare const resizeColumn: (resizeState: ResizeState, colIndex: number, amount: number, tableRef: HTMLElement | null, tableNode: PmNode, selectedColumns?: number[], isTableScalingEnabled?: boolean, scalePercent?: number) => ResizeState;
5
- type ResizeInformation = {
6
- resizeState: ResizeState;
7
- colIndex: number;
8
- amount: number;
9
- };
10
- type TableReferences = {
11
- tableRef: HTMLElement;
12
- tableNode: PmNode;
13
- };
14
- type TableResizingPluginOptions = {
15
- isTableAlignmentEnabled?: boolean;
16
- };
17
- type ResizeColumnAndTable = ResizeInformation & TableResizingPluginOptions & TableReferences & EditorContainerWidth;
18
- export declare const resizeColumnAndTable: ({ resizeState, colIndex, amount, tableRef, tableNode, lineLength, width: editorWidth, isTableAlignmentEnabled, }: ResizeColumnAndTable) => ResizeState;
19
- /**
20
- * Apply a scaling factor to resize state
21
- */
22
- export declare const scaleResizeState: ({ resizeState, tableRef, tableNode, editorWidth, shouldUseIncreasedScalingPercent, }: TableReferences & {
23
- resizeState: ResizeState;
24
- editorWidth: number;
25
- shouldUseIncreasedScalingPercent: boolean;
26
- }) => ResizeState;
27
- export {};
@@ -18,7 +18,6 @@ export interface TablePluginOptions {
18
18
  fullWidthEnabled?: boolean;
19
19
  wasFullWidthEnabled?: boolean;
20
20
  getEditorFeatureFlags?: GetEditorFeatureFlags;
21
- isNewColumnResizingEnabled?: boolean;
22
21
  isCommentEditor?: boolean;
23
22
  isChromelessEditor?: boolean;
24
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "8.4.14",
3
+ "version": "9.0.1",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -30,11 +30,11 @@
30
30
  "@atlaskit/adf-schema": "^46.1.0",
31
31
  "@atlaskit/button": "^20.3.0",
32
32
  "@atlaskit/custom-steps": "^0.9.0",
33
- "@atlaskit/editor-common": "^97.2.0",
33
+ "@atlaskit/editor-common": "^98.2.0",
34
34
  "@atlaskit/editor-palette": "1.6.3",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
- "@atlaskit/editor-plugin-batch-attribute-updates": "1.1.9",
37
+ "@atlaskit/editor-plugin-batch-attribute-updates": "1.1.10",
38
38
  "@atlaskit/editor-plugin-content-insertion": "^1.11.0",
39
39
  "@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
40
40
  "@atlaskit/editor-plugin-guideline": "^1.2.0",
@@ -43,7 +43,7 @@
43
43
  "@atlaskit/editor-prosemirror": "6.2.1",
44
44
  "@atlaskit/editor-shared-styles": "^3.2.0",
45
45
  "@atlaskit/editor-tables": "^2.8.0",
46
- "@atlaskit/icon": "^23.1.0",
46
+ "@atlaskit/icon": "^23.2.0",
47
47
  "@atlaskit/menu": "^2.13.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.3.0",
49
49
  "@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
@@ -51,7 +51,7 @@
51
51
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
52
52
  "@atlaskit/primitives": "^13.3.0",
53
53
  "@atlaskit/theme": "^14.0.0",
54
- "@atlaskit/tmp-editor-statsig": "^2.30.0",
54
+ "@atlaskit/tmp-editor-statsig": "^2.32.0",
55
55
  "@atlaskit/toggle": "^14.0.0",
56
56
  "@atlaskit/tokens": "^2.5.0",
57
57
  "@atlaskit/tooltip": "^19.0.0",
@@ -908,7 +908,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
908
908
  const topShadowPadding = isDragAndDropEnabled ? 0 : shadowPadding;
909
909
  const topOffset = fg('platform_editor_breakout_use_css')
910
910
  ? 0
911
- : (this.state.stickyHeader?.top ?? 0);
911
+ : this.state.stickyHeader?.top ?? 0;
912
912
 
913
913
  const topStickyShadowPosition =
914
914
  this.state.stickyHeader && topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
@@ -303,7 +303,7 @@ export const ResizableTableContainer = React.memo(
303
303
  ? containerWidth - akEditorGutterPaddingDynamic() * 2
304
304
  : containerWidth - akEditorGutterPaddingDynamic() * 2 - resizeHandleSpacing;
305
305
  }
306
- let width =
306
+ const width =
307
307
  !node.attrs.width && isCommentEditor
308
308
  ? responsiveContainerWidth
309
309
  : Math.min(tableWidth, responsiveContainerWidth);
@@ -493,24 +493,44 @@ export default class TableRow extends TableNodeView<HTMLTableRowElement> impleme
493
493
  const tableContainer = wrapper.parentElement;
494
494
  const tableContentWrapper = tableContainer?.parentElement;
495
495
 
496
- const layoutContainer = tableContentWrapper && tableContentWrapper.parentElement;
496
+ const parentContainer = tableContentWrapper && tableContentWrapper.parentElement;
497
497
 
498
- if (isCurrentTableSelected) {
499
- this.colControlsOffset = tableControlsSpacing;
498
+ const isTableInsideLayout =
499
+ parentContainer && parentContainer.getAttribute('data-layout-content');
500
+
501
+ const isNestedTable =
502
+ parentContainer &&
503
+ (parentContainer.className === 'pm-table-header-content-wrap' ||
504
+ parentContainer.className === 'pm-table-cell-content-wrap');
505
+
506
+ const isNestedDataTable =
507
+ parentContainer &&
508
+ parentContainer.getAttribute('data-mark-type') === 'fragment' &&
509
+ (parentContainer.parentElement?.className === 'pm-table-header-content-wrap' ||
510
+ parentContainer.parentElement?.className === 'pm-table-cell-content-wrap');
511
+
512
+ const isTableInsideTable = isNestedTable || isNestedDataTable;
513
+
514
+ if (tableContentWrapper) {
515
+ if (isCurrentTableSelected) {
516
+ this.colControlsOffset = tableControlsSpacing;
500
517
 
501
- if (layoutContainer && layoutContainer.getAttribute('data-layout-content')) {
502
518
  // move table a little out of the way
503
519
  // to provide spacing for table controls
504
- // Ignored via go/ees005
505
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
506
- tableContentWrapper!.style.paddingLeft = '11px';
507
- }
508
- } else {
509
- this.colControlsOffset = 0;
510
- if (layoutContainer && layoutContainer.getAttribute('data-layout-content')) {
511
- // Ignored via go/ees005
512
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
513
- tableContentWrapper!.style.removeProperty('padding-left');
520
+ if (isTableInsideLayout) {
521
+ tableContentWrapper.style.paddingLeft = '11px';
522
+ } else if (isTableInsideTable) {
523
+ tableContentWrapper.style.paddingLeft = '15px';
524
+ tableContentWrapper.style.paddingRight = '4px';
525
+ }
526
+ } else {
527
+ this.colControlsOffset = 0;
528
+ if (isTableInsideLayout) {
529
+ tableContentWrapper.style.removeProperty('padding-left');
530
+ } else if (isTableInsideTable) {
531
+ tableContentWrapper.style.removeProperty('padding-left');
532
+ tableContentWrapper.style.removeProperty('padding-right');
533
+ }
514
534
  }
515
535
  }
516
536
 
@@ -382,7 +382,7 @@ export const changeColumnWidthByStep =
382
382
  isTableScalingEnabled && isCommentEditor && !originalTable.attrs?.width
383
383
  ? getScalingPercentForTableWithoutWidth(originalTable, dom)
384
384
  : getTableScalingPercent(originalTable, dom, shouldUseIncreasedScalingPercent);
385
- let newResizeState = resizeColumn(
385
+ const newResizeState = resizeColumn(
386
386
  initialResizeState,
387
387
  colIndex,
388
388
  stepSize,
@@ -221,8 +221,8 @@ export const hoverCell = (rowIndex?: number, colIndex?: number) =>
221
221
  // If no arguments have been passed then the intention it to reset the hover cell data
222
222
  const clear = rowIndex === undefined && colIndex === undefined;
223
223
 
224
- const nextRowIndex = clear ? undefined : (rowIndex ?? prevHoveredCell.rowIndex);
225
- const nextColIndex = clear ? undefined : (colIndex ?? prevHoveredCell.colIndex);
224
+ const nextRowIndex = clear ? undefined : rowIndex ?? prevHoveredCell.rowIndex;
225
+ const nextColIndex = clear ? undefined : colIndex ?? prevHoveredCell.colIndex;
226
226
 
227
227
  if (nextRowIndex === prevHoveredCell.rowIndex && nextColIndex === prevHoveredCell.colIndex) {
228
228
  return false;
@@ -134,7 +134,7 @@ export const addColumnBefore =
134
134
  return false;
135
135
  }
136
136
  if (dispatch) {
137
- let rect = selectedRect(state);
137
+ const rect = selectedRect(state);
138
138
  dispatch(
139
139
  addColumnAt(
140
140
  api,
@@ -171,7 +171,7 @@ export const addColumnAfter =
171
171
  }
172
172
 
173
173
  if (dispatch) {
174
- let rect = selectedRect(state);
174
+ const rect = selectedRect(state);
175
175
  dispatch(
176
176
  addColumnAt(
177
177
  api,
@@ -201,7 +201,7 @@ export const insertColumn =
201
201
  ) =>
202
202
  (column: number): Command =>
203
203
  (state, dispatch, view) => {
204
- let tr = addColumnAt(
204
+ const tr = addColumnAt(
205
205
  api,
206
206
  isTableScalingEnabled,
207
207
  isTableFixedColumnWidthsOptionEnabled,
@@ -737,7 +737,7 @@ export const addBoldInEmptyHeaderCells =
737
737
 
738
738
  export const updateWidthToWidest = (widthToWidest: WidthToWidest) =>
739
739
  createCommand((state) => {
740
- let { widthToWidest: prevWidthToWidest } = getPluginState(state);
740
+ const { widthToWidest: prevWidthToWidest } = getPluginState(state);
741
741
 
742
742
  if (isEqual(widthToWidest, prevWidthToWidest)) {
743
743
  return false;
@@ -16,7 +16,7 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
16
16
  import { findCellRectClosestToPos, getSelectionRect } from '@atlaskit/editor-tables/utils';
17
17
 
18
18
  import type { DraggableData, DraggableType } from '../../types';
19
- import { getSelectedTableInfo , withEditorAnalyticsAPI } from '../utils/analytics';
19
+ import { getSelectedTableInfo, withEditorAnalyticsAPI } from '../utils/analytics';
20
20
  import { canMove, getTargetIndex } from '../utils/drag-menu';
21
21
  import { getSelectedColumnIndexes, getSelectedRowIndexes } from '../utils/selection';
22
22
 
@@ -5,7 +5,11 @@ import { cloneColumn, cloneRow, moveColumn, moveRow } from '@atlaskit/editor-tab
5
5
 
6
6
  import type { DraggableType, TableDirection } from '../../types';
7
7
  import { TableDecorations } from '../../types';
8
- import { createColumnInsertLine , createRowInsertLine , updateDecorations } from '../utils/decoration';
8
+ import {
9
+ createColumnInsertLine,
10
+ createRowInsertLine,
11
+ updateDecorations,
12
+ } from '../utils/decoration';
9
13
 
10
14
  import { DragAndDropActionType } from './actions';
11
15
  import { DropTargetType } from './consts';
@@ -122,7 +126,7 @@ export const toggleDragMenu = (
122
126
  ) =>
123
127
  createCommand(
124
128
  (state) => {
125
- let {
129
+ const {
126
130
  isDragMenuOpen: previousOpenState,
127
131
  dragMenuDirection: previousDragMenuDirection,
128
132
  dragMenuIndex: previousDragMenuIndex,
@@ -55,7 +55,7 @@ const createPlugin = (
55
55
  appendTransaction: (transactions, oldState, newState) => {
56
56
  const newPluginState = pluginKey.getState(newState);
57
57
  let hasAnalyticsBeenDispatched = false;
58
- let lastTriggerName =
58
+ const lastTriggerName =
59
59
  newPluginState?.lastTrigger?.name ||
60
60
  // NOTE: We assume that we know and can correctly differentiate
61
61
  // between all triggers of table overflow state change.