@atlaskit/editor-plugin-table 12.1.14 → 12.2.0

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.
Files changed (137) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/afm-cc/tsconfig.json +6 -0
  3. package/afm-dev-agents/tsconfig.json +6 -0
  4. package/afm-jira/tsconfig.json +6 -0
  5. package/afm-passionfruit/tsconfig.json +120 -0
  6. package/afm-post-office/tsconfig.json +6 -0
  7. package/afm-rovo-extension/tsconfig.json +6 -0
  8. package/afm-townsquare/tsconfig.json +6 -0
  9. package/afm-volt/tsconfig.json +13 -4
  10. package/dist/cjs/nodeviews/TableComponent.js +77 -26
  11. package/dist/cjs/nodeviews/TableContainer.js +270 -10
  12. package/dist/cjs/nodeviews/TableResizer.js +9 -2
  13. package/dist/cjs/nodeviews/TableRow.js +24 -1
  14. package/dist/cjs/nodeviews/table-node-views.js +1 -1
  15. package/dist/cjs/nodeviews/table.js +22 -7
  16. package/dist/cjs/nodeviews/toDOM.js +23 -7
  17. package/dist/cjs/pm-plugins/main.js +57 -22
  18. package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +72 -1
  19. package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +70 -1
  20. package/dist/cjs/tablePlugin.js +17 -3
  21. package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +2 -7
  22. package/dist/es2019/nodeviews/TableComponent.js +80 -26
  23. package/dist/es2019/nodeviews/TableContainer.js +256 -2
  24. package/dist/es2019/nodeviews/TableResizer.js +9 -2
  25. package/dist/es2019/nodeviews/TableRow.js +24 -1
  26. package/dist/es2019/nodeviews/table-node-views.js +1 -1
  27. package/dist/es2019/nodeviews/table.js +21 -6
  28. package/dist/es2019/nodeviews/toDOM.js +24 -8
  29. package/dist/es2019/pm-plugins/main.js +57 -22
  30. package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +72 -3
  31. package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +70 -1
  32. package/dist/es2019/tablePlugin.js +17 -3
  33. package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +5 -14
  34. package/dist/esm/nodeviews/TableComponent.js +77 -26
  35. package/dist/esm/nodeviews/TableContainer.js +270 -10
  36. package/dist/esm/nodeviews/TableResizer.js +9 -2
  37. package/dist/esm/nodeviews/TableRow.js +24 -1
  38. package/dist/esm/nodeviews/table-node-views.js +1 -1
  39. package/dist/esm/nodeviews/table.js +22 -7
  40. package/dist/esm/nodeviews/toDOM.js +24 -8
  41. package/dist/esm/pm-plugins/main.js +57 -22
  42. package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +74 -3
  43. package/dist/esm/pm-plugins/table-resizing/utils/misc.js +70 -1
  44. package/dist/esm/tablePlugin.js +17 -3
  45. package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +1 -6
  46. package/dist/types/nodeviews/ExternalDropTargets.d.ts +1 -1
  47. package/dist/types/nodeviews/TableComponent.d.ts +1 -0
  48. package/dist/types/nodeviews/TableContainer.d.ts +7 -2
  49. package/dist/types/nodeviews/TableResizer.d.ts +1 -1
  50. package/dist/types/nodeviews/TableRow.d.ts +3 -1
  51. package/dist/types/nodeviews/table.d.ts +1 -1
  52. package/dist/types/nodeviews/toDOM.d.ts +5 -0
  53. package/dist/types/nodeviews/types.d.ts +1 -0
  54. package/dist/types/pm-plugins/analytics/commands.d.ts +2 -2
  55. package/dist/types/pm-plugins/analytics/plugin-factory.d.ts +1 -1
  56. package/dist/types/pm-plugins/analytics/utils/moved-event.d.ts +1 -1
  57. package/dist/types/pm-plugins/commands/column-resize.d.ts +10 -10
  58. package/dist/types/pm-plugins/commands/commands-with-analytics.d.ts +1 -1
  59. package/dist/types/pm-plugins/commands/go-to-next-cell.d.ts +1 -1
  60. package/dist/types/pm-plugins/commands/misc.d.ts +2 -2
  61. package/dist/types/pm-plugins/commands/selection.d.ts +6 -6
  62. package/dist/types/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +3 -3
  63. package/dist/types/pm-plugins/drag-and-drop/commands.d.ts +1 -1
  64. package/dist/types/pm-plugins/drag-and-drop/plugin-factory.d.ts +1 -1
  65. package/dist/types/pm-plugins/plugin-factory.d.ts +1 -1
  66. package/dist/types/pm-plugins/sticky-headers/plugin-state.d.ts +1 -1
  67. package/dist/types/pm-plugins/table-resizing/plugin-factory.d.ts +1 -1
  68. package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -0
  69. package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +41 -0
  70. package/dist/types/pm-plugins/utils/create.d.ts +10 -10
  71. package/dist/types/pm-plugins/utils/decoration.d.ts +3 -3
  72. package/dist/types/pm-plugins/utils/dom.d.ts +2 -2
  73. package/dist/types/pm-plugins/utils/drag-menu.d.ts +3 -3
  74. package/dist/types/pm-plugins/utils/merged-cells.d.ts +3 -2
  75. package/dist/types/tablePluginType.d.ts +2 -0
  76. package/dist/types/ui/DragHandle/index.d.ts +4 -14
  77. package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -7
  78. package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -14
  79. package/dist/types/ui/TableFloatingControls/RowControls/DragControls.d.ts +1 -1
  80. package/dist/types/ui/TableFloatingControls/index.d.ts +1 -7
  81. package/dist/types/ui/global-styles.d.ts +2 -8
  82. package/dist/types/ui/hooks/useInternalTablePluginStateSelector.d.ts +1 -1
  83. package/dist/types-ts4.5/nodeviews/ExternalDropTargets.d.ts +1 -1
  84. package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +1 -0
  85. package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +7 -2
  86. package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +1 -1
  87. package/dist/types-ts4.5/nodeviews/TableRow.d.ts +3 -1
  88. package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
  89. package/dist/types-ts4.5/nodeviews/toDOM.d.ts +5 -0
  90. package/dist/types-ts4.5/nodeviews/types.d.ts +1 -0
  91. package/dist/types-ts4.5/pm-plugins/analytics/commands.d.ts +2 -2
  92. package/dist/types-ts4.5/pm-plugins/analytics/plugin-factory.d.ts +1 -1
  93. package/dist/types-ts4.5/pm-plugins/analytics/utils/moved-event.d.ts +1 -1
  94. package/dist/types-ts4.5/pm-plugins/commands/column-resize.d.ts +10 -10
  95. package/dist/types-ts4.5/pm-plugins/commands/commands-with-analytics.d.ts +1 -1
  96. package/dist/types-ts4.5/pm-plugins/commands/go-to-next-cell.d.ts +1 -1
  97. package/dist/types-ts4.5/pm-plugins/commands/misc.d.ts +2 -2
  98. package/dist/types-ts4.5/pm-plugins/commands/selection.d.ts +6 -6
  99. package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +3 -3
  100. package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands.d.ts +1 -1
  101. package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin-factory.d.ts +1 -1
  102. package/dist/types-ts4.5/pm-plugins/plugin-factory.d.ts +1 -1
  103. package/dist/types-ts4.5/pm-plugins/sticky-headers/plugin-state.d.ts +1 -1
  104. package/dist/types-ts4.5/pm-plugins/table-resizing/plugin-factory.d.ts +1 -1
  105. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -0
  106. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +41 -0
  107. package/dist/types-ts4.5/pm-plugins/utils/create.d.ts +10 -10
  108. package/dist/types-ts4.5/pm-plugins/utils/decoration.d.ts +3 -3
  109. package/dist/types-ts4.5/pm-plugins/utils/dom.d.ts +2 -2
  110. package/dist/types-ts4.5/pm-plugins/utils/drag-menu.d.ts +3 -3
  111. package/dist/types-ts4.5/pm-plugins/utils/merged-cells.d.ts +3 -2
  112. package/dist/types-ts4.5/tablePluginType.d.ts +2 -0
  113. package/dist/types-ts4.5/ui/DragHandle/index.d.ts +4 -14
  114. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -7
  115. package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -14
  116. package/dist/types-ts4.5/ui/TableFloatingControls/RowControls/DragControls.d.ts +1 -1
  117. package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +1 -7
  118. package/dist/types-ts4.5/ui/global-styles.d.ts +2 -8
  119. package/dist/types-ts4.5/ui/hooks/useInternalTablePluginStateSelector.d.ts +1 -1
  120. package/package.json +10 -11
  121. package/src/nodeviews/TableComponent.tsx +113 -23
  122. package/src/nodeviews/TableContainer.tsx +331 -2
  123. package/src/nodeviews/TableResizer.tsx +10 -5
  124. package/src/nodeviews/TableRow.ts +38 -1
  125. package/src/nodeviews/table-node-views.ts +1 -1
  126. package/src/nodeviews/table.tsx +23 -0
  127. package/src/nodeviews/toDOM.ts +75 -9
  128. package/src/nodeviews/types.ts +1 -0
  129. package/src/pm-plugins/main.ts +41 -18
  130. package/src/pm-plugins/table-resizing/utils/colgroup.ts +139 -6
  131. package/src/pm-plugins/table-resizing/utils/misc.ts +87 -0
  132. package/src/tablePlugin.tsx +21 -0
  133. package/src/tablePluginType.ts +2 -0
  134. package/src/ui/TableFloatingControls/NumberColumn/index.tsx +5 -14
  135. package/tsconfig.app.json +6 -0
  136. package/types/package.json +1 -1
  137. package/ui/common-styles/package.json +1 -1
@@ -11,14 +11,17 @@ 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");
14
15
  var _hooks = require("@atlaskit/editor-common/hooks");
15
16
  var _nodeWidth = require("@atlaskit/editor-common/node-width");
16
17
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
17
18
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
+ var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
18
20
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
19
21
  var _commandsWithAnalytics = require("../pm-plugins/commands/commands-with-analytics");
20
22
  var _pluginFactory = require("../pm-plugins/plugin-factory");
21
23
  var _consts = require("../pm-plugins/table-resizing/utils/consts");
24
+ var _misc = require("../pm-plugins/table-resizing/utils/misc");
22
25
  var _alignment = require("../pm-plugins/utils/alignment");
23
26
  var _types = require("../types");
24
27
  var _tableContainerStyles = require("./table-container-styles");
@@ -161,7 +164,7 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
161
164
  var getPadding = function getPadding(containerWidth) {
162
165
  return containerWidth <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
163
166
  };
164
- var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_react.default.memo(function (_ref4) {
167
+ var ResizableTableContainerLegacy = /*#__PURE__*/_react.default.memo(function (_ref4) {
165
168
  var children = _ref4.children,
166
169
  className = _ref4.className,
167
170
  node = _ref4.node,
@@ -355,28 +358,283 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
355
358
  node: node
356
359
  }, children)) : null));
357
360
  });
358
- var TableContainer = exports.TableContainer = function TableContainer(_ref5) {
361
+ var ResizableTableContainerNext = /*#__PURE__*/_react.default.memo(function (_ref5) {
359
362
  var children = _ref5.children,
360
- node = _ref5.node,
361
363
  className = _ref5.className,
362
- _ref5$containerWidth = _ref5.containerWidth,
363
- editorWidth = _ref5$containerWidth.width,
364
- lineLength = _ref5$containerWidth.lineLength,
364
+ node = _ref5.node,
365
+ containerWidth = _ref5.containerWidth,
366
+ lineLength = _ref5.lineLength,
365
367
  editorView = _ref5.editorView,
366
368
  getPos = _ref5.getPos,
367
369
  tableRef = _ref5.tableRef,
368
- isNested = _ref5.isNested,
369
- tableWrapperHeight = _ref5.tableWrapperHeight,
370
370
  isResizing = _ref5.isResizing,
371
+ isWindowResized = _ref5.isWindowResized,
371
372
  pluginInjectionApi = _ref5.pluginInjectionApi,
373
+ tableWrapperHeight = _ref5.tableWrapperHeight,
372
374
  isWholeTableInDanger = _ref5.isWholeTableInDanger,
373
- isTableResizingEnabled = _ref5.isTableResizingEnabled,
374
375
  isTableScalingEnabled = _ref5.isTableScalingEnabled,
375
376
  isTableWithFixedColumnWidthsOptionEnabled = _ref5.isTableWithFixedColumnWidthsOptionEnabled,
376
377
  isTableAlignmentEnabled = _ref5.isTableAlignmentEnabled,
377
378
  shouldUseIncreasedScalingPercent = _ref5.shouldUseIncreasedScalingPercent,
378
379
  isCommentEditor = _ref5.isCommentEditor,
379
380
  isChromelessEditor = _ref5.isChromelessEditor;
381
+ var tableWidth = (0, _nodeWidth.getTableContainerWidth)(node);
382
+ var containerRef = (0, _react.useRef)(null);
383
+ var tableWidthRef = (0, _react.useRef)(_editorSharedStyles.akEditorDefaultLayoutWidth);
384
+ var _useState3 = (0, _react.useState)(false),
385
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
386
+ resizing = _useState4[0],
387
+ setIsResizing = _useState4[1];
388
+ var _useState5 = (0, _react.useState)(tableWidth),
389
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
390
+ tableMaxWidthForFullPageOnLoad = _useState6[0],
391
+ setTableMaxWidthForFullPageOnLoad = _useState6[1];
392
+ var _useSharedState2 = useSharedState(pluginInjectionApi),
393
+ tableState = _useSharedState2.tableState,
394
+ editorViewModeState = _useSharedState2.editorViewModeState;
395
+ var isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
396
+ var mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
397
+ var updateContainerHeight = (0, _react.useCallback)(function (height) {
398
+ var _containerRef$current3;
399
+ // current StickyHeader State is not stable to be fetch.
400
+ // we need to update stickyHeader plugin to make sure state can be
401
+ // consistently fetch and refactor below
402
+ var stickyHeaders = (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.getElementsByClassName('pm-table-sticky');
403
+ if (!stickyHeaders || stickyHeaders.length < 1) {
404
+ // when starting to drag, we need to keep the original space,
405
+ // -- When sticky header not appear, margin top(24px) and margin bottom(16px), should be 40px,
406
+ // 1px is border width but collapse make it 0.5.
407
+ // -- When sticky header appear, we should add first row height but reduce
408
+ // collapsed border
409
+ return typeof height === 'number' ? "".concat(height + 40.5, "px") : 'auto';
410
+ } else {
411
+ var _containerRef$current4;
412
+ var stickyHeaderHeight = ((_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.getElementsByTagName('th')[0].getBoundingClientRect().height) || 0;
413
+ return typeof height === 'number' ? "".concat(height + stickyHeaderHeight + 39.5, "px") : 'auto';
414
+ }
415
+ }, []);
416
+ var onResizeStart = (0, _react.useCallback)(function () {
417
+ setIsResizing(true);
418
+ }, []);
419
+ var onResizeStop = (0, _react.useCallback)(function () {
420
+ setIsResizing(false);
421
+ }, []);
422
+ var updateWidth = (0, _react.useCallback)(function (width) {
423
+ if (!containerRef.current) {
424
+ return;
425
+ }
426
+
427
+ // make sure during resizing
428
+ // the pm-table-resizer-container width is the same as its child div resizer-item
429
+ // otherwise when resize table from wider to narrower , pm-table-resizer-container stays wider
430
+ // and cause the fabric-editor-popup-scroll-parent to overflow
431
+ if (containerRef.current.style.width !== "".concat(width, "px")) {
432
+ containerRef.current.style.width = "".concat(width, "px");
433
+ }
434
+ }, []);
435
+ var displayGuideline = (0, _react.useCallback)(function (guidelines) {
436
+ var _pluginInjectionApi$g3, _pluginInjectionApi$g4;
437
+ 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)({
438
+ guidelines: guidelines
439
+ })) !== null && _pluginInjectionApi$g3 !== void 0 ? _pluginInjectionApi$g3 : false;
440
+ }, [pluginInjectionApi, editorView]);
441
+ var attachAnalyticsEvent = (0, _react.useCallback)(function (payload) {
442
+ var _pluginInjectionApi$a3;
443
+ return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions.attachAnalyticsEvent(payload);
444
+ }, [pluginInjectionApi]);
445
+ var displayGapCursor = (0, _react.useCallback)(function (toggle) {
446
+ var _pluginInjectionApi$c3, _pluginInjectionApi$c4, _pluginInjectionApi$s2;
447
+ 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;
448
+ }, [pluginInjectionApi]);
449
+ var isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
450
+ var responsiveContainerWidth = 0;
451
+ var resizeHandleSpacing = 12;
452
+ var padding = getPadding(containerWidth);
453
+ // When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
454
+ // updating Settings -> Appearance -> Show scroll bars from "When scrolling" to "Always". It causes
455
+ // issues when viwport width is less than full width Editor's width. To detect avoid them
456
+ // we need to use lineLength to defined responsiveWidth instead of containerWidth
457
+ // (which does not get updated when Mac setting changes) in Full-width editor.
458
+ if (isFullWidthModeEnabled) {
459
+ // When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
460
+ // When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
461
+ // scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
462
+ responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - padding * 2 - resizeHandleSpacing;
463
+
464
+ // platform_editor_table_fw_numcol_overflow_fix:
465
+ // lineLength is undefined on first paint → width: NaN → wrapper expands to page
466
+ // width. rAF col-sizing then runs before the number-column padding and
467
+ // the final shrink, so column widths are locked in wrong.
468
+ // With the flag ON, if the value isn’t finite we fall back to gutterWidth
469
+ // for that first frame—no flash, no premature rAF.
470
+ //
471
+ // Type clean-up comes later:
472
+ // 1) ship this runtime guard (quick fix, no breakage);
473
+ // 2) TODO: widen lineLength to `number|undefined` and remove this block.
474
+ if ((0, _platformFeatureFlags.fg)('platform_editor_table_fw_numcol_overflow_fix')) {
475
+ if (isTableScalingEnabled && !Number.isFinite(responsiveContainerWidth)) {
476
+ responsiveContainerWidth = containerWidth - padding * 2 - resizeHandleSpacing;
477
+ }
478
+ }
479
+ } else if (isCommentEditor) {
480
+ responsiveContainerWidth = containerWidth - _consts.TABLE_OFFSET_IN_COMMENT_EDITOR;
481
+ } else {
482
+ // 76 is currently an accepted padding value considering the spacing for resizer handle
483
+ // containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
484
+ // a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
485
+ // padding left = padding right = akEditorGutterPadding = 32
486
+ responsiveContainerWidth = isTableScalingEnabled ? containerWidth - padding * 2 : containerWidth - padding * 2 - resizeHandleSpacing;
487
+ }
488
+ var width = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
489
+ if (!isResizing) {
490
+ tableWidthRef.current = width;
491
+ }
492
+ var maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, _consts.TABLE_MAX_WIDTH);
493
+
494
+ // CSS solution for table resizer item width
495
+ // The `width` is used for .resizer-item in <TableResizer>, and it has to be a number
496
+ // So we can't use min(var(--ak-editor-table-width), ${tableWidth}px) here
497
+ // We get the correct width from CSS value on page load
498
+ // After window resize, we use the width from plugin state
499
+ // After table resize, the table width attribute is used
500
+ var tableResizerItemWidth = (0, _react.useMemo)(function () {
501
+ // if not on full page editor, we just rely on the width calculated from plugin state
502
+ // if on full page editor and after window resize, we use the width from plugin state
503
+ if (!isFullPageAppearance || isFullPageAppearance && isWindowResized) {
504
+ return width;
505
+ }
506
+ if (isResizing) {
507
+ return tableWidth;
508
+ }
509
+ // if on full page editor and on page load, we use the computed value from CSS
510
+ return Math.min(tableWidth, tableMaxWidthForFullPageOnLoad);
511
+ }, [isWindowResized, isResizing, isFullPageAppearance, tableMaxWidthForFullPageOnLoad, tableWidth, width]);
512
+
513
+ // CSS Solution for table resizer container width
514
+ var tableResizerContainerWidth = (0, _react.useMemo)(function () {
515
+ return (0, _misc.getTableResizerContainerForFullPageWidthInCSS)(node, isTableScalingEnabled);
516
+ }, [node, isTableScalingEnabled]);
517
+
518
+ // CSS Solution for table resizer max width
519
+ var tableResizerMaxWidth = _react.default.useMemo(function () {
520
+ var isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
521
+ var nonResizingMaxWidth = isFullPageAppearance ? (0, _misc.getTableResizerContainerMaxWidthInCSS)(isCommentEditor, isChromelessEditor, isTableScalingEnabled) : maxResizerWidth;
522
+ // isResizing is needed, otherwise we can't resize table.
523
+ // when not resizing, maxWidth is calculated based on the container width via CSS
524
+ return !isResizing ? nonResizingMaxWidth : maxResizerWidth;
525
+ }, [isCommentEditor, isChromelessEditor, isTableScalingEnabled, isResizing, maxResizerWidth]);
526
+
527
+ // on SSR, the width would be the default state, which is tableWidth
528
+ // but because we have maxWidth set to the editor container width via CSS
529
+ // So it would work just fine
530
+ (0, _react.useEffect)(function () {
531
+ var _containerRef$current5;
532
+ if (!(0, _coreUtils.isSSR)() && isFullPageAppearance && (_containerRef$current5 = containerRef.current) !== null && _containerRef$current5 !== void 0 && _containerRef$current5.firstElementChild) {
533
+ // get the computed value of max-width from '.resizer-item', because it uses `cqw` unit in CSS
534
+ var computedStyle = window.getComputedStyle(containerRef.current.firstElementChild);
535
+ var _containerWidth = computedStyle.maxWidth ? parseFloat(computedStyle.maxWidth) : tableWidth;
536
+ setTableMaxWidthForFullPageOnLoad(Math.min(_containerWidth, tableWidth));
537
+ }
538
+ }, [tableWidthRef, tableWidth, isFullPageAppearance]);
539
+ var tableResizerProps = {
540
+ width: tableResizerItemWidth,
541
+ maxWidth: tableResizerMaxWidth,
542
+ containerWidth: containerWidth,
543
+ lineLength: lineLength,
544
+ updateWidth: updateWidth,
545
+ editorView: editorView,
546
+ getPos: getPos,
547
+ node: node,
548
+ tableRef: tableRef,
549
+ displayGuideline: displayGuideline,
550
+ attachAnalyticsEvent: attachAnalyticsEvent,
551
+ displayGapCursor: displayGapCursor,
552
+ isTableAlignmentEnabled: isTableAlignmentEnabled,
553
+ isFullWidthModeEnabled: isFullWidthModeEnabled,
554
+ isTableScalingEnabled: isTableScalingEnabled,
555
+ isTableWithFixedColumnWidthsOptionEnabled: isTableWithFixedColumnWidthsOptionEnabled,
556
+ isWholeTableInDanger: isWholeTableInDanger,
557
+ shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
558
+ pluginInjectionApi: pluginInjectionApi,
559
+ onResizeStart: onResizeStart,
560
+ onResizeStop: onResizeStop,
561
+ isCommentEditor: isCommentEditor
562
+ };
563
+ var isLivePageViewMode = mode === 'view';
564
+ return /*#__PURE__*/_react.default.createElement(AlignmentTableContainerWrapper, {
565
+ isTableAlignmentEnabled: isTableAlignmentEnabled,
566
+ node: node,
567
+ pluginInjectionApi: pluginInjectionApi,
568
+ getPos: getPos,
569
+ editorView: editorView
570
+ }, /*#__PURE__*/_react.default.createElement("div", {
571
+ style: {
572
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
573
+ '--ak-editor-table-gutter-padding': 'calc(var(--ak-editor--large-gutter-padding) * 2)',
574
+ '--ak-editor-table-width': isFullPageAppearance ? tableResizerContainerWidth : "".concat(tableWidthRef.current, "px"),
575
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
576
+ width: 'var(--ak-editor-table-width)',
577
+ height: resizing ? updateContainerHeight(tableWrapperHeight !== null && tableWrapperHeight !== void 0 ? tableWrapperHeight : 'auto') : 'auto',
578
+ position: isLivePageViewMode ? 'relative' : 'unset'
579
+ }
580
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
581
+ ,
582
+ className: _types.TableCssClassName.TABLE_RESIZER_CONTAINER,
583
+ ref: containerRef
584
+ }, (0, _platformFeatureFlags.fg)('platform_editor_live_page_prevent_table_recreation') ? null : isLivePageViewMode ? /*#__PURE__*/_react.default.createElement(InnerContainer
585
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
586
+ , {
587
+ className: className,
588
+ node: node
589
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
590
+ ,
591
+ style: {
592
+ width: 'inherit'
593
+ }
594
+ }, children) :
595
+ /*#__PURE__*/
596
+ // Ignored via go/ees005
597
+ // eslint-disable-next-line react/jsx-props-no-spreading
598
+ _react.default.createElement(_TableResizer.TableResizer, tableResizerProps, /*#__PURE__*/_react.default.createElement(InnerContainer, {
599
+ className: className,
600
+ node: node
601
+ }, children)), (0, _platformFeatureFlags.fg)('platform_editor_live_page_prevent_table_recreation') ?
602
+ /*#__PURE__*/
603
+ // Ignored via go/ees005
604
+ // eslint-disable-next-line react/jsx-props-no-spreading
605
+ _react.default.createElement(_TableResizer.TableResizer, (0, _extends2.default)({}, tableResizerProps, {
606
+ disabled: isLivePageViewMode
607
+ }), /*#__PURE__*/_react.default.createElement(InnerContainer, {
608
+ className: className,
609
+ node: node
610
+ }, children)) : null));
611
+ });
612
+ var ResizableTableContainer = exports.ResizableTableContainer = (0, _platformFeatureFlagsReact.componentWithCondition)(function () {
613
+ return (0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true);
614
+ }, ResizableTableContainerNext, ResizableTableContainerLegacy);
615
+ var TableContainer = exports.TableContainer = function TableContainer(_ref6) {
616
+ var children = _ref6.children,
617
+ node = _ref6.node,
618
+ className = _ref6.className,
619
+ _ref6$containerWidth = _ref6.containerWidth,
620
+ editorWidth = _ref6$containerWidth.width,
621
+ lineLength = _ref6$containerWidth.lineLength,
622
+ editorView = _ref6.editorView,
623
+ getPos = _ref6.getPos,
624
+ tableRef = _ref6.tableRef,
625
+ isNested = _ref6.isNested,
626
+ tableWrapperHeight = _ref6.tableWrapperHeight,
627
+ isResizing = _ref6.isResizing,
628
+ isWindowResized = _ref6.isWindowResized,
629
+ pluginInjectionApi = _ref6.pluginInjectionApi,
630
+ isWholeTableInDanger = _ref6.isWholeTableInDanger,
631
+ isTableResizingEnabled = _ref6.isTableResizingEnabled,
632
+ isTableScalingEnabled = _ref6.isTableScalingEnabled,
633
+ isTableWithFixedColumnWidthsOptionEnabled = _ref6.isTableWithFixedColumnWidthsOptionEnabled,
634
+ isTableAlignmentEnabled = _ref6.isTableAlignmentEnabled,
635
+ shouldUseIncreasedScalingPercent = _ref6.shouldUseIncreasedScalingPercent,
636
+ isCommentEditor = _ref6.isCommentEditor,
637
+ isChromelessEditor = _ref6.isChromelessEditor;
380
638
  if (isTableResizingEnabled && !isNested) {
381
639
  return /*#__PURE__*/_react.default.createElement(ResizableTableContainer
382
640
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -396,13 +654,15 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref5) {
396
654
  tableRef: tableRef,
397
655
  tableWrapperHeight: tableWrapperHeight,
398
656
  isResizing: isResizing,
657
+ isWindowResized: isWindowResized,
399
658
  pluginInjectionApi: pluginInjectionApi,
400
659
  isTableScalingEnabled: isTableScalingEnabled,
401
660
  isTableWithFixedColumnWidthsOptionEnabled: isTableWithFixedColumnWidthsOptionEnabled,
402
661
  isWholeTableInDanger: isWholeTableInDanger,
403
662
  isTableAlignmentEnabled: isTableAlignmentEnabled,
404
663
  shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
405
- isCommentEditor: isCommentEditor
664
+ isCommentEditor: isCommentEditor,
665
+ isChromelessEditor: isChromelessEditor
406
666
  }, children);
407
667
  }
408
668
  var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
@@ -406,8 +406,15 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
406
406
  }, [editorView, getPos, node, isCommentEditor, widthToWidest, endMeasure, displayGapCursor, displayGuideline, updateWidth, scheduleResize, onResizeStop, attachAnalyticsEvent, tableRef, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, formatMessage]);
407
407
  var handleTableSizeChangeOnKeypress = (0, _react.useCallback)(function (step) {
408
408
  var newWidth = width + step;
409
- if (newWidth > maxWidth || newWidth < resizerMinWidth) {
410
- return;
409
+ if ((0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true)) {
410
+ if (newWidth < resizerMinWidth) {
411
+ return;
412
+ }
413
+ } else {
414
+ // maxWidth when platform_editor_tables_scaling_css off is always a number
415
+ if (newWidth > maxWidth || newWidth < resizerMinWidth) {
416
+ return;
417
+ }
411
418
  }
412
419
  handleResizeStop({
413
420
  width: width,
@@ -35,10 +35,25 @@ var HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200;
35
35
  // if too short it would trigger too many dom updates.
36
36
  var HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT = 400;
37
37
  var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
38
- function TableRow(node, view, getPos, eventDispatcher) {
38
+ function TableRow(node, view, getPos, eventDispatcher, api) {
39
+ var _api$limitedMode;
39
40
  var _this;
40
41
  (0, _classCallCheck2.default)(this, TableRow);
41
42
  _this = _callSuper(this, TableRow, [node, view, getPos, eventDispatcher]);
43
+ (0, _defineProperty2.default)(_this, "cleanup", function () {
44
+ if (_this.isStickyHeaderEnabled) {
45
+ _this.unsubscribe();
46
+ _this.nodeVisibilityObserverCleanupFn && _this.nodeVisibilityObserverCleanupFn();
47
+ var tree = (0, _dom2.getTree)(_this.dom);
48
+ if (tree) {
49
+ _this.makeRowHeaderNotSticky(tree.table, true);
50
+ }
51
+ _this.emitOff(false);
52
+ }
53
+ if (_this.tableContainerObserver) {
54
+ _this.tableContainerObserver.disconnect();
55
+ }
56
+ });
42
57
  (0, _defineProperty2.default)(_this, "colControlsOffset", 0);
43
58
  (0, _defineProperty2.default)(_this, "focused", false);
44
59
  (0, _defineProperty2.default)(_this, "topPosEditorElement", 0);
@@ -78,6 +93,11 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
78
93
  var _getPluginState = (0, _pluginFactory.getPluginState)(view.state),
79
94
  pluginConfig = _getPluginState.pluginConfig;
80
95
  _this.isStickyHeaderEnabled = !!pluginConfig.stickyHeaders;
96
+ if (api !== null && api !== void 0 && (_api$limitedMode = api.limitedMode) !== null && _api$limitedMode !== void 0 && (_api$limitedMode = _api$limitedMode.sharedState.currentState()) !== null && _api$limitedMode !== void 0 && (_api$limitedMode = _api$limitedMode.limitedModePluginKey.getState(view.state)) !== null && _api$limitedMode !== void 0 && _api$limitedMode.documentSizeBreachesThreshold) {
97
+ _this.isStickyHeaderEnabled = false;
98
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
99
+ document.addEventListener('limited-mode-activated', _this.cleanup);
100
+ }
81
101
  var pos = _this.getPos();
82
102
  _this.isInNestedTable = false;
83
103
  if (pos) {
@@ -160,6 +180,9 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
160
180
  }
161
181
  this.emitOff(true);
162
182
  }
183
+
184
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
185
+ document.removeEventListener('limited-mode-activated', this.cleanup);
163
186
  if (this.tableContainerObserver) {
164
187
  this.tableContainerObserver.disconnect();
165
188
  }
@@ -29,6 +29,6 @@ var tableHeaderView = exports.tableHeaderView = function tableHeaderView(options
29
29
  };
30
30
  var tableRowView = exports.tableRowView = function tableRowView(options) {
31
31
  return function (node, view, getPos) {
32
- return new _TableRow.default(node, view, getPos, options.eventDispatcher);
32
+ return new _TableRow.default(node, view, getPos, options.eventDispatcher, options.pluginInjectionApi);
33
33
  };
34
34
  };
@@ -69,7 +69,9 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
69
69
  function TableView(props) {
70
70
  var _this;
71
71
  (0, _classCallCheck2.default)(this, TableView);
72
- _this = _callSuper(this, TableView, [props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props]);
72
+ _this = _callSuper(this, TableView, [props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, undefined,
73
+ // @portal-render-immediately
74
+ true]);
73
75
  (0, _defineProperty2.default)(_this, "getNode", function () {
74
76
  return _this.node;
75
77
  });
@@ -87,10 +89,17 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
87
89
  return (0, _createClass2.default)(TableView, [{
88
90
  key: "getContentDOM",
89
91
  value: function getContentDOM() {
92
+ var _this$reactComponentP, _this$reactComponentP2, _this$reactComponentP3, _this$reactComponentP4;
93
+ var isNested = (0, _nodes.isTableNested)(this.view.state, this.getPos());
90
94
  var tableDOMStructure = (0, _toDOM.tableNodeSpecWithFixedToDOM)({
91
95
  allowColumnResizing: !!this.reactComponentProps.allowColumnResizing,
92
96
  tableResizingEnabled: !!this.reactComponentProps.allowTableResizing,
93
- getEditorContainerWidth: this.reactComponentProps.getEditorContainerWidth
97
+ getEditorContainerWidth: this.reactComponentProps.getEditorContainerWidth,
98
+ isTableScalingEnabled: (_this$reactComponentP = this.reactComponentProps.options) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.isTableScalingEnabled,
99
+ shouldUseIncreasedScalingPercent: (_this$reactComponentP2 = this.reactComponentProps.options) === null || _this$reactComponentP2 === void 0 ? void 0 : _this$reactComponentP2.shouldUseIncreasedScalingPercent,
100
+ isCommentEditor: (_this$reactComponentP3 = this.reactComponentProps.options) === null || _this$reactComponentP3 === void 0 ? void 0 : _this$reactComponentP3.isCommentEditor,
101
+ isChromelessEditor: (_this$reactComponentP4 = this.reactComponentProps.options) === null || _this$reactComponentP4 === void 0 ? void 0 : _this$reactComponentP4.isChromelessEditor,
102
+ isNested: isNested
94
103
  }).toDOM(this.node);
95
104
  var rendered = _model.DOMSerializer.renderSpec(document, tableDOMStructure);
96
105
  if (rendered.dom) {
@@ -204,7 +213,8 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
204
213
  }, {
205
214
  key: "render",
206
215
  value: function render(props, forwardRef) {
207
- var _this4 = this;
216
+ var _props$pluginInjectio,
217
+ _this4 = this;
208
218
  if ((0, _platformFeatureFlags.fg)('platform_editor_table_use_shared_state_hook_fg')) {
209
219
  return /*#__PURE__*/_react.default.createElement(_TableComponentWithSharedState.TableComponentWithSharedState, {
210
220
  forwardRef: forwardRef,
@@ -250,11 +260,12 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
250
260
  tableWidthPluginState: _tableWidth.pluginKey,
251
261
  widthPlugin: fakePluginKey,
252
262
  mediaState: fakeMediaPluginKey,
253
- tableDragAndDropState: _pluginKey.pluginKey
263
+ tableDragAndDropState: _pluginKey.pluginKey,
264
+ limitedModePlugin: (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 || (_props$pluginInjectio = _props$pluginInjectio.limitedMode) === null || _props$pluginInjectio === void 0 || (_props$pluginInjectio = _props$pluginInjectio.sharedState.currentState()) === null || _props$pluginInjectio === void 0 ? void 0 : _props$pluginInjectio.limitedModePluginKey
254
265
  },
255
266
  editorView: props.view,
256
267
  render: function render(pluginStates) {
257
- var _props$options;
268
+ var _props$options, _pluginStates$limited, _pluginStates$limited2;
258
269
  var tableResizingPluginState = pluginStates.tableResizingPluginState,
259
270
  tableWidthPluginState = pluginStates.tableWidthPluginState,
260
271
  pluginState = pluginStates.pluginState,
@@ -321,7 +332,8 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
321
332
  contentDOM: forwardRef,
322
333
  getEditorFeatureFlags: props.getEditorFeatureFlags,
323
334
  dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
324
- pluginInjectionApi: props.pluginInjectionApi
335
+ pluginInjectionApi: props.pluginInjectionApi,
336
+ limitedMode: (_pluginStates$limited = (_pluginStates$limited2 = pluginStates.limitedModePlugin) === null || _pluginStates$limited2 === void 0 ? void 0 : _pluginStates$limited2.documentSizeBreachesThreshold) !== null && _pluginStates$limited !== void 0 ? _pluginStates$limited : false
325
337
  });
326
338
  }
327
339
  });
@@ -404,6 +416,8 @@ var createTableView = exports.createTableView = function createTableView(node, v
404
416
  allowControls = _getPluginConfig.allowControls,
405
417
  allowTableResizing = _getPluginConfig.allowTableResizing,
406
418
  allowTableAlignment = _getPluginConfig.allowTableAlignment;
419
+ var isTableFixedColumnWidthsOptionEnabled = (getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().tableWithFixedColumnWidthsOption) || false;
420
+ var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
407
421
  return new TableView({
408
422
  node: node,
409
423
  view: view,
@@ -421,7 +435,8 @@ var createTableView = exports.createTableView = function createTableView(node, v
421
435
  isTableScalingEnabled: isTableScalingEnabled,
422
436
  // same as options.isTableScalingEnabled
423
437
  isCommentEditor: isCommentEditor,
424
- isChromelessEditor: isChromelessEditor
438
+ isChromelessEditor: isChromelessEditor,
439
+ shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
425
440
  },
426
441
  getEditorContainerWidth: getEditorContainerWidth,
427
442
  getEditorFeatureFlags: getEditorFeatureFlags,
@@ -15,6 +15,7 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
15
15
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
16
16
  var _colgroup = require("../pm-plugins/table-resizing/utils/colgroup");
17
17
  var _consts = require("../pm-plugins/table-resizing/utils/consts");
18
+ var _misc = require("../pm-plugins/table-resizing/utils/misc");
18
19
  var _tableContainerStyles = require("./table-container-styles");
19
20
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
21
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -22,6 +23,7 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
22
23
  var tableNode = config.isNestingSupported ? _adfSchema.tableWithNestedTable : _adfSchema.table;
23
24
  return _objectSpread(_objectSpread({}, tableNode), {}, {
24
25
  toDOM: function toDOM(node) {
26
+ var _node$attrs$width;
25
27
  var gutterPadding = function gutterPadding() {
26
28
  if ((0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
27
29
  return 'calc(var(--ak-editor--large-gutter-padding) * 2)';
@@ -36,6 +38,8 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
36
38
  return "".concat((0, _kebabCase.default)(k), ": ").concat((0, _kebabCase.default)(v));
37
39
  }).join(';');
38
40
  var tableMinWidth = (0, _colgroup.getResizerMinWidth)(node);
41
+ var tableWidthAttribute = node.attrs.width ? "".concat(node.attrs.width, "px") : "100%";
42
+ var isFullPageEditor = !config.isChromelessEditor && !config.isCommentEditor;
39
43
  var attrs = {
40
44
  'data-number-column': node.attrs.isNumberColumnEnabled,
41
45
  'data-layout': node.attrs.layout,
@@ -43,10 +47,20 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
43
47
  'data-table-local-id': node.attrs.localId,
44
48
  'data-table-width': node.attrs.width
45
49
  };
50
+
51
+ // This would be used for table scaling in colgroup CSS
52
+ // cqw, or px is well supported
53
+ var resizableTableWidth = (0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true) ? isFullPageEditor ? (0, _misc.getTableResizerContainerForFullPageWidthInCSS)(node, config.isTableScalingEnabled) : "calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))" : "min(calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2)), ".concat((_node$attrs$width = node.attrs.width) !== null && _node$attrs$width !== void 0 ? _node$attrs$width : '100%', ")");
46
54
  var colgroup = '';
47
55
  if (config.allowColumnResizing) {
48
- colgroup = ['colgroup', {}].concat((0, _toConsumableArray2.default)((0, _colgroup.generateColgroup)(node)));
56
+ if ((0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true)) {
57
+ colgroup = ['colgroup', {}].concat((0, _toConsumableArray2.default)((0, _colgroup.generateColgroupFromNode)(node, config.isCommentEditor, config.isChromelessEditor, config.isNested, config.isTableScalingEnabled, config.shouldUseIncreasedScalingPercent)));
58
+ } else {
59
+ colgroup = ['colgroup', {}].concat((0, _toConsumableArray2.default)((0, _colgroup.generateColgroup)(node)));
60
+ }
49
61
  }
62
+
63
+ // For Chromeless editor, and nested tables in full page editor
50
64
  var tableContainerDiv = ['div', {
51
65
  class: 'pm-table-container',
52
66
  'data-number-column': node.attrs.isNumberColumnEnabled,
@@ -73,31 +87,33 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
73
87
  class: 'pm-table-sticky-sentinel-bottom',
74
88
  'data-testid': 'sticky-sentinel-bottom'
75
89
  }]];
76
- if (!config.tableResizingEnabled) {
90
+ if (!config.tableResizingEnabled || (0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true) && config.isNested) {
77
91
  return ['div', {
78
92
  class: 'tableView-content-wrap',
79
93
  'data-prosemirror-initial-toDOM-render': 'true'
80
94
  }, tableContainerDiv];
81
95
  }
82
- var tableWidthAttribute = node.attrs.width ? "".concat(node.attrs.width, "px") : "100%";
83
96
  var tableResizingDiv = ['div', {
84
97
  'data-testid': 'table-alignment-container',
85
98
  style: alignmentStyle
86
99
  }, ['div', {
87
100
  class: 'pm-table-resizer-container',
88
- style: "width: min(calc(100cqw - ".concat(gutterPadding(), "), ").concat(tableWidthAttribute, ");")
101
+ style: (0, _lazyNodeView.convertToInlineCss)({
102
+ '--ak-editor-table-gutter-padding': config.isTableScalingEnabled ? 'calc(var(--ak-editor--large-gutter-padding) * 2)' : 'calc(var(--ak-editor--large-gutter-padding) * 2 - var(--ak-editor-resizer-handle-spacing))',
103
+ '--ak-editor-table-width': resizableTableWidth,
104
+ width: (0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true) ? "var(--ak-editor-table-width)" : "min(calc(100cqw - ".concat(gutterPadding(), "), ").concat(tableWidthAttribute, ")")
105
+ })
89
106
  }, ['div', {
90
107
  class: 'resizer-item display-handle',
91
108
  style: (0, _lazyNodeView.convertToInlineCss)({
92
109
  position: 'relative',
93
110
  userSelect: 'auto',
94
111
  boxSizing: 'border-box',
95
- '--ak-editor-table-gutter-padding': "".concat(gutterPadding()),
96
112
  '--ak-editor-table-max-width': "".concat(_consts.TABLE_MAX_WIDTH, "px"),
97
113
  '--ak-editor-table-min-width': "".concat(tableMinWidth, "px"),
98
114
  minWidth: 'var(--ak-editor-table-min-width)',
99
- maxWidth: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))",
100
- width: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(tableWidthAttribute, ")")
115
+ maxWidth: (0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true) ? (0, _misc.getTableResizerContainerMaxWidthInCSS)(config.isCommentEditor, config.isChromelessEditor, config.isTableScalingEnabled) : "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))",
116
+ width: (0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true) ? (0, _misc.getTableResizerItemWidthInCSS)(node, config.isCommentEditor, config.isChromelessEditor) : "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(tableWidthAttribute, ")")
101
117
  })
102
118
  }, ['span', {
103
119
  class: 'resizer-hover-zone'