@atlaskit/editor-plugin-table 7.5.1 → 7.5.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#79502](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/79502) [`be5350055f7a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/be5350055f7a) - [ux] Fix switch focused table cause a crash
8
+
3
9
  ## 7.5.1
4
10
 
5
11
  ### Patch Changes
@@ -234,8 +234,13 @@ var checkEdgeHasMergedCells = exports.checkEdgeHasMergedCells = function checkEd
234
234
  var maxIndex = Math.max.apply(Math, (0, _toConsumableArray2.default)(indexes));
235
235
  var isTopSideHaveMergedCells = false;
236
236
  var isBottomSideHaveMergedCells = false;
237
- var isOldMinIndex = !map[minIndex - 1] && !map[minIndex];
238
- var isOldMaxIndex = !map[maxIndex + 1] && !map[maxIndex];
237
+
238
+ /**
239
+ * this is to check if the cell position from last focused table is overflow. since if you selection from a cell in 6th row and 7th column cell in a 7x8 table to 3x3 table, the cell position will be overflow because new table dont have this cell at all.
240
+ TODO: ED-22335 this should better called only when hover over the drag handle.
241
+ */
242
+ var isOldMinIndex = !map[minIndex - 1] || !map[minIndex];
243
+ var isOldMaxIndex = !map[maxIndex + 1] || !map[maxIndex];
239
244
  if (minIndex > 0 && !isOldMinIndex) {
240
245
  var prevSelectionSet = map[minIndex - 1];
241
246
  var minSelectionSet = map[minIndex];
@@ -212,8 +212,13 @@ export const checkEdgeHasMergedCells = (indexes, tableMap, direction) => {
212
212
  let maxIndex = Math.max(...indexes);
213
213
  let isTopSideHaveMergedCells = false;
214
214
  let isBottomSideHaveMergedCells = false;
215
- let isOldMinIndex = !map[minIndex - 1] && !map[minIndex];
216
- let isOldMaxIndex = !map[maxIndex + 1] && !map[maxIndex];
215
+
216
+ /**
217
+ * this is to check if the cell position from last focused table is overflow. since if you selection from a cell in 6th row and 7th column cell in a 7x8 table to 3x3 table, the cell position will be overflow because new table dont have this cell at all.
218
+ TODO: ED-22335 this should better called only when hover over the drag handle.
219
+ */
220
+ let isOldMinIndex = !map[minIndex - 1] || !map[minIndex];
221
+ let isOldMaxIndex = !map[maxIndex + 1] || !map[maxIndex];
217
222
  if (minIndex > 0 && !isOldMinIndex) {
218
223
  const prevSelectionSet = map[minIndex - 1];
219
224
  const minSelectionSet = map[minIndex];
@@ -227,8 +227,13 @@ export var checkEdgeHasMergedCells = function checkEdgeHasMergedCells(indexes, t
227
227
  var maxIndex = Math.max.apply(Math, _toConsumableArray(indexes));
228
228
  var isTopSideHaveMergedCells = false;
229
229
  var isBottomSideHaveMergedCells = false;
230
- var isOldMinIndex = !map[minIndex - 1] && !map[minIndex];
231
- var isOldMaxIndex = !map[maxIndex + 1] && !map[maxIndex];
230
+
231
+ /**
232
+ * this is to check if the cell position from last focused table is overflow. since if you selection from a cell in 6th row and 7th column cell in a 7x8 table to 3x3 table, the cell position will be overflow because new table dont have this cell at all.
233
+ TODO: ED-22335 this should better called only when hover over the drag handle.
234
+ */
235
+ var isOldMinIndex = !map[minIndex - 1] || !map[minIndex];
236
+ var isOldMaxIndex = !map[maxIndex + 1] || !map[maxIndex];
232
237
  if (minIndex > 0 && !isOldMinIndex) {
233
238
  var prevSelectionSet = map[minIndex - 1];
234
239
  var minSelectionSet = map[minIndex];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.5.1",
3
+ "version": "7.5.2",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -145,4 +145,4 @@
145
145
  "type": "boolean"
146
146
  }
147
147
  }
148
- }
148
+ }
@@ -259,13 +259,17 @@ export const checkEdgeHasMergedCells = (
259
259
  const { mapByRow, mapByColumn } = tableMap;
260
260
  const map = 'row' === direction ? mapByRow : mapByColumn;
261
261
  const lengthLimiter = direction === 'row' ? tableMap.width : tableMap.height;
262
-
263
262
  let minIndex = Math.min(...indexes);
264
263
  let maxIndex = Math.max(...indexes);
265
264
  let isTopSideHaveMergedCells = false;
266
265
  let isBottomSideHaveMergedCells = false;
267
- let isOldMinIndex = !map[minIndex - 1] && !map[minIndex];
268
- let isOldMaxIndex = !map[maxIndex + 1] && !map[maxIndex];
266
+
267
+ /**
268
+ * this is to check if the cell position from last focused table is overflow. since if you selection from a cell in 6th row and 7th column cell in a 7x8 table to 3x3 table, the cell position will be overflow because new table dont have this cell at all.
269
+ TODO: ED-22335 this should better called only when hover over the drag handle.
270
+ */
271
+ let isOldMinIndex = !map[minIndex - 1] || !map[minIndex];
272
+ let isOldMaxIndex = !map[maxIndex + 1] || !map[maxIndex];
269
273
 
270
274
  if (minIndex > 0 && !isOldMinIndex) {
271
275
  const prevSelectionSet = map[minIndex - 1];