@atlaskit/editor-plugin-table 7.29.10 → 7.30.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 +31 -0
- package/afm-jira/tsconfig.json +98 -98
- package/dist/cjs/nodeviews/TableComponent.js +63 -23
- package/dist/cjs/plugin.js +22 -2
- package/dist/cjs/toDOM.js +3 -2
- package/dist/cjs/ui/common-styles.js +3 -2
- package/dist/cjs/utils/index.js +6 -0
- package/dist/cjs/utils/nodes.js +5 -1
- package/dist/es2019/nodeviews/TableComponent.js +31 -3
- package/dist/es2019/plugin.js +23 -3
- package/dist/es2019/toDOM.js +4 -3
- package/dist/es2019/ui/common-styles.js +6 -5
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/utils/nodes.js +3 -0
- package/dist/esm/nodeviews/TableComponent.js +64 -24
- package/dist/esm/plugin.js +23 -3
- package/dist/esm/toDOM.js +4 -3
- package/dist/esm/ui/common-styles.js +3 -2
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/nodes.js +4 -0
- package/dist/types/toDOM.d.ts +3 -2
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/nodes.d.ts +1 -0
- package/dist/types-ts4.5/toDOM.d.ts +3 -2
- package/dist/types-ts4.5/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/nodes.d.ts +1 -0
- package/package.json +11 -5
- package/src/nodeviews/TableComponent.tsx +50 -1
- package/src/plugin.tsx +40 -15
- package/src/pm-plugins/keymap.ts +1 -1
- package/src/toDOM.ts +8 -5
- package/src/ui/common-styles.ts +6 -2
- package/src/utils/index.ts +1 -0
- package/src/utils/nodes.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.30.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#160630](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/160630)
|
|
8
|
+
[`1f1fd28e743e8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1f1fd28e743e8) -
|
|
9
|
+
[ux] Show drop targets when drag and drop feature is enabled in Jira via FF.
|
|
10
|
+
|
|
11
|
+
## 7.30.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#160688](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/160688)
|
|
16
|
+
[`7988fbc63aa4b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7988fbc63aa4b) -
|
|
17
|
+
[ux] Fix numbered column position when new tables in Jira FF is enabled.
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
20
|
+
## 7.30.0
|
|
21
|
+
|
|
22
|
+
### Minor Changes
|
|
23
|
+
|
|
24
|
+
- [#159340](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/159340)
|
|
25
|
+
[`aa03078fd0c80`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/aa03078fd0c80) -
|
|
26
|
+
[ux] [ED-25398] This change is enabling nested tables behind a feature gate.
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- [`9546839a5b527`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9546839a5b527) -
|
|
31
|
+
[ux] Fix comically wide table columns widths when table nested inside a nested node.
|
|
32
|
+
- Updated dependencies
|
|
33
|
+
|
|
3
34
|
## 7.29.10
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -1,99 +1,99 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.jira.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"target": "es5",
|
|
6
|
+
"outDir": "../../../../../tsDist/@atlaskit__editor-plugin-table/app",
|
|
7
|
+
"rootDir": "../",
|
|
8
|
+
"composite": true
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"../src/**/*.ts",
|
|
12
|
+
"../src/**/*.tsx"
|
|
13
|
+
],
|
|
14
|
+
"exclude": [
|
|
15
|
+
"../src/**/__tests__/*",
|
|
16
|
+
"../src/**/*.test.*",
|
|
17
|
+
"../src/**/test.*"
|
|
18
|
+
],
|
|
19
|
+
"references": [
|
|
20
|
+
{
|
|
21
|
+
"path": "../../../design-system/button/afm-jira/tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../../custom-steps/afm-jira/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../editor-common/afm-jira/tsconfig.json"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-palette/afm-jira/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../editor-plugin-accessibility-utils/afm-jira/tsconfig.json"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "../../editor-plugin-analytics/afm-jira/tsconfig.json"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "../../editor-plugin-batch-attribute-updates/afm-jira/tsconfig.json"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../../editor-plugin-content-insertion/afm-jira/tsconfig.json"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"path": "../../editor-plugin-editor-viewmode/afm-jira/tsconfig.json"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "../../editor-plugin-guideline/afm-jira/tsconfig.json"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"path": "../../editor-plugin-selection/afm-jira/tsconfig.json"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"path": "../../editor-plugin-width/afm-jira/tsconfig.json"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"path": "../../editor-shared-styles/afm-jira/tsconfig.json"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"path": "../../editor-tables/afm-jira/tsconfig.json"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"path": "../../../design-system/icon/afm-jira/tsconfig.json"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"path": "../../../design-system/menu/afm-jira/tsconfig.json"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"path": "../../../platform/feature-flags/afm-jira/tsconfig.json"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"path": "../../../pragmatic-drag-and-drop/core/afm-jira/tsconfig.json"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"path": "../../../pragmatic-drag-and-drop/auto-scroll/afm-jira/tsconfig.json"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"path": "../../../pragmatic-drag-and-drop/hitbox/afm-jira/tsconfig.json"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"path": "../../../design-system/primitives/afm-jira/tsconfig.json"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"path": "../../../design-system/theme/afm-jira/tsconfig.json"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"path": "../../tmp-editor-statsig/afm-jira/tsconfig.json"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"path": "../../../design-system/toggle/afm-jira/tsconfig.json"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"path": "../../../design-system/tokens/afm-jira/tsconfig.json"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"path": "../../../design-system/tooltip/afm-jira/tsconfig.json"
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
@@ -65,6 +65,10 @@ var initialOverflowCaptureTimeroutDelay = 300;
|
|
|
65
65
|
// the current collected data becomes stale and we want to start collecting fresh data again in future.
|
|
66
66
|
// PLEASE NOTE: that the current way this alaytics has been configured WILL cause reflows to occur. This is why the has been disabled.
|
|
67
67
|
var isOverflowAnalyticsEnabled = false;
|
|
68
|
+
|
|
69
|
+
// Prevent unnecessary parentWidth updates when table is nested inside of a node that is nested itself.
|
|
70
|
+
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD = 2;
|
|
71
|
+
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD = 20;
|
|
68
72
|
var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
69
73
|
(0, _inherits2.default)(TableComponent, _React$Component);
|
|
70
74
|
var _super = _createSuper(TableComponent);
|
|
@@ -157,6 +161,21 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
157
161
|
var prevAttrs = prevNode.attrs;
|
|
158
162
|
var isNested = (0, _utils5.isTableNested)(_this.props.view.state, _this.props.getPos());
|
|
159
163
|
var parentWidth = _this.getParentNodeWidth();
|
|
164
|
+
if (isNested && (0, _utils5.isTableNestedInMoreThanOneNode)(_this.props.view.state, _this.props.getPos()) && (0, _platformFeatureFlags.fg)('platform_editor_nested_table_in_nested_parent_fix')) {
|
|
165
|
+
var resizeObsWrapperWidth = _this.wrapperWidth || 0;
|
|
166
|
+
var wrapperWidthDiffBetweenRerenders = Math.abs(resizeObsWrapperWidth - (_this.state.parentWidth || 0));
|
|
167
|
+
var isOusideOfThreshold = wrapperWidthDiffBetweenRerenders <= NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD || wrapperWidthDiffBetweenRerenders > NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD;
|
|
168
|
+
// 1. Check isOusideOfThreshold is added to prevent undersired state update.
|
|
169
|
+
// When table is nested in the extenstion and the table column is being resized,
|
|
170
|
+
// space available within extension can change and cause undesirable state update.
|
|
171
|
+
// MIN_THRESNESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLDHOLD value is required
|
|
172
|
+
// as the resizeObsWrapperWidth can differ between page reloads by 2px.
|
|
173
|
+
|
|
174
|
+
// 2. Check resizeObsWrapperWidth > 1 is added to prevent parentWidth update when table unmounts.
|
|
175
|
+
// When a is nested table in a nested expand and the expand collabses, the table unmounts and
|
|
176
|
+
// resizeObsWrapperWidth becomes 1.
|
|
177
|
+
parentWidth = isOusideOfThreshold && resizeObsWrapperWidth > 1 ? resizeObsWrapperWidth : _this.state.parentWidth;
|
|
178
|
+
}
|
|
160
179
|
var parentWidthChanged = parentWidth && parentWidth !== _this.state.parentWidth;
|
|
161
180
|
var layoutSize = _this.tableNodeLayoutSize(node, containerWidth.width, options);
|
|
162
181
|
var hasNumberedColumnChanged = prevAttrs.isNumberColumnEnabled !== node.attrs.isNumberColumnEnabled;
|
|
@@ -358,7 +377,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
358
377
|
(0, _createClass2.default)(TableComponent, [{
|
|
359
378
|
key: "componentDidMount",
|
|
360
379
|
value: function componentDidMount() {
|
|
361
|
-
var _this$table,
|
|
380
|
+
var _this$table,
|
|
381
|
+
_this$table2,
|
|
382
|
+
_this$table3,
|
|
383
|
+
_this2 = this;
|
|
362
384
|
var _this$props7 = this.props,
|
|
363
385
|
allowColumnResizing = _this$props7.allowColumnResizing,
|
|
364
386
|
eventDispatcher = _this$props7.eventDispatcher,
|
|
@@ -379,6 +401,23 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
379
401
|
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
380
402
|
this.handleColgroupUpdates(true);
|
|
381
403
|
}
|
|
404
|
+
if (this.wrapper && (0, _platformFeatureFlags.fg)('platform_editor_nested_table_in_nested_parent_fix')) {
|
|
405
|
+
this.wrapperReisizeObserver = new ResizeObserver(function (entries) {
|
|
406
|
+
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
407
|
+
_step2;
|
|
408
|
+
try {
|
|
409
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
410
|
+
var entry = _step2.value;
|
|
411
|
+
_this2.wrapperWidth = entry.contentRect.width;
|
|
412
|
+
}
|
|
413
|
+
} catch (err) {
|
|
414
|
+
_iterator2.e(err);
|
|
415
|
+
} finally {
|
|
416
|
+
_iterator2.f();
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
this.wrapperReisizeObserver.observe(this.wrapper);
|
|
420
|
+
}
|
|
382
421
|
if (allowColumnResizing && this.wrapper && !isIE11) {
|
|
383
422
|
this.wrapper.addEventListener('scroll', this.handleScrollDebounced, {
|
|
384
423
|
passive: true
|
|
@@ -416,7 +455,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
416
455
|
}, {
|
|
417
456
|
key: "componentWillUnmount",
|
|
418
457
|
value: function componentWillUnmount() {
|
|
419
|
-
var _this$resizeObserver, _this$table4, _this$table5, _this$table6;
|
|
458
|
+
var _this$resizeObserver, _this$wrapperReisizeO, _this$table4, _this$table5, _this$table6;
|
|
420
459
|
var _this$props8 = this.props,
|
|
421
460
|
allowColumnResizing = _this$props8.allowColumnResizing,
|
|
422
461
|
eventDispatcher = _this$props8.eventDispatcher,
|
|
@@ -429,6 +468,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
429
468
|
this.dragAndDropCleanupFn();
|
|
430
469
|
}
|
|
431
470
|
(_this$resizeObserver = this.resizeObserver) === null || _this$resizeObserver === void 0 || _this$resizeObserver.disconnect();
|
|
471
|
+
(_this$wrapperReisizeO = this.wrapperReisizeObserver) === null || _this$wrapperReisizeO === void 0 || _this$wrapperReisizeO.disconnect();
|
|
432
472
|
if (this.stickyScrollbar) {
|
|
433
473
|
this.stickyScrollbar.dispose();
|
|
434
474
|
}
|
|
@@ -481,7 +521,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
481
521
|
}, {
|
|
482
522
|
key: "handleColgroupUpdates",
|
|
483
523
|
value: function handleColgroupUpdates() {
|
|
484
|
-
var
|
|
524
|
+
var _this3 = this;
|
|
485
525
|
var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
486
526
|
var _this$props10 = this.props,
|
|
487
527
|
getNode = _this$props10.getNode,
|
|
@@ -555,18 +595,18 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
555
595
|
}
|
|
556
596
|
var scalePercent = 1;
|
|
557
597
|
requestAnimationFrame(function () {
|
|
558
|
-
var
|
|
598
|
+
var _this3$props$options, _this3$props$options2;
|
|
559
599
|
// Scaling percent has to be calculated inside requestAnimationFrame, otherwise
|
|
560
600
|
// renderWidth calculated as `tableRef?.parentElement?.clientWidth`
|
|
561
601
|
// inside of getTableScalingPercent returns 0.
|
|
562
|
-
if (!((
|
|
563
|
-
scalePercent = (0, _misc.getTableScalingPercent)(tableNode,
|
|
602
|
+
if (!((_this3$props$options = _this3.props.options) !== null && _this3$props$options !== void 0 && _this3$props$options.isCommentEditor) || (_this3$props$options2 = _this3.props.options) !== null && _this3$props$options2 !== void 0 && _this3$props$options2.isCommentEditor && tableNode.attrs.width) {
|
|
603
|
+
scalePercent = (0, _misc.getTableScalingPercent)(tableNode, _this3.table, shouldUseIncreasedScalingPercent);
|
|
564
604
|
} else {
|
|
565
|
-
scalePercent = (0, _misc.getScalingPercentForTableWithoutWidth)(tableNode,
|
|
605
|
+
scalePercent = (0, _misc.getScalingPercentForTableWithoutWidth)(tableNode, _this3.table);
|
|
566
606
|
}
|
|
567
607
|
|
|
568
608
|
// Request animation frame required for Firefox
|
|
569
|
-
(0, _utils4.updateColgroup)(resizeState,
|
|
609
|
+
(0, _utils4.updateColgroup)(resizeState, _this3.table, tableNode, shouldScaleOnColgroupUpdate, scalePercent);
|
|
570
610
|
});
|
|
571
611
|
}
|
|
572
612
|
}
|
|
@@ -580,7 +620,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
580
620
|
var _this$props$options8,
|
|
581
621
|
_this$props$options9,
|
|
582
622
|
_this$wrapper,
|
|
583
|
-
|
|
623
|
+
_this4 = this;
|
|
584
624
|
var _this$props11 = this.props,
|
|
585
625
|
view = _this$props11.view,
|
|
586
626
|
getNode = _this$props11.getNode,
|
|
@@ -627,7 +667,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
627
667
|
// that happens when a table is nested in expand and expand's width is
|
|
628
668
|
// changed via breakout button
|
|
629
669
|
window.requestAnimationFrame(function () {
|
|
630
|
-
|
|
670
|
+
_this4.overflowShadowsObserver = new _OverflowShadowsObserver.OverflowShadowsObserver(_this4.updateShadowState, _this4.table, _this4.wrapper);
|
|
631
671
|
});
|
|
632
672
|
} else {
|
|
633
673
|
this.overflowShadowsObserver = new _OverflowShadowsObserver.OverflowShadowsObserver(this.updateShadowState, this.table, this.wrapper);
|
|
@@ -704,7 +744,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
704
744
|
}, {
|
|
705
745
|
key: "render",
|
|
706
746
|
value: function render() {
|
|
707
|
-
var
|
|
747
|
+
var _this5 = this,
|
|
708
748
|
_this$state$stickyHea2,
|
|
709
749
|
_this$state$stickyHea3,
|
|
710
750
|
_this$props$options10,
|
|
@@ -795,8 +835,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
795
835
|
tableContainerWidth: tableContainerWidth,
|
|
796
836
|
isNumberColumnEnabled: node.attrs.isNumberColumnEnabled,
|
|
797
837
|
getScrollOffset: function getScrollOffset() {
|
|
798
|
-
var
|
|
799
|
-
return ((
|
|
838
|
+
var _this5$wrapper;
|
|
839
|
+
return ((_this5$wrapper = _this5.wrapper) === null || _this5$wrapper === void 0 ? void 0 : _this5$wrapper.scrollLeft) || 0;
|
|
800
840
|
},
|
|
801
841
|
tableWrapperHeight: this.state.tableWrapperHeight,
|
|
802
842
|
api: pluginInjectionApi,
|
|
@@ -861,12 +901,12 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
861
901
|
editorView: view,
|
|
862
902
|
node: node,
|
|
863
903
|
getScrollOffset: function getScrollOffset() {
|
|
864
|
-
var
|
|
865
|
-
return ((
|
|
904
|
+
var _this5$wrapper2;
|
|
905
|
+
return ((_this5$wrapper2 = _this5.wrapper) === null || _this5$wrapper2 === void 0 ? void 0 : _this5$wrapper2.scrollLeft) || 0;
|
|
866
906
|
},
|
|
867
907
|
getTableWrapperWidth: function getTableWrapperWidth() {
|
|
868
|
-
var
|
|
869
|
-
return ((
|
|
908
|
+
var _this5$wrapper3;
|
|
909
|
+
return ((_this5$wrapper3 = _this5.wrapper) === null || _this5$wrapper3 === void 0 ? void 0 : _this5$wrapper3.clientWidth) || 760;
|
|
870
910
|
}
|
|
871
911
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
872
912
|
contentEditable: false
|
|
@@ -888,14 +928,14 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
888
928
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
889
929
|
className: (0, _classnames2.default)(_types.TableCssClassName.TABLE_NODE_WRAPPER),
|
|
890
930
|
ref: function ref(elem) {
|
|
891
|
-
|
|
931
|
+
_this5.wrapper = elem;
|
|
892
932
|
if (elem) {
|
|
893
|
-
|
|
933
|
+
_this5.props.contentDOM(elem);
|
|
894
934
|
var tableElement = elem.querySelector('table');
|
|
895
|
-
if (tableElement !==
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
935
|
+
if (tableElement !== _this5.table) {
|
|
936
|
+
_this5.table = tableElement;
|
|
937
|
+
_this5.createShadowSentinels(_this5.table);
|
|
938
|
+
_this5.observeTable(_this5.table);
|
|
899
939
|
}
|
|
900
940
|
}
|
|
901
941
|
}
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -18,6 +18,7 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
18
18
|
var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
|
|
19
19
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
20
20
|
var _pmPlugins = require("@atlaskit/editor-tables/pm-plugins");
|
|
21
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
22
|
var _insert = require("./commands/insert");
|
|
22
23
|
var _createPluginConfig = require("./create-plugin-config");
|
|
23
24
|
var _plugin = require("./pm-plugins/analytics/plugin");
|
|
@@ -143,12 +144,31 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
143
144
|
nodes: function nodes() {
|
|
144
145
|
var _pluginConfig = (0, _createPluginConfig.pluginConfig)(options === null || options === void 0 ? void 0 : options.tableOptions),
|
|
145
146
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
146
|
-
|
|
147
|
+
var isNestingSupported = (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes');
|
|
148
|
+
return isNestingSupported ? [{
|
|
147
149
|
name: 'table',
|
|
148
150
|
node: (0, _toDOM.tableNodeSpecWithFixedToDOM)({
|
|
149
151
|
allowColumnResizing: Boolean(allowColumnResizing),
|
|
150
152
|
tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.tableResizingEnabled),
|
|
151
|
-
getEditorContainerWidth: defaultGetEditorContainerWidth
|
|
153
|
+
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
154
|
+
isNestingSupported: isNestingSupported
|
|
155
|
+
})
|
|
156
|
+
}, {
|
|
157
|
+
name: 'tableHeader',
|
|
158
|
+
node: _adfSchema.tableHeaderWithNestedTable
|
|
159
|
+
}, {
|
|
160
|
+
name: 'tableRow',
|
|
161
|
+
node: _adfSchema.tableRowWithNestedTable
|
|
162
|
+
}, {
|
|
163
|
+
name: 'tableCell',
|
|
164
|
+
node: _adfSchema.tableCellWithNestedTable
|
|
165
|
+
}] : [{
|
|
166
|
+
name: 'table',
|
|
167
|
+
node: (0, _toDOM.tableNodeSpecWithFixedToDOM)({
|
|
168
|
+
allowColumnResizing: Boolean(allowColumnResizing),
|
|
169
|
+
tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.tableResizingEnabled),
|
|
170
|
+
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
171
|
+
isNestingSupported: isNestingSupported
|
|
152
172
|
})
|
|
153
173
|
}, {
|
|
154
174
|
name: 'tableHeader',
|
package/dist/cjs/toDOM.js
CHANGED
|
@@ -20,10 +20,11 @@ var _consts = require("./pm-plugins/table-resizing/utils/consts");
|
|
|
20
20
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
22
|
var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(config) {
|
|
23
|
+
var tableNode = config.isNestingSupported ? _adfSchema.tableWithNestedTable : _adfSchema.table;
|
|
23
24
|
if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false)) {
|
|
24
|
-
return
|
|
25
|
+
return tableNode;
|
|
25
26
|
}
|
|
26
|
-
return _objectSpread(_objectSpread({},
|
|
27
|
+
return _objectSpread(_objectSpread({}, tableNode), {}, {
|
|
27
28
|
toDOM: function toDOM(node) {
|
|
28
29
|
var gutterPadding = (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2;
|
|
29
30
|
var editorWidthFromGetter = (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? undefined : Math.min(config.getEditorContainerWidth().width - gutterPadding, node.attrs.width);
|