@atlaskit/editor-plugin-table 2.5.4 → 2.5.5

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
+ ## 2.5.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d55db921de3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d55db921de3) - improve performance when adding a new column in table
8
+
3
9
  ## 2.5.4
4
10
 
5
11
  ### Patch Changes
@@ -32,22 +32,6 @@ var anyChildCellMergedAcrossRow = function anyChildCellMergedAcrossRow(node) {
32
32
  });
33
33
  };
34
34
 
35
- /**
36
- * Compare two table row nodes and return true if the two table rows have a
37
- * different number of table cells or if table cell row spans are different
38
- */
39
- var rowHasDifferentMergedCells = function rowHasDifferentMergedCells(prevNode, incomingNode) {
40
- var incomingNodeChildrenRowSpan = (0, _utils.mapChildren)(prevNode, function (child) {
41
- return child.attrs.rowspan || 0;
42
- });
43
- var currentNodeChildrenRowSpan = (0, _utils.mapChildren)(incomingNode, function (child) {
44
- return child.attrs.rowspan || 0;
45
- });
46
- return incomingNodeChildrenRowSpan.length !== currentNodeChildrenRowSpan.length || currentNodeChildrenRowSpan.some(function (child, index) {
47
- return child !== incomingNodeChildrenRowSpan[index];
48
- });
49
- };
50
-
51
35
  /**
52
36
  * Check if a given node is a header row with this definition:
53
37
  * - all children are tableHeader cells
@@ -512,10 +496,6 @@ var TableRowNodeView = /*#__PURE__*/function () {
512
496
  return false; // re-create nodeview
513
497
  }
514
498
 
515
- if (rowHasDifferentMergedCells(this.node, node)) {
516
- return false;
517
- }
518
-
519
499
  // node is different but no need to re-create nodeview
520
500
  this.node = node;
521
501
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.5.4",
3
+ "version": "2.5.5",
4
4
  "sideEffects": false
5
5
  }
@@ -18,16 +18,6 @@ const HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200;
18
18
  const HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT = 400;
19
19
  const anyChildCellMergedAcrossRow = node => mapChildren(node, child => child.attrs.rowspan || 0).some(rowspan => rowspan > 1);
20
20
 
21
- /**
22
- * Compare two table row nodes and return true if the two table rows have a
23
- * different number of table cells or if table cell row spans are different
24
- */
25
- const rowHasDifferentMergedCells = (prevNode, incomingNode) => {
26
- const incomingNodeChildrenRowSpan = mapChildren(prevNode, child => child.attrs.rowspan || 0);
27
- const currentNodeChildrenRowSpan = mapChildren(incomingNode, child => child.attrs.rowspan || 0);
28
- return incomingNodeChildrenRowSpan.length !== currentNodeChildrenRowSpan.length || currentNodeChildrenRowSpan.some((child, index) => child !== incomingNodeChildrenRowSpan[index]);
29
- };
30
-
31
21
  /**
32
22
  * Check if a given node is a header row with this definition:
33
23
  * - all children are tableHeader cells
@@ -477,10 +467,6 @@ export class TableRowNodeView {
477
467
  return false; // re-create nodeview
478
468
  }
479
469
 
480
- if (rowHasDifferentMergedCells(this.node, node)) {
481
- return false;
482
- }
483
-
484
470
  // node is different but no need to re-create nodeview
485
471
  this.node = node;
486
472
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.5.4",
3
+ "version": "2.5.5",
4
4
  "sideEffects": false
5
5
  }
@@ -26,22 +26,6 @@ var anyChildCellMergedAcrossRow = function anyChildCellMergedAcrossRow(node) {
26
26
  });
27
27
  };
28
28
 
29
- /**
30
- * Compare two table row nodes and return true if the two table rows have a
31
- * different number of table cells or if table cell row spans are different
32
- */
33
- var rowHasDifferentMergedCells = function rowHasDifferentMergedCells(prevNode, incomingNode) {
34
- var incomingNodeChildrenRowSpan = mapChildren(prevNode, function (child) {
35
- return child.attrs.rowspan || 0;
36
- });
37
- var currentNodeChildrenRowSpan = mapChildren(incomingNode, function (child) {
38
- return child.attrs.rowspan || 0;
39
- });
40
- return incomingNodeChildrenRowSpan.length !== currentNodeChildrenRowSpan.length || currentNodeChildrenRowSpan.some(function (child, index) {
41
- return child !== incomingNodeChildrenRowSpan[index];
42
- });
43
- };
44
-
45
29
  /**
46
30
  * Check if a given node is a header row with this definition:
47
31
  * - all children are tableHeader cells
@@ -505,10 +489,6 @@ export var TableRowNodeView = /*#__PURE__*/function () {
505
489
  return false; // re-create nodeview
506
490
  }
507
491
 
508
- if (rowHasDifferentMergedCells(this.node, node)) {
509
- return false;
510
- }
511
-
512
492
  // node is different but no need to re-create nodeview
513
493
  this.node = node;
514
494
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.5.4",
3
+ "version": "2.5.5",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.5.4",
3
+ "version": "2.5.5",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -27,7 +27,7 @@
27
27
  "releaseModel": "continuous"
28
28
  },
29
29
  "dependencies": {
30
- "@atlaskit/adf-schema": "^26.2.0",
30
+ "@atlaskit/adf-schema": "^26.3.0",
31
31
  "@atlaskit/editor-common": "^74.26.0",
32
32
  "@atlaskit/editor-palette": "1.5.1",
33
33
  "@atlaskit/editor-plugin-analytics": "^0.1.0",
@@ -39,7 +39,8 @@ describe('Snapshot Test: Table', () => {
39
39
  });
40
40
 
41
41
  describe('sticky header', () => {
42
- it('should align with table cell when active', async () => {
42
+ // FIXME: This test was automatically skipped due to failure on 26/07/2023: https://product-fabric.atlassian.net/browse/ED-19223
43
+ it.skip('should align with table cell when active', async () => {
43
44
  await initEditor(page, stickyHeaderWithHorizontalScroll);
44
45
 
45
46
  await clickFirstCell(page, true);
@@ -40,28 +40,6 @@ const anyChildCellMergedAcrossRow = (node: PmNode) =>
40
40
  (rowspan) => rowspan > 1,
41
41
  );
42
42
 
43
- /**
44
- * Compare two table row nodes and return true if the two table rows have a
45
- * different number of table cells or if table cell row spans are different
46
- */
47
- const rowHasDifferentMergedCells = (prevNode: PmNode, incomingNode: PmNode) => {
48
- const incomingNodeChildrenRowSpan = mapChildren(
49
- prevNode,
50
- (child) => child.attrs.rowspan || 0,
51
- );
52
- const currentNodeChildrenRowSpan = mapChildren(
53
- incomingNode,
54
- (child) => child.attrs.rowspan || 0,
55
- );
56
-
57
- return (
58
- incomingNodeChildrenRowSpan.length !== currentNodeChildrenRowSpan.length ||
59
- currentNodeChildrenRowSpan.some(
60
- (child, index) => child !== incomingNodeChildrenRowSpan[index],
61
- )
62
- );
63
- };
64
-
65
43
  /**
66
44
  * Check if a given node is a header row with this definition:
67
45
  * - all children are tableHeader cells
@@ -429,10 +407,6 @@ export class TableRowNodeView implements NodeView {
429
407
  return false; // re-create nodeview
430
408
  }
431
409
 
432
- if (rowHasDifferentMergedCells(this.node, node)) {
433
- return false;
434
- }
435
-
436
410
  // node is different but no need to re-create nodeview
437
411
  this.node = node;
438
412