@atlaskit/editor-plugin-table 22.4.6 → 22.4.7
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 +9 -0
- package/dist/cjs/pm-plugins/utils/nodes.js +17 -2
- package/dist/es2019/pm-plugins/utils/nodes.js +11 -2
- package/dist/esm/pm-plugins/utils/nodes.js +17 -2
- package/dist/types/pm-plugins/utils/nodes.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/utils/nodes.d.ts +3 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 22.4.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`46f34d2400d1c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/46f34d2400d1c) -
|
|
8
|
+
Fixes malfunctioning sticky header when header columns are merged so that headers don't
|
|
9
|
+
stack/overlap.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 22.4.6
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -9,6 +9,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
9
9
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
10
10
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
11
11
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
12
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
13
|
var isIsolating = exports.isIsolating = function isIsolating(node) {
|
|
13
14
|
return !!node.type.spec.isolating;
|
|
14
15
|
};
|
|
@@ -27,7 +28,7 @@ var containsHeaderColumn = exports.containsHeaderColumn = function containsHeade
|
|
|
27
28
|
if (cell && cell.type !== table.type.schema.nodes.tableHeader) {
|
|
28
29
|
return false;
|
|
29
30
|
}
|
|
30
|
-
} catch (
|
|
31
|
+
} catch (_unused) {
|
|
31
32
|
return false;
|
|
32
33
|
}
|
|
33
34
|
}
|
|
@@ -134,11 +135,20 @@ var anyChildCellMergedAcrossRow = function anyChildCellMergedAcrossRow(node) {
|
|
|
134
135
|
return rowspan > 1;
|
|
135
136
|
});
|
|
136
137
|
};
|
|
138
|
+
var anyChildCellMergedAcrossColumn = function anyChildCellMergedAcrossColumn(node) {
|
|
139
|
+
return (0, _utils.mapChildren)(node, function (child) {
|
|
140
|
+
return child.attrs.colspan || 0;
|
|
141
|
+
}).some(function (colspan) {
|
|
142
|
+
return colspan > 1;
|
|
143
|
+
});
|
|
144
|
+
};
|
|
137
145
|
|
|
138
146
|
/**
|
|
139
147
|
* Check if a given node is a header row with this definition:
|
|
140
148
|
* - all children are tableHeader cells
|
|
141
|
-
* - no table cells have been
|
|
149
|
+
* - no table cells have been merged with other table row cells (rowspan > 1)
|
|
150
|
+
* - no table cells have been merged with other table column cells (colspan > 1),
|
|
151
|
+
* (colspan check gated behind platform_editor_fix_sticky_header_malfunction)
|
|
142
152
|
*
|
|
143
153
|
* @param node ProseMirror node
|
|
144
154
|
* @returns boolean if it meets definition
|
|
@@ -147,6 +157,11 @@ var supportedHeaderRow = exports.supportedHeaderRow = function supportedHeaderRo
|
|
|
147
157
|
var allHeaders = (0, _utils.mapChildren)(node, function (child) {
|
|
148
158
|
return child.type.name === 'tableHeader';
|
|
149
159
|
}).every(Boolean);
|
|
160
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_fix_sticky_header_malfunction', 'isEnabled', true)) {
|
|
161
|
+
var someMergedAcrossRow = anyChildCellMergedAcrossRow(node);
|
|
162
|
+
var someMergedAcrossColumn = anyChildCellMergedAcrossColumn(node);
|
|
163
|
+
return allHeaders && !someMergedAcrossRow && !someMergedAcrossColumn;
|
|
164
|
+
}
|
|
150
165
|
var someMerged = anyChildCellMergedAcrossRow(node);
|
|
151
166
|
return allHeaders && !someMerged;
|
|
152
167
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mapChildren } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
3
3
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
5
|
export const isIsolating = node => {
|
|
5
6
|
return !!node.type.spec.isolating;
|
|
6
7
|
};
|
|
@@ -19,7 +20,7 @@ export const containsHeaderColumn = table => {
|
|
|
19
20
|
if (cell && cell.type !== table.type.schema.nodes.tableHeader) {
|
|
20
21
|
return false;
|
|
21
22
|
}
|
|
22
|
-
} catch
|
|
23
|
+
} catch {
|
|
23
24
|
return false;
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -108,17 +109,25 @@ export const isTableNestedUnderBodiedSyncBlock = (state, tablePos) => {
|
|
|
108
109
|
return false;
|
|
109
110
|
};
|
|
110
111
|
const anyChildCellMergedAcrossRow = node => mapChildren(node, child => child.attrs.rowspan || 0).some(rowspan => rowspan > 1);
|
|
112
|
+
const anyChildCellMergedAcrossColumn = node => mapChildren(node, child => child.attrs.colspan || 0).some(colspan => colspan > 1);
|
|
111
113
|
|
|
112
114
|
/**
|
|
113
115
|
* Check if a given node is a header row with this definition:
|
|
114
116
|
* - all children are tableHeader cells
|
|
115
|
-
* - no table cells have been
|
|
117
|
+
* - no table cells have been merged with other table row cells (rowspan > 1)
|
|
118
|
+
* - no table cells have been merged with other table column cells (colspan > 1),
|
|
119
|
+
* (colspan check gated behind platform_editor_fix_sticky_header_malfunction)
|
|
116
120
|
*
|
|
117
121
|
* @param node ProseMirror node
|
|
118
122
|
* @returns boolean if it meets definition
|
|
119
123
|
*/
|
|
120
124
|
export const supportedHeaderRow = node => {
|
|
121
125
|
const allHeaders = mapChildren(node, child => child.type.name === 'tableHeader').every(Boolean);
|
|
126
|
+
if (expValEquals('platform_editor_fix_sticky_header_malfunction', 'isEnabled', true)) {
|
|
127
|
+
const someMergedAcrossRow = anyChildCellMergedAcrossRow(node);
|
|
128
|
+
const someMergedAcrossColumn = anyChildCellMergedAcrossColumn(node);
|
|
129
|
+
return allHeaders && !someMergedAcrossRow && !someMergedAcrossColumn;
|
|
130
|
+
}
|
|
122
131
|
const someMerged = anyChildCellMergedAcrossRow(node);
|
|
123
132
|
return allHeaders && !someMerged;
|
|
124
133
|
};
|
|
@@ -2,6 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
import { mapChildren } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
4
4
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
6
|
export var isIsolating = function isIsolating(node) {
|
|
6
7
|
return !!node.type.spec.isolating;
|
|
7
8
|
};
|
|
@@ -20,7 +21,7 @@ export var containsHeaderColumn = function containsHeaderColumn(table) {
|
|
|
20
21
|
if (cell && cell.type !== table.type.schema.nodes.tableHeader) {
|
|
21
22
|
return false;
|
|
22
23
|
}
|
|
23
|
-
} catch (
|
|
24
|
+
} catch (_unused) {
|
|
24
25
|
return false;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -127,11 +128,20 @@ var anyChildCellMergedAcrossRow = function anyChildCellMergedAcrossRow(node) {
|
|
|
127
128
|
return rowspan > 1;
|
|
128
129
|
});
|
|
129
130
|
};
|
|
131
|
+
var anyChildCellMergedAcrossColumn = function anyChildCellMergedAcrossColumn(node) {
|
|
132
|
+
return mapChildren(node, function (child) {
|
|
133
|
+
return child.attrs.colspan || 0;
|
|
134
|
+
}).some(function (colspan) {
|
|
135
|
+
return colspan > 1;
|
|
136
|
+
});
|
|
137
|
+
};
|
|
130
138
|
|
|
131
139
|
/**
|
|
132
140
|
* Check if a given node is a header row with this definition:
|
|
133
141
|
* - all children are tableHeader cells
|
|
134
|
-
* - no table cells have been
|
|
142
|
+
* - no table cells have been merged with other table row cells (rowspan > 1)
|
|
143
|
+
* - no table cells have been merged with other table column cells (colspan > 1),
|
|
144
|
+
* (colspan check gated behind platform_editor_fix_sticky_header_malfunction)
|
|
135
145
|
*
|
|
136
146
|
* @param node ProseMirror node
|
|
137
147
|
* @returns boolean if it meets definition
|
|
@@ -140,6 +150,11 @@ export var supportedHeaderRow = function supportedHeaderRow(node) {
|
|
|
140
150
|
var allHeaders = mapChildren(node, function (child) {
|
|
141
151
|
return child.type.name === 'tableHeader';
|
|
142
152
|
}).every(Boolean);
|
|
153
|
+
if (expValEquals('platform_editor_fix_sticky_header_malfunction', 'isEnabled', true)) {
|
|
154
|
+
var someMergedAcrossRow = anyChildCellMergedAcrossRow(node);
|
|
155
|
+
var someMergedAcrossColumn = anyChildCellMergedAcrossColumn(node);
|
|
156
|
+
return allHeaders && !someMergedAcrossRow && !someMergedAcrossColumn;
|
|
157
|
+
}
|
|
143
158
|
var someMerged = anyChildCellMergedAcrossRow(node);
|
|
144
159
|
return allHeaders && !someMerged;
|
|
145
160
|
};
|
|
@@ -20,7 +20,9 @@ export declare const isTableNestedUnderBodiedSyncBlock: (state: EditorState, tab
|
|
|
20
20
|
/**
|
|
21
21
|
* Check if a given node is a header row with this definition:
|
|
22
22
|
* - all children are tableHeader cells
|
|
23
|
-
* - no table cells have been
|
|
23
|
+
* - no table cells have been merged with other table row cells (rowspan > 1)
|
|
24
|
+
* - no table cells have been merged with other table column cells (colspan > 1),
|
|
25
|
+
* (colspan check gated behind platform_editor_fix_sticky_header_malfunction)
|
|
24
26
|
*
|
|
25
27
|
* @param node ProseMirror node
|
|
26
28
|
* @returns boolean if it meets definition
|
|
@@ -20,7 +20,9 @@ export declare const isTableNestedUnderBodiedSyncBlock: (state: EditorState, tab
|
|
|
20
20
|
/**
|
|
21
21
|
* Check if a given node is a header row with this definition:
|
|
22
22
|
* - all children are tableHeader cells
|
|
23
|
-
* - no table cells have been
|
|
23
|
+
* - no table cells have been merged with other table row cells (rowspan > 1)
|
|
24
|
+
* - no table cells have been merged with other table column cells (colspan > 1),
|
|
25
|
+
* (colspan check gated behind platform_editor_fix_sticky_header_malfunction)
|
|
24
26
|
*
|
|
25
27
|
* @param node ProseMirror node
|
|
26
28
|
* @returns boolean if it meets definition
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "22.4.
|
|
3
|
+
"version": "22.4.7",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/editor-plugin-batch-attribute-updates": "^10.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-content-insertion": "^10.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^12.1.0",
|
|
40
|
-
"@atlaskit/editor-plugin-extension": "13.5.
|
|
40
|
+
"@atlaskit/editor-plugin-extension": "13.5.3",
|
|
41
41
|
"@atlaskit/editor-plugin-guideline": "^10.1.0",
|
|
42
42
|
"@atlaskit/editor-plugin-interaction": "^19.1.0",
|
|
43
43
|
"@atlaskit/editor-plugin-limited-mode": "^7.2.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@atlaskit/editor-tables": "^2.10.0",
|
|
52
52
|
"@atlaskit/editor-toolbar": "^1.5.0",
|
|
53
53
|
"@atlaskit/editor-ui-control-model": "^1.2.0",
|
|
54
|
-
"@atlaskit/icon": "^
|
|
54
|
+
"@atlaskit/icon": "^35.0.0",
|
|
55
55
|
"@atlaskit/insm": "^0.4.0",
|
|
56
56
|
"@atlaskit/menu": "^8.5.0",
|
|
57
57
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
60
60
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
61
61
|
"@atlaskit/primitives": "^19.0.0",
|
|
62
|
-
"@atlaskit/tmp-editor-statsig": "^81.
|
|
62
|
+
"@atlaskit/tmp-editor-statsig": "^81.1.0",
|
|
63
63
|
"@atlaskit/toggle": "^15.6.0",
|
|
64
64
|
"@atlaskit/tokens": "^13.0.0",
|
|
65
65
|
"@atlaskit/tooltip": "^22.2.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"uuid": "^3.1.0"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@atlaskit/editor-common": "^114.
|
|
77
|
+
"@atlaskit/editor-common": "^114.35.0",
|
|
78
78
|
"react": "^18.2.0",
|
|
79
79
|
"react-dom": "^18.2.0",
|
|
80
80
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|