@atlaskit/editor-plugin-table 15.2.1 → 15.2.3
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 +16 -0
- package/dist/cjs/nodeviews/TableComponentLegacy.js +23 -35
- package/dist/cjs/nodeviews/TableComponentNext.js +24 -36
- package/dist/cjs/nodeviews/TableContainer.js +31 -215
- package/dist/cjs/nodeviews/TableResizer.js +7 -12
- package/dist/cjs/nodeviews/table.js +1 -2
- package/dist/cjs/nodeviews/toDOM.js +9 -27
- package/dist/cjs/pm-plugins/drag-and-drop/utils/getDragBehaviour.js +3 -1
- package/dist/cjs/pm-plugins/main.js +3 -31
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +1 -2
- package/dist/cjs/tablePlugin.js +2 -1
- package/dist/cjs/ui/DragHandle/index.js +4 -2
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +5 -8
- package/dist/cjs/ui/TableFloatingControls/index.js +5 -2
- package/dist/cjs/ui/common-styles.js +2 -1
- package/dist/es2019/nodeviews/TableComponentLegacy.js +15 -27
- package/dist/es2019/nodeviews/TableComponentNext.js +16 -28
- package/dist/es2019/nodeviews/TableContainer.js +9 -190
- package/dist/es2019/nodeviews/TableResizer.js +6 -11
- package/dist/es2019/nodeviews/table.js +1 -2
- package/dist/es2019/nodeviews/toDOM.js +9 -28
- package/dist/es2019/pm-plugins/drag-and-drop/utils/getDragBehaviour.js +3 -1
- package/dist/es2019/pm-plugins/main.js +4 -32
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +1 -2
- package/dist/es2019/tablePlugin.js +2 -1
- package/dist/es2019/ui/DragHandle/index.js +3 -1
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +2 -5
- package/dist/es2019/ui/TableFloatingControls/index.js +4 -1
- package/dist/es2019/ui/common-styles.js +2 -1
- package/dist/esm/nodeviews/TableComponentLegacy.js +24 -36
- package/dist/esm/nodeviews/TableComponentNext.js +25 -37
- package/dist/esm/nodeviews/TableContainer.js +31 -215
- package/dist/esm/nodeviews/TableResizer.js +6 -11
- package/dist/esm/nodeviews/table.js +1 -2
- package/dist/esm/nodeviews/toDOM.js +10 -28
- package/dist/esm/pm-plugins/drag-and-drop/utils/getDragBehaviour.js +3 -1
- package/dist/esm/pm-plugins/main.js +4 -32
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +1 -2
- package/dist/esm/tablePlugin.js +2 -1
- package/dist/esm/ui/DragHandle/index.js +3 -1
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +5 -8
- package/dist/esm/ui/TableFloatingControls/index.js +4 -1
- package/dist/esm/ui/common-styles.js +2 -1
- package/dist/types/nodeviews/TableContainer.d.ts +1 -3
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +1 -3
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 15.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`14a03e6be917d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/14a03e6be917d) -
|
|
8
|
+
upgrade use of browser util
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 15.2.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`5f70b8e74f5f3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5f70b8e74f5f3) -
|
|
16
|
+
tidy up feature flag platform_editor_tables_scaling_css
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 15.2.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -18,6 +18,7 @@ var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
|
18
18
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
19
19
|
var _reactIntlNext = require("react-intl-next");
|
|
20
20
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
21
|
+
var _browser = require("@atlaskit/editor-common/browser");
|
|
21
22
|
var _collab = require("@atlaskit/editor-common/collab");
|
|
22
23
|
var _nesting = require("@atlaskit/editor-common/nesting");
|
|
23
24
|
var _nodeVisibility = require("@atlaskit/editor-common/node-visibility");
|
|
@@ -58,7 +59,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
58
59
|
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)); }
|
|
59
60
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // Ignored via go/ees005
|
|
60
61
|
// eslint-disable-next-line import/no-named-as-default
|
|
61
|
-
var isIE11 = _utils.browser.ie_version === 11;
|
|
62
62
|
// When table is inserted via paste, keyboard shortcut or quickInsert,
|
|
63
63
|
// componentDidUpdate is called multiple times. The isOverflowing value is correct only on the last update.
|
|
64
64
|
// To make sure we capture the last update, we use setTimeout.
|
|
@@ -363,7 +363,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
363
363
|
isNumberOfColumnsChanged = params.isNumberOfColumnsChanged,
|
|
364
364
|
isFullWidthModeAndLineLengthChanged = params.isFullWidthModeAndLineLengthChanged;
|
|
365
365
|
var isFullPageEditor = !((_this$props$options = _this.props.options) !== null && _this$props$options !== void 0 && _this$props$options.isCommentEditor) && !((_this$props$options2 = _this.props.options) !== null && _this$props$options2 !== void 0 && _this$props$options2.isChromelessEditor);
|
|
366
|
-
if (
|
|
366
|
+
if (isFullPageEditor) {
|
|
367
367
|
return !!isWindowResized || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
368
368
|
}
|
|
369
369
|
return isWidthChanged || isTableWidthChanged || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
@@ -447,10 +447,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
449
|
});
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
453
|
-
}
|
|
450
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
451
|
+
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
454
452
|
}
|
|
455
453
|
}
|
|
456
454
|
}, {
|
|
@@ -465,9 +463,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
465
463
|
allowTableResizing = _this$props7.allowTableResizing,
|
|
466
464
|
eventDispatcher = _this$props7.eventDispatcher,
|
|
467
465
|
isDragAndDropEnabled = _this$props7.isDragAndDropEnabled,
|
|
468
|
-
getNode = _this$props7.getNode
|
|
469
|
-
|
|
470
|
-
|
|
466
|
+
getNode = _this$props7.getNode;
|
|
467
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
468
|
+
var isIE11 = browser.ie_version === 11;
|
|
471
469
|
|
|
472
470
|
// Ignored via go/ees005
|
|
473
471
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -480,17 +478,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
480
478
|
// Ignored via go/ees005
|
|
481
479
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
482
480
|
this === null || this === void 0 || (_this$table3 = this.table) === null || _this$table3 === void 0 || _this$table3.addEventListener('mouseover', this.handleMouseOver);
|
|
483
|
-
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
484
|
-
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
|
|
485
|
-
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
|
|
486
|
-
if (!(0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
487
|
-
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
488
|
-
this.handleColgroupUpdates(true);
|
|
489
|
-
}
|
|
490
|
-
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
491
|
-
this.handleColgroupUpdates(true);
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
481
|
if (this.wrapper) {
|
|
495
482
|
this.wrapperReisizeObserver = new ResizeObserver(function (entries) {
|
|
496
483
|
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
@@ -561,6 +548,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
561
548
|
isDragAndDropEnabled = _this$props8.isDragAndDropEnabled,
|
|
562
549
|
view = _this$props8.view,
|
|
563
550
|
isInDanger = _this$props8.isInDanger;
|
|
551
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
552
|
+
var isIE11 = browser.ie_version === 11;
|
|
564
553
|
if (this.wrapper && !isIE11) {
|
|
565
554
|
// Ignored via go/ees005
|
|
566
555
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -595,10 +584,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
595
584
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
596
585
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
597
586
|
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
}
|
|
587
|
+
|
|
588
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
589
|
+
window.removeEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
602
590
|
|
|
603
591
|
// Ignored via go/ees005
|
|
604
592
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -688,7 +676,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
688
676
|
containerLineLength = containerWidth.lineLength;
|
|
689
677
|
var isLineLengthChanged = ((_this$containerWidth = this.containerWidth) === null || _this$containerWidth === void 0 ? void 0 : _this$containerWidth.lineLength) !== containerLineLength;
|
|
690
678
|
var isFullWidthModeAndLineLengthChanged = this.updateColGroupFromFullWidthChange && isLineLengthChanged && (0, _platformFeatureFlags.fg)('platform_editor_table_overflow_in_full_width_fix');
|
|
691
|
-
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged ||
|
|
679
|
+
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged || this.state.windowResized;
|
|
692
680
|
if (force || maybeScale || isFullWidthModeAndLineLengthChanged) {
|
|
693
681
|
var _this$containerWidth2, _this$props$options3, _this$props$options4, _this$props$options5;
|
|
694
682
|
var isWidthChanged = ((_this$containerWidth2 = this.containerWidth) === null || _this$containerWidth2 === void 0 ? void 0 : _this$containerWidth2.width) !== containerWidthValue;
|
|
@@ -707,9 +695,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
707
695
|
isNumberOfColumnsChanged: isNumberOfColumnsChanged,
|
|
708
696
|
isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged
|
|
709
697
|
});
|
|
710
|
-
var
|
|
711
|
-
|
|
712
|
-
tableWithFixedColumnWidthsOption =
|
|
698
|
+
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
699
|
+
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
|
|
700
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
|
|
713
701
|
var isTableScalingWithFixedColumnWidthsOptionEnabled = !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
|
|
714
702
|
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled || !!((_this$props$options4 = this.props.options) !== null && _this$props$options4 !== void 0 && _this$props$options4.isTableScalingEnabled) && !!((_this$props$options5 = this.props.options) !== null && _this$props$options5 !== void 0 && _this$props$options5.isCommentEditor);
|
|
715
703
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
@@ -793,9 +781,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
793
781
|
var table = (0, _utils2.findTable)(view.state.selection);
|
|
794
782
|
var shouldScale = false;
|
|
795
783
|
var shouldHandleColgroupUpdates = false;
|
|
796
|
-
var
|
|
797
|
-
|
|
798
|
-
tableWithFixedColumnWidthsOption =
|
|
784
|
+
var _getEditorFeatureFlag3 = getEditorFeatureFlags(),
|
|
785
|
+
_getEditorFeatureFlag4 = _getEditorFeatureFlag3.tableWithFixedColumnWidthsOption,
|
|
786
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag4 === void 0 ? false : _getEditorFeatureFlag4;
|
|
799
787
|
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
800
788
|
shouldScale = true;
|
|
801
789
|
shouldHandleColgroupUpdates = true;
|
|
@@ -806,7 +794,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
806
794
|
shouldScale = true;
|
|
807
795
|
shouldHandleColgroupUpdates = true;
|
|
808
796
|
}
|
|
809
|
-
if (
|
|
797
|
+
if (this.state.windowResized) {
|
|
810
798
|
shouldHandleColgroupUpdates = true;
|
|
811
799
|
}
|
|
812
800
|
if (shouldHandleColgroupUpdates) {
|
|
@@ -1021,9 +1009,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1021
1009
|
var topShadowPadding = isDragAndDropEnabled ? 0 : shadowPadding;
|
|
1022
1010
|
var topOffset = 0;
|
|
1023
1011
|
var topStickyShadowPosition = !this.props.limitedMode && this.state.stickyHeader && topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
|
|
1024
|
-
var
|
|
1025
|
-
|
|
1026
|
-
tableWithFixedColumnWidthsOption =
|
|
1012
|
+
var _getEditorFeatureFlag5 = getEditorFeatureFlags(),
|
|
1013
|
+
_getEditorFeatureFlag6 = _getEditorFeatureFlag5.tableWithFixedColumnWidthsOption,
|
|
1014
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag6 === void 0 ? false : _getEditorFeatureFlag6;
|
|
1027
1015
|
var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption || !!((_this$props$options10 = this.props.options) !== null && _this$props$options10 !== void 0 && _this$props$options10.isCommentEditor));
|
|
1028
1016
|
return /*#__PURE__*/_react.default.createElement(_TableContainer.TableContainer
|
|
1029
1017
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -16,6 +16,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
16
16
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
17
17
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
18
18
|
var _reactIntlNext = require("react-intl-next");
|
|
19
|
+
var _browser = require("@atlaskit/editor-common/browser");
|
|
19
20
|
var _collab = require("@atlaskit/editor-common/collab");
|
|
20
21
|
var _nesting = require("@atlaskit/editor-common/nesting");
|
|
21
22
|
var _nodeVisibility = require("@atlaskit/editor-common/node-visibility");
|
|
@@ -53,8 +54,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
53
54
|
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)); }
|
|
54
55
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // Ignored via go/ees005
|
|
55
56
|
// eslint-disable-next-line import/no-named-as-default
|
|
56
|
-
var isIE11 = _utils.browser.ie_version === 11;
|
|
57
|
-
|
|
58
57
|
// Prevent unnecessary parentWidth updates when table is nested inside of a node that is nested itself.
|
|
59
58
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD = 2;
|
|
60
59
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD = 20;
|
|
@@ -306,7 +305,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
306
305
|
isNumberOfColumnsChanged = params.isNumberOfColumnsChanged,
|
|
307
306
|
isFullWidthModeAndLineLengthChanged = params.isFullWidthModeAndLineLengthChanged;
|
|
308
307
|
var isFullPageEditor = !((_this$props$options = _this.props.options) !== null && _this$props$options !== void 0 && _this$props$options.isCommentEditor) && !((_this$props$options2 = _this.props.options) !== null && _this$props$options2 !== void 0 && _this$props$options2.isChromelessEditor);
|
|
309
|
-
if (
|
|
308
|
+
if (isFullPageEditor) {
|
|
310
309
|
return !!isWindowResized || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
311
310
|
}
|
|
312
311
|
return isWidthChanged || isTableWidthChanged || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
@@ -388,10 +387,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
388
387
|
}
|
|
389
388
|
}
|
|
390
389
|
});
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}
|
|
390
|
+
|
|
391
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
392
|
+
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
395
393
|
}
|
|
396
394
|
}
|
|
397
395
|
}, {
|
|
@@ -406,9 +404,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
406
404
|
allowTableResizing = _this$props6.allowTableResizing,
|
|
407
405
|
eventDispatcher = _this$props6.eventDispatcher,
|
|
408
406
|
isDragAndDropEnabled = _this$props6.isDragAndDropEnabled,
|
|
409
|
-
getNode = _this$props6.getNode
|
|
410
|
-
|
|
411
|
-
|
|
407
|
+
getNode = _this$props6.getNode;
|
|
408
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
409
|
+
var isIE11 = browser.ie_version === 11;
|
|
412
410
|
|
|
413
411
|
// Ignored via go/ees005
|
|
414
412
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -421,17 +419,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
421
419
|
// Ignored via go/ees005
|
|
422
420
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
423
421
|
this === null || this === void 0 || (_this$table3 = this.table) === null || _this$table3 === void 0 || _this$table3.addEventListener('mouseover', this.handleMouseOver);
|
|
424
|
-
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
425
|
-
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
|
|
426
|
-
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
|
|
427
|
-
if (!(0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
428
|
-
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
429
|
-
this.handleColgroupUpdates(true);
|
|
430
|
-
}
|
|
431
|
-
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
432
|
-
this.handleColgroupUpdates(true);
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
422
|
if (this.wrapper) {
|
|
436
423
|
this.wrapperReisizeObserver = new ResizeObserver(function (entries) {
|
|
437
424
|
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
@@ -498,6 +485,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
498
485
|
isDragAndDropEnabled = _this$props7.isDragAndDropEnabled,
|
|
499
486
|
view = _this$props7.view,
|
|
500
487
|
isInDanger = _this$props7.isInDanger;
|
|
488
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
489
|
+
var isIE11 = browser.ie_version === 11;
|
|
501
490
|
if (this.wrapper && !isIE11) {
|
|
502
491
|
// Ignored via go/ees005
|
|
503
492
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -532,10 +521,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
532
521
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
533
522
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
534
523
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}
|
|
524
|
+
|
|
525
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
526
|
+
window.removeEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
539
527
|
|
|
540
528
|
// Ignored via go/ees005
|
|
541
529
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -622,7 +610,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
622
610
|
containerLineLength = containerWidth.lineLength;
|
|
623
611
|
var isLineLengthChanged = ((_this$containerWidth = this.containerWidth) === null || _this$containerWidth === void 0 ? void 0 : _this$containerWidth.lineLength) !== containerLineLength;
|
|
624
612
|
var isFullWidthModeAndLineLengthChanged = this.updateColGroupFromFullWidthChange && isLineLengthChanged && (0, _platformFeatureFlags.fg)('platform_editor_table_overflow_in_full_width_fix');
|
|
625
|
-
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged ||
|
|
613
|
+
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged || this.state.windowResized;
|
|
626
614
|
if (force || maybeScale || isFullWidthModeAndLineLengthChanged) {
|
|
627
615
|
var _this$containerWidth2, _this$props$options3, _this$props$options4, _this$props$options5;
|
|
628
616
|
var isWidthChanged = ((_this$containerWidth2 = this.containerWidth) === null || _this$containerWidth2 === void 0 ? void 0 : _this$containerWidth2.width) !== containerWidthValue;
|
|
@@ -641,9 +629,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
641
629
|
isNumberOfColumnsChanged: isNumberOfColumnsChanged,
|
|
642
630
|
isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged
|
|
643
631
|
});
|
|
644
|
-
var
|
|
645
|
-
|
|
646
|
-
tableWithFixedColumnWidthsOption =
|
|
632
|
+
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
633
|
+
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
|
|
634
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
|
|
647
635
|
var isTableScalingWithFixedColumnWidthsOptionEnabled = !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
|
|
648
636
|
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled || !!((_this$props$options4 = this.props.options) !== null && _this$props$options4 !== void 0 && _this$props$options4.isTableScalingEnabled) && !!((_this$props$options5 = this.props.options) !== null && _this$props$options5 !== void 0 && _this$props$options5.isCommentEditor);
|
|
649
637
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
@@ -724,9 +712,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
724
712
|
var table = (0, _utils2.findTable)(view.state.selection);
|
|
725
713
|
var shouldScale = false;
|
|
726
714
|
var shouldHandleColgroupUpdates = false;
|
|
727
|
-
var
|
|
728
|
-
|
|
729
|
-
tableWithFixedColumnWidthsOption =
|
|
715
|
+
var _getEditorFeatureFlag3 = getEditorFeatureFlags(),
|
|
716
|
+
_getEditorFeatureFlag4 = _getEditorFeatureFlag3.tableWithFixedColumnWidthsOption,
|
|
717
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag4 === void 0 ? false : _getEditorFeatureFlag4;
|
|
730
718
|
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
731
719
|
shouldScale = true;
|
|
732
720
|
shouldHandleColgroupUpdates = true;
|
|
@@ -737,7 +725,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
737
725
|
shouldScale = true;
|
|
738
726
|
shouldHandleColgroupUpdates = true;
|
|
739
727
|
}
|
|
740
|
-
if (
|
|
728
|
+
if (this.state.windowResized) {
|
|
741
729
|
shouldHandleColgroupUpdates = true;
|
|
742
730
|
}
|
|
743
731
|
if (shouldHandleColgroupUpdates) {
|
|
@@ -895,9 +883,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
895
883
|
tablePos = undefined;
|
|
896
884
|
}
|
|
897
885
|
var isNested = (0, _nodes.isTableNested)(view.state, tablePos);
|
|
898
|
-
var
|
|
899
|
-
|
|
900
|
-
tableWithFixedColumnWidthsOption =
|
|
886
|
+
var _getEditorFeatureFlag5 = getEditorFeatureFlags(),
|
|
887
|
+
_getEditorFeatureFlag6 = _getEditorFeatureFlag5.tableWithFixedColumnWidthsOption,
|
|
888
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag6 === void 0 ? false : _getEditorFeatureFlag6;
|
|
901
889
|
var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption || !!((_this$props$options10 = this.props.options) !== null && _this$props$options10 !== void 0 && _this$props$options10.isCommentEditor));
|
|
902
890
|
return /*#__PURE__*/_react.default.createElement(_TableContainer.TableContainer
|
|
903
891
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -15,8 +15,6 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
15
15
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
16
16
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
17
17
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
|
-
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
19
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
20
18
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
21
19
|
var _commandsWithAnalytics = require("../pm-plugins/commands/commands-with-analytics");
|
|
22
20
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
@@ -84,8 +82,8 @@ var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
|
84
82
|
}, [alignment]);
|
|
85
83
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
86
84
|
"data-testid": "table-alignment-container",
|
|
87
|
-
"data-ssr-placeholder":
|
|
88
|
-
"data-ssr-placeholder-replace":
|
|
85
|
+
"data-ssr-placeholder": "table-".concat(node.attrs.localId),
|
|
86
|
+
"data-ssr-placeholder-replace": "table-".concat(node.attrs.localId)
|
|
89
87
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
90
88
|
,
|
|
91
89
|
style: style
|
|
@@ -101,8 +99,8 @@ var AlignmentTableContainerWrapper = function AlignmentTableContainerWrapper(_re
|
|
|
101
99
|
if (!isTableAlignmentEnabled) {
|
|
102
100
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
103
101
|
"data-testid": "table-alignment-container",
|
|
104
|
-
"data-ssr-placeholder":
|
|
105
|
-
"data-ssr-placeholder-replace":
|
|
102
|
+
"data-ssr-placeholder": "table-".concat(node.attrs.localId),
|
|
103
|
+
"data-ssr-placeholder-replace": "table-".concat(node.attrs.localId),
|
|
106
104
|
style: {
|
|
107
105
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
108
106
|
display: 'flex',
|
|
@@ -129,7 +127,7 @@ var getPadding = function getPadding(containerWidth) {
|
|
|
129
127
|
exposure: true
|
|
130
128
|
}) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
|
|
131
129
|
};
|
|
132
|
-
var
|
|
130
|
+
var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_react.default.memo(function (_ref4) {
|
|
133
131
|
var children = _ref4.children,
|
|
134
132
|
className = _ref4.className,
|
|
135
133
|
node = _ref4.node,
|
|
@@ -146,7 +144,9 @@ var ResizableTableContainerLegacy = /*#__PURE__*/_react.default.memo(function (_
|
|
|
146
144
|
isTableWithFixedColumnWidthsOptionEnabled = _ref4.isTableWithFixedColumnWidthsOptionEnabled,
|
|
147
145
|
isTableAlignmentEnabled = _ref4.isTableAlignmentEnabled,
|
|
148
146
|
shouldUseIncreasedScalingPercent = _ref4.shouldUseIncreasedScalingPercent,
|
|
149
|
-
isCommentEditor = _ref4.isCommentEditor
|
|
147
|
+
isCommentEditor = _ref4.isCommentEditor,
|
|
148
|
+
isChromelessEditor = _ref4.isChromelessEditor;
|
|
149
|
+
var tableWidth = (0, _nodeWidth.getTableContainerWidth)(node);
|
|
150
150
|
var containerRef = (0, _react.useRef)(null);
|
|
151
151
|
var tableWidthRef = (0, _react.useRef)(_editorSharedStyles.akEditorDefaultLayoutWidth);
|
|
152
152
|
var _useState = (0, _react.useState)(false),
|
|
@@ -210,186 +210,6 @@ var ResizableTableContainerLegacy = /*#__PURE__*/_react.default.memo(function (_
|
|
|
210
210
|
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$s;
|
|
211
211
|
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
212
212
|
}, [pluginInjectionApi]);
|
|
213
|
-
var tableWidth = (0, _nodeWidth.getTableContainerWidth)(node);
|
|
214
|
-
var responsiveContainerWidth = 0;
|
|
215
|
-
var resizeHandleSpacing = 12;
|
|
216
|
-
var padding = getPadding(containerWidth);
|
|
217
|
-
// When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
|
|
218
|
-
// updating Settings -> Appearance -> Show scroll bars from "When scrolling" to "Always". It causes
|
|
219
|
-
// issues when viwport width is less than full width Editor's width. To detect avoid them
|
|
220
|
-
// we need to use lineLength to defined responsiveWidth instead of containerWidth
|
|
221
|
-
// (which does not get updated when Mac setting changes) in Full-width editor.
|
|
222
|
-
if (isFullWidthModeEnabled) {
|
|
223
|
-
// When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
|
|
224
|
-
// When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
|
|
225
|
-
// scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
|
|
226
|
-
responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - padding * 2 - resizeHandleSpacing;
|
|
227
|
-
|
|
228
|
-
// platform_editor_table_fw_numcol_overflow_fix:
|
|
229
|
-
// lineLength is undefined on first paint → width: NaN → wrapper expands to page
|
|
230
|
-
// width. rAF col-sizing then runs before the number-column padding and
|
|
231
|
-
// the final shrink, so column widths are locked in wrong.
|
|
232
|
-
// With the flag ON, if the value isn’t finite we fall back to gutterWidth
|
|
233
|
-
// for that first frame—no flash, no premature rAF.
|
|
234
|
-
//
|
|
235
|
-
// Type clean-up comes later:
|
|
236
|
-
// 1) ship this runtime guard (quick fix, no breakage);
|
|
237
|
-
// 2) TODO: widen lineLength to `number|undefined` and remove this block.
|
|
238
|
-
if ((0, _platformFeatureFlags.fg)('platform_editor_table_fw_numcol_overflow_fix')) {
|
|
239
|
-
if (isTableScalingEnabled && !Number.isFinite(responsiveContainerWidth)) {
|
|
240
|
-
responsiveContainerWidth = containerWidth - padding * 2 - resizeHandleSpacing;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
} else if (isCommentEditor) {
|
|
244
|
-
responsiveContainerWidth = containerWidth - _consts.TABLE_OFFSET_IN_COMMENT_EDITOR;
|
|
245
|
-
} else {
|
|
246
|
-
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
247
|
-
// containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
|
|
248
|
-
// a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
|
|
249
|
-
// padding left = padding right = akEditorGutterPadding = 32
|
|
250
|
-
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - padding * 2 : containerWidth - padding * 2 - resizeHandleSpacing;
|
|
251
|
-
}
|
|
252
|
-
// Fix for HOT-119925: Ensure table width is properly constrained and responsive
|
|
253
|
-
// For wide tables, ensure they don't exceed container width and can be scrolled
|
|
254
|
-
var calculatedWidth = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
255
|
-
|
|
256
|
-
// Ensure minimum width for usability while respecting container constraints
|
|
257
|
-
var width = Math.max(calculatedWidth, Math.min(responsiveContainerWidth * 0.5, 300));
|
|
258
|
-
if (!isResizing) {
|
|
259
|
-
tableWidthRef.current = width;
|
|
260
|
-
}
|
|
261
|
-
var maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, _consts.TABLE_MAX_WIDTH);
|
|
262
|
-
var tableResizerProps = {
|
|
263
|
-
width: width,
|
|
264
|
-
maxWidth: maxResizerWidth,
|
|
265
|
-
containerWidth: containerWidth,
|
|
266
|
-
lineLength: lineLength,
|
|
267
|
-
updateWidth: updateWidth,
|
|
268
|
-
editorView: editorView,
|
|
269
|
-
getPos: getPos,
|
|
270
|
-
node: node,
|
|
271
|
-
tableRef: tableRef,
|
|
272
|
-
displayGuideline: displayGuideline,
|
|
273
|
-
attachAnalyticsEvent: attachAnalyticsEvent,
|
|
274
|
-
displayGapCursor: displayGapCursor,
|
|
275
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
276
|
-
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
277
|
-
isTableScalingEnabled: isTableScalingEnabled,
|
|
278
|
-
isTableWithFixedColumnWidthsOptionEnabled: isTableWithFixedColumnWidthsOptionEnabled,
|
|
279
|
-
isWholeTableInDanger: isWholeTableInDanger,
|
|
280
|
-
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
281
|
-
pluginInjectionApi: pluginInjectionApi,
|
|
282
|
-
onResizeStart: onResizeStart,
|
|
283
|
-
onResizeStop: onResizeStop,
|
|
284
|
-
isCommentEditor: isCommentEditor
|
|
285
|
-
};
|
|
286
|
-
var isLivePageViewMode = mode === 'view';
|
|
287
|
-
return /*#__PURE__*/_react.default.createElement(AlignmentTableContainerWrapper, {
|
|
288
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
289
|
-
node: node,
|
|
290
|
-
pluginInjectionApi: pluginInjectionApi,
|
|
291
|
-
getPos: getPos,
|
|
292
|
-
editorView: editorView
|
|
293
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
294
|
-
style: {
|
|
295
|
-
width: tableWidthRef.current,
|
|
296
|
-
height: resizing ? updateContainerHeight(tableWrapperHeight !== null && tableWrapperHeight !== void 0 ? tableWrapperHeight : 'auto') : 'auto',
|
|
297
|
-
position: isLivePageViewMode ? 'relative' : 'unset'
|
|
298
|
-
}
|
|
299
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
300
|
-
,
|
|
301
|
-
className: _types.TableCssClassName.TABLE_RESIZER_CONTAINER,
|
|
302
|
-
ref: containerRef
|
|
303
|
-
}, /*#__PURE__*/_react.default.createElement(_TableResizer.TableResizer, (0, _extends2.default)({}, tableResizerProps, {
|
|
304
|
-
disabled: isLivePageViewMode
|
|
305
|
-
}), /*#__PURE__*/_react.default.createElement(InnerContainer, {
|
|
306
|
-
className: className,
|
|
307
|
-
node: node
|
|
308
|
-
}, children))));
|
|
309
|
-
});
|
|
310
|
-
var ResizableTableContainerNext = /*#__PURE__*/_react.default.memo(function (_ref5) {
|
|
311
|
-
var children = _ref5.children,
|
|
312
|
-
className = _ref5.className,
|
|
313
|
-
node = _ref5.node,
|
|
314
|
-
containerWidth = _ref5.containerWidth,
|
|
315
|
-
lineLength = _ref5.lineLength,
|
|
316
|
-
editorView = _ref5.editorView,
|
|
317
|
-
getPos = _ref5.getPos,
|
|
318
|
-
tableRef = _ref5.tableRef,
|
|
319
|
-
isResizing = _ref5.isResizing,
|
|
320
|
-
pluginInjectionApi = _ref5.pluginInjectionApi,
|
|
321
|
-
tableWrapperHeight = _ref5.tableWrapperHeight,
|
|
322
|
-
isWholeTableInDanger = _ref5.isWholeTableInDanger,
|
|
323
|
-
isTableScalingEnabled = _ref5.isTableScalingEnabled,
|
|
324
|
-
isTableWithFixedColumnWidthsOptionEnabled = _ref5.isTableWithFixedColumnWidthsOptionEnabled,
|
|
325
|
-
isTableAlignmentEnabled = _ref5.isTableAlignmentEnabled,
|
|
326
|
-
shouldUseIncreasedScalingPercent = _ref5.shouldUseIncreasedScalingPercent,
|
|
327
|
-
isCommentEditor = _ref5.isCommentEditor,
|
|
328
|
-
isChromelessEditor = _ref5.isChromelessEditor;
|
|
329
|
-
var tableWidth = (0, _nodeWidth.getTableContainerWidth)(node);
|
|
330
|
-
var containerRef = (0, _react.useRef)(null);
|
|
331
|
-
var tableWidthRef = (0, _react.useRef)(_editorSharedStyles.akEditorDefaultLayoutWidth);
|
|
332
|
-
var _useState3 = (0, _react.useState)(false),
|
|
333
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
334
|
-
resizing = _useState4[0],
|
|
335
|
-
setIsResizing = _useState4[1];
|
|
336
|
-
var _useSharedPluginState3 = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['table', 'editorViewMode'], selector),
|
|
337
|
-
tableState = _useSharedPluginState3.tableState,
|
|
338
|
-
editorViewModeState = _useSharedPluginState3.editorViewModeState;
|
|
339
|
-
var isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
|
|
340
|
-
var mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
341
|
-
var updateContainerHeight = (0, _react.useCallback)(function (height) {
|
|
342
|
-
var _containerRef$current3;
|
|
343
|
-
// current StickyHeader State is not stable to be fetch.
|
|
344
|
-
// we need to update stickyHeader plugin to make sure state can be
|
|
345
|
-
// consistently fetch and refactor below
|
|
346
|
-
var stickyHeaders = (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.getElementsByClassName('pm-table-sticky');
|
|
347
|
-
if (!stickyHeaders || stickyHeaders.length < 1) {
|
|
348
|
-
// when starting to drag, we need to keep the original space,
|
|
349
|
-
// -- When sticky header not appear, margin top(24px) and margin bottom(16px), should be 40px,
|
|
350
|
-
// 1px is border width but collapse make it 0.5.
|
|
351
|
-
// -- When sticky header appear, we should add first row height but reduce
|
|
352
|
-
// collapsed border
|
|
353
|
-
return typeof height === 'number' ? "".concat(height + 40.5, "px") : 'auto';
|
|
354
|
-
} else {
|
|
355
|
-
var _containerRef$current4;
|
|
356
|
-
var stickyHeaderHeight = ((_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.getElementsByTagName('th')[0].getBoundingClientRect().height) || 0;
|
|
357
|
-
return typeof height === 'number' ? "".concat(height + stickyHeaderHeight + 39.5, "px") : 'auto';
|
|
358
|
-
}
|
|
359
|
-
}, []);
|
|
360
|
-
var onResizeStart = (0, _react.useCallback)(function () {
|
|
361
|
-
setIsResizing(true);
|
|
362
|
-
}, []);
|
|
363
|
-
var onResizeStop = (0, _react.useCallback)(function () {
|
|
364
|
-
setIsResizing(false);
|
|
365
|
-
}, []);
|
|
366
|
-
var updateWidth = (0, _react.useCallback)(function (width) {
|
|
367
|
-
if (!containerRef.current) {
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
// make sure during resizing
|
|
372
|
-
// the pm-table-resizer-container width is the same as its child div resizer-item
|
|
373
|
-
// otherwise when resize table from wider to narrower , pm-table-resizer-container stays wider
|
|
374
|
-
// and cause the fabric-editor-popup-scroll-parent to overflow
|
|
375
|
-
if (containerRef.current.style.width !== "".concat(width, "px")) {
|
|
376
|
-
containerRef.current.style.width = "".concat(width, "px");
|
|
377
|
-
}
|
|
378
|
-
}, []);
|
|
379
|
-
var displayGuideline = (0, _react.useCallback)(function (guidelines) {
|
|
380
|
-
var _pluginInjectionApi$g3, _pluginInjectionApi$g4;
|
|
381
|
-
return (_pluginInjectionApi$g3 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$g4 = pluginInjectionApi.guideline) === null || _pluginInjectionApi$g4 === void 0 || (_pluginInjectionApi$g4 = _pluginInjectionApi$g4.actions) === null || _pluginInjectionApi$g4 === void 0 ? void 0 : _pluginInjectionApi$g4.displayGuideline(editorView)({
|
|
382
|
-
guidelines: guidelines
|
|
383
|
-
})) !== null && _pluginInjectionApi$g3 !== void 0 ? _pluginInjectionApi$g3 : false;
|
|
384
|
-
}, [pluginInjectionApi, editorView]);
|
|
385
|
-
var attachAnalyticsEvent = (0, _react.useCallback)(function (payload) {
|
|
386
|
-
var _pluginInjectionApi$a3;
|
|
387
|
-
return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions.attachAnalyticsEvent(payload);
|
|
388
|
-
}, [pluginInjectionApi]);
|
|
389
|
-
var displayGapCursor = (0, _react.useCallback)(function (toggle) {
|
|
390
|
-
var _pluginInjectionApi$c3, _pluginInjectionApi$c4, _pluginInjectionApi$s2;
|
|
391
|
-
return (_pluginInjectionApi$c3 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c4 = pluginInjectionApi.core) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s2 = pluginInjectionApi.selection) === null || _pluginInjectionApi$s2 === void 0 ? void 0 : _pluginInjectionApi$s2.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c3 !== void 0 ? _pluginInjectionApi$c3 : false;
|
|
392
|
-
}, [pluginInjectionApi]);
|
|
393
213
|
var isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
|
|
394
214
|
var _useMemo = (0, _react.useMemo)(function () {
|
|
395
215
|
var responsiveContainerWidth = 0;
|
|
@@ -519,32 +339,28 @@ var ResizableTableContainerNext = /*#__PURE__*/_react.default.memo(function (_re
|
|
|
519
339
|
node: node
|
|
520
340
|
}, children))));
|
|
521
341
|
});
|
|
522
|
-
var
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
isTableAlignmentEnabled = _ref6.isTableAlignmentEnabled,
|
|
545
|
-
shouldUseIncreasedScalingPercent = _ref6.shouldUseIncreasedScalingPercent,
|
|
546
|
-
isCommentEditor = _ref6.isCommentEditor,
|
|
547
|
-
isChromelessEditor = _ref6.isChromelessEditor;
|
|
342
|
+
var TableContainer = exports.TableContainer = function TableContainer(_ref5) {
|
|
343
|
+
var children = _ref5.children,
|
|
344
|
+
node = _ref5.node,
|
|
345
|
+
className = _ref5.className,
|
|
346
|
+
_ref5$containerWidth = _ref5.containerWidth,
|
|
347
|
+
editorWidth = _ref5$containerWidth.width,
|
|
348
|
+
lineLength = _ref5$containerWidth.lineLength,
|
|
349
|
+
editorView = _ref5.editorView,
|
|
350
|
+
getPos = _ref5.getPos,
|
|
351
|
+
tableRef = _ref5.tableRef,
|
|
352
|
+
isNested = _ref5.isNested,
|
|
353
|
+
tableWrapperHeight = _ref5.tableWrapperHeight,
|
|
354
|
+
isResizing = _ref5.isResizing,
|
|
355
|
+
pluginInjectionApi = _ref5.pluginInjectionApi,
|
|
356
|
+
isWholeTableInDanger = _ref5.isWholeTableInDanger,
|
|
357
|
+
isTableResizingEnabled = _ref5.isTableResizingEnabled,
|
|
358
|
+
isTableScalingEnabled = _ref5.isTableScalingEnabled,
|
|
359
|
+
isTableWithFixedColumnWidthsOptionEnabled = _ref5.isTableWithFixedColumnWidthsOptionEnabled,
|
|
360
|
+
isTableAlignmentEnabled = _ref5.isTableAlignmentEnabled,
|
|
361
|
+
shouldUseIncreasedScalingPercent = _ref5.shouldUseIncreasedScalingPercent,
|
|
362
|
+
isCommentEditor = _ref5.isCommentEditor,
|
|
363
|
+
isChromelessEditor = _ref5.isChromelessEditor;
|
|
548
364
|
if (isTableResizingEnabled && !isNested) {
|
|
549
365
|
return /*#__PURE__*/_react.default.createElement(ResizableTableContainer
|
|
550
366
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -577,7 +393,7 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref6) {
|
|
|
577
393
|
var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
578
394
|
isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
|
|
579
395
|
var isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
|
|
580
|
-
var resizableTableWidth =
|
|
396
|
+
var resizableTableWidth = isFullPageAppearance ? (0, _misc.getTableResizerContainerForFullPageWidthInCSS)(node, isTableScalingEnabled) : "calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))";
|
|
581
397
|
return /*#__PURE__*/_react.default.createElement(InnerContainer, {
|
|
582
398
|
node: node
|
|
583
399
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|