@atlaskit/editor-plugin-table 23.4.3 → 24.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.
- package/CHANGELOG.md +38 -0
- package/dist/cjs/nodeviews/TableCell.js +4 -27
- package/dist/cjs/nodeviews/TableComponent.js +1 -1
- package/dist/cjs/nodeviews/rounded-table-edges.js +168 -0
- package/dist/cjs/nodeviews/table.js +17 -68
- package/dist/cjs/pm-plugins/table-resizing/utils/dom.js +16 -1
- package/dist/cjs/ui/FloatingContextualButton/styles.js +5 -2
- package/dist/cjs/ui/common-styles.js +1 -1
- package/dist/es2019/nodeviews/TableCell.js +4 -27
- package/dist/es2019/nodeviews/TableComponent.js +2 -2
- package/dist/es2019/nodeviews/rounded-table-edges.js +150 -0
- package/dist/es2019/nodeviews/table.js +15 -62
- package/dist/es2019/pm-plugins/table-resizing/utils/dom.js +15 -0
- package/dist/es2019/ui/FloatingContextualButton/styles.js +5 -2
- package/dist/es2019/ui/common-styles.js +14 -0
- package/dist/esm/nodeviews/TableCell.js +4 -27
- package/dist/esm/nodeviews/TableComponent.js +2 -2
- package/dist/esm/nodeviews/rounded-table-edges.js +161 -0
- package/dist/esm/nodeviews/table.js +17 -68
- package/dist/esm/pm-plugins/table-resizing/utils/dom.js +15 -0
- package/dist/esm/ui/FloatingContextualButton/styles.js +5 -2
- package/dist/esm/ui/common-styles.js +1 -1
- package/dist/types/nodeviews/TableCell.d.ts +0 -5
- package/dist/types/nodeviews/rounded-table-edges.d.ts +26 -0
- package/dist/types/nodeviews/table.d.ts +1 -2
- package/dist/types/pm-plugins/table-resizing/utils/dom.d.ts +4 -0
- package/package.json +38 -46
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 24.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`52a892635e9a0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/52a892635e9a0) -
|
|
8
|
+
Update border-radius for cell menu button to 4px
|
|
9
|
+
- [`11006329a22d1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/11006329a22d1) -
|
|
10
|
+
Clean up experiment `platform_editor_lovability_distribute_column_fix`
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 24.0.0
|
|
14
|
+
|
|
15
|
+
### Major Changes
|
|
16
|
+
|
|
17
|
+
- [`f2dc9097319f0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2dc9097319f0) - ###
|
|
18
|
+
Dropped support for _legacy_ Typescript 4 types. **Typescript 5 is now the new minimum**.
|
|
19
|
+
|
|
20
|
+
Removes the `typesVersions` property and `dist/types-ts4.5` directory from the dist.
|
|
21
|
+
|
|
22
|
+
Types are now exclusively via the `"types": "dist/types/index.d.ts"` property.
|
|
23
|
+
|
|
24
|
+
```diff
|
|
25
|
+
- "typesVersions": {
|
|
26
|
+
- ">=4.5 <4.9": {
|
|
27
|
+
- "*": [
|
|
28
|
+
- "dist/types-ts4.5/*",
|
|
29
|
+
- "dist/types-ts4.5/index.d.ts"
|
|
30
|
+
- ]
|
|
31
|
+
- }
|
|
32
|
+
- },
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- [`a0d08d30a116b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a0d08d30a116b) -
|
|
38
|
+
Fix number column issues with sticky header, refactor table nodeview logic
|
|
39
|
+
- Updated dependencies
|
|
40
|
+
|
|
3
41
|
## 23.4.3
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
|
@@ -58,11 +58,6 @@ var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
58
58
|
var _this;
|
|
59
59
|
(0, _classCallCheck2.default)(this, TableCell);
|
|
60
60
|
_this = _callSuper(this, TableCell, [node, view, getPos, eventDispatcher]);
|
|
61
|
-
/** Cached edge state to avoid redundant DOM writes. */
|
|
62
|
-
(0, _defineProperty2.default)(_this, "prevReachesTop", false);
|
|
63
|
-
(0, _defineProperty2.default)(_this, "prevReachesBottom", false);
|
|
64
|
-
(0, _defineProperty2.default)(_this, "prevReachesLeft", false);
|
|
65
|
-
(0, _defineProperty2.default)(_this, "prevReachesRight", false);
|
|
66
61
|
(0, _defineProperty2.default)(_this, "destroy", function () {
|
|
67
62
|
if (_this.delayHandle && typeof window !== 'undefined') {
|
|
68
63
|
var _window, _window$cancelIdleCal, _window2, _window2$cancelAnimat;
|
|
@@ -144,28 +139,10 @@ var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
144
139
|
var tableMap = _editorTables.TableMap.get(tableNode);
|
|
145
140
|
var cellStartInTable = pos - resolvedPos.start(tableDepth);
|
|
146
141
|
var cellRect = tableMap.findCell(cellStartInTable);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
// Only touch DOM attributes that actually changed
|
|
153
|
-
if (reachesTop !== this.prevReachesTop) {
|
|
154
|
-
this.prevReachesTop = reachesTop;
|
|
155
|
-
this.setDataAttr('data-reaches-top', reachesTop);
|
|
156
|
-
}
|
|
157
|
-
if (reachesBottom !== this.prevReachesBottom) {
|
|
158
|
-
this.prevReachesBottom = reachesBottom;
|
|
159
|
-
this.setDataAttr('data-reaches-bottom', reachesBottom);
|
|
160
|
-
}
|
|
161
|
-
if (reachesLeft !== this.prevReachesLeft) {
|
|
162
|
-
this.prevReachesLeft = reachesLeft;
|
|
163
|
-
this.setDataAttr('data-reaches-left', reachesLeft);
|
|
164
|
-
}
|
|
165
|
-
if (reachesRight !== this.prevReachesRight) {
|
|
166
|
-
this.prevReachesRight = reachesRight;
|
|
167
|
-
this.setDataAttr('data-reaches-right', reachesRight);
|
|
168
|
-
}
|
|
142
|
+
this.setDataAttr('data-reaches-top', cellRect.top === 0);
|
|
143
|
+
this.setDataAttr('data-reaches-bottom', cellRect.bottom >= tableMap.height);
|
|
144
|
+
this.setDataAttr('data-reaches-left', cellRect.left === 0);
|
|
145
|
+
this.setDataAttr('data-reaches-right', cellRect.right >= tableMap.width);
|
|
169
146
|
} catch (_unused) {
|
|
170
147
|
// Position may be stale during document mutations; silently ignore.
|
|
171
148
|
}
|
|
@@ -141,7 +141,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
141
141
|
header.style.marginRight = '2px';
|
|
142
142
|
}
|
|
143
143
|
if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true)) {
|
|
144
|
-
(0, _dom.
|
|
144
|
+
(0, _dom.syncStickyCornerMasks)(_this.table);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.RoundedTableEdges = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
11
|
+
var setDataAttr = function setDataAttr(cell, attr, value) {
|
|
12
|
+
var hasAttr = cell.hasAttribute(attr);
|
|
13
|
+
if (value && !hasAttr) {
|
|
14
|
+
cell.setAttribute(attr, 'true');
|
|
15
|
+
} else if (!value && hasAttr) {
|
|
16
|
+
cell.removeAttribute(attr);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Refreshes the `data-reaches-{top,bottom,left,right}` attributes used by CSS to round
|
|
22
|
+
* the table's corner cells (including merged cells that span to an edge).
|
|
23
|
+
*
|
|
24
|
+
* Edge membership is derived directly from the table map's border rows/columns: a cell
|
|
25
|
+
* reaches an edge iff its offset appears in the corresponding border slice (this naturally
|
|
26
|
+
* accounts for rowspan/colspan cells, whose offset is repeated across every grid slot they
|
|
27
|
+
* cover). This is O(cells) overall, versus O(cells^2) when calling findCell per cell.
|
|
28
|
+
*/
|
|
29
|
+
var refreshRoundedTableEdgeAttrs = function refreshRoundedTableEdgeAttrs(table, tableNode) {
|
|
30
|
+
try {
|
|
31
|
+
var tableMap = _tableMap.TableMap.get(tableNode);
|
|
32
|
+
var width = tableMap.width,
|
|
33
|
+
height = tableMap.height,
|
|
34
|
+
map = tableMap.map;
|
|
35
|
+
var cells = Array.from(table.rows).flatMap(function (row) {
|
|
36
|
+
return Array.from(row.cells);
|
|
37
|
+
});
|
|
38
|
+
var cellOffsets = Array.from(new Set(map));
|
|
39
|
+
var topOffsets = new Set();
|
|
40
|
+
var bottomOffsets = new Set();
|
|
41
|
+
var leftOffsets = new Set();
|
|
42
|
+
var rightOffsets = new Set();
|
|
43
|
+
for (var col = 0; col < width; col++) {
|
|
44
|
+
topOffsets.add(map[col]);
|
|
45
|
+
bottomOffsets.add(map[(height - 1) * width + col]);
|
|
46
|
+
}
|
|
47
|
+
for (var row = 0; row < height; row++) {
|
|
48
|
+
leftOffsets.add(map[row * width]);
|
|
49
|
+
rightOffsets.add(map[row * width + width - 1]);
|
|
50
|
+
}
|
|
51
|
+
cellOffsets.forEach(function (cellOffset, cellIndex) {
|
|
52
|
+
var cell = cells[cellIndex];
|
|
53
|
+
if (!cell) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
setDataAttr(cell, 'data-reaches-top', topOffsets.has(cellOffset));
|
|
57
|
+
setDataAttr(cell, 'data-reaches-bottom', bottomOffsets.has(cellOffset));
|
|
58
|
+
setDataAttr(cell, 'data-reaches-left', leftOffsets.has(cellOffset));
|
|
59
|
+
setDataAttr(cell, 'data-reaches-right', rightOffsets.has(cellOffset));
|
|
60
|
+
});
|
|
61
|
+
} catch (_unused) {
|
|
62
|
+
// Table structure can be transient while ProseMirror normalises transactions.
|
|
63
|
+
// Keep existing edge attrs if the current shape cannot be mapped safely.
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Builds a lightweight signature of the cells sitting on the table's four borders, using
|
|
69
|
+
* their (immutable) ProseMirror node references. The signature changes whenever a border
|
|
70
|
+
* cell is added, removed, merged, or moved (row/column reorder via drag-and-drop) but stays
|
|
71
|
+
* stable across pure text edits in non-edge cells. This lets the controller decide cheaply
|
|
72
|
+
* (O(rows + cols)) whether the rounded-edge attrs need a full refresh, instead of only
|
|
73
|
+
* reacting to width/height changes.
|
|
74
|
+
*/
|
|
75
|
+
var getTableEdgeSignature = function getTableEdgeSignature(tableNode) {
|
|
76
|
+
var edgeCells = [];
|
|
77
|
+
var lastRowIndex = tableNode.childCount - 1;
|
|
78
|
+
tableNode.forEach(function (row, _rowOffset, rowIndex) {
|
|
79
|
+
var isEdgeRow = rowIndex === 0 || rowIndex === lastRowIndex;
|
|
80
|
+
var lastCellIndex = row.childCount - 1;
|
|
81
|
+
row.forEach(function (cell, _cellOffset, cellIndex) {
|
|
82
|
+
if (isEdgeRow || cellIndex === 0 || cellIndex === lastCellIndex) {
|
|
83
|
+
edgeCells.push(cell);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
return edgeCells;
|
|
88
|
+
};
|
|
89
|
+
var tableEdgeSignaturesDiffer = function tableEdgeSignaturesDiffer(prev, next) {
|
|
90
|
+
if (!prev || prev.length !== next.length) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
for (var i = 0; i < prev.length; i++) {
|
|
94
|
+
if (prev[i] !== next[i]) {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Keeps a table's rounded-corner edge attributes in sync as its shape changes.
|
|
103
|
+
*
|
|
104
|
+
* Each TableCell node view refreshes its own edge attrs when its cell attrs change. However,
|
|
105
|
+
* when the table's shape changes (e.g. a new row is inserted below the last row) or cells are
|
|
106
|
+
* reordered (e.g. dragging a row/column to a new position), ProseMirror may reuse the existing
|
|
107
|
+
* neighbouring cells as-is, so those cells never get a chance to update their edge attrs on
|
|
108
|
+
* their own. This controller covers those cases from the table node view.
|
|
109
|
+
*
|
|
110
|
+
* Callers are responsible for feature-gating each call site.
|
|
111
|
+
*/
|
|
112
|
+
var RoundedTableEdges = exports.RoundedTableEdges = /*#__PURE__*/function () {
|
|
113
|
+
// References to the previous render's border cells (O(rows + cols), perimeter-sized, not all cells).
|
|
114
|
+
|
|
115
|
+
function RoundedTableEdges(getTableElement, node) {
|
|
116
|
+
(0, _classCallCheck2.default)(this, RoundedTableEdges);
|
|
117
|
+
this.getTableElement = getTableElement;
|
|
118
|
+
|
|
119
|
+
// Baseline the edge signature so the first content edit doesn't trigger a spurious
|
|
120
|
+
// refresh — the cells set their own edge attrs on construction.
|
|
121
|
+
this.prevSignature = getTableEdgeSignature(node);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Call from the node view's `update()` after `super.update()`. When the border signature
|
|
126
|
+
* changes it schedules a refresh of the edge attrs on the next animation frame.
|
|
127
|
+
*/
|
|
128
|
+
return (0, _createClass2.default)(RoundedTableEdges, [{
|
|
129
|
+
key: "handleUpdate",
|
|
130
|
+
value: function handleUpdate(node) {
|
|
131
|
+
var nextSignature = getTableEdgeSignature(node);
|
|
132
|
+
var edgesChanged = tableEdgeSignaturesDiffer(this.prevSignature, nextSignature);
|
|
133
|
+
this.prevSignature = nextSignature;
|
|
134
|
+
if (edgesChanged) {
|
|
135
|
+
this.scheduleRefresh(node);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Call from the node view's `destroy()` to cancel any pending refresh. */
|
|
140
|
+
}, {
|
|
141
|
+
key: "destroy",
|
|
142
|
+
value: function destroy() {
|
|
143
|
+
if (this.refreshHandle !== undefined) {
|
|
144
|
+
cancelAnimationFrame(this.refreshHandle);
|
|
145
|
+
this.refreshHandle = undefined;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// The refresh runs on the next animation frame because ReactNodeView.update() schedules the
|
|
150
|
+
// table's React render via the portal provider. If we read `table.rows` synchronously, we'd
|
|
151
|
+
// still see the previous DOM.
|
|
152
|
+
}, {
|
|
153
|
+
key: "scheduleRefresh",
|
|
154
|
+
value: function scheduleRefresh(node) {
|
|
155
|
+
var _this = this;
|
|
156
|
+
if (this.refreshHandle !== undefined) {
|
|
157
|
+
cancelAnimationFrame(this.refreshHandle);
|
|
158
|
+
}
|
|
159
|
+
this.refreshHandle = requestAnimationFrame(function () {
|
|
160
|
+
_this.refreshHandle = undefined;
|
|
161
|
+
var table = _this.getTableElement();
|
|
162
|
+
if (table instanceof HTMLTableElement) {
|
|
163
|
+
refreshRoundedTableEdgeAttrs(table, node);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}]);
|
|
168
|
+
}();
|
|
@@ -29,6 +29,7 @@ var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
|
29
29
|
var _tableWidth = require("../pm-plugins/table-width");
|
|
30
30
|
var _nodes = require("../pm-plugins/utils/nodes");
|
|
31
31
|
var _isContentModeSupported = require("../pm-plugins/utils/tableMode/is-content-mode-supported");
|
|
32
|
+
var _roundedTableEdges = require("./rounded-table-edges");
|
|
32
33
|
var _TableComponentWithSharedState = require("./TableComponentWithSharedState");
|
|
33
34
|
var _toDOM = require("./toDOM");
|
|
34
35
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
@@ -65,37 +66,6 @@ var handleInlineTableWidth = function handleInlineTableWidth(table, width) {
|
|
|
65
66
|
}
|
|
66
67
|
table.style.setProperty('width', "".concat(width, "px"));
|
|
67
68
|
};
|
|
68
|
-
var setDataAttr = function setDataAttr(cell, attr, value) {
|
|
69
|
-
var hasAttr = cell.hasAttribute(attr);
|
|
70
|
-
if (value && !hasAttr) {
|
|
71
|
-
cell.setAttribute(attr, 'true');
|
|
72
|
-
} else if (!value && hasAttr) {
|
|
73
|
-
cell.removeAttribute(attr);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
var refreshRoundedTableEdgeAttrs = function refreshRoundedTableEdgeAttrs(table, tableNode) {
|
|
77
|
-
try {
|
|
78
|
-
var tableMap = _tableMap.TableMap.get(tableNode);
|
|
79
|
-
var cells = Array.from(table.rows).flatMap(function (row) {
|
|
80
|
-
return Array.from(row.cells);
|
|
81
|
-
});
|
|
82
|
-
var cellOffsets = Array.from(new Set(tableMap.map));
|
|
83
|
-
cellOffsets.forEach(function (cellOffset, cellIndex) {
|
|
84
|
-
var cell = cells[cellIndex];
|
|
85
|
-
if (!cell) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
var cellRect = tableMap.findCell(cellOffset);
|
|
89
|
-
setDataAttr(cell, 'data-reaches-top', cellRect.top === 0);
|
|
90
|
-
setDataAttr(cell, 'data-reaches-bottom', cellRect.bottom >= tableMap.height);
|
|
91
|
-
setDataAttr(cell, 'data-reaches-left', cellRect.left === 0);
|
|
92
|
-
setDataAttr(cell, 'data-reaches-right', cellRect.right >= tableMap.width);
|
|
93
|
-
});
|
|
94
|
-
} catch (_unused) {
|
|
95
|
-
// Table structure can be transient while ProseMirror normalises transactions.
|
|
96
|
-
// Keep existing edge attrs if the current shape cannot be mapped safely.
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
69
|
var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
100
70
|
function TableView(props) {
|
|
101
71
|
var _this;
|
|
@@ -111,6 +81,11 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
111
81
|
_this.eventDispatcher = props.eventDispatcher;
|
|
112
82
|
_this.options = props.options;
|
|
113
83
|
_this.getEditorFeatureFlags = props.getEditorFeatureFlags;
|
|
84
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true)) {
|
|
85
|
+
_this.roundedTableEdges = new _roundedTableEdges.RoundedTableEdges(function () {
|
|
86
|
+
return _this.table;
|
|
87
|
+
}, props.node);
|
|
88
|
+
}
|
|
114
89
|
_this.handleRef = function (node) {
|
|
115
90
|
return _this._handleTableRef(node);
|
|
116
91
|
};
|
|
@@ -280,43 +255,17 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
280
255
|
}
|
|
281
256
|
}
|
|
282
257
|
}
|
|
283
|
-
}, {
|
|
284
|
-
key: "scheduleRoundedTableEdgeRefresh",
|
|
285
|
-
value:
|
|
286
|
-
// Each TableCell node view refreshes its own edge attrs when its cell attrs change.
|
|
287
|
-
// However, when the table's shape changes (e.g. a new row is inserted below the
|
|
288
|
-
// last row), ProseMirror may reuse the existing neighbouring cells as-is, so those
|
|
289
|
-
// cells never get a chance to update their edge attrs on their own.
|
|
290
|
-
//
|
|
291
|
-
// To cover those cases, we refresh edge attrs from the table node view here.
|
|
292
|
-
//
|
|
293
|
-
// The refresh runs on the next animation frame because ReactNodeView.update()
|
|
294
|
-
// schedules the table's React render via the portal provider. If we read
|
|
295
|
-
// `this.table.rows` synchronously, we'd still see the previous DOM.
|
|
296
|
-
function scheduleRoundedTableEdgeRefresh(node) {
|
|
297
|
-
var _this4 = this;
|
|
298
|
-
if (this.roundedTableEdgeRefreshHandle !== undefined) {
|
|
299
|
-
cancelAnimationFrame(this.roundedTableEdgeRefreshHandle);
|
|
300
|
-
}
|
|
301
|
-
this.roundedTableEdgeRefreshHandle = requestAnimationFrame(function () {
|
|
302
|
-
_this4.roundedTableEdgeRefreshHandle = undefined;
|
|
303
|
-
if (_this4.table instanceof HTMLTableElement) {
|
|
304
|
-
refreshRoundedTableEdgeAttrs(_this4.table, node);
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
258
|
}, {
|
|
309
259
|
key: "update",
|
|
310
260
|
value: function update(node, decorations, innerDecorations, validUpdate) {
|
|
311
|
-
if (!(0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true)) {
|
|
312
|
-
return _superPropGet(TableView, "update", this, 3)([node, decorations, innerDecorations, validUpdate]);
|
|
313
|
-
}
|
|
314
|
-
var currentTableMap = _tableMap.TableMap.get(this.node);
|
|
315
|
-
var nextTableMap = _tableMap.TableMap.get(node);
|
|
316
|
-
var tableGeometryChanged = currentTableMap.width !== nextTableMap.width || currentTableMap.height !== nextTableMap.height;
|
|
317
261
|
var didUpdate = _superPropGet(TableView, "update", this, 3)([node, decorations, innerDecorations, validUpdate]);
|
|
318
|
-
|
|
319
|
-
|
|
262
|
+
|
|
263
|
+
// Keep the rounded-corner edge attrs in sync with structural changes (rows/columns
|
|
264
|
+
// added, removed, merged, or reordered via drag-and-drop) that the cells themselves
|
|
265
|
+
// can miss.
|
|
266
|
+
if (didUpdate && (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true)) {
|
|
267
|
+
var _this$roundedTableEdg;
|
|
268
|
+
(_this$roundedTableEdg = this.roundedTableEdges) === null || _this$roundedTableEdg === void 0 || _this$roundedTableEdg.handleUpdate(node);
|
|
320
269
|
}
|
|
321
270
|
return didUpdate;
|
|
322
271
|
}
|
|
@@ -354,7 +303,7 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
354
303
|
if ((0, _typeof2.default)(node.attrs) !== (0, _typeof2.default)(nextNode.attrs)) {
|
|
355
304
|
return true;
|
|
356
305
|
}
|
|
357
|
-
if ((0, _nodes.tablesHaveDifferentColumnWidths)(node, nextNode)
|
|
306
|
+
if ((0, _nodes.tablesHaveDifferentColumnWidths)(node, nextNode)) {
|
|
358
307
|
return true;
|
|
359
308
|
}
|
|
360
309
|
var attrKeys = Object.keys(node.attrs);
|
|
@@ -397,9 +346,9 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
397
346
|
key: "destroy",
|
|
398
347
|
value: function destroy() {
|
|
399
348
|
var _this$eventDispatcher;
|
|
400
|
-
if (
|
|
401
|
-
|
|
402
|
-
this.
|
|
349
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true)) {
|
|
350
|
+
var _this$roundedTableEdg2;
|
|
351
|
+
(_this$roundedTableEdg2 = this.roundedTableEdges) === null || _this$roundedTableEdg2 === void 0 || _this$roundedTableEdg2.destroy();
|
|
403
352
|
}
|
|
404
353
|
if (this.resizeObserver) {
|
|
405
354
|
this.resizeObserver.disconnect();
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.updateStickyMargins = exports.updateControls = exports.syncStickyRowToTable = exports.isClickNear = exports.getResizeCellPos = exports.clearStickyCornerMaskPositions = void 0;
|
|
6
|
+
exports.updateStickyMargins = exports.updateControls = exports.syncStickyRowToTable = exports.syncStickyCornerMasks = exports.isClickNear = exports.getResizeCellPos = exports.clearStickyCornerMaskPositions = void 0;
|
|
7
7
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
8
8
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
9
9
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
@@ -109,6 +109,21 @@ var applyTableWidthToStickyRow = function applyTableWidthToStickyRow(tableRef, h
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Repositions only the sticky-header corner masks to match the current scroll position.
|
|
115
|
+
*/
|
|
116
|
+
var syncStickyCornerMasks = exports.syncStickyCornerMasks = function syncStickyCornerMasks(tableRef) {
|
|
117
|
+
if (!tableRef) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
var headerRow = tableRef.querySelector('tr[data-header-row]');
|
|
121
|
+
var wrapper = tableRef.parentElement;
|
|
122
|
+
if (!headerRow || !wrapper) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
syncCornerMasksToStickyRow(tableRef, headerRow, wrapper);
|
|
126
|
+
};
|
|
112
127
|
var clearStickyCornerMaskPositions = exports.clearStickyCornerMaskPositions = function clearStickyCornerMaskPositions(tableRef) {
|
|
113
128
|
var wrapper = tableRef === null || tableRef === void 0 ? void 0 : tableRef.parentElement;
|
|
114
129
|
if (!wrapper) {
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.tableFloatingCellButtonStyles = exports.tableFloatingCellButtonSelectedStyles = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
8
9
|
var _consts = require("../consts");
|
|
9
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
11
|
|
|
@@ -14,7 +15,8 @@ var tableFloatingCellButtonStyles = exports.tableFloatingCellButtonStyles = func
|
|
|
14
15
|
'> div': {
|
|
15
16
|
// Sits behind button to provide surface-color background
|
|
16
17
|
background: "var(--ds-surface, #FFFFFF)",
|
|
17
|
-
|
|
18
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
19
|
+
borderRadius: (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? "var(--ds-radius-small, 4px)" : "var(--ds-radius-small, 3px)",
|
|
18
20
|
display: 'flex',
|
|
19
21
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
20
22
|
height: "".concat(_consts.contextualMenuTriggerSize + 2, "px"),
|
|
@@ -27,7 +29,8 @@ var tableFloatingCellButtonStyles = exports.tableFloatingCellButtonStyles = func
|
|
|
27
29
|
flexDirection: 'column',
|
|
28
30
|
margin: "var(--ds-space-025, 2px)",
|
|
29
31
|
outline: "2px solid ".concat("var(--ds-surface, #FFFFFF)"),
|
|
30
|
-
|
|
32
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
33
|
+
borderRadius: (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? "var(--ds-radius-xsmall, 2px)" : '1px',
|
|
31
34
|
padding: 0,
|
|
32
35
|
height: 'calc(100% - 4px)',
|
|
33
36
|
display: 'flex'
|