@atlaskit/editor-plugin-table 14.2.3 → 14.2.5

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 14.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`6b6eca9cee16d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6b6eca9cee16d) -
8
+ Switch to use editorExperiment to use productKey for responsive preview panel changes.
9
+ - [`07c4ed52fa008`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/07c4ed52fa008) -
10
+ Hydration fixes for table plugin
11
+ - Updated dependencies
12
+
13
+ ## 14.2.4
14
+
15
+ ### Patch Changes
16
+
17
+ - [`6759639cbc48a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6759639cbc48a) -
18
+ Optimized table resizing in full page mode by bundling layout calculations and clean up old
19
+ expensive layout calculations
20
+
3
21
  ## 14.2.3
4
22
 
5
23
  ### Patch Changes
@@ -1069,7 +1069,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
1069
1069
  tableWrapperHeight: this.state.tableWrapperHeight,
1070
1070
  isTableResizingEnabled: allowTableResizing,
1071
1071
  isResizing: isResizing,
1072
- isWindowResized: this.state.windowResized,
1073
1072
  isTableScalingEnabled: isTableScalingEnabled,
1074
1073
  isTableWithFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
1075
1074
  isWholeTableInDanger: isWholeTableInDanger,
@@ -11,13 +11,13 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _classnames = _interopRequireDefault(require("classnames"));
13
13
  var _analytics = require("@atlaskit/editor-common/analytics");
14
- var _coreUtils = require("@atlaskit/editor-common/core-utils");
15
14
  var _hooks = require("@atlaskit/editor-common/hooks");
16
15
  var _nodeWidth = require("@atlaskit/editor-common/node-width");
17
16
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
18
17
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
18
  var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
20
19
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
20
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
21
21
  var _commandsWithAnalytics = require("../pm-plugins/commands/commands-with-analytics");
22
22
  var _pluginFactory = require("../pm-plugins/plugin-factory");
23
23
  var _consts = require("../pm-plugins/table-resizing/utils/consts");
@@ -125,7 +125,9 @@ var selector = function selector(states) {
125
125
  };
126
126
  };
127
127
  var getPadding = function getPadding(containerWidth) {
128
- return containerWidth <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
128
+ return containerWidth <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
129
+ exposure: true
130
+ }) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
129
131
  };
130
132
  var ResizableTableContainerLegacy = /*#__PURE__*/_react.default.memo(function (_ref4) {
131
133
  var children = _ref4.children,
@@ -336,7 +338,6 @@ var ResizableTableContainerNext = /*#__PURE__*/_react.default.memo(function (_re
336
338
  getPos = _ref5.getPos,
337
339
  tableRef = _ref5.tableRef,
338
340
  isResizing = _ref5.isResizing,
339
- isWindowResized = _ref5.isWindowResized,
340
341
  pluginInjectionApi = _ref5.pluginInjectionApi,
341
342
  tableWrapperHeight = _ref5.tableWrapperHeight,
342
343
  isWholeTableInDanger = _ref5.isWholeTableInDanger,
@@ -353,10 +354,6 @@ var ResizableTableContainerNext = /*#__PURE__*/_react.default.memo(function (_re
353
354
  _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
354
355
  resizing = _useState4[0],
355
356
  setIsResizing = _useState4[1];
356
- var _useState5 = (0, _react.useState)(tableWidth),
357
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
358
- tableMaxWidthForFullPageOnLoad = _useState6[0],
359
- setTableMaxWidthForFullPageOnLoad = _useState6[1];
360
357
  var _useSharedPluginState3 = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['table', 'editorViewMode'], selector),
361
358
  tableState = _useSharedPluginState3.tableState,
362
359
  editorViewModeState = _useSharedPluginState3.editorViewModeState;
@@ -415,74 +412,65 @@ var ResizableTableContainerNext = /*#__PURE__*/_react.default.memo(function (_re
415
412
  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;
416
413
  }, [pluginInjectionApi]);
417
414
  var isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
418
- var responsiveContainerWidth = 0;
419
- var resizeHandleSpacing = 12;
420
- var padding = getPadding(containerWidth);
421
- // When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
422
- // updating Settings -> Appearance -> Show scroll bars from "When scrolling" to "Always". It causes
423
- // issues when viwport width is less than full width Editor's width. To detect avoid them
424
- // we need to use lineLength to defined responsiveWidth instead of containerWidth
425
- // (which does not get updated when Mac setting changes) in Full-width editor.
426
- if (isFullWidthModeEnabled) {
427
- // When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
428
- // When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
429
- // scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
430
- responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - padding * 2 - resizeHandleSpacing;
415
+ var _useMemo = (0, _react.useMemo)(function () {
416
+ var responsiveContainerWidth = 0;
417
+ var resizeHandleSpacing = 12;
418
+ var padding = getPadding(containerWidth);
419
+ // When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
420
+ // updating Settings -> Appearance -> Show scroll bars from "When scrolling" to "Always". It causes
421
+ // issues when viwport width is less than full width Editor's width. To detect avoid them
422
+ // we need to use lineLength to defined responsiveWidth instead of containerWidth
423
+ // (which does not get updated when Mac setting changes) in Full-width editor.
424
+ if (isFullWidthModeEnabled) {
425
+ // When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
426
+ // When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
427
+ // scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
428
+ responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - padding * 2 - resizeHandleSpacing;
431
429
 
432
- // platform_editor_table_fw_numcol_overflow_fix:
433
- // lineLength is undefined on first paint → width: NaN → wrapper expands to page
434
- // width. rAF col-sizing then runs before the number-column padding and
435
- // the final shrink, so column widths are locked in wrong.
436
- // With the flag ON, if the value isn’t finite we fall back to gutterWidth
437
- // for that first frame—no flash, no premature rAF.
438
- //
439
- // Type clean-up comes later:
440
- // 1) ship this runtime guard (quick fix, no breakage);
441
- // 2) TODO: widen lineLength to `number|undefined` and remove this block.
442
- if ((0, _platformFeatureFlags.fg)('platform_editor_table_fw_numcol_overflow_fix')) {
443
- if (isTableScalingEnabled && !Number.isFinite(responsiveContainerWidth)) {
444
- responsiveContainerWidth = containerWidth - padding * 2 - resizeHandleSpacing;
430
+ // platform_editor_table_fw_numcol_overflow_fix:
431
+ // lineLength is undefined on first paint → width: NaN → wrapper expands to page
432
+ // width. rAF col-sizing then runs before the number-column padding and
433
+ // the final shrink, so column widths are locked in wrong.
434
+ // With the flag ON, if the value isn’t finite we fall back to gutterWidth
435
+ // for that first frame—no flash, no premature rAF.
436
+ //
437
+ // Type clean-up comes later:
438
+ // 1) ship this runtime guard (quick fix, no breakage);
439
+ // 2) TODO: widen lineLength to `number|undefined` and remove this block.
440
+ if ((0, _platformFeatureFlags.fg)('platform_editor_table_fw_numcol_overflow_fix')) {
441
+ if (isTableScalingEnabled && !Number.isFinite(responsiveContainerWidth)) {
442
+ responsiveContainerWidth = containerWidth - padding * 2 - resizeHandleSpacing;
443
+ }
444
+ }
445
+ } else if (isCommentEditor) {
446
+ responsiveContainerWidth = containerWidth - _consts.TABLE_OFFSET_IN_COMMENT_EDITOR;
447
+ } else {
448
+ // 76 is currently an accepted padding value considering the spacing for resizer handle
449
+ // containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
450
+ // a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
451
+ // padding left = padding right = akEditorGutterPadding = 32
452
+ responsiveContainerWidth = isTableScalingEnabled ? containerWidth - padding * 2 : containerWidth - padding * 2 - resizeHandleSpacing;
445
453
  }
446
- }
447
- } else if (isCommentEditor) {
448
- responsiveContainerWidth = containerWidth - _consts.TABLE_OFFSET_IN_COMMENT_EDITOR;
449
- } else {
450
- // 76 is currently an accepted padding value considering the spacing for resizer handle
451
- // containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
452
- // a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
453
- // padding left = padding right = akEditorGutterPadding = 32
454
- responsiveContainerWidth = isTableScalingEnabled ? containerWidth - padding * 2 : containerWidth - padding * 2 - resizeHandleSpacing;
455
- }
456
454
 
457
- // Fix for HOT-119925: Ensure table width is properly constrained and responsive
458
- // For wide tables, ensure they don't exceed container width and can be scrolled
459
- var calculatedWidth = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
455
+ // Fix for HOT-119925: Ensure table width is properly constrained and responsive
456
+ // For wide tables, ensure they don't exceed container width and can be scrolled
457
+ var calculatedWidth = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
460
458
 
461
- // Ensure minimum width for usability while respecting container constraints
462
- var width = (0, _expValEquals.expValEquals)('platform_editor_table_container_width_fix', 'isEnabled', true) ? Math.max(calculatedWidth, Math.min(responsiveContainerWidth * 0.5, 300)) : calculatedWidth;
463
- if (!isResizing) {
464
- tableWidthRef.current = width;
465
- }
466
- var maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, _consts.TABLE_MAX_WIDTH);
467
-
468
- // CSS solution for table resizer item width
469
- // The `width` is used for .resizer-item in <TableResizer>, and it has to be a number
470
- // So we can't use min(var(--ak-editor-table-width), ${tableWidth}px) here
471
- // We get the correct width from CSS value on page load
472
- // After window resize, we use the width from plugin state
473
- // After table resize, the table width attribute is used
474
- var tableResizerItemWidth = (0, _react.useMemo)(function () {
475
- // if not on full page editor, we just rely on the width calculated from plugin state
476
- // if on full page editor and after window resize, we use the width from plugin state
477
- if (!isFullPageAppearance || isFullPageAppearance && isWindowResized) {
478
- return width;
479
- }
480
- if (isResizing) {
481
- return tableWidth;
459
+ // Ensure minimum width for usability while respecting container constraints
460
+ var width = (0, _expValEquals.expValEquals)('platform_editor_table_container_width_fix', 'isEnabled', true) ? Math.max(calculatedWidth, Math.min(responsiveContainerWidth * 0.5, 300)) : calculatedWidth;
461
+ var maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, _consts.TABLE_MAX_WIDTH);
462
+ return {
463
+ width: width,
464
+ maxResizerWidth: maxResizerWidth
465
+ };
466
+ }, [containerWidth, isCommentEditor, isFullWidthModeEnabled, isTableScalingEnabled, lineLength, node.attrs.width, tableWidth]),
467
+ width = _useMemo.width,
468
+ maxResizerWidth = _useMemo.maxResizerWidth;
469
+ (0, _react.useEffect)(function () {
470
+ if (!isResizing) {
471
+ tableWidthRef.current = width;
482
472
  }
483
- // if on full page editor and on page load, we use the computed value from CSS
484
- return Math.min(tableWidth, tableMaxWidthForFullPageOnLoad);
485
- }, [isWindowResized, isResizing, isFullPageAppearance, tableMaxWidthForFullPageOnLoad, tableWidth, width]);
473
+ }, [width, isResizing]);
486
474
 
487
475
  // CSS Solution for table resizer container width
488
476
  var tableResizerContainerWidth = (0, _react.useMemo)(function () {
@@ -497,21 +485,11 @@ var ResizableTableContainerNext = /*#__PURE__*/_react.default.memo(function (_re
497
485
  // when not resizing, maxWidth is calculated based on the container width via CSS
498
486
  return !isResizing ? nonResizingMaxWidth : maxResizerWidth;
499
487
  }, [isCommentEditor, isChromelessEditor, isTableScalingEnabled, isResizing, maxResizerWidth]);
500
-
501
- // on SSR, the width would be the default state, which is tableWidth
502
- // but because we have maxWidth set to the editor container width via CSS
503
- // So it would work just fine
504
- (0, _react.useEffect)(function () {
505
- var _containerRef$current5;
506
- if (!(0, _coreUtils.isSSR)() && isFullPageAppearance && (_containerRef$current5 = containerRef.current) !== null && _containerRef$current5 !== void 0 && _containerRef$current5.firstElementChild) {
507
- // get the computed value of max-width from '.resizer-item', because it uses `cqw` unit in CSS
508
- var computedStyle = window.getComputedStyle(containerRef.current.firstElementChild);
509
- var _containerWidth = computedStyle.maxWidth ? parseFloat(computedStyle.maxWidth) : tableWidth;
510
- setTableMaxWidthForFullPageOnLoad(Math.min(_containerWidth, tableWidth));
511
- }
512
- }, [tableWidthRef, tableWidth, isFullPageAppearance]);
513
488
  var tableResizerProps = {
514
- width: tableResizerItemWidth,
489
+ // The `width` is used for .resizer-item in <TableResizer>, and it has to be a number
490
+ // So we can't use min(var(--ak-editor-table-width), ${tableWidth}px) here
491
+ // We still have to use JS to calculate width
492
+ width: width,
515
493
  maxWidth: tableResizerMaxWidth,
516
494
  containerWidth: containerWidth,
517
495
  lineLength: lineLength,
@@ -599,7 +577,6 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref6) {
599
577
  isNested = _ref6.isNested,
600
578
  tableWrapperHeight = _ref6.tableWrapperHeight,
601
579
  isResizing = _ref6.isResizing,
602
- isWindowResized = _ref6.isWindowResized,
603
580
  pluginInjectionApi = _ref6.pluginInjectionApi,
604
581
  isWholeTableInDanger = _ref6.isWholeTableInDanger,
605
582
  isTableResizingEnabled = _ref6.isTableResizingEnabled,
@@ -628,7 +605,6 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref6) {
628
605
  tableRef: tableRef,
629
606
  tableWrapperHeight: tableWrapperHeight,
630
607
  isResizing: isResizing,
631
- isWindowResized: isWindowResized,
632
608
  pluginInjectionApi: pluginInjectionApi,
633
609
  isTableScalingEnabled: isTableScalingEnabled,
634
610
  isTableWithFixedColumnWidthsOptionEnabled: isTableWithFixedColumnWidthsOptionEnabled,
@@ -81,7 +81,9 @@ var getResizerMinWidth = function getResizerMinWidth(node) {
81
81
  return minColumnWidth + 1;
82
82
  };
83
83
  var getPadding = function getPadding(containerWidth) {
84
- return containerWidth <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
84
+ return containerWidth <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
85
+ exposure: true
86
+ }) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
85
87
  };
86
88
 
87
89
  /**
@@ -13,6 +13,7 @@ var _adfSchema = require("@atlaskit/adf-schema");
13
13
  var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
14
14
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
15
15
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
16
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
16
17
  var _colgroup = require("../pm-plugins/table-resizing/utils/colgroup");
17
18
  var _consts = require("../pm-plugins/table-resizing/utils/consts");
18
19
  var _misc = require("../pm-plugins/table-resizing/utils/misc");
@@ -25,7 +26,9 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
25
26
  toDOM: function toDOM(node) {
26
27
  var _node$attrs$width;
27
28
  var gutterPadding = function gutterPadding() {
28
- if ((0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
29
+ if ((0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
30
+ exposure: true
31
+ })) {
29
32
  return 'calc(var(--ak-editor--large-gutter-padding) * 2)';
30
33
  } else {
31
34
  return "".concat((0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2, "px");
@@ -11,7 +11,7 @@ var _nodeWidth = require("@atlaskit/editor-common/node-width");
11
11
  var _styles = require("@atlaskit/editor-common/styles");
12
12
  var _utils = require("@atlaskit/editor-common/utils");
13
13
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
14
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
14
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
15
15
  var _colgroup = require("./colgroup");
16
16
  var _consts = require("./consts");
17
17
  // Translates named layouts in number values.
@@ -21,7 +21,9 @@ function getLayoutSize(tableLayout) {
21
21
  var isFullWidthModeEnabled = options.isFullWidthModeEnabled;
22
22
  if (isFullWidthModeEnabled) {
23
23
  var padding = (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
24
- if (containerWidth <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
24
+ if (containerWidth <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
25
+ exposure: true
26
+ })) {
25
27
  padding = _editorSharedStyles.akEditorGutterPaddingReduced;
26
28
  }
27
29
  return containerWidth ? Math.min(containerWidth - padding * 2, _editorSharedStyles.akEditorFullWidthLayoutWidth) : _editorSharedStyles.akEditorFullWidthLayoutWidth;
@@ -8,7 +8,7 @@ exports.findClosestSnap = exports.defaultTablePreserveSnappingWidths = exports.d
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _guideline = require("@atlaskit/editor-common/guideline");
10
10
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
11
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
11
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
12
12
  var numberOfLanesInDefaultLayoutWidth = 12;
13
13
  var calculateSubSnappingWidths = function calculateSubSnappingWidths(totalLanes, totalWidth) {
14
14
  return new Array(Math.round(totalLanes / 2) - 1).fill(totalWidth / totalLanes).map(function (v, i) {
@@ -20,7 +20,9 @@ var calculateDefaultSnappings = exports.calculateDefaultSnappings = function cal
20
20
  return [].concat((0, _toConsumableArray2.default)(calculateSubSnappingWidths(numberOfLanesInDefaultLayoutWidth, _editorSharedStyles.akEditorDefaultLayoutWidth + lengthOffset)), [_editorSharedStyles.akEditorDefaultLayoutWidth + lengthOffset, _editorSharedStyles.akEditorCalculatedWideLayoutWidth + lengthOffset, _editorSharedStyles.akEditorFullWidthLayoutWidth + lengthOffset]);
21
21
  };
22
22
  var getPadding = function getPadding(editorContainerWith) {
23
- return editorContainerWith <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
23
+ return editorContainerWith <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
24
+ exposure: true
25
+ }) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
24
26
  };
25
27
 
26
28
  // FF TablePreserve for calculateDefaultSnappings
@@ -10,6 +10,7 @@ var _ui = require("@atlaskit/editor-common/ui");
10
10
  var _utils = require("@atlaskit/editor-prosemirror/utils");
11
11
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
12
  var _utils2 = require("@atlaskit/editor-tables/utils");
13
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
14
  var _pluginFactory = require("../../pm-plugins/plugin-factory");
14
15
  var _consts = require("../consts");
15
16
  var _ContextualMenu = _interopRequireDefault(require("./ContextualMenu"));
@@ -36,13 +37,24 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
36
37
  isCellMenuOpenByKeyboard = _ref.isCellMenuOpenByKeyboard,
37
38
  isCommentEditor = _ref.isCommentEditor,
38
39
  api = _ref.api;
40
+ if ((0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
41
+ return null;
42
+ }
43
+
39
44
  // TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
45
+ // Remove ! during platform_editor_hydratable_ui cleanup
46
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
40
47
  var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
41
48
  targetCellPosition = _getPluginState.targetCellPosition,
42
49
  isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
50
+ // Remove ! during platform_editor_hydratable_ui cleanup
51
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
43
52
  if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
44
53
  return null;
45
54
  }
55
+
56
+ // Remove ! during platform_editor_hydratable_ui cleanup
57
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
46
58
  var selection = editorView.state.selection;
47
59
  var selectionRect = (0, _utils2.isSelectionType)(selection, 'cell') ?
48
60
  // Ignored via go/ees005
@@ -51,6 +63,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
51
63
  if (!selectionRect) {
52
64
  return null;
53
65
  }
66
+ // Remove ! during platform_editor_hydratable_ui cleanup
67
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
54
68
  var domAtPos = editorView.domAtPos.bind(editorView);
55
69
  var targetCellRef = (0, _utils.findDomRefAtPos)(targetCellPosition, domAtPos);
56
70
  if (!targetCellRef) {
@@ -78,7 +92,10 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
78
92
  stick: true
79
93
  }, (0, _react.jsx)("div", {
80
94
  css: (0, _styles.tablePopupStyles)(isDragAndDropEnabled)
81
- }, (0, _react.jsx)(_ContextualMenu.default, {
95
+ }, (0, _react.jsx)(_ContextualMenu.default
96
+ // Remove ! during platform_editor_hydratable_ui cleanup
97
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
98
+ , {
82
99
  editorView: editorView,
83
100
  offset: [_consts.contextualMenuTriggerSize / 2, -_consts.contextualMenuTriggerSize],
84
101
  isOpen: isOpen,
@@ -1045,7 +1045,6 @@ class TableComponent extends React.Component {
1045
1045
  tableWrapperHeight: this.state.tableWrapperHeight,
1046
1046
  isTableResizingEnabled: allowTableResizing,
1047
1047
  isResizing: isResizing,
1048
- isWindowResized: this.state.windowResized,
1049
1048
  isTableScalingEnabled: isTableScalingEnabled,
1050
1049
  isTableWithFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
1051
1050
  isWholeTableInDanger: isWholeTableInDanger,
@@ -2,13 +2,13 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
- import { isSSR } from '@atlaskit/editor-common/core-utils';
6
5
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
7
6
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
8
7
  import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
9
8
  import { fg } from '@atlaskit/platform-feature-flags';
10
9
  import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
11
10
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
11
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
12
12
  import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
13
13
  import { getPluginState } from '../pm-plugins/plugin-factory';
14
14
  import { TABLE_MAX_WIDTH, TABLE_OFFSET_IN_COMMENT_EDITOR } from '../pm-plugins/table-resizing/utils/consts';
@@ -119,7 +119,9 @@ const selector = states => ({
119
119
  editorViewModeState: states.editorViewModeState
120
120
  });
121
121
  const getPadding = containerWidth => {
122
- return containerWidth <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
122
+ return containerWidth <= akEditorFullPageNarrowBreakout && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
123
+ exposure: true
124
+ }) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
123
125
  };
124
126
  const ResizableTableContainerLegacy = /*#__PURE__*/React.memo(({
125
127
  children,
@@ -329,7 +331,6 @@ const ResizableTableContainerNext = /*#__PURE__*/React.memo(({
329
331
  getPos,
330
332
  tableRef,
331
333
  isResizing,
332
- isWindowResized,
333
334
  pluginInjectionApi,
334
335
  tableWrapperHeight,
335
336
  isWholeTableInDanger,
@@ -344,7 +345,6 @@ const ResizableTableContainerNext = /*#__PURE__*/React.memo(({
344
345
  const containerRef = useRef(null);
345
346
  const tableWidthRef = useRef(akEditorDefaultLayoutWidth);
346
347
  const [resizing, setIsResizing] = useState(false);
347
- const [tableMaxWidthForFullPageOnLoad, setTableMaxWidthForFullPageOnLoad] = useState(tableWidth);
348
348
  const {
349
349
  tableState,
350
350
  editorViewModeState
@@ -404,74 +404,66 @@ const ResizableTableContainerNext = /*#__PURE__*/React.memo(({
404
404
  return (_pluginInjectionApi$c3 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c4 = pluginInjectionApi.core) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? 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;
405
405
  }, [pluginInjectionApi]);
406
406
  const isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
407
- let responsiveContainerWidth = 0;
408
- const resizeHandleSpacing = 12;
409
- const padding = getPadding(containerWidth);
410
- // When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
411
- // updating Settings -> Appearance -> Show scroll bars from "When scrolling" to "Always". It causes
412
- // issues when viwport width is less than full width Editor's width. To detect avoid them
413
- // we need to use lineLength to defined responsiveWidth instead of containerWidth
414
- // (which does not get updated when Mac setting changes) in Full-width editor.
415
- if (isFullWidthModeEnabled) {
416
- // When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
417
- // When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
418
- // scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
419
- responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - padding * 2 - resizeHandleSpacing;
407
+ const {
408
+ width,
409
+ maxResizerWidth
410
+ } = useMemo(() => {
411
+ let responsiveContainerWidth = 0;
412
+ const resizeHandleSpacing = 12;
413
+ const padding = getPadding(containerWidth);
414
+ // When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
415
+ // updating Settings -> Appearance -> Show scroll bars from "When scrolling" to "Always". It causes
416
+ // issues when viwport width is less than full width Editor's width. To detect avoid them
417
+ // we need to use lineLength to defined responsiveWidth instead of containerWidth
418
+ // (which does not get updated when Mac setting changes) in Full-width editor.
419
+ if (isFullWidthModeEnabled) {
420
+ // When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
421
+ // When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
422
+ // scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
423
+ responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - padding * 2 - resizeHandleSpacing;
420
424
 
421
- // platform_editor_table_fw_numcol_overflow_fix:
422
- // lineLength is undefined on first paint → width: NaN → wrapper expands to page
423
- // width. rAF col-sizing then runs before the number-column padding and
424
- // the final shrink, so column widths are locked in wrong.
425
- // With the flag ON, if the value isn’t finite we fall back to gutterWidth
426
- // for that first frame—no flash, no premature rAF.
427
- //
428
- // Type clean-up comes later:
429
- // 1) ship this runtime guard (quick fix, no breakage);
430
- // 2) TODO: widen lineLength to `number|undefined` and remove this block.
431
- if (fg('platform_editor_table_fw_numcol_overflow_fix')) {
432
- if (isTableScalingEnabled && !Number.isFinite(responsiveContainerWidth)) {
433
- responsiveContainerWidth = containerWidth - padding * 2 - resizeHandleSpacing;
425
+ // platform_editor_table_fw_numcol_overflow_fix:
426
+ // lineLength is undefined on first paint → width: NaN → wrapper expands to page
427
+ // width. rAF col-sizing then runs before the number-column padding and
428
+ // the final shrink, so column widths are locked in wrong.
429
+ // With the flag ON, if the value isn’t finite we fall back to gutterWidth
430
+ // for that first frame—no flash, no premature rAF.
431
+ //
432
+ // Type clean-up comes later:
433
+ // 1) ship this runtime guard (quick fix, no breakage);
434
+ // 2) TODO: widen lineLength to `number|undefined` and remove this block.
435
+ if (fg('platform_editor_table_fw_numcol_overflow_fix')) {
436
+ if (isTableScalingEnabled && !Number.isFinite(responsiveContainerWidth)) {
437
+ responsiveContainerWidth = containerWidth - padding * 2 - resizeHandleSpacing;
438
+ }
434
439
  }
440
+ } else if (isCommentEditor) {
441
+ responsiveContainerWidth = containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR;
442
+ } else {
443
+ // 76 is currently an accepted padding value considering the spacing for resizer handle
444
+ // containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
445
+ // a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
446
+ // padding left = padding right = akEditorGutterPadding = 32
447
+ responsiveContainerWidth = isTableScalingEnabled ? containerWidth - padding * 2 : containerWidth - padding * 2 - resizeHandleSpacing;
435
448
  }
436
- } else if (isCommentEditor) {
437
- responsiveContainerWidth = containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR;
438
- } else {
439
- // 76 is currently an accepted padding value considering the spacing for resizer handle
440
- // containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
441
- // a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
442
- // padding left = padding right = akEditorGutterPadding = 32
443
- responsiveContainerWidth = isTableScalingEnabled ? containerWidth - padding * 2 : containerWidth - padding * 2 - resizeHandleSpacing;
444
- }
445
-
446
- // Fix for HOT-119925: Ensure table width is properly constrained and responsive
447
- // For wide tables, ensure they don't exceed container width and can be scrolled
448
- const calculatedWidth = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
449
449
 
450
- // Ensure minimum width for usability while respecting container constraints
451
- const width = expValEquals('platform_editor_table_container_width_fix', 'isEnabled', true) ? Math.max(calculatedWidth, Math.min(responsiveContainerWidth * 0.5, 300)) : calculatedWidth;
452
- if (!isResizing) {
453
- tableWidthRef.current = width;
454
- }
455
- const maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
450
+ // Fix for HOT-119925: Ensure table width is properly constrained and responsive
451
+ // For wide tables, ensure they don't exceed container width and can be scrolled
452
+ const calculatedWidth = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
456
453
 
457
- // CSS solution for table resizer item width
458
- // The `width` is used for .resizer-item in <TableResizer>, and it has to be a number
459
- // So we can't use min(var(--ak-editor-table-width), ${tableWidth}px) here
460
- // We get the correct width from CSS value on page load
461
- // After window resize, we use the width from plugin state
462
- // After table resize, the table width attribute is used
463
- const tableResizerItemWidth = useMemo(() => {
464
- // if not on full page editor, we just rely on the width calculated from plugin state
465
- // if on full page editor and after window resize, we use the width from plugin state
466
- if (!isFullPageAppearance || isFullPageAppearance && isWindowResized) {
467
- return width;
468
- }
469
- if (isResizing) {
470
- return tableWidth;
454
+ // Ensure minimum width for usability while respecting container constraints
455
+ const width = expValEquals('platform_editor_table_container_width_fix', 'isEnabled', true) ? Math.max(calculatedWidth, Math.min(responsiveContainerWidth * 0.5, 300)) : calculatedWidth;
456
+ const maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
457
+ return {
458
+ width,
459
+ maxResizerWidth
460
+ };
461
+ }, [containerWidth, isCommentEditor, isFullWidthModeEnabled, isTableScalingEnabled, lineLength, node.attrs.width, tableWidth]);
462
+ useEffect(() => {
463
+ if (!isResizing) {
464
+ tableWidthRef.current = width;
471
465
  }
472
- // if on full page editor and on page load, we use the computed value from CSS
473
- return Math.min(tableWidth, tableMaxWidthForFullPageOnLoad);
474
- }, [isWindowResized, isResizing, isFullPageAppearance, tableMaxWidthForFullPageOnLoad, tableWidth, width]);
466
+ }, [width, isResizing]);
475
467
 
476
468
  // CSS Solution for table resizer container width
477
469
  const tableResizerContainerWidth = useMemo(() => {
@@ -486,21 +478,11 @@ const ResizableTableContainerNext = /*#__PURE__*/React.memo(({
486
478
  // when not resizing, maxWidth is calculated based on the container width via CSS
487
479
  return !isResizing ? nonResizingMaxWidth : maxResizerWidth;
488
480
  }, [isCommentEditor, isChromelessEditor, isTableScalingEnabled, isResizing, maxResizerWidth]);
489
-
490
- // on SSR, the width would be the default state, which is tableWidth
491
- // but because we have maxWidth set to the editor container width via CSS
492
- // So it would work just fine
493
- useEffect(() => {
494
- var _containerRef$current5;
495
- if (!isSSR() && isFullPageAppearance && (_containerRef$current5 = containerRef.current) !== null && _containerRef$current5 !== void 0 && _containerRef$current5.firstElementChild) {
496
- // get the computed value of max-width from '.resizer-item', because it uses `cqw` unit in CSS
497
- const computedStyle = window.getComputedStyle(containerRef.current.firstElementChild);
498
- const containerWidth = computedStyle.maxWidth ? parseFloat(computedStyle.maxWidth) : tableWidth;
499
- setTableMaxWidthForFullPageOnLoad(Math.min(containerWidth, tableWidth));
500
- }
501
- }, [tableWidthRef, tableWidth, isFullPageAppearance]);
502
481
  const tableResizerProps = {
503
- width: tableResizerItemWidth,
482
+ // The `width` is used for .resizer-item in <TableResizer>, and it has to be a number
483
+ // So we can't use min(var(--ak-editor-table-width), ${tableWidth}px) here
484
+ // We still have to use JS to calculate width
485
+ width,
504
486
  maxWidth: tableResizerMaxWidth,
505
487
  containerWidth,
506
488
  lineLength,
@@ -587,7 +569,6 @@ export const TableContainer = ({
587
569
  isNested,
588
570
  tableWrapperHeight,
589
571
  isResizing,
590
- isWindowResized,
591
572
  pluginInjectionApi,
592
573
  isWholeTableInDanger,
593
574
  isTableResizingEnabled,
@@ -617,7 +598,6 @@ export const TableContainer = ({
617
598
  tableRef: tableRef,
618
599
  tableWrapperHeight: tableWrapperHeight,
619
600
  isResizing: isResizing,
620
- isWindowResized: isWindowResized,
621
601
  pluginInjectionApi: pluginInjectionApi,
622
602
  isTableScalingEnabled: isTableScalingEnabled,
623
603
  isTableWithFixedColumnWidthsOptionEnabled: isTableWithFixedColumnWidthsOptionEnabled,
@@ -68,7 +68,9 @@ const getResizerMinWidth = node => {
68
68
  return minColumnWidth + 1;
69
69
  };
70
70
  const getPadding = containerWidth => {
71
- return containerWidth <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
71
+ return containerWidth <= akEditorFullPageNarrowBreakout && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
72
+ exposure: true
73
+ }) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
72
74
  };
73
75
 
74
76
  /**
@@ -3,6 +3,7 @@ import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
3
3
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
4
4
  import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
5
5
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
7
  import { generateColgroup, generateColgroupFromNode, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
7
8
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
8
9
  import { getTableResizerContainerMaxWidthInCSS, getTableResizerContainerForFullPageWidthInCSS, getTableResizerItemWidthInCSS } from '../pm-plugins/table-resizing/utils/misc';
@@ -14,7 +15,9 @@ export const tableNodeSpecWithFixedToDOM = config => {
14
15
  toDOM: node => {
15
16
  var _node$attrs$width;
16
17
  const gutterPadding = () => {
17
- if (expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
18
+ if (editorExperiment('platform_editor_preview_panel_responsiveness', true, {
19
+ exposure: true
20
+ })) {
18
21
  return 'calc(var(--ak-editor--large-gutter-padding) * 2)';
19
22
  } else {
20
23
  return `${akEditorGutterPaddingDynamic() * 2}px`;
@@ -2,7 +2,7 @@ import { getParentNodeWidth, getTableContainerWidth, layoutToWidth } from '@atla
2
2
  import { calcTableWidth } from '@atlaskit/editor-common/styles';
3
3
  import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
4
4
  import { akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorTableNumberColumnWidth, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
5
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
6
  import { hasTableBeenResized, hasTableColumnBeenResized } from './colgroup';
7
7
  import { MAX_SCALING_PERCENT, MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION, TABLE_MAX_WIDTH } from './consts';
8
8
 
@@ -13,7 +13,9 @@ export function getLayoutSize(tableLayout, containerWidth = 0, options) {
13
13
  } = options;
14
14
  if (isFullWidthModeEnabled) {
15
15
  let padding = akEditorGutterPaddingDynamic();
16
- if (containerWidth <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
16
+ if (containerWidth <= akEditorFullPageNarrowBreakout && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
17
+ exposure: true
18
+ })) {
17
19
  padding = akEditorGutterPaddingReduced;
18
20
  }
19
21
  return containerWidth ? Math.min(containerWidth - padding * 2, akEditorFullWidthLayoutWidth) : akEditorFullWidthLayoutWidth;
@@ -1,11 +1,13 @@
1
1
  import { isVerticalPosition } from '@atlaskit/editor-common/guideline';
2
2
  import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
3
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
4
  const numberOfLanesInDefaultLayoutWidth = 12;
5
5
  const calculateSubSnappingWidths = (totalLanes, totalWidth) => new Array(Math.round(totalLanes / 2) - 1).fill(totalWidth / totalLanes).map((v, i) => v * (i + 1) * 2);
6
6
  export const calculateDefaultSnappings = (lengthOffset = 0) => [...calculateSubSnappingWidths(numberOfLanesInDefaultLayoutWidth, akEditorDefaultLayoutWidth + lengthOffset), akEditorDefaultLayoutWidth + lengthOffset, akEditorCalculatedWideLayoutWidth + lengthOffset, akEditorFullWidthLayoutWidth + lengthOffset];
7
7
  const getPadding = editorContainerWith => {
8
- return editorContainerWith <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
8
+ return editorContainerWith <= akEditorFullPageNarrowBreakout && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
9
+ exposure: true
10
+ }) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
9
11
  };
10
12
 
11
13
  // FF TablePreserve for calculateDefaultSnappings
@@ -8,6 +8,7 @@ import { Popup } from '@atlaskit/editor-common/ui';
8
8
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
9
9
  import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
10
10
  import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
11
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
11
12
  import { getPluginState } from '../../pm-plugins/plugin-factory';
12
13
  import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize, tablePopupMenuFitHeight } from '../consts';
13
14
 
@@ -29,14 +30,25 @@ const FloatingContextualMenu = ({
29
30
  isCommentEditor,
30
31
  api
31
32
  }) => {
33
+ if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
34
+ return null;
35
+ }
36
+
32
37
  // TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
38
+ // Remove ! during platform_editor_hydratable_ui cleanup
39
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
33
40
  const {
34
41
  targetCellPosition,
35
42
  isDragAndDropEnabled
36
43
  } = getPluginState(editorView.state);
44
+ // Remove ! during platform_editor_hydratable_ui cleanup
45
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
37
46
  if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
38
47
  return null;
39
48
  }
49
+
50
+ // Remove ! during platform_editor_hydratable_ui cleanup
51
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
40
52
  const {
41
53
  selection
42
54
  } = editorView.state;
@@ -47,6 +59,8 @@ const FloatingContextualMenu = ({
47
59
  if (!selectionRect) {
48
60
  return null;
49
61
  }
62
+ // Remove ! during platform_editor_hydratable_ui cleanup
63
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
50
64
  const domAtPos = editorView.domAtPos.bind(editorView);
51
65
  const targetCellRef = findDomRefAtPos(targetCellPosition, domAtPos);
52
66
  if (!targetCellRef) {
@@ -74,7 +88,10 @@ const FloatingContextualMenu = ({
74
88
  stick: true
75
89
  }, jsx("div", {
76
90
  css: tablePopupStyles(isDragAndDropEnabled)
77
- }, jsx(ContextualMenu, {
91
+ }, jsx(ContextualMenu
92
+ // Remove ! during platform_editor_hydratable_ui cleanup
93
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
94
+ , {
78
95
  editorView: editorView,
79
96
  offset: [contextualMenuTriggerSize / 2, -contextualMenuTriggerSize],
80
97
  isOpen: isOpen,
@@ -1063,7 +1063,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
1063
1063
  tableWrapperHeight: this.state.tableWrapperHeight,
1064
1064
  isTableResizingEnabled: allowTableResizing,
1065
1065
  isResizing: isResizing,
1066
- isWindowResized: this.state.windowResized,
1067
1066
  isTableScalingEnabled: isTableScalingEnabled,
1068
1067
  isTableWithFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
1069
1068
  isWholeTableInDanger: isWholeTableInDanger,
@@ -3,13 +3,13 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
4
  import classNames from 'classnames';
5
5
  import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
- import { isSSR } from '@atlaskit/editor-common/core-utils';
7
6
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
8
7
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
9
8
  import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
10
9
  import { fg } from '@atlaskit/platform-feature-flags';
11
10
  import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
12
11
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
13
  import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
14
14
  import { getPluginState } from '../pm-plugins/plugin-factory';
15
15
  import { TABLE_MAX_WIDTH, TABLE_OFFSET_IN_COMMENT_EDITOR } from '../pm-plugins/table-resizing/utils/consts';
@@ -116,7 +116,9 @@ var selector = function selector(states) {
116
116
  };
117
117
  };
118
118
  var getPadding = function getPadding(containerWidth) {
119
- return containerWidth <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
119
+ return containerWidth <= akEditorFullPageNarrowBreakout && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
120
+ exposure: true
121
+ }) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
120
122
  };
121
123
  var ResizableTableContainerLegacy = /*#__PURE__*/React.memo(function (_ref4) {
122
124
  var children = _ref4.children,
@@ -327,7 +329,6 @@ var ResizableTableContainerNext = /*#__PURE__*/React.memo(function (_ref5) {
327
329
  getPos = _ref5.getPos,
328
330
  tableRef = _ref5.tableRef,
329
331
  isResizing = _ref5.isResizing,
330
- isWindowResized = _ref5.isWindowResized,
331
332
  pluginInjectionApi = _ref5.pluginInjectionApi,
332
333
  tableWrapperHeight = _ref5.tableWrapperHeight,
333
334
  isWholeTableInDanger = _ref5.isWholeTableInDanger,
@@ -344,10 +345,6 @@ var ResizableTableContainerNext = /*#__PURE__*/React.memo(function (_ref5) {
344
345
  _useState4 = _slicedToArray(_useState3, 2),
345
346
  resizing = _useState4[0],
346
347
  setIsResizing = _useState4[1];
347
- var _useState5 = useState(tableWidth),
348
- _useState6 = _slicedToArray(_useState5, 2),
349
- tableMaxWidthForFullPageOnLoad = _useState6[0],
350
- setTableMaxWidthForFullPageOnLoad = _useState6[1];
351
348
  var _useSharedPluginState3 = useSharedPluginStateWithSelector(pluginInjectionApi, ['table', 'editorViewMode'], selector),
352
349
  tableState = _useSharedPluginState3.tableState,
353
350
  editorViewModeState = _useSharedPluginState3.editorViewModeState;
@@ -406,74 +403,65 @@ var ResizableTableContainerNext = /*#__PURE__*/React.memo(function (_ref5) {
406
403
  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;
407
404
  }, [pluginInjectionApi]);
408
405
  var isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
409
- var responsiveContainerWidth = 0;
410
- var resizeHandleSpacing = 12;
411
- var padding = getPadding(containerWidth);
412
- // When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
413
- // updating Settings -> Appearance -> Show scroll bars from "When scrolling" to "Always". It causes
414
- // issues when viwport width is less than full width Editor's width. To detect avoid them
415
- // we need to use lineLength to defined responsiveWidth instead of containerWidth
416
- // (which does not get updated when Mac setting changes) in Full-width editor.
417
- if (isFullWidthModeEnabled) {
418
- // When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
419
- // When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
420
- // scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
421
- responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - padding * 2 - resizeHandleSpacing;
406
+ var _useMemo = useMemo(function () {
407
+ var responsiveContainerWidth = 0;
408
+ var resizeHandleSpacing = 12;
409
+ var padding = getPadding(containerWidth);
410
+ // When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
411
+ // updating Settings -> Appearance -> Show scroll bars from "When scrolling" to "Always". It causes
412
+ // issues when viwport width is less than full width Editor's width. To detect avoid them
413
+ // we need to use lineLength to defined responsiveWidth instead of containerWidth
414
+ // (which does not get updated when Mac setting changes) in Full-width editor.
415
+ if (isFullWidthModeEnabled) {
416
+ // When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
417
+ // When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
418
+ // scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
419
+ responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - padding * 2 - resizeHandleSpacing;
422
420
 
423
- // platform_editor_table_fw_numcol_overflow_fix:
424
- // lineLength is undefined on first paint → width: NaN → wrapper expands to page
425
- // width. rAF col-sizing then runs before the number-column padding and
426
- // the final shrink, so column widths are locked in wrong.
427
- // With the flag ON, if the value isn’t finite we fall back to gutterWidth
428
- // for that first frame—no flash, no premature rAF.
429
- //
430
- // Type clean-up comes later:
431
- // 1) ship this runtime guard (quick fix, no breakage);
432
- // 2) TODO: widen lineLength to `number|undefined` and remove this block.
433
- if (fg('platform_editor_table_fw_numcol_overflow_fix')) {
434
- if (isTableScalingEnabled && !Number.isFinite(responsiveContainerWidth)) {
435
- responsiveContainerWidth = containerWidth - padding * 2 - resizeHandleSpacing;
421
+ // platform_editor_table_fw_numcol_overflow_fix:
422
+ // lineLength is undefined on first paint → width: NaN → wrapper expands to page
423
+ // width. rAF col-sizing then runs before the number-column padding and
424
+ // the final shrink, so column widths are locked in wrong.
425
+ // With the flag ON, if the value isn’t finite we fall back to gutterWidth
426
+ // for that first frame—no flash, no premature rAF.
427
+ //
428
+ // Type clean-up comes later:
429
+ // 1) ship this runtime guard (quick fix, no breakage);
430
+ // 2) TODO: widen lineLength to `number|undefined` and remove this block.
431
+ if (fg('platform_editor_table_fw_numcol_overflow_fix')) {
432
+ if (isTableScalingEnabled && !Number.isFinite(responsiveContainerWidth)) {
433
+ responsiveContainerWidth = containerWidth - padding * 2 - resizeHandleSpacing;
434
+ }
435
+ }
436
+ } else if (isCommentEditor) {
437
+ responsiveContainerWidth = containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR;
438
+ } else {
439
+ // 76 is currently an accepted padding value considering the spacing for resizer handle
440
+ // containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
441
+ // a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
442
+ // padding left = padding right = akEditorGutterPadding = 32
443
+ responsiveContainerWidth = isTableScalingEnabled ? containerWidth - padding * 2 : containerWidth - padding * 2 - resizeHandleSpacing;
436
444
  }
437
- }
438
- } else if (isCommentEditor) {
439
- responsiveContainerWidth = containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR;
440
- } else {
441
- // 76 is currently an accepted padding value considering the spacing for resizer handle
442
- // containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
443
- // a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
444
- // padding left = padding right = akEditorGutterPadding = 32
445
- responsiveContainerWidth = isTableScalingEnabled ? containerWidth - padding * 2 : containerWidth - padding * 2 - resizeHandleSpacing;
446
- }
447
445
 
448
- // Fix for HOT-119925: Ensure table width is properly constrained and responsive
449
- // For wide tables, ensure they don't exceed container width and can be scrolled
450
- var calculatedWidth = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
446
+ // Fix for HOT-119925: Ensure table width is properly constrained and responsive
447
+ // For wide tables, ensure they don't exceed container width and can be scrolled
448
+ var calculatedWidth = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
451
449
 
452
- // Ensure minimum width for usability while respecting container constraints
453
- var width = expValEquals('platform_editor_table_container_width_fix', 'isEnabled', true) ? Math.max(calculatedWidth, Math.min(responsiveContainerWidth * 0.5, 300)) : calculatedWidth;
454
- if (!isResizing) {
455
- tableWidthRef.current = width;
456
- }
457
- var maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
458
-
459
- // CSS solution for table resizer item width
460
- // The `width` is used for .resizer-item in <TableResizer>, and it has to be a number
461
- // So we can't use min(var(--ak-editor-table-width), ${tableWidth}px) here
462
- // We get the correct width from CSS value on page load
463
- // After window resize, we use the width from plugin state
464
- // After table resize, the table width attribute is used
465
- var tableResizerItemWidth = useMemo(function () {
466
- // if not on full page editor, we just rely on the width calculated from plugin state
467
- // if on full page editor and after window resize, we use the width from plugin state
468
- if (!isFullPageAppearance || isFullPageAppearance && isWindowResized) {
469
- return width;
470
- }
471
- if (isResizing) {
472
- return tableWidth;
450
+ // Ensure minimum width for usability while respecting container constraints
451
+ var width = expValEquals('platform_editor_table_container_width_fix', 'isEnabled', true) ? Math.max(calculatedWidth, Math.min(responsiveContainerWidth * 0.5, 300)) : calculatedWidth;
452
+ var maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
453
+ return {
454
+ width: width,
455
+ maxResizerWidth: maxResizerWidth
456
+ };
457
+ }, [containerWidth, isCommentEditor, isFullWidthModeEnabled, isTableScalingEnabled, lineLength, node.attrs.width, tableWidth]),
458
+ width = _useMemo.width,
459
+ maxResizerWidth = _useMemo.maxResizerWidth;
460
+ useEffect(function () {
461
+ if (!isResizing) {
462
+ tableWidthRef.current = width;
473
463
  }
474
- // if on full page editor and on page load, we use the computed value from CSS
475
- return Math.min(tableWidth, tableMaxWidthForFullPageOnLoad);
476
- }, [isWindowResized, isResizing, isFullPageAppearance, tableMaxWidthForFullPageOnLoad, tableWidth, width]);
464
+ }, [width, isResizing]);
477
465
 
478
466
  // CSS Solution for table resizer container width
479
467
  var tableResizerContainerWidth = useMemo(function () {
@@ -488,21 +476,11 @@ var ResizableTableContainerNext = /*#__PURE__*/React.memo(function (_ref5) {
488
476
  // when not resizing, maxWidth is calculated based on the container width via CSS
489
477
  return !isResizing ? nonResizingMaxWidth : maxResizerWidth;
490
478
  }, [isCommentEditor, isChromelessEditor, isTableScalingEnabled, isResizing, maxResizerWidth]);
491
-
492
- // on SSR, the width would be the default state, which is tableWidth
493
- // but because we have maxWidth set to the editor container width via CSS
494
- // So it would work just fine
495
- useEffect(function () {
496
- var _containerRef$current5;
497
- if (!isSSR() && isFullPageAppearance && (_containerRef$current5 = containerRef.current) !== null && _containerRef$current5 !== void 0 && _containerRef$current5.firstElementChild) {
498
- // get the computed value of max-width from '.resizer-item', because it uses `cqw` unit in CSS
499
- var computedStyle = window.getComputedStyle(containerRef.current.firstElementChild);
500
- var _containerWidth = computedStyle.maxWidth ? parseFloat(computedStyle.maxWidth) : tableWidth;
501
- setTableMaxWidthForFullPageOnLoad(Math.min(_containerWidth, tableWidth));
502
- }
503
- }, [tableWidthRef, tableWidth, isFullPageAppearance]);
504
479
  var tableResizerProps = {
505
- width: tableResizerItemWidth,
480
+ // The `width` is used for .resizer-item in <TableResizer>, and it has to be a number
481
+ // So we can't use min(var(--ak-editor-table-width), ${tableWidth}px) here
482
+ // We still have to use JS to calculate width
483
+ width: width,
506
484
  maxWidth: tableResizerMaxWidth,
507
485
  containerWidth: containerWidth,
508
486
  lineLength: lineLength,
@@ -590,7 +568,6 @@ export var TableContainer = function TableContainer(_ref6) {
590
568
  isNested = _ref6.isNested,
591
569
  tableWrapperHeight = _ref6.tableWrapperHeight,
592
570
  isResizing = _ref6.isResizing,
593
- isWindowResized = _ref6.isWindowResized,
594
571
  pluginInjectionApi = _ref6.pluginInjectionApi,
595
572
  isWholeTableInDanger = _ref6.isWholeTableInDanger,
596
573
  isTableResizingEnabled = _ref6.isTableResizingEnabled,
@@ -619,7 +596,6 @@ export var TableContainer = function TableContainer(_ref6) {
619
596
  tableRef: tableRef,
620
597
  tableWrapperHeight: tableWrapperHeight,
621
598
  isResizing: isResizing,
622
- isWindowResized: isWindowResized,
623
599
  pluginInjectionApi: pluginInjectionApi,
624
600
  isTableScalingEnabled: isTableScalingEnabled,
625
601
  isTableWithFixedColumnWidthsOptionEnabled: isTableWithFixedColumnWidthsOptionEnabled,
@@ -72,7 +72,9 @@ var getResizerMinWidth = function getResizerMinWidth(node) {
72
72
  return minColumnWidth + 1;
73
73
  };
74
74
  var getPadding = function getPadding(containerWidth) {
75
- return containerWidth <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
75
+ return containerWidth <= akEditorFullPageNarrowBreakout && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
76
+ exposure: true
77
+ }) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
76
78
  };
77
79
 
78
80
  /**
@@ -8,6 +8,7 @@ import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
8
8
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
9
9
  import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
10
10
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
11
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
11
12
  import { generateColgroup, generateColgroupFromNode, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
12
13
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
13
14
  import { getTableResizerContainerMaxWidthInCSS, getTableResizerContainerForFullPageWidthInCSS, getTableResizerItemWidthInCSS } from '../pm-plugins/table-resizing/utils/misc';
@@ -18,7 +19,9 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
18
19
  toDOM: function toDOM(node) {
19
20
  var _node$attrs$width;
20
21
  var gutterPadding = function gutterPadding() {
21
- if (expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
22
+ if (editorExperiment('platform_editor_preview_panel_responsiveness', true, {
23
+ exposure: true
24
+ })) {
22
25
  return 'calc(var(--ak-editor--large-gutter-padding) * 2)';
23
26
  } else {
24
27
  return "".concat(akEditorGutterPaddingDynamic() * 2, "px");
@@ -2,7 +2,7 @@ import { getParentNodeWidth, getTableContainerWidth, layoutToWidth } from '@atla
2
2
  import { calcTableWidth } from '@atlaskit/editor-common/styles';
3
3
  import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
4
4
  import { akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorTableNumberColumnWidth, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
5
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
6
  import { hasTableBeenResized, hasTableColumnBeenResized } from './colgroup';
7
7
  import { MAX_SCALING_PERCENT, MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION, TABLE_MAX_WIDTH } from './consts';
8
8
 
@@ -13,7 +13,9 @@ export function getLayoutSize(tableLayout) {
13
13
  var isFullWidthModeEnabled = options.isFullWidthModeEnabled;
14
14
  if (isFullWidthModeEnabled) {
15
15
  var padding = akEditorGutterPaddingDynamic();
16
- if (containerWidth <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
16
+ if (containerWidth <= akEditorFullPageNarrowBreakout && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
17
+ exposure: true
18
+ })) {
17
19
  padding = akEditorGutterPaddingReduced;
18
20
  }
19
21
  return containerWidth ? Math.min(containerWidth - padding * 2, akEditorFullWidthLayoutWidth) : akEditorFullWidthLayoutWidth;
@@ -1,7 +1,7 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { isVerticalPosition } from '@atlaskit/editor-common/guideline';
3
3
  import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
4
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
5
  var numberOfLanesInDefaultLayoutWidth = 12;
6
6
  var calculateSubSnappingWidths = function calculateSubSnappingWidths(totalLanes, totalWidth) {
7
7
  return new Array(Math.round(totalLanes / 2) - 1).fill(totalWidth / totalLanes).map(function (v, i) {
@@ -13,7 +13,9 @@ export var calculateDefaultSnappings = function calculateDefaultSnappings() {
13
13
  return [].concat(_toConsumableArray(calculateSubSnappingWidths(numberOfLanesInDefaultLayoutWidth, akEditorDefaultLayoutWidth + lengthOffset)), [akEditorDefaultLayoutWidth + lengthOffset, akEditorCalculatedWideLayoutWidth + lengthOffset, akEditorFullWidthLayoutWidth + lengthOffset]);
14
14
  };
15
15
  var getPadding = function getPadding(editorContainerWith) {
16
- return editorContainerWith <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
16
+ return editorContainerWith <= akEditorFullPageNarrowBreakout && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
17
+ exposure: true
18
+ }) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
17
19
  };
18
20
 
19
21
  // FF TablePreserve for calculateDefaultSnappings
@@ -8,6 +8,7 @@ import { Popup } from '@atlaskit/editor-common/ui';
8
8
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
9
9
  import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
10
10
  import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
11
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
11
12
  import { getPluginState } from '../../pm-plugins/plugin-factory';
12
13
  import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize, tablePopupMenuFitHeight } from '../consts';
13
14
 
@@ -28,13 +29,24 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
28
29
  isCellMenuOpenByKeyboard = _ref.isCellMenuOpenByKeyboard,
29
30
  isCommentEditor = _ref.isCommentEditor,
30
31
  api = _ref.api;
32
+ if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
33
+ return null;
34
+ }
35
+
31
36
  // TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
37
+ // Remove ! during platform_editor_hydratable_ui cleanup
38
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
32
39
  var _getPluginState = getPluginState(editorView.state),
33
40
  targetCellPosition = _getPluginState.targetCellPosition,
34
41
  isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
42
+ // Remove ! during platform_editor_hydratable_ui cleanup
43
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
35
44
  if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
36
45
  return null;
37
46
  }
47
+
48
+ // Remove ! during platform_editor_hydratable_ui cleanup
49
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
38
50
  var selection = editorView.state.selection;
39
51
  var selectionRect = isSelectionType(selection, 'cell') ?
40
52
  // Ignored via go/ees005
@@ -43,6 +55,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
43
55
  if (!selectionRect) {
44
56
  return null;
45
57
  }
58
+ // Remove ! during platform_editor_hydratable_ui cleanup
59
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
46
60
  var domAtPos = editorView.domAtPos.bind(editorView);
47
61
  var targetCellRef = findDomRefAtPos(targetCellPosition, domAtPos);
48
62
  if (!targetCellRef) {
@@ -70,7 +84,10 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
70
84
  stick: true
71
85
  }, jsx("div", {
72
86
  css: tablePopupStyles(isDragAndDropEnabled)
73
- }, jsx(ContextualMenu, {
87
+ }, jsx(ContextualMenu
88
+ // Remove ! during platform_editor_hydratable_ui cleanup
89
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
90
+ , {
74
91
  editorView: editorView,
75
92
  offset: [contextualMenuTriggerSize / 2, -contextualMenuTriggerSize],
76
93
  isOpen: isOpen,
@@ -16,7 +16,6 @@ type ResizableTableContainerProps = {
16
16
  isTableScalingEnabled?: boolean;
17
17
  isTableWithFixedColumnWidthsOptionEnabled?: boolean;
18
18
  isWholeTableInDanger?: boolean;
19
- isWindowResized?: boolean;
20
19
  lineLength: number;
21
20
  node: PMNode;
22
21
  pluginInjectionApi?: PluginInjectionAPI;
@@ -41,12 +40,11 @@ type TableContainerProps = {
41
40
  isTableScalingEnabled?: boolean;
42
41
  isTableWithFixedColumnWidthsOptionEnabled?: boolean;
43
42
  isWholeTableInDanger?: boolean;
44
- isWindowResized?: boolean;
45
43
  node: PMNode;
46
44
  pluginInjectionApi?: PluginInjectionAPI;
47
45
  shouldUseIncreasedScalingPercent?: boolean;
48
46
  tableRef: HTMLTableElement;
49
47
  tableWrapperHeight?: number;
50
48
  };
51
- export declare const TableContainer: ({ children, node, className, containerWidth: { width: editorWidth, lineLength }, editorView, getPos, tableRef, isNested, tableWrapperHeight, isResizing, isWindowResized, pluginInjectionApi, isWholeTableInDanger, isTableResizingEnabled, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, }: PropsWithChildren<TableContainerProps>) => React.JSX.Element;
49
+ export declare const TableContainer: ({ children, node, className, containerWidth: { width: editorWidth, lineLength }, editorView, getPos, tableRef, isNested, tableWrapperHeight, isResizing, pluginInjectionApi, isWholeTableInDanger, isTableResizingEnabled, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, }: PropsWithChildren<TableContainerProps>) => React.JSX.Element;
52
50
  export {};
@@ -11,7 +11,7 @@ interface Props {
11
11
  api: PluginInjectionAPI | undefined | null;
12
12
  boundariesElement?: HTMLElement;
13
13
  editorAnalyticsAPI?: EditorAnalyticsAPI;
14
- editorView: EditorView;
14
+ editorView: EditorView | undefined;
15
15
  getEditorContainerWidth: GetEditorContainerWidth;
16
16
  getEditorFeatureFlags?: GetEditorFeatureFlags;
17
17
  isCellMenuOpenByKeyboard?: boolean;
@@ -16,7 +16,6 @@ type ResizableTableContainerProps = {
16
16
  isTableScalingEnabled?: boolean;
17
17
  isTableWithFixedColumnWidthsOptionEnabled?: boolean;
18
18
  isWholeTableInDanger?: boolean;
19
- isWindowResized?: boolean;
20
19
  lineLength: number;
21
20
  node: PMNode;
22
21
  pluginInjectionApi?: PluginInjectionAPI;
@@ -41,12 +40,11 @@ type TableContainerProps = {
41
40
  isTableScalingEnabled?: boolean;
42
41
  isTableWithFixedColumnWidthsOptionEnabled?: boolean;
43
42
  isWholeTableInDanger?: boolean;
44
- isWindowResized?: boolean;
45
43
  node: PMNode;
46
44
  pluginInjectionApi?: PluginInjectionAPI;
47
45
  shouldUseIncreasedScalingPercent?: boolean;
48
46
  tableRef: HTMLTableElement;
49
47
  tableWrapperHeight?: number;
50
48
  };
51
- export declare const TableContainer: ({ children, node, className, containerWidth: { width: editorWidth, lineLength }, editorView, getPos, tableRef, isNested, tableWrapperHeight, isResizing, isWindowResized, pluginInjectionApi, isWholeTableInDanger, isTableResizingEnabled, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, }: PropsWithChildren<TableContainerProps>) => React.JSX.Element;
49
+ export declare const TableContainer: ({ children, node, className, containerWidth: { width: editorWidth, lineLength }, editorView, getPos, tableRef, isNested, tableWrapperHeight, isResizing, pluginInjectionApi, isWholeTableInDanger, isTableResizingEnabled, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, }: PropsWithChildren<TableContainerProps>) => React.JSX.Element;
52
50
  export {};
@@ -11,7 +11,7 @@ interface Props {
11
11
  api: PluginInjectionAPI | undefined | null;
12
12
  boundariesElement?: HTMLElement;
13
13
  editorAnalyticsAPI?: EditorAnalyticsAPI;
14
- editorView: EditorView;
14
+ editorView: EditorView | undefined;
15
15
  getEditorContainerWidth: GetEditorContainerWidth;
16
16
  getEditorFeatureFlags?: GetEditorFeatureFlags;
17
17
  isCellMenuOpenByKeyboard?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "14.2.3",
3
+ "version": "14.2.5",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -59,7 +59,7 @@
59
59
  "@atlaskit/primitives": "^14.14.0",
60
60
  "@atlaskit/react-ufo": "^4.7.0",
61
61
  "@atlaskit/theme": "^21.0.0",
62
- "@atlaskit/tmp-editor-statsig": "^12.24.0",
62
+ "@atlaskit/tmp-editor-statsig": "^12.25.0",
63
63
  "@atlaskit/toggle": "^15.1.0",
64
64
  "@atlaskit/tokens": "^6.3.0",
65
65
  "@atlaskit/tooltip": "^20.4.0",
@@ -72,7 +72,7 @@
72
72
  "uuid": "^3.1.0"
73
73
  },
74
74
  "peerDependencies": {
75
- "@atlaskit/editor-common": "^109.8.0",
75
+ "@atlaskit/editor-common": "^109.10.0",
76
76
  "react": "^18.2.0",
77
77
  "react-dom": "^18.2.0",
78
78
  "react-intl-next": "npm:react-intl@^5.18.1"