@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
|
@@ -18,12 +18,13 @@ import memoizeOne from 'memoize-one';
|
|
|
18
18
|
import rafSchedule from 'raf-schd';
|
|
19
19
|
import { injectIntl } from 'react-intl-next';
|
|
20
20
|
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
21
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
21
22
|
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
22
23
|
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
23
24
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
24
25
|
import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
25
26
|
import { tableMarginSides } from '@atlaskit/editor-common/styles';
|
|
26
|
-
import {
|
|
27
|
+
import { isValidPosition } from '@atlaskit/editor-common/utils';
|
|
27
28
|
import { akEditorTableNumberColumnWidth, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
|
|
28
29
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
29
30
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -52,7 +53,6 @@ import { ExternalDropTargets } from './ExternalDropTargets';
|
|
|
52
53
|
import { OverflowShadowsObserver } from './OverflowShadowsObserver';
|
|
53
54
|
import { TableContainer } from './TableContainer';
|
|
54
55
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
55
|
-
var isIE11 = browser.ie_version === 11;
|
|
56
56
|
// When table is inserted via paste, keyboard shortcut or quickInsert,
|
|
57
57
|
// componentDidUpdate is called multiple times. The isOverflowing value is correct only on the last update.
|
|
58
58
|
// To make sure we capture the last update, we use setTimeout.
|
|
@@ -357,7 +357,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
357
357
|
isNumberOfColumnsChanged = params.isNumberOfColumnsChanged,
|
|
358
358
|
isFullWidthModeAndLineLengthChanged = params.isFullWidthModeAndLineLengthChanged;
|
|
359
359
|
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);
|
|
360
|
-
if (
|
|
360
|
+
if (isFullPageEditor) {
|
|
361
361
|
return !!isWindowResized || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
362
362
|
}
|
|
363
363
|
return isWidthChanged || isTableWidthChanged || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
@@ -441,10 +441,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
443
|
});
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
447
|
-
}
|
|
444
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
445
|
+
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
448
446
|
}
|
|
449
447
|
}
|
|
450
448
|
}, {
|
|
@@ -459,9 +457,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
459
457
|
allowTableResizing = _this$props7.allowTableResizing,
|
|
460
458
|
eventDispatcher = _this$props7.eventDispatcher,
|
|
461
459
|
isDragAndDropEnabled = _this$props7.isDragAndDropEnabled,
|
|
462
|
-
getNode = _this$props7.getNode
|
|
463
|
-
|
|
464
|
-
|
|
460
|
+
getNode = _this$props7.getNode;
|
|
461
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
462
|
+
var isIE11 = browser.ie_version === 11;
|
|
465
463
|
|
|
466
464
|
// Ignored via go/ees005
|
|
467
465
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -474,17 +472,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
474
472
|
// Ignored via go/ees005
|
|
475
473
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
476
474
|
this === null || this === void 0 || (_this$table3 = this.table) === null || _this$table3 === void 0 || _this$table3.addEventListener('mouseover', this.handleMouseOver);
|
|
477
|
-
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
478
|
-
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
|
|
479
|
-
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
|
|
480
|
-
if (!expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
481
|
-
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
482
|
-
this.handleColgroupUpdates(true);
|
|
483
|
-
}
|
|
484
|
-
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
485
|
-
this.handleColgroupUpdates(true);
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
475
|
if (this.wrapper) {
|
|
489
476
|
this.wrapperReisizeObserver = new ResizeObserver(function (entries) {
|
|
490
477
|
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
@@ -555,6 +542,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
555
542
|
isDragAndDropEnabled = _this$props8.isDragAndDropEnabled,
|
|
556
543
|
view = _this$props8.view,
|
|
557
544
|
isInDanger = _this$props8.isInDanger;
|
|
545
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
546
|
+
var isIE11 = browser.ie_version === 11;
|
|
558
547
|
if (this.wrapper && !isIE11) {
|
|
559
548
|
// Ignored via go/ees005
|
|
560
549
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -589,10 +578,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
589
578
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
590
579
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
591
580
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
}
|
|
581
|
+
|
|
582
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
583
|
+
window.removeEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
596
584
|
|
|
597
585
|
// Ignored via go/ees005
|
|
598
586
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -682,7 +670,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
682
670
|
containerLineLength = containerWidth.lineLength;
|
|
683
671
|
var isLineLengthChanged = ((_this$containerWidth = this.containerWidth) === null || _this$containerWidth === void 0 ? void 0 : _this$containerWidth.lineLength) !== containerLineLength;
|
|
684
672
|
var isFullWidthModeAndLineLengthChanged = this.updateColGroupFromFullWidthChange && isLineLengthChanged && fg('platform_editor_table_overflow_in_full_width_fix');
|
|
685
|
-
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged ||
|
|
673
|
+
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged || this.state.windowResized;
|
|
686
674
|
if (force || maybeScale || isFullWidthModeAndLineLengthChanged) {
|
|
687
675
|
var _this$containerWidth2, _this$props$options3, _this$props$options4, _this$props$options5;
|
|
688
676
|
var isWidthChanged = ((_this$containerWidth2 = this.containerWidth) === null || _this$containerWidth2 === void 0 ? void 0 : _this$containerWidth2.width) !== containerWidthValue;
|
|
@@ -701,9 +689,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
701
689
|
isNumberOfColumnsChanged: isNumberOfColumnsChanged,
|
|
702
690
|
isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged
|
|
703
691
|
});
|
|
704
|
-
var
|
|
705
|
-
|
|
706
|
-
tableWithFixedColumnWidthsOption =
|
|
692
|
+
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
693
|
+
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
|
|
694
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
|
|
707
695
|
var isTableScalingWithFixedColumnWidthsOptionEnabled = !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
|
|
708
696
|
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);
|
|
709
697
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
@@ -787,9 +775,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
787
775
|
var table = findTable(view.state.selection);
|
|
788
776
|
var shouldScale = false;
|
|
789
777
|
var shouldHandleColgroupUpdates = false;
|
|
790
|
-
var
|
|
791
|
-
|
|
792
|
-
tableWithFixedColumnWidthsOption =
|
|
778
|
+
var _getEditorFeatureFlag3 = getEditorFeatureFlags(),
|
|
779
|
+
_getEditorFeatureFlag4 = _getEditorFeatureFlag3.tableWithFixedColumnWidthsOption,
|
|
780
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag4 === void 0 ? false : _getEditorFeatureFlag4;
|
|
793
781
|
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
794
782
|
shouldScale = true;
|
|
795
783
|
shouldHandleColgroupUpdates = true;
|
|
@@ -800,7 +788,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
800
788
|
shouldScale = true;
|
|
801
789
|
shouldHandleColgroupUpdates = true;
|
|
802
790
|
}
|
|
803
|
-
if (
|
|
791
|
+
if (this.state.windowResized) {
|
|
804
792
|
shouldHandleColgroupUpdates = true;
|
|
805
793
|
}
|
|
806
794
|
if (shouldHandleColgroupUpdates) {
|
|
@@ -1015,9 +1003,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1015
1003
|
var topShadowPadding = isDragAndDropEnabled ? 0 : shadowPadding;
|
|
1016
1004
|
var topOffset = 0;
|
|
1017
1005
|
var topStickyShadowPosition = !this.props.limitedMode && this.state.stickyHeader && topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
|
|
1018
|
-
var
|
|
1019
|
-
|
|
1020
|
-
tableWithFixedColumnWidthsOption =
|
|
1006
|
+
var _getEditorFeatureFlag5 = getEditorFeatureFlags(),
|
|
1007
|
+
_getEditorFeatureFlag6 = _getEditorFeatureFlag5.tableWithFixedColumnWidthsOption,
|
|
1008
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag6 === void 0 ? false : _getEditorFeatureFlag6;
|
|
1021
1009
|
var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption || !!((_this$props$options10 = this.props.options) !== null && _this$props$options10 !== void 0 && _this$props$options10.isCommentEditor));
|
|
1022
1010
|
return /*#__PURE__*/React.createElement(TableContainer
|
|
1023
1011
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -16,11 +16,12 @@ import React from 'react';
|
|
|
16
16
|
import classnames from 'classnames';
|
|
17
17
|
import rafSchedule from 'raf-schd';
|
|
18
18
|
import { injectIntl } from 'react-intl-next';
|
|
19
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
19
20
|
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
20
21
|
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
21
22
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
22
23
|
import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
23
|
-
import {
|
|
24
|
+
import { isValidPosition } from '@atlaskit/editor-common/utils';
|
|
24
25
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
25
26
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
26
27
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -47,8 +48,6 @@ import TableFloatingControls from '../ui/TableFloatingControls';
|
|
|
47
48
|
import { ExternalDropTargets } from './ExternalDropTargets';
|
|
48
49
|
import { TableContainer } from './TableContainer';
|
|
49
50
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
50
|
-
var isIE11 = browser.ie_version === 11;
|
|
51
|
-
|
|
52
51
|
// Prevent unnecessary parentWidth updates when table is nested inside of a node that is nested itself.
|
|
53
52
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD = 2;
|
|
54
53
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD = 20;
|
|
@@ -300,7 +299,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
300
299
|
isNumberOfColumnsChanged = params.isNumberOfColumnsChanged,
|
|
301
300
|
isFullWidthModeAndLineLengthChanged = params.isFullWidthModeAndLineLengthChanged;
|
|
302
301
|
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);
|
|
303
|
-
if (
|
|
302
|
+
if (isFullPageEditor) {
|
|
304
303
|
return !!isWindowResized || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
305
304
|
}
|
|
306
305
|
return isWidthChanged || isTableWidthChanged || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
@@ -382,10 +381,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
382
381
|
}
|
|
383
382
|
}
|
|
384
383
|
});
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}
|
|
384
|
+
|
|
385
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
386
|
+
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
389
387
|
}
|
|
390
388
|
}
|
|
391
389
|
}, {
|
|
@@ -400,9 +398,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
400
398
|
allowTableResizing = _this$props6.allowTableResizing,
|
|
401
399
|
eventDispatcher = _this$props6.eventDispatcher,
|
|
402
400
|
isDragAndDropEnabled = _this$props6.isDragAndDropEnabled,
|
|
403
|
-
getNode = _this$props6.getNode
|
|
404
|
-
|
|
405
|
-
|
|
401
|
+
getNode = _this$props6.getNode;
|
|
402
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
403
|
+
var isIE11 = browser.ie_version === 11;
|
|
406
404
|
|
|
407
405
|
// Ignored via go/ees005
|
|
408
406
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -415,17 +413,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
415
413
|
// Ignored via go/ees005
|
|
416
414
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
417
415
|
this === null || this === void 0 || (_this$table3 = this.table) === null || _this$table3 === void 0 || _this$table3.addEventListener('mouseover', this.handleMouseOver);
|
|
418
|
-
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
419
|
-
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
|
|
420
|
-
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
|
|
421
|
-
if (!expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
422
|
-
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
423
|
-
this.handleColgroupUpdates(true);
|
|
424
|
-
}
|
|
425
|
-
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
426
|
-
this.handleColgroupUpdates(true);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
416
|
if (this.wrapper) {
|
|
430
417
|
this.wrapperReisizeObserver = new ResizeObserver(function (entries) {
|
|
431
418
|
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
@@ -492,6 +479,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
492
479
|
isDragAndDropEnabled = _this$props7.isDragAndDropEnabled,
|
|
493
480
|
view = _this$props7.view,
|
|
494
481
|
isInDanger = _this$props7.isInDanger;
|
|
482
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
483
|
+
var isIE11 = browser.ie_version === 11;
|
|
495
484
|
if (this.wrapper && !isIE11) {
|
|
496
485
|
// Ignored via go/ees005
|
|
497
486
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -526,10 +515,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
526
515
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
527
516
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
528
517
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
}
|
|
518
|
+
|
|
519
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
520
|
+
window.removeEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
533
521
|
|
|
534
522
|
// Ignored via go/ees005
|
|
535
523
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -616,7 +604,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
616
604
|
containerLineLength = containerWidth.lineLength;
|
|
617
605
|
var isLineLengthChanged = ((_this$containerWidth = this.containerWidth) === null || _this$containerWidth === void 0 ? void 0 : _this$containerWidth.lineLength) !== containerLineLength;
|
|
618
606
|
var isFullWidthModeAndLineLengthChanged = this.updateColGroupFromFullWidthChange && isLineLengthChanged && fg('platform_editor_table_overflow_in_full_width_fix');
|
|
619
|
-
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged ||
|
|
607
|
+
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged || this.state.windowResized;
|
|
620
608
|
if (force || maybeScale || isFullWidthModeAndLineLengthChanged) {
|
|
621
609
|
var _this$containerWidth2, _this$props$options3, _this$props$options4, _this$props$options5;
|
|
622
610
|
var isWidthChanged = ((_this$containerWidth2 = this.containerWidth) === null || _this$containerWidth2 === void 0 ? void 0 : _this$containerWidth2.width) !== containerWidthValue;
|
|
@@ -635,9 +623,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
635
623
|
isNumberOfColumnsChanged: isNumberOfColumnsChanged,
|
|
636
624
|
isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged
|
|
637
625
|
});
|
|
638
|
-
var
|
|
639
|
-
|
|
640
|
-
tableWithFixedColumnWidthsOption =
|
|
626
|
+
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
627
|
+
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
|
|
628
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
|
|
641
629
|
var isTableScalingWithFixedColumnWidthsOptionEnabled = !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
|
|
642
630
|
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);
|
|
643
631
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
@@ -718,9 +706,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
718
706
|
var table = findTable(view.state.selection);
|
|
719
707
|
var shouldScale = false;
|
|
720
708
|
var shouldHandleColgroupUpdates = false;
|
|
721
|
-
var
|
|
722
|
-
|
|
723
|
-
tableWithFixedColumnWidthsOption =
|
|
709
|
+
var _getEditorFeatureFlag3 = getEditorFeatureFlags(),
|
|
710
|
+
_getEditorFeatureFlag4 = _getEditorFeatureFlag3.tableWithFixedColumnWidthsOption,
|
|
711
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag4 === void 0 ? false : _getEditorFeatureFlag4;
|
|
724
712
|
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
725
713
|
shouldScale = true;
|
|
726
714
|
shouldHandleColgroupUpdates = true;
|
|
@@ -731,7 +719,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
731
719
|
shouldScale = true;
|
|
732
720
|
shouldHandleColgroupUpdates = true;
|
|
733
721
|
}
|
|
734
|
-
if (
|
|
722
|
+
if (this.state.windowResized) {
|
|
735
723
|
shouldHandleColgroupUpdates = true;
|
|
736
724
|
}
|
|
737
725
|
if (shouldHandleColgroupUpdates) {
|
|
@@ -889,9 +877,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
889
877
|
tablePos = undefined;
|
|
890
878
|
}
|
|
891
879
|
var isNested = isTableNested(view.state, tablePos);
|
|
892
|
-
var
|
|
893
|
-
|
|
894
|
-
tableWithFixedColumnWidthsOption =
|
|
880
|
+
var _getEditorFeatureFlag5 = getEditorFeatureFlags(),
|
|
881
|
+
_getEditorFeatureFlag6 = _getEditorFeatureFlag5.tableWithFixedColumnWidthsOption,
|
|
882
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag6 === void 0 ? false : _getEditorFeatureFlag6;
|
|
895
883
|
var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption || !!((_this$props$options10 = this.props.options) !== null && _this$props$options10 !== void 0 && _this$props$options10.isCommentEditor));
|
|
896
884
|
return /*#__PURE__*/React.createElement(TableContainer
|
|
897
885
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -7,8 +7,6 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
7
7
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
8
8
|
import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
11
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
11
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
14
12
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -75,8 +73,8 @@ var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
|
75
73
|
}, [alignment]);
|
|
76
74
|
return /*#__PURE__*/React.createElement("div", {
|
|
77
75
|
"data-testid": "table-alignment-container",
|
|
78
|
-
"data-ssr-placeholder":
|
|
79
|
-
"data-ssr-placeholder-replace":
|
|
76
|
+
"data-ssr-placeholder": "table-".concat(node.attrs.localId),
|
|
77
|
+
"data-ssr-placeholder-replace": "table-".concat(node.attrs.localId)
|
|
80
78
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
81
79
|
,
|
|
82
80
|
style: style
|
|
@@ -92,8 +90,8 @@ var AlignmentTableContainerWrapper = function AlignmentTableContainerWrapper(_re
|
|
|
92
90
|
if (!isTableAlignmentEnabled) {
|
|
93
91
|
return /*#__PURE__*/React.createElement("div", {
|
|
94
92
|
"data-testid": "table-alignment-container",
|
|
95
|
-
"data-ssr-placeholder":
|
|
96
|
-
"data-ssr-placeholder-replace":
|
|
93
|
+
"data-ssr-placeholder": "table-".concat(node.attrs.localId),
|
|
94
|
+
"data-ssr-placeholder-replace": "table-".concat(node.attrs.localId),
|
|
97
95
|
style: {
|
|
98
96
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
99
97
|
display: 'flex',
|
|
@@ -120,7 +118,7 @@ var getPadding = function getPadding(containerWidth) {
|
|
|
120
118
|
exposure: true
|
|
121
119
|
}) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
122
120
|
};
|
|
123
|
-
var
|
|
121
|
+
export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
124
122
|
var children = _ref4.children,
|
|
125
123
|
className = _ref4.className,
|
|
126
124
|
node = _ref4.node,
|
|
@@ -137,7 +135,9 @@ var ResizableTableContainerLegacy = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
137
135
|
isTableWithFixedColumnWidthsOptionEnabled = _ref4.isTableWithFixedColumnWidthsOptionEnabled,
|
|
138
136
|
isTableAlignmentEnabled = _ref4.isTableAlignmentEnabled,
|
|
139
137
|
shouldUseIncreasedScalingPercent = _ref4.shouldUseIncreasedScalingPercent,
|
|
140
|
-
isCommentEditor = _ref4.isCommentEditor
|
|
138
|
+
isCommentEditor = _ref4.isCommentEditor,
|
|
139
|
+
isChromelessEditor = _ref4.isChromelessEditor;
|
|
140
|
+
var tableWidth = getTableContainerWidth(node);
|
|
141
141
|
var containerRef = useRef(null);
|
|
142
142
|
var tableWidthRef = useRef(akEditorDefaultLayoutWidth);
|
|
143
143
|
var _useState = useState(false),
|
|
@@ -201,186 +201,6 @@ var ResizableTableContainerLegacy = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
201
201
|
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$s;
|
|
202
202
|
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;
|
|
203
203
|
}, [pluginInjectionApi]);
|
|
204
|
-
var tableWidth = getTableContainerWidth(node);
|
|
205
|
-
var responsiveContainerWidth = 0;
|
|
206
|
-
var resizeHandleSpacing = 12;
|
|
207
|
-
var padding = getPadding(containerWidth);
|
|
208
|
-
// When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
|
|
209
|
-
// updating Settings -> Appearance -> Show scroll bars from "When scrolling" to "Always". It causes
|
|
210
|
-
// issues when viwport width is less than full width Editor's width. To detect avoid them
|
|
211
|
-
// we need to use lineLength to defined responsiveWidth instead of containerWidth
|
|
212
|
-
// (which does not get updated when Mac setting changes) in Full-width editor.
|
|
213
|
-
if (isFullWidthModeEnabled) {
|
|
214
|
-
// When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
|
|
215
|
-
// When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
|
|
216
|
-
// scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
|
|
217
|
-
responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - padding * 2 - resizeHandleSpacing;
|
|
218
|
-
|
|
219
|
-
// platform_editor_table_fw_numcol_overflow_fix:
|
|
220
|
-
// lineLength is undefined on first paint → width: NaN → wrapper expands to page
|
|
221
|
-
// width. rAF col-sizing then runs before the number-column padding and
|
|
222
|
-
// the final shrink, so column widths are locked in wrong.
|
|
223
|
-
// With the flag ON, if the value isn’t finite we fall back to gutterWidth
|
|
224
|
-
// for that first frame—no flash, no premature rAF.
|
|
225
|
-
//
|
|
226
|
-
// Type clean-up comes later:
|
|
227
|
-
// 1) ship this runtime guard (quick fix, no breakage);
|
|
228
|
-
// 2) TODO: widen lineLength to `number|undefined` and remove this block.
|
|
229
|
-
if (fg('platform_editor_table_fw_numcol_overflow_fix')) {
|
|
230
|
-
if (isTableScalingEnabled && !Number.isFinite(responsiveContainerWidth)) {
|
|
231
|
-
responsiveContainerWidth = containerWidth - padding * 2 - resizeHandleSpacing;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
} else if (isCommentEditor) {
|
|
235
|
-
responsiveContainerWidth = containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR;
|
|
236
|
-
} else {
|
|
237
|
-
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
238
|
-
// containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
|
|
239
|
-
// a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
|
|
240
|
-
// padding left = padding right = akEditorGutterPadding = 32
|
|
241
|
-
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - padding * 2 : containerWidth - padding * 2 - resizeHandleSpacing;
|
|
242
|
-
}
|
|
243
|
-
// Fix for HOT-119925: Ensure table width is properly constrained and responsive
|
|
244
|
-
// For wide tables, ensure they don't exceed container width and can be scrolled
|
|
245
|
-
var calculatedWidth = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
246
|
-
|
|
247
|
-
// Ensure minimum width for usability while respecting container constraints
|
|
248
|
-
var width = Math.max(calculatedWidth, Math.min(responsiveContainerWidth * 0.5, 300));
|
|
249
|
-
if (!isResizing) {
|
|
250
|
-
tableWidthRef.current = width;
|
|
251
|
-
}
|
|
252
|
-
var maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
|
|
253
|
-
var tableResizerProps = {
|
|
254
|
-
width: width,
|
|
255
|
-
maxWidth: maxResizerWidth,
|
|
256
|
-
containerWidth: containerWidth,
|
|
257
|
-
lineLength: lineLength,
|
|
258
|
-
updateWidth: updateWidth,
|
|
259
|
-
editorView: editorView,
|
|
260
|
-
getPos: getPos,
|
|
261
|
-
node: node,
|
|
262
|
-
tableRef: tableRef,
|
|
263
|
-
displayGuideline: displayGuideline,
|
|
264
|
-
attachAnalyticsEvent: attachAnalyticsEvent,
|
|
265
|
-
displayGapCursor: displayGapCursor,
|
|
266
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
267
|
-
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
268
|
-
isTableScalingEnabled: isTableScalingEnabled,
|
|
269
|
-
isTableWithFixedColumnWidthsOptionEnabled: isTableWithFixedColumnWidthsOptionEnabled,
|
|
270
|
-
isWholeTableInDanger: isWholeTableInDanger,
|
|
271
|
-
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
272
|
-
pluginInjectionApi: pluginInjectionApi,
|
|
273
|
-
onResizeStart: onResizeStart,
|
|
274
|
-
onResizeStop: onResizeStop,
|
|
275
|
-
isCommentEditor: isCommentEditor
|
|
276
|
-
};
|
|
277
|
-
var isLivePageViewMode = mode === 'view';
|
|
278
|
-
return /*#__PURE__*/React.createElement(AlignmentTableContainerWrapper, {
|
|
279
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
280
|
-
node: node,
|
|
281
|
-
pluginInjectionApi: pluginInjectionApi,
|
|
282
|
-
getPos: getPos,
|
|
283
|
-
editorView: editorView
|
|
284
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
285
|
-
style: {
|
|
286
|
-
width: tableWidthRef.current,
|
|
287
|
-
height: resizing ? updateContainerHeight(tableWrapperHeight !== null && tableWrapperHeight !== void 0 ? tableWrapperHeight : 'auto') : 'auto',
|
|
288
|
-
position: isLivePageViewMode ? 'relative' : 'unset'
|
|
289
|
-
}
|
|
290
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
291
|
-
,
|
|
292
|
-
className: ClassName.TABLE_RESIZER_CONTAINER,
|
|
293
|
-
ref: containerRef
|
|
294
|
-
}, /*#__PURE__*/React.createElement(TableResizer, _extends({}, tableResizerProps, {
|
|
295
|
-
disabled: isLivePageViewMode
|
|
296
|
-
}), /*#__PURE__*/React.createElement(InnerContainer, {
|
|
297
|
-
className: className,
|
|
298
|
-
node: node
|
|
299
|
-
}, children))));
|
|
300
|
-
});
|
|
301
|
-
var ResizableTableContainerNext = /*#__PURE__*/React.memo(function (_ref5) {
|
|
302
|
-
var children = _ref5.children,
|
|
303
|
-
className = _ref5.className,
|
|
304
|
-
node = _ref5.node,
|
|
305
|
-
containerWidth = _ref5.containerWidth,
|
|
306
|
-
lineLength = _ref5.lineLength,
|
|
307
|
-
editorView = _ref5.editorView,
|
|
308
|
-
getPos = _ref5.getPos,
|
|
309
|
-
tableRef = _ref5.tableRef,
|
|
310
|
-
isResizing = _ref5.isResizing,
|
|
311
|
-
pluginInjectionApi = _ref5.pluginInjectionApi,
|
|
312
|
-
tableWrapperHeight = _ref5.tableWrapperHeight,
|
|
313
|
-
isWholeTableInDanger = _ref5.isWholeTableInDanger,
|
|
314
|
-
isTableScalingEnabled = _ref5.isTableScalingEnabled,
|
|
315
|
-
isTableWithFixedColumnWidthsOptionEnabled = _ref5.isTableWithFixedColumnWidthsOptionEnabled,
|
|
316
|
-
isTableAlignmentEnabled = _ref5.isTableAlignmentEnabled,
|
|
317
|
-
shouldUseIncreasedScalingPercent = _ref5.shouldUseIncreasedScalingPercent,
|
|
318
|
-
isCommentEditor = _ref5.isCommentEditor,
|
|
319
|
-
isChromelessEditor = _ref5.isChromelessEditor;
|
|
320
|
-
var tableWidth = getTableContainerWidth(node);
|
|
321
|
-
var containerRef = useRef(null);
|
|
322
|
-
var tableWidthRef = useRef(akEditorDefaultLayoutWidth);
|
|
323
|
-
var _useState3 = useState(false),
|
|
324
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
325
|
-
resizing = _useState4[0],
|
|
326
|
-
setIsResizing = _useState4[1];
|
|
327
|
-
var _useSharedPluginState3 = useSharedPluginStateWithSelector(pluginInjectionApi, ['table', 'editorViewMode'], selector),
|
|
328
|
-
tableState = _useSharedPluginState3.tableState,
|
|
329
|
-
editorViewModeState = _useSharedPluginState3.editorViewModeState;
|
|
330
|
-
var isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
|
|
331
|
-
var mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
332
|
-
var updateContainerHeight = useCallback(function (height) {
|
|
333
|
-
var _containerRef$current3;
|
|
334
|
-
// current StickyHeader State is not stable to be fetch.
|
|
335
|
-
// we need to update stickyHeader plugin to make sure state can be
|
|
336
|
-
// consistently fetch and refactor below
|
|
337
|
-
var stickyHeaders = (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.getElementsByClassName('pm-table-sticky');
|
|
338
|
-
if (!stickyHeaders || stickyHeaders.length < 1) {
|
|
339
|
-
// when starting to drag, we need to keep the original space,
|
|
340
|
-
// -- When sticky header not appear, margin top(24px) and margin bottom(16px), should be 40px,
|
|
341
|
-
// 1px is border width but collapse make it 0.5.
|
|
342
|
-
// -- When sticky header appear, we should add first row height but reduce
|
|
343
|
-
// collapsed border
|
|
344
|
-
return typeof height === 'number' ? "".concat(height + 40.5, "px") : 'auto';
|
|
345
|
-
} else {
|
|
346
|
-
var _containerRef$current4;
|
|
347
|
-
var stickyHeaderHeight = ((_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.getElementsByTagName('th')[0].getBoundingClientRect().height) || 0;
|
|
348
|
-
return typeof height === 'number' ? "".concat(height + stickyHeaderHeight + 39.5, "px") : 'auto';
|
|
349
|
-
}
|
|
350
|
-
}, []);
|
|
351
|
-
var onResizeStart = useCallback(function () {
|
|
352
|
-
setIsResizing(true);
|
|
353
|
-
}, []);
|
|
354
|
-
var onResizeStop = useCallback(function () {
|
|
355
|
-
setIsResizing(false);
|
|
356
|
-
}, []);
|
|
357
|
-
var updateWidth = useCallback(function (width) {
|
|
358
|
-
if (!containerRef.current) {
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// make sure during resizing
|
|
363
|
-
// the pm-table-resizer-container width is the same as its child div resizer-item
|
|
364
|
-
// otherwise when resize table from wider to narrower , pm-table-resizer-container stays wider
|
|
365
|
-
// and cause the fabric-editor-popup-scroll-parent to overflow
|
|
366
|
-
if (containerRef.current.style.width !== "".concat(width, "px")) {
|
|
367
|
-
containerRef.current.style.width = "".concat(width, "px");
|
|
368
|
-
}
|
|
369
|
-
}, []);
|
|
370
|
-
var displayGuideline = useCallback(function (guidelines) {
|
|
371
|
-
var _pluginInjectionApi$g3, _pluginInjectionApi$g4;
|
|
372
|
-
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)({
|
|
373
|
-
guidelines: guidelines
|
|
374
|
-
})) !== null && _pluginInjectionApi$g3 !== void 0 ? _pluginInjectionApi$g3 : false;
|
|
375
|
-
}, [pluginInjectionApi, editorView]);
|
|
376
|
-
var attachAnalyticsEvent = useCallback(function (payload) {
|
|
377
|
-
var _pluginInjectionApi$a3;
|
|
378
|
-
return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions.attachAnalyticsEvent(payload);
|
|
379
|
-
}, [pluginInjectionApi]);
|
|
380
|
-
var displayGapCursor = useCallback(function (toggle) {
|
|
381
|
-
var _pluginInjectionApi$c3, _pluginInjectionApi$c4, _pluginInjectionApi$s2;
|
|
382
|
-
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;
|
|
383
|
-
}, [pluginInjectionApi]);
|
|
384
204
|
var isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
|
|
385
205
|
var _useMemo = useMemo(function () {
|
|
386
206
|
var responsiveContainerWidth = 0;
|
|
@@ -510,32 +330,28 @@ var ResizableTableContainerNext = /*#__PURE__*/React.memo(function (_ref5) {
|
|
|
510
330
|
node: node
|
|
511
331
|
}, children))));
|
|
512
332
|
});
|
|
513
|
-
export var
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
isTableAlignmentEnabled = _ref6.isTableAlignmentEnabled,
|
|
536
|
-
shouldUseIncreasedScalingPercent = _ref6.shouldUseIncreasedScalingPercent,
|
|
537
|
-
isCommentEditor = _ref6.isCommentEditor,
|
|
538
|
-
isChromelessEditor = _ref6.isChromelessEditor;
|
|
333
|
+
export var TableContainer = function TableContainer(_ref5) {
|
|
334
|
+
var children = _ref5.children,
|
|
335
|
+
node = _ref5.node,
|
|
336
|
+
className = _ref5.className,
|
|
337
|
+
_ref5$containerWidth = _ref5.containerWidth,
|
|
338
|
+
editorWidth = _ref5$containerWidth.width,
|
|
339
|
+
lineLength = _ref5$containerWidth.lineLength,
|
|
340
|
+
editorView = _ref5.editorView,
|
|
341
|
+
getPos = _ref5.getPos,
|
|
342
|
+
tableRef = _ref5.tableRef,
|
|
343
|
+
isNested = _ref5.isNested,
|
|
344
|
+
tableWrapperHeight = _ref5.tableWrapperHeight,
|
|
345
|
+
isResizing = _ref5.isResizing,
|
|
346
|
+
pluginInjectionApi = _ref5.pluginInjectionApi,
|
|
347
|
+
isWholeTableInDanger = _ref5.isWholeTableInDanger,
|
|
348
|
+
isTableResizingEnabled = _ref5.isTableResizingEnabled,
|
|
349
|
+
isTableScalingEnabled = _ref5.isTableScalingEnabled,
|
|
350
|
+
isTableWithFixedColumnWidthsOptionEnabled = _ref5.isTableWithFixedColumnWidthsOptionEnabled,
|
|
351
|
+
isTableAlignmentEnabled = _ref5.isTableAlignmentEnabled,
|
|
352
|
+
shouldUseIncreasedScalingPercent = _ref5.shouldUseIncreasedScalingPercent,
|
|
353
|
+
isCommentEditor = _ref5.isCommentEditor,
|
|
354
|
+
isChromelessEditor = _ref5.isChromelessEditor;
|
|
539
355
|
if (isTableResizingEnabled && !isNested) {
|
|
540
356
|
return /*#__PURE__*/React.createElement(ResizableTableContainer
|
|
541
357
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -568,7 +384,7 @@ export var TableContainer = function TableContainer(_ref6) {
|
|
|
568
384
|
var _getPluginState = getPluginState(editorView.state),
|
|
569
385
|
isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
|
|
570
386
|
var isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
|
|
571
|
-
var resizableTableWidth =
|
|
387
|
+
var resizableTableWidth = isFullPageAppearance ? getTableResizerContainerForFullPageWidthInCSS(node, isTableScalingEnabled) : "calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))";
|
|
572
388
|
return /*#__PURE__*/React.createElement(InnerContainer, {
|
|
573
389
|
node: node
|
|
574
390
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|