@atlaskit/editor-plugin-table 17.7.0 → 17.7.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 +21 -0
- package/dist/cjs/nodeviews/TableContainer.js +3 -8
- package/dist/cjs/nodeviews/TableRow.js +7 -12
- package/dist/cjs/nodeviews/toDOM.js +10 -1
- package/dist/cjs/pm-plugins/utils/decoration.js +7 -1
- package/dist/cjs/tablePlugin.js +25 -27
- package/dist/es2019/nodeviews/TableContainer.js +3 -8
- package/dist/es2019/nodeviews/TableRow.js +7 -12
- package/dist/es2019/nodeviews/toDOM.js +10 -1
- package/dist/es2019/pm-plugins/utils/decoration.js +7 -1
- package/dist/es2019/tablePlugin.js +25 -27
- package/dist/esm/nodeviews/TableContainer.js +3 -8
- package/dist/esm/nodeviews/TableRow.js +7 -12
- package/dist/esm/nodeviews/toDOM.js +10 -1
- package/dist/esm/pm-plugins/utils/decoration.js +7 -1
- package/dist/esm/tablePlugin.js +25 -27
- package/package.json +6 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 17.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1fd2b267eb592`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1fd2b267eb592) -
|
|
8
|
+
Cleanup `platform_editor_ai_aifc_patch_ga` flag
|
|
9
|
+
- [`ac4a428022f83`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ac4a428022f83) -
|
|
10
|
+
[EDITOR-5480] Removes data-borders-ready fix from table and adds border to prosemirror toDOM
|
|
11
|
+
instead
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 17.7.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`94dbc76370522`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/94dbc76370522) -
|
|
19
|
+
[ux] remove unnecessary decoration for last cell element in table
|
|
20
|
+
- [`1d6c1d6ba61dc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1d6c1d6ba61dc) -
|
|
21
|
+
FFCLEANUP-79953 clean up stale experiment platform_editor_editor_width_analytics
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 17.7.0
|
|
4
25
|
|
|
5
26
|
### Minor Changes
|
|
@@ -30,9 +30,7 @@ var InnerContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
30
30
|
var className = _ref.className,
|
|
31
31
|
style = _ref.style,
|
|
32
32
|
node = _ref.node,
|
|
33
|
-
children = _ref.children
|
|
34
|
-
tableWrapperHeight = _ref.tableWrapperHeight;
|
|
35
|
-
var bordersReady = (0, _expValEquals.expValEquals)('platform_editor_vc90_transition_table_border', 'isEnabled', true) ? tableWrapperHeight !== undefined && tableWrapperHeight > 0 : undefined;
|
|
33
|
+
children = _ref.children;
|
|
36
34
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
37
35
|
ref: ref
|
|
38
36
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -43,7 +41,6 @@ var InnerContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
43
41
|
className: className,
|
|
44
42
|
"data-number-column": node.attrs.isNumberColumnEnabled,
|
|
45
43
|
"data-layout": node.attrs.layout,
|
|
46
|
-
"data-borders-ready": bordersReady,
|
|
47
44
|
"data-testid": "table-container"
|
|
48
45
|
}, children);
|
|
49
46
|
});
|
|
@@ -345,8 +342,7 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
345
342
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
346
343
|
, {
|
|
347
344
|
className: className,
|
|
348
|
-
node: node
|
|
349
|
-
tableWrapperHeight: tableWrapperHeight
|
|
345
|
+
node: node
|
|
350
346
|
}, children))));
|
|
351
347
|
});
|
|
352
348
|
var TableContainer = exports.TableContainer = function TableContainer(_ref5) {
|
|
@@ -405,8 +401,7 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref5) {
|
|
|
405
401
|
var isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
|
|
406
402
|
var resizableTableWidth = isFullPageAppearance ? (0, _misc.getTableResizerContainerForFullPageWidthInCSS)(node, isTableScalingEnabled) : "calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))";
|
|
407
403
|
return /*#__PURE__*/_react.default.createElement(InnerContainer, {
|
|
408
|
-
node: node
|
|
409
|
-
tableWrapperHeight: tableWrapperHeight
|
|
404
|
+
node: node
|
|
410
405
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
411
406
|
,
|
|
412
407
|
className: (0, _classnames.default)(className, {
|
|
@@ -17,7 +17,6 @@ var _nesting = require("@atlaskit/editor-common/nesting");
|
|
|
17
17
|
var _nodeVisibility = require("@atlaskit/editor-common/node-visibility");
|
|
18
18
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
19
19
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
20
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
20
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
22
21
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
23
22
|
var _commands = require("../pm-plugins/sticky-headers/commands");
|
|
@@ -101,20 +100,16 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
101
100
|
}
|
|
102
101
|
var pos = _this.getPos();
|
|
103
102
|
_this.isInNestedTable = false;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
// E.g. when AI streaming brings in new content, this position brings back incorrect values that cannot be resolved
|
|
110
|
-
if (pos) {
|
|
111
|
-
_this.isInNestedTable = (0, _nesting.getParentOfTypeCount)(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
112
|
-
}
|
|
113
|
-
} catch (e) {}
|
|
114
|
-
} else {
|
|
103
|
+
try {
|
|
104
|
+
// We cannot trust that the value from getPos will be defined
|
|
105
|
+
// https://discuss.prosemirror.net/t/getpos-is-undefined-in-nodeview-constructor/1246/4
|
|
106
|
+
// There are also scenarios where the value it brings back does not tally with the current doc
|
|
107
|
+
// E.g. when AI streaming brings in new content, this position brings back incorrect values that cannot be resolved
|
|
115
108
|
if (pos) {
|
|
116
109
|
_this.isInNestedTable = (0, _nesting.getParentOfTypeCount)(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
117
110
|
}
|
|
111
|
+
} catch (_unused) {
|
|
112
|
+
// Intentionally swallowed — getPos can return stale positions during AI streaming
|
|
118
113
|
}
|
|
119
114
|
if (_this.isHeaderRow) {
|
|
120
115
|
_this.dom.setAttribute('data-vc-nvs', 'true');
|
|
@@ -62,7 +62,16 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
|
|
|
62
62
|
}, ['table', attrs, colgroup, ['tbody', 0]]], ['div', {
|
|
63
63
|
class: 'pm-table-sticky-sentinel-bottom',
|
|
64
64
|
'data-testid': 'sticky-sentinel-bottom'
|
|
65
|
-
}]]
|
|
65
|
+
}]].concat((0, _toConsumableArray2.default)((0, _expValEquals.expValEquals)('platform_editor_vc90_transition_table_border', 'isEnabled', true) ? [['div', {
|
|
66
|
+
contenteditable: 'false',
|
|
67
|
+
class: 'pm-table-left-border',
|
|
68
|
+
'data-with-numbered-table': node.attrs.isNumberColumnEnabled,
|
|
69
|
+
'data-testid': 'table-left-border'
|
|
70
|
+
}], ['div', {
|
|
71
|
+
contenteditable: 'false',
|
|
72
|
+
class: 'pm-table-right-border',
|
|
73
|
+
'data-testid': 'table-right-border'
|
|
74
|
+
}]] : []));
|
|
66
75
|
if (!config.tableResizingEnabled || config.isNested) {
|
|
67
76
|
return ['div', {
|
|
68
77
|
class: 'tableView-content-wrap',
|
|
@@ -13,6 +13,7 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
13
13
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
14
14
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
15
15
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
16
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
17
|
var _types = require("../../types");
|
|
17
18
|
var _ColumnResizeWidget = require("../../ui/ColumnResizeWidget");
|
|
18
19
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
@@ -287,12 +288,17 @@ var createResizeHandleDecoration = exports.createResizeHandleDecoration = functi
|
|
|
287
288
|
return element;
|
|
288
289
|
}, {
|
|
289
290
|
key: "".concat(_types.TableDecorations.COLUMN_RESIZING_HANDLE_WIDGET, "_").concat(rowIndex, "_").concat(columnIndex, "_").concat(includeTooltip ? 'with' : 'no', "-tooltip"),
|
|
290
|
-
destroy: function destroy(
|
|
291
|
+
destroy: function destroy(_node) {
|
|
291
292
|
nodeViewPortalProviderAPI.remove(decorationRenderKey);
|
|
292
293
|
}
|
|
293
294
|
});
|
|
294
295
|
};
|
|
295
296
|
var createLastCellElementDecoration = function createLastCellElementDecoration(cellColumnPositioning, cellPos, cellNode) {
|
|
297
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_table_remove_last_cell_decoration', 'isEnabled', true)) {
|
|
298
|
+
// no longer need to add the last cell decoration to override marginBottom as media wrapper doesn't have margin bottom. This will avoid unnecessary decoration computation/mutation and improve performance
|
|
299
|
+
// consider clean up ClassName.LAST_ITEM_IN_CELL with platform_editor_table_remove_last_cell_decoration experiment
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
296
302
|
var lastItemPositions;
|
|
297
303
|
cellNode.forEach(function (childNode, offset, index) {
|
|
298
304
|
if (index === cellNode.childCount - 1) {
|
package/dist/cjs/tablePlugin.js
CHANGED
|
@@ -433,39 +433,37 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
433
433
|
return new _safePlugin.SafePlugin({
|
|
434
434
|
view: function view(editorView) {
|
|
435
435
|
editorViewRef.current = editorView;
|
|
436
|
-
var setTimeoutID;
|
|
437
436
|
var rafID;
|
|
438
437
|
var ricID;
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
}
|
|
438
|
+
|
|
439
|
+
// send statistics about the widths of the tables on the page for alerting
|
|
440
|
+
// only send this event once, after the editorView is first initialised
|
|
441
|
+
var setTimeoutID = setTimeout(function () {
|
|
442
|
+
var requestIdleCallbackFn = function requestIdleCallbackFn() {
|
|
443
|
+
var _api$width$sharedStat2;
|
|
444
|
+
var editorWidth = api === null || api === void 0 || (_api$width$sharedStat2 = api.width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width;
|
|
445
|
+
if (editorViewRef.current) {
|
|
446
|
+
if (editorWidth) {
|
|
447
|
+
var payload = (0, _analytics2.getWidthInfoPayload)(editorViewRef.current, editorWidth);
|
|
448
|
+
if (payload) {
|
|
449
|
+
dispatchAnalyticsEvent(payload);
|
|
452
450
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
451
|
+
}
|
|
452
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_table_height_analytics_event')) {
|
|
453
|
+
var payloadHeight = (0, _analytics2.getHeightInfoPayload)(editorViewRef.current);
|
|
454
|
+
if (payloadHeight) {
|
|
455
|
+
dispatchAnalyticsEvent(payloadHeight);
|
|
458
456
|
}
|
|
459
457
|
}
|
|
460
|
-
};
|
|
461
|
-
if (window && typeof window.requestIdleCallback === 'function') {
|
|
462
|
-
ricID = window.requestIdleCallback(requestIdleCallbackFn);
|
|
463
|
-
} else if (window && typeof window.requestAnimationFrame === 'function') {
|
|
464
|
-
// requestIdleCallback is not supported in safari, fallback to requestAnimationFrame
|
|
465
|
-
rafID = window.requestAnimationFrame(requestIdleCallbackFn);
|
|
466
458
|
}
|
|
467
|
-
}
|
|
468
|
-
|
|
459
|
+
};
|
|
460
|
+
if (window && typeof window.requestIdleCallback === 'function') {
|
|
461
|
+
ricID = window.requestIdleCallback(requestIdleCallbackFn);
|
|
462
|
+
} else if (window && typeof window.requestAnimationFrame === 'function') {
|
|
463
|
+
// requestIdleCallback is not supported in safari, fallback to requestAnimationFrame
|
|
464
|
+
rafID = window.requestAnimationFrame(requestIdleCallbackFn);
|
|
465
|
+
}
|
|
466
|
+
}, TABLE_WIDTH_INFO_TIMEOUT);
|
|
469
467
|
return {
|
|
470
468
|
destroy: function destroy() {
|
|
471
469
|
editorViewRef.current = null;
|
|
@@ -20,10 +20,8 @@ const InnerContainer = /*#__PURE__*/forwardRef(({
|
|
|
20
20
|
className,
|
|
21
21
|
style,
|
|
22
22
|
node,
|
|
23
|
-
children
|
|
24
|
-
tableWrapperHeight
|
|
23
|
+
children
|
|
25
24
|
}, ref) => {
|
|
26
|
-
const bordersReady = expValEquals('platform_editor_vc90_transition_table_border', 'isEnabled', true) ? tableWrapperHeight !== undefined && tableWrapperHeight > 0 : undefined;
|
|
27
25
|
return /*#__PURE__*/React.createElement("div", {
|
|
28
26
|
ref: ref
|
|
29
27
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -34,7 +32,6 @@ const InnerContainer = /*#__PURE__*/forwardRef(({
|
|
|
34
32
|
className: className,
|
|
35
33
|
"data-number-column": node.attrs.isNumberColumnEnabled,
|
|
36
34
|
"data-layout": node.attrs.layout,
|
|
37
|
-
"data-borders-ready": bordersReady,
|
|
38
35
|
"data-testid": "table-container"
|
|
39
36
|
}, children);
|
|
40
37
|
});
|
|
@@ -339,8 +336,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
339
336
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
340
337
|
, {
|
|
341
338
|
className: className,
|
|
342
|
-
node: node
|
|
343
|
-
tableWrapperHeight: tableWrapperHeight
|
|
339
|
+
node: node
|
|
344
340
|
}, children))));
|
|
345
341
|
});
|
|
346
342
|
export const TableContainer = ({
|
|
@@ -402,8 +398,7 @@ export const TableContainer = ({
|
|
|
402
398
|
const isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
|
|
403
399
|
const resizableTableWidth = isFullPageAppearance ? getTableResizerContainerForFullPageWidthInCSS(node, isTableScalingEnabled) : `calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))`;
|
|
404
400
|
return /*#__PURE__*/React.createElement(InnerContainer, {
|
|
405
|
-
node: node
|
|
406
|
-
tableWrapperHeight: tableWrapperHeight
|
|
401
|
+
node: node
|
|
407
402
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
408
403
|
,
|
|
409
404
|
className: classNames(className, {
|
|
@@ -5,7 +5,6 @@ import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
|
5
5
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
6
6
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
7
7
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
10
9
|
import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
|
|
11
10
|
import { updateStickyState } from '../pm-plugins/sticky-headers/commands';
|
|
@@ -86,20 +85,16 @@ export default class TableRow extends TableNodeView {
|
|
|
86
85
|
}
|
|
87
86
|
const pos = this.getPos();
|
|
88
87
|
this.isInNestedTable = false;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
// E.g. when AI streaming brings in new content, this position brings back incorrect values that cannot be resolved
|
|
95
|
-
if (pos) {
|
|
96
|
-
this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
97
|
-
}
|
|
98
|
-
} catch (e) {}
|
|
99
|
-
} else {
|
|
88
|
+
try {
|
|
89
|
+
// We cannot trust that the value from getPos will be defined
|
|
90
|
+
// https://discuss.prosemirror.net/t/getpos-is-undefined-in-nodeview-constructor/1246/4
|
|
91
|
+
// There are also scenarios where the value it brings back does not tally with the current doc
|
|
92
|
+
// E.g. when AI streaming brings in new content, this position brings back incorrect values that cannot be resolved
|
|
100
93
|
if (pos) {
|
|
101
94
|
this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
102
95
|
}
|
|
96
|
+
} catch {
|
|
97
|
+
// Intentionally swallowed — getPos can return stale positions during AI streaming
|
|
103
98
|
}
|
|
104
99
|
if (this.isHeaderRow) {
|
|
105
100
|
this.dom.setAttribute('data-vc-nvs', 'true');
|
|
@@ -46,7 +46,16 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
46
46
|
}, ['table', attrs, colgroup, ['tbody', 0]]], ['div', {
|
|
47
47
|
class: 'pm-table-sticky-sentinel-bottom',
|
|
48
48
|
'data-testid': 'sticky-sentinel-bottom'
|
|
49
|
-
}]
|
|
49
|
+
}], ...(expValEquals('platform_editor_vc90_transition_table_border', 'isEnabled', true) ? [['div', {
|
|
50
|
+
contenteditable: 'false',
|
|
51
|
+
class: 'pm-table-left-border',
|
|
52
|
+
'data-with-numbered-table': node.attrs.isNumberColumnEnabled,
|
|
53
|
+
'data-testid': 'table-left-border'
|
|
54
|
+
}], ['div', {
|
|
55
|
+
contenteditable: 'false',
|
|
56
|
+
class: 'pm-table-right-border',
|
|
57
|
+
'data-testid': 'table-right-border'
|
|
58
|
+
}]] : [])];
|
|
50
59
|
if (!config.tableResizingEnabled || config.isNested) {
|
|
51
60
|
return ['div', {
|
|
52
61
|
class: 'tableView-content-wrap',
|
|
@@ -9,6 +9,7 @@ import { nonNullable } from '@atlaskit/editor-common/utils';
|
|
|
9
9
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
10
10
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
11
11
|
import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
12
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
13
|
import { TableCssClassName as ClassName, TableDecorations } from '../../types';
|
|
13
14
|
import { ColumnResizeWidget } from '../../ui/ColumnResizeWidget';
|
|
14
15
|
const filterDecorationByKey = (key, decorationSet) => decorationSet.find(undefined, undefined, spec => spec.key.indexOf(key) > -1);
|
|
@@ -254,12 +255,17 @@ export const createResizeHandleDecoration = (tr, rowIndexTarget, columnEndIndexT
|
|
|
254
255
|
return element;
|
|
255
256
|
}, {
|
|
256
257
|
key: `${TableDecorations.COLUMN_RESIZING_HANDLE_WIDGET}_${rowIndex}_${columnIndex}_${includeTooltip ? 'with' : 'no'}-tooltip`,
|
|
257
|
-
destroy:
|
|
258
|
+
destroy: _node => {
|
|
258
259
|
nodeViewPortalProviderAPI.remove(decorationRenderKey);
|
|
259
260
|
}
|
|
260
261
|
});
|
|
261
262
|
};
|
|
262
263
|
const createLastCellElementDecoration = (cellColumnPositioning, cellPos, cellNode) => {
|
|
264
|
+
if (expValEquals('platform_editor_table_remove_last_cell_decoration', 'isEnabled', true)) {
|
|
265
|
+
// no longer need to add the last cell decoration to override marginBottom as media wrapper doesn't have margin bottom. This will avoid unnecessary decoration computation/mutation and improve performance
|
|
266
|
+
// consider clean up ClassName.LAST_ITEM_IN_CELL with platform_editor_table_remove_last_cell_decoration experiment
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
263
269
|
let lastItemPositions;
|
|
264
270
|
cellNode.forEach((childNode, offset, index) => {
|
|
265
271
|
if (index === cellNode.childCount - 1) {
|
|
@@ -423,39 +423,37 @@ const tablePlugin = ({
|
|
|
423
423
|
return new SafePlugin({
|
|
424
424
|
view: editorView => {
|
|
425
425
|
editorViewRef.current = editorView;
|
|
426
|
-
let setTimeoutID;
|
|
427
426
|
let rafID;
|
|
428
427
|
let ricID;
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
}
|
|
428
|
+
|
|
429
|
+
// send statistics about the widths of the tables on the page for alerting
|
|
430
|
+
// only send this event once, after the editorView is first initialised
|
|
431
|
+
const setTimeoutID = setTimeout(() => {
|
|
432
|
+
const requestIdleCallbackFn = () => {
|
|
433
|
+
var _api$width$sharedStat2;
|
|
434
|
+
const editorWidth = api === null || api === void 0 ? void 0 : (_api$width$sharedStat2 = api.width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width;
|
|
435
|
+
if (editorViewRef.current) {
|
|
436
|
+
if (editorWidth) {
|
|
437
|
+
const payload = getWidthInfoPayload(editorViewRef.current, editorWidth);
|
|
438
|
+
if (payload) {
|
|
439
|
+
dispatchAnalyticsEvent(payload);
|
|
442
440
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
441
|
+
}
|
|
442
|
+
if (fg('platform_editor_table_height_analytics_event')) {
|
|
443
|
+
const payloadHeight = getHeightInfoPayload(editorViewRef.current);
|
|
444
|
+
if (payloadHeight) {
|
|
445
|
+
dispatchAnalyticsEvent(payloadHeight);
|
|
448
446
|
}
|
|
449
447
|
}
|
|
450
|
-
};
|
|
451
|
-
if (window && typeof window.requestIdleCallback === 'function') {
|
|
452
|
-
ricID = window.requestIdleCallback(requestIdleCallbackFn);
|
|
453
|
-
} else if (window && typeof window.requestAnimationFrame === 'function') {
|
|
454
|
-
// requestIdleCallback is not supported in safari, fallback to requestAnimationFrame
|
|
455
|
-
rafID = window.requestAnimationFrame(requestIdleCallbackFn);
|
|
456
448
|
}
|
|
457
|
-
}
|
|
458
|
-
|
|
449
|
+
};
|
|
450
|
+
if (window && typeof window.requestIdleCallback === 'function') {
|
|
451
|
+
ricID = window.requestIdleCallback(requestIdleCallbackFn);
|
|
452
|
+
} else if (window && typeof window.requestAnimationFrame === 'function') {
|
|
453
|
+
// requestIdleCallback is not supported in safari, fallback to requestAnimationFrame
|
|
454
|
+
rafID = window.requestAnimationFrame(requestIdleCallbackFn);
|
|
455
|
+
}
|
|
456
|
+
}, TABLE_WIDTH_INFO_TIMEOUT);
|
|
459
457
|
return {
|
|
460
458
|
destroy: () => {
|
|
461
459
|
editorViewRef.current = null;
|
|
@@ -21,9 +21,7 @@ var InnerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
21
21
|
var className = _ref.className,
|
|
22
22
|
style = _ref.style,
|
|
23
23
|
node = _ref.node,
|
|
24
|
-
children = _ref.children
|
|
25
|
-
tableWrapperHeight = _ref.tableWrapperHeight;
|
|
26
|
-
var bordersReady = expValEquals('platform_editor_vc90_transition_table_border', 'isEnabled', true) ? tableWrapperHeight !== undefined && tableWrapperHeight > 0 : undefined;
|
|
24
|
+
children = _ref.children;
|
|
27
25
|
return /*#__PURE__*/React.createElement("div", {
|
|
28
26
|
ref: ref
|
|
29
27
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -34,7 +32,6 @@ var InnerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
34
32
|
className: className,
|
|
35
33
|
"data-number-column": node.attrs.isNumberColumnEnabled,
|
|
36
34
|
"data-layout": node.attrs.layout,
|
|
37
|
-
"data-borders-ready": bordersReady,
|
|
38
35
|
"data-testid": "table-container"
|
|
39
36
|
}, children);
|
|
40
37
|
});
|
|
@@ -336,8 +333,7 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
336
333
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
337
334
|
, {
|
|
338
335
|
className: className,
|
|
339
|
-
node: node
|
|
340
|
-
tableWrapperHeight: tableWrapperHeight
|
|
336
|
+
node: node
|
|
341
337
|
}, children))));
|
|
342
338
|
});
|
|
343
339
|
export var TableContainer = function TableContainer(_ref5) {
|
|
@@ -396,8 +392,7 @@ export var TableContainer = function TableContainer(_ref5) {
|
|
|
396
392
|
var isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
|
|
397
393
|
var resizableTableWidth = isFullPageAppearance ? getTableResizerContainerForFullPageWidthInCSS(node, isTableScalingEnabled) : "calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))";
|
|
398
394
|
return /*#__PURE__*/React.createElement(InnerContainer, {
|
|
399
|
-
node: node
|
|
400
|
-
tableWrapperHeight: tableWrapperHeight
|
|
395
|
+
node: node
|
|
401
396
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
402
397
|
,
|
|
403
398
|
className: classNames(className, {
|
|
@@ -12,7 +12,6 @@ import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
|
12
12
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
13
13
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
14
14
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
15
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
15
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
17
16
|
import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
|
|
18
17
|
import { updateStickyState } from '../pm-plugins/sticky-headers/commands';
|
|
@@ -94,20 +93,16 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
|
94
93
|
}
|
|
95
94
|
var pos = _this.getPos();
|
|
96
95
|
_this.isInNestedTable = false;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// E.g. when AI streaming brings in new content, this position brings back incorrect values that cannot be resolved
|
|
103
|
-
if (pos) {
|
|
104
|
-
_this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
105
|
-
}
|
|
106
|
-
} catch (e) {}
|
|
107
|
-
} else {
|
|
96
|
+
try {
|
|
97
|
+
// We cannot trust that the value from getPos will be defined
|
|
98
|
+
// https://discuss.prosemirror.net/t/getpos-is-undefined-in-nodeview-constructor/1246/4
|
|
99
|
+
// There are also scenarios where the value it brings back does not tally with the current doc
|
|
100
|
+
// E.g. when AI streaming brings in new content, this position brings back incorrect values that cannot be resolved
|
|
108
101
|
if (pos) {
|
|
109
102
|
_this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
110
103
|
}
|
|
104
|
+
} catch (_unused) {
|
|
105
|
+
// Intentionally swallowed — getPos can return stale positions during AI streaming
|
|
111
106
|
}
|
|
112
107
|
if (_this.isHeaderRow) {
|
|
113
108
|
_this.dom.setAttribute('data-vc-nvs', 'true');
|
|
@@ -55,7 +55,16 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
55
55
|
}, ['table', attrs, colgroup, ['tbody', 0]]], ['div', {
|
|
56
56
|
class: 'pm-table-sticky-sentinel-bottom',
|
|
57
57
|
'data-testid': 'sticky-sentinel-bottom'
|
|
58
|
-
}]]
|
|
58
|
+
}]].concat(_toConsumableArray(expValEquals('platform_editor_vc90_transition_table_border', 'isEnabled', true) ? [['div', {
|
|
59
|
+
contenteditable: 'false',
|
|
60
|
+
class: 'pm-table-left-border',
|
|
61
|
+
'data-with-numbered-table': node.attrs.isNumberColumnEnabled,
|
|
62
|
+
'data-testid': 'table-left-border'
|
|
63
|
+
}], ['div', {
|
|
64
|
+
contenteditable: 'false',
|
|
65
|
+
class: 'pm-table-right-border',
|
|
66
|
+
'data-testid': 'table-right-border'
|
|
67
|
+
}]] : []));
|
|
59
68
|
if (!config.tableResizingEnabled || config.isNested) {
|
|
60
69
|
return ['div', {
|
|
61
70
|
class: 'tableView-content-wrap',
|
|
@@ -10,6 +10,7 @@ import { nonNullable } from '@atlaskit/editor-common/utils';
|
|
|
10
10
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
11
11
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
12
12
|
import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
13
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
14
|
import { TableCssClassName as ClassName, TableDecorations } from '../../types';
|
|
14
15
|
import { ColumnResizeWidget } from '../../ui/ColumnResizeWidget';
|
|
15
16
|
var filterDecorationByKey = function filterDecorationByKey(key, decorationSet) {
|
|
@@ -280,12 +281,17 @@ export var createResizeHandleDecoration = function createResizeHandleDecoration(
|
|
|
280
281
|
return element;
|
|
281
282
|
}, {
|
|
282
283
|
key: "".concat(TableDecorations.COLUMN_RESIZING_HANDLE_WIDGET, "_").concat(rowIndex, "_").concat(columnIndex, "_").concat(includeTooltip ? 'with' : 'no', "-tooltip"),
|
|
283
|
-
destroy: function destroy(
|
|
284
|
+
destroy: function destroy(_node) {
|
|
284
285
|
nodeViewPortalProviderAPI.remove(decorationRenderKey);
|
|
285
286
|
}
|
|
286
287
|
});
|
|
287
288
|
};
|
|
288
289
|
var createLastCellElementDecoration = function createLastCellElementDecoration(cellColumnPositioning, cellPos, cellNode) {
|
|
290
|
+
if (expValEquals('platform_editor_table_remove_last_cell_decoration', 'isEnabled', true)) {
|
|
291
|
+
// no longer need to add the last cell decoration to override marginBottom as media wrapper doesn't have margin bottom. This will avoid unnecessary decoration computation/mutation and improve performance
|
|
292
|
+
// consider clean up ClassName.LAST_ITEM_IN_CELL with platform_editor_table_remove_last_cell_decoration experiment
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
289
295
|
var lastItemPositions;
|
|
290
296
|
cellNode.forEach(function (childNode, offset, index) {
|
|
291
297
|
if (index === cellNode.childCount - 1) {
|
package/dist/esm/tablePlugin.js
CHANGED
|
@@ -424,39 +424,37 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
424
424
|
return new SafePlugin({
|
|
425
425
|
view: function view(editorView) {
|
|
426
426
|
editorViewRef.current = editorView;
|
|
427
|
-
var setTimeoutID;
|
|
428
427
|
var rafID;
|
|
429
428
|
var ricID;
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}
|
|
429
|
+
|
|
430
|
+
// send statistics about the widths of the tables on the page for alerting
|
|
431
|
+
// only send this event once, after the editorView is first initialised
|
|
432
|
+
var setTimeoutID = setTimeout(function () {
|
|
433
|
+
var requestIdleCallbackFn = function requestIdleCallbackFn() {
|
|
434
|
+
var _api$width$sharedStat2;
|
|
435
|
+
var editorWidth = api === null || api === void 0 || (_api$width$sharedStat2 = api.width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width;
|
|
436
|
+
if (editorViewRef.current) {
|
|
437
|
+
if (editorWidth) {
|
|
438
|
+
var payload = getWidthInfoPayload(editorViewRef.current, editorWidth);
|
|
439
|
+
if (payload) {
|
|
440
|
+
dispatchAnalyticsEvent(payload);
|
|
443
441
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
442
|
+
}
|
|
443
|
+
if (fg('platform_editor_table_height_analytics_event')) {
|
|
444
|
+
var payloadHeight = getHeightInfoPayload(editorViewRef.current);
|
|
445
|
+
if (payloadHeight) {
|
|
446
|
+
dispatchAnalyticsEvent(payloadHeight);
|
|
449
447
|
}
|
|
450
448
|
}
|
|
451
|
-
};
|
|
452
|
-
if (window && typeof window.requestIdleCallback === 'function') {
|
|
453
|
-
ricID = window.requestIdleCallback(requestIdleCallbackFn);
|
|
454
|
-
} else if (window && typeof window.requestAnimationFrame === 'function') {
|
|
455
|
-
// requestIdleCallback is not supported in safari, fallback to requestAnimationFrame
|
|
456
|
-
rafID = window.requestAnimationFrame(requestIdleCallbackFn);
|
|
457
449
|
}
|
|
458
|
-
}
|
|
459
|
-
|
|
450
|
+
};
|
|
451
|
+
if (window && typeof window.requestIdleCallback === 'function') {
|
|
452
|
+
ricID = window.requestIdleCallback(requestIdleCallbackFn);
|
|
453
|
+
} else if (window && typeof window.requestAnimationFrame === 'function') {
|
|
454
|
+
// requestIdleCallback is not supported in safari, fallback to requestAnimationFrame
|
|
455
|
+
rafID = window.requestAnimationFrame(requestIdleCallbackFn);
|
|
456
|
+
}
|
|
457
|
+
}, TABLE_WIDTH_INFO_TIMEOUT);
|
|
460
458
|
return {
|
|
461
459
|
destroy: function destroy() {
|
|
462
460
|
editorViewRef.current = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "17.7.
|
|
3
|
+
"version": "17.7.2",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"@atlaskit/editor-plugin-batch-attribute-updates": "^7.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-content-insertion": "^7.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^9.0.0",
|
|
40
|
-
"@atlaskit/editor-plugin-extension": "10.1.
|
|
40
|
+
"@atlaskit/editor-plugin-extension": "10.1.18",
|
|
41
41
|
"@atlaskit/editor-plugin-guideline": "^7.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-interaction": "^14.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-limited-mode": "^4.0.0",
|
|
44
|
-
"@atlaskit/editor-plugin-selection": "^7.
|
|
44
|
+
"@atlaskit/editor-plugin-selection": "^7.1.0",
|
|
45
45
|
"@atlaskit/editor-plugin-toolbar": "^4.1.0",
|
|
46
46
|
"@atlaskit/editor-plugin-user-intent": "^5.0.0",
|
|
47
47
|
"@atlaskit/editor-plugin-width": "^8.1.0",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
58
58
|
"@atlaskit/primitives": "^18.0.0",
|
|
59
59
|
"@atlaskit/theme": "^22.0.0",
|
|
60
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
60
|
+
"@atlaskit/tmp-editor-statsig": "^35.5.0",
|
|
61
61
|
"@atlaskit/toggle": "^15.2.0",
|
|
62
|
-
"@atlaskit/tokens": "^11.
|
|
62
|
+
"@atlaskit/tokens": "^11.1.0",
|
|
63
63
|
"@atlaskit/tooltip": "^20.14.0",
|
|
64
64
|
"@babel/runtime": "^7.0.0",
|
|
65
65
|
"@emotion/react": "^11.7.1",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"uuid": "^3.1.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@atlaskit/editor-common": "^111.
|
|
73
|
+
"@atlaskit/editor-common": "^111.32.0",
|
|
74
74
|
"react": "^18.2.0",
|
|
75
75
|
"react-dom": "^18.2.0",
|
|
76
76
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -136,9 +136,6 @@
|
|
|
136
136
|
"platform_editor_table_height_analytics_event": {
|
|
137
137
|
"type": "boolean"
|
|
138
138
|
},
|
|
139
|
-
"platform_editor_ai_aifc_patch_ga": {
|
|
140
|
-
"type": "boolean"
|
|
141
|
-
},
|
|
142
139
|
"platform_editor_change_table_nesting_check": {
|
|
143
140
|
"type": "boolean"
|
|
144
141
|
},
|