@atlaskit/editor-plugin-table 15.3.10 → 15.3.11

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 (27) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/nodeviews/TableComponentLegacy.js +6 -3
  3. package/dist/cjs/nodeviews/TableComponentNext.js +6 -3
  4. package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +22 -11
  5. package/dist/cjs/ui/ContentComponent.js +3 -1
  6. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +14 -3
  7. package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -1
  8. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +1 -1
  9. package/dist/es2019/nodeviews/TableComponentLegacy.js +6 -3
  10. package/dist/es2019/nodeviews/TableComponentNext.js +6 -3
  11. package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +20 -11
  12. package/dist/es2019/ui/ContentComponent.js +3 -1
  13. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +11 -1
  14. package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -1
  15. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +1 -1
  16. package/dist/esm/nodeviews/TableComponentLegacy.js +6 -3
  17. package/dist/esm/nodeviews/TableComponentNext.js +6 -3
  18. package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +22 -11
  19. package/dist/esm/ui/ContentComponent.js +3 -1
  20. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +14 -3
  21. package/dist/esm/ui/FloatingContextualMenu/index.js +4 -1
  22. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +1 -1
  23. package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -0
  24. package/dist/types/ui/FloatingContextualMenu/index.d.ts +2 -1
  25. package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -0
  26. package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +2 -1
  27. package/package.json +6 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 15.3.11
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e3336879840a4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e3336879840a4) -
8
+ [ux] EDITOR-2620 Toggle contextual menu when drag menu is opened
9
+ - [`8b2c7333efccd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8b2c7333efccd) -
10
+ fix table width css used for table scaling
11
+ - Updated dependencies
12
+
3
13
  ## 15.3.10
4
14
 
5
15
  ### Patch Changes
@@ -693,7 +693,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
693
693
  isTableDisplayModeChanged: isTableDisplayModeChanged,
694
694
  isNumberColumnChanged: isNumberColumnChanged,
695
695
  isNumberOfColumnsChanged: isNumberOfColumnsChanged,
696
- isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged
696
+ isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged,
697
+ isTableResized: isTableResized
697
698
  });
698
699
  var _getEditorFeatureFlag = getEditorFeatureFlags(),
699
700
  _getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
@@ -794,8 +795,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
794
795
  shouldScale = true;
795
796
  shouldHandleColgroupUpdates = true;
796
797
  }
797
- if (this.state.windowResized) {
798
- shouldHandleColgroupUpdates = true;
798
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_table_width_refactor')) {
799
+ if (this.state.windowResized) {
800
+ shouldHandleColgroupUpdates = true;
801
+ }
799
802
  }
800
803
  if (shouldHandleColgroupUpdates) {
801
804
  this.handleColgroupUpdates();
@@ -627,7 +627,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
627
627
  isTableDisplayModeChanged: isTableDisplayModeChanged,
628
628
  isNumberColumnChanged: isNumberColumnChanged,
629
629
  isNumberOfColumnsChanged: isNumberOfColumnsChanged,
630
- isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged
630
+ isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged,
631
+ isTableResized: isTableResized
631
632
  });
632
633
  var _getEditorFeatureFlag = getEditorFeatureFlags(),
633
634
  _getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
@@ -725,8 +726,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
725
726
  shouldScale = true;
726
727
  shouldHandleColgroupUpdates = true;
727
728
  }
728
- if (this.state.windowResized) {
729
- shouldHandleColgroupUpdates = true;
729
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_table_width_refactor')) {
730
+ if (this.state.windowResized) {
731
+ shouldHandleColgroupUpdates = true;
732
+ }
730
733
  }
731
734
  if (shouldHandleColgroupUpdates) {
732
735
  this.handleColgroupUpdates();
@@ -11,6 +11,7 @@ var _utils = require("@atlaskit/editor-common/utils");
11
11
  var _model = require("@atlaskit/editor-prosemirror/model");
12
12
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
13
13
  var _tableMap = require("@atlaskit/editor-tables/table-map");
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _consts = require("./consts");
15
16
  var _misc = require("./misc");
16
17
  /**
@@ -76,17 +77,27 @@ var generateColgroupFromNode = exports.generateColgroupFromNode = function gener
76
77
  }
77
78
  });
78
79
  } else {
79
- // columns has not been resized, so distribute the width evenly
80
- cols.push.apply(cols, (0, _toConsumableArray2.default)(Array.from({
81
- length: colspan
82
- }, function (_) {
83
- var tableWidth = (0, _misc.getTableContainerElementWidth)(table);
84
- var columnWidth = tableWidth / map.width || 0;
85
- var fixedColWidth = getColWidthFix(columnWidth, map.width || 0);
86
- return ['col', {
87
- style: generateColStyle(fixedColWidth, tableWidth, isCommentEditor, isChromelessEditor, isNested, shouldUseIncreasedScalingPercent, isNumberColumnEnabled, isTableHasWidth)
88
- }];
89
- })));
80
+ if (!isTableScalingEnabled && (0, _platformFeatureFlags.fg)('platform_editor_table_width_refactor')) {
81
+ cols.push.apply(cols, (0, _toConsumableArray2.default)(Array.from({
82
+ length: colspan
83
+ }, function (_) {
84
+ return ['col', {
85
+ style: "width: ".concat(_styles.tableCellMinWidth, "px;")
86
+ }];
87
+ })));
88
+ } else {
89
+ // columns has not been resized, so distribute the width evenly
90
+ cols.push.apply(cols, (0, _toConsumableArray2.default)(Array.from({
91
+ length: colspan
92
+ }, function (_) {
93
+ var tableWidth = (0, _misc.getTableContainerElementWidth)(table);
94
+ var columnWidth = tableWidth / map.width || 0;
95
+ var fixedColWidth = getColWidthFix(columnWidth, map.width || 0);
96
+ return ['col', {
97
+ style: generateColStyle(fixedColWidth, tableWidth, isCommentEditor, isChromelessEditor, isNested, shouldUseIncreasedScalingPercent, isNumberColumnEnabled, isTableHasWidth)
98
+ }];
99
+ })));
100
+ }
90
101
  }
91
102
  });
92
103
  return cols;
@@ -13,6 +13,7 @@ var _hooks = require("@atlaskit/editor-common/hooks");
13
13
  var _resizer = require("@atlaskit/editor-common/resizer");
14
14
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
15
15
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
16
+ var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
16
17
  var _FloatingContextualButton = _interopRequireDefault(require("./FloatingContextualButton"));
17
18
  var _FloatingContextualMenu = _interopRequireDefault(require("./FloatingContextualMenu"));
18
19
  var _FloatingDeleteButton = _interopRequireDefault(require("./FloatingDeleteButton"));
@@ -145,7 +146,8 @@ var ContentComponentInternal = function ContentComponentInternal(_ref) {
145
146
  getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
146
147
  isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
147
148
  isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
148
- api: api
149
+ api: api,
150
+ isDragMenuOpen: isDragAndDropEnabled && (0, _expVal.expValNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true) ? isDragMenuOpen : undefined
149
151
  }), isDragAndDropEnabled && /*#__PURE__*/_react.default.createElement(_FloatingDragMenu.default, {
150
152
  editorView: editorView,
151
153
  mountPoint: popupsMountPoint,
@@ -43,6 +43,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
43
43
  var _primitives = require("@atlaskit/primitives");
44
44
  var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
45
45
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
46
+ var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
46
47
  var _commands = require("../../pm-plugins/commands");
47
48
  var _commandsWithAnalytics = require("../../pm-plugins/commands/commands-with-analytics");
48
49
  var _pluginFactory = require("../../pm-plugins/plugin-factory");
@@ -748,6 +749,16 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
748
749
  }));
749
750
  }
750
751
  }
752
+ }, {
753
+ key: "componentDidUpdate",
754
+ value: function componentDidUpdate() {
755
+ var _getPluginState11 = (0, _pluginFactory.getPluginState)(this.props.editorView.state),
756
+ isDragAndDropEnabled = _getPluginState11.isDragAndDropEnabled,
757
+ isContextualMenuOpen = _getPluginState11.isContextualMenuOpen;
758
+ if (isDragAndDropEnabled && this.props.isDragMenuOpen && isContextualMenuOpen && (0, _expVal.expValNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true)) {
759
+ (0, _commands.toggleContextualMenu)()(this.props.editorView.state, this.props.editorView.dispatch);
760
+ }
761
+ }
751
762
  }, {
752
763
  key: "render",
753
764
  value: function render() {
@@ -760,8 +771,8 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
760
771
  editorView = _this$props13.editorView,
761
772
  isCellMenuOpenByKeyboard = _this$props13.isCellMenuOpenByKeyboard,
762
773
  api = _this$props13.api;
763
- var _getPluginState11 = (0, _pluginFactory.getPluginState)(editorView.state),
764
- isDragAndDropEnabled = _getPluginState11.isDragAndDropEnabled;
774
+ var _getPluginState12 = (0, _pluginFactory.getPluginState)(editorView.state),
775
+ isDragAndDropEnabled = _getPluginState12.isDragAndDropEnabled;
765
776
  var items = isDragAndDropEnabled ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
766
777
  var isOpenAllowed = false;
767
778
  isOpenAllowed = isCellMenuOpenByKeyboard ? this.state.isOpenAllowed : isOpen;
@@ -802,7 +813,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
802
813
  };
803
814
  if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true)) {
804
815
  return (0, _react2.jsx)(_userIntent.UserIntentPopupWrapper, {
805
- userIntent: "tablePopupOpen",
816
+ userIntent: "tableContextualMenuPopupOpen",
806
817
  api: api
807
818
  }, popupContent());
808
819
  }
@@ -12,6 +12,7 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
12
  var _utils2 = require("@atlaskit/editor-tables/utils");
13
13
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
14
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
15
+ var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
15
16
  var _pluginFactory = require("../../pm-plugins/plugin-factory");
16
17
  var _consts = require("../consts");
17
18
  var _ContextualMenu = _interopRequireDefault(require("./ContextualMenu"));
@@ -37,6 +38,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
37
38
  getEditorFeatureFlags = _ref.getEditorFeatureFlags,
38
39
  isCellMenuOpenByKeyboard = _ref.isCellMenuOpenByKeyboard,
39
40
  isCommentEditor = _ref.isCommentEditor,
41
+ isDragMenuOpen = _ref.isDragMenuOpen,
40
42
  api = _ref.api;
41
43
  if ((0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
42
44
  return null;
@@ -118,7 +120,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
118
120
  getEditorFeatureFlags: getEditorFeatureFlags,
119
121
  isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
120
122
  isCommentEditor: isCommentEditor,
121
- api: api
123
+ api: api,
124
+ isDragMenuOpen: (0, _expVal.expValNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true) ? isDragMenuOpen : undefined
122
125
  })));
123
126
  };
124
127
  FloatingContextualMenu.displayName = 'FloatingContextualMenu';
@@ -561,7 +561,7 @@ var DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
561
561
  });
562
562
  return isToolbarAIFCEnabled || (0, _expValEquals.expValEquals)('platform_editor_lovability_user_intent', 'isEnabled', true) ? (0, _react2.jsx)(_userIntent.UserIntentPopupWrapper, {
563
563
  api: api,
564
- userIntent: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true) ? 'tablePopupOpen' : undefined
564
+ userIntent: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true) ? 'tableDragMenuPopupOpen' : undefined
565
565
  }, Menu) : Menu;
566
566
  });
567
567
  var _default = exports.default = (0, _reactIntlNext.injectIntl)(DragMenu);
@@ -664,7 +664,8 @@ class TableComponent extends React.Component {
664
664
  isTableDisplayModeChanged,
665
665
  isNumberColumnChanged,
666
666
  isNumberOfColumnsChanged,
667
- isFullWidthModeAndLineLengthChanged
667
+ isFullWidthModeAndLineLengthChanged,
668
+ isTableResized
668
669
  });
669
670
  const {
670
671
  tableWithFixedColumnWidthsOption = false
@@ -762,8 +763,10 @@ class TableComponent extends React.Component {
762
763
  shouldScale = true;
763
764
  shouldHandleColgroupUpdates = true;
764
765
  }
765
- if (this.state.windowResized) {
766
- shouldHandleColgroupUpdates = true;
766
+ if (!fg('platform_editor_table_width_refactor')) {
767
+ if (this.state.windowResized) {
768
+ shouldHandleColgroupUpdates = true;
769
+ }
767
770
  }
768
771
  if (shouldHandleColgroupUpdates) {
769
772
  this.handleColgroupUpdates();
@@ -588,7 +588,8 @@ class TableComponent extends React.Component {
588
588
  isTableDisplayModeChanged,
589
589
  isNumberColumnChanged,
590
590
  isNumberOfColumnsChanged,
591
- isFullWidthModeAndLineLengthChanged
591
+ isFullWidthModeAndLineLengthChanged,
592
+ isTableResized
592
593
  });
593
594
  const {
594
595
  tableWithFixedColumnWidthsOption = false
@@ -686,8 +687,10 @@ class TableComponent extends React.Component {
686
687
  shouldScale = true;
687
688
  shouldHandleColgroupUpdates = true;
688
689
  }
689
- if (this.state.windowResized) {
690
- shouldHandleColgroupUpdates = true;
690
+ if (!fg('platform_editor_table_width_refactor')) {
691
+ if (this.state.windowResized) {
692
+ shouldHandleColgroupUpdates = true;
693
+ }
691
694
  }
692
695
  if (shouldHandleColgroupUpdates) {
693
696
  this.handleColgroupUpdates();
@@ -3,6 +3,7 @@ import { calcTableColumnWidths, getFragmentBackingArray } from '@atlaskit/editor
3
3
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
4
4
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
5
5
  import { TableMap } from '@atlaskit/editor-tables/table-map';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { COLUMN_MIN_WIDTH, MAX_SCALING_PERCENT, MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION } from './consts';
7
8
  import { getScalingPercentForTableWithoutWidth, getTableContainerElementWidth, getTableScalingPercent } from './misc';
8
9
  /**
@@ -64,17 +65,25 @@ export const generateColgroupFromNode = (table, isCommentEditor, isChromelessEdi
64
65
  }
65
66
  });
66
67
  } else {
67
- // columns has not been resized, so distribute the width evenly
68
- cols.push(...Array.from({
69
- length: colspan
70
- }, _ => {
71
- const tableWidth = getTableContainerElementWidth(table);
72
- const columnWidth = tableWidth / map.width || 0;
73
- const fixedColWidth = getColWidthFix(columnWidth, map.width || 0);
74
- return ['col', {
75
- style: generateColStyle(fixedColWidth, tableWidth, isCommentEditor, isChromelessEditor, isNested, shouldUseIncreasedScalingPercent, isNumberColumnEnabled, isTableHasWidth)
76
- }];
77
- }));
68
+ if (!isTableScalingEnabled && fg('platform_editor_table_width_refactor')) {
69
+ cols.push(...Array.from({
70
+ length: colspan
71
+ }, _ => ['col', {
72
+ style: `width: ${tableCellMinWidth}px;`
73
+ }]));
74
+ } else {
75
+ // columns has not been resized, so distribute the width evenly
76
+ cols.push(...Array.from({
77
+ length: colspan
78
+ }, _ => {
79
+ const tableWidth = getTableContainerElementWidth(table);
80
+ const columnWidth = tableWidth / map.width || 0;
81
+ const fixedColWidth = getColWidthFix(columnWidth, map.width || 0);
82
+ return ['col', {
83
+ style: generateColStyle(fixedColWidth, tableWidth, isCommentEditor, isChromelessEditor, isNested, shouldUseIncreasedScalingPercent, isNumberColumnEnabled, isTableHasWidth)
84
+ }];
85
+ }));
86
+ }
78
87
  }
79
88
  });
80
89
  return cols;
@@ -6,6 +6,7 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
6
6
  import { ResizerBreakoutModeLabel } from '@atlaskit/editor-common/resizer';
7
7
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
8
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
+ import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
9
10
  import FloatingContextualButton from './FloatingContextualButton';
10
11
  import FloatingContextualMenu from './FloatingContextualMenu';
11
12
  import FloatingDeleteButton from './FloatingDeleteButton';
@@ -140,7 +141,8 @@ const ContentComponentInternal = ({
140
141
  getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
141
142
  isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
142
143
  isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
143
- api: api
144
+ api: api,
145
+ isDragMenuOpen: isDragAndDropEnabled && expValNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true) ? isDragMenuOpen : undefined
144
146
  }), isDragAndDropEnabled && /*#__PURE__*/React.createElement(FloatingDragMenu, {
145
147
  editorView: editorView,
146
148
  mountPoint: popupsMountPoint,
@@ -36,6 +36,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
36
36
  import { Box, xcss } from '@atlaskit/primitives';
37
37
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
38
38
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
39
+ import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
39
40
  import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, setFocusToCellMenu, toggleContextualMenu } from '../../pm-plugins/commands';
40
41
  import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics } from '../../pm-plugins/commands/commands-with-analytics';
41
42
  import { getPluginState } from '../../pm-plugins/plugin-factory';
@@ -807,6 +808,15 @@ export class ContextualMenu extends Component {
807
808
  });
808
809
  }
809
810
  }
811
+ componentDidUpdate() {
812
+ const {
813
+ isDragAndDropEnabled,
814
+ isContextualMenuOpen
815
+ } = getPluginState(this.props.editorView.state);
816
+ if (isDragAndDropEnabled && this.props.isDragMenuOpen && isContextualMenuOpen && expValNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true)) {
817
+ toggleContextualMenu()(this.props.editorView.state, this.props.editorView.dispatch);
818
+ }
819
+ }
810
820
  render() {
811
821
  const {
812
822
  isOpen,
@@ -858,7 +868,7 @@ export class ContextualMenu extends Component {
858
868
  }));
859
869
  if (expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true)) {
860
870
  return jsx(UserIntentPopupWrapper, {
861
- userIntent: "tablePopupOpen",
871
+ userIntent: "tableContextualMenuPopupOpen",
862
872
  api: api
863
873
  }, popupContent());
864
874
  }
@@ -10,6 +10,7 @@ import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from
10
10
  import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
11
11
  import { fg } from '@atlaskit/platform-feature-flags';
12
12
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
+ import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
13
14
  import { getPluginState } from '../../pm-plugins/plugin-factory';
14
15
  import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize, tablePopupMenuFitHeight } from '../consts';
15
16
 
@@ -29,6 +30,7 @@ const FloatingContextualMenu = ({
29
30
  getEditorFeatureFlags,
30
31
  isCellMenuOpenByKeyboard,
31
32
  isCommentEditor,
33
+ isDragMenuOpen,
32
34
  api
33
35
  }) => {
34
36
  if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
@@ -114,7 +116,8 @@ const FloatingContextualMenu = ({
114
116
  getEditorFeatureFlags: getEditorFeatureFlags,
115
117
  isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
116
118
  isCommentEditor: isCommentEditor,
117
- api: api
119
+ api: api,
120
+ isDragMenuOpen: expValNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true) ? isDragMenuOpen : undefined
118
121
  })));
119
122
  };
120
123
  FloatingContextualMenu.displayName = 'FloatingContextualMenu';
@@ -560,7 +560,7 @@ const DragMenu = /*#__PURE__*/React.memo(({
560
560
  });
561
561
  return isToolbarAIFCEnabled || expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true) ? jsx(UserIntentPopupWrapper, {
562
562
  api: api,
563
- userIntent: expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true) ? 'tablePopupOpen' : undefined
563
+ userIntent: expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true) ? 'tableDragMenuPopupOpen' : undefined
564
564
  }, Menu) : Menu;
565
565
  });
566
566
  export default injectIntl(DragMenu);
@@ -687,7 +687,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
687
687
  isTableDisplayModeChanged: isTableDisplayModeChanged,
688
688
  isNumberColumnChanged: isNumberColumnChanged,
689
689
  isNumberOfColumnsChanged: isNumberOfColumnsChanged,
690
- isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged
690
+ isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged,
691
+ isTableResized: isTableResized
691
692
  });
692
693
  var _getEditorFeatureFlag = getEditorFeatureFlags(),
693
694
  _getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
@@ -788,8 +789,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
788
789
  shouldScale = true;
789
790
  shouldHandleColgroupUpdates = true;
790
791
  }
791
- if (this.state.windowResized) {
792
- shouldHandleColgroupUpdates = true;
792
+ if (!fg('platform_editor_table_width_refactor')) {
793
+ if (this.state.windowResized) {
794
+ shouldHandleColgroupUpdates = true;
795
+ }
793
796
  }
794
797
  if (shouldHandleColgroupUpdates) {
795
798
  this.handleColgroupUpdates();
@@ -621,7 +621,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
621
621
  isTableDisplayModeChanged: isTableDisplayModeChanged,
622
622
  isNumberColumnChanged: isNumberColumnChanged,
623
623
  isNumberOfColumnsChanged: isNumberOfColumnsChanged,
624
- isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged
624
+ isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged,
625
+ isTableResized: isTableResized
625
626
  });
626
627
  var _getEditorFeatureFlag = getEditorFeatureFlags(),
627
628
  _getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
@@ -719,8 +720,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
719
720
  shouldScale = true;
720
721
  shouldHandleColgroupUpdates = true;
721
722
  }
722
- if (this.state.windowResized) {
723
- shouldHandleColgroupUpdates = true;
723
+ if (!fg('platform_editor_table_width_refactor')) {
724
+ if (this.state.windowResized) {
725
+ shouldHandleColgroupUpdates = true;
726
+ }
724
727
  }
725
728
  if (shouldHandleColgroupUpdates) {
726
729
  this.handleColgroupUpdates();
@@ -4,6 +4,7 @@ import { calcTableColumnWidths, getFragmentBackingArray } from '@atlaskit/editor
4
4
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
5
5
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
6
6
  import { TableMap } from '@atlaskit/editor-tables/table-map';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { COLUMN_MIN_WIDTH, MAX_SCALING_PERCENT, MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION } from './consts';
8
9
  import { getScalingPercentForTableWithoutWidth, getTableContainerElementWidth, getTableScalingPercent } from './misc';
9
10
  /**
@@ -69,17 +70,27 @@ export var generateColgroupFromNode = function generateColgroupFromNode(table, i
69
70
  }
70
71
  });
71
72
  } else {
72
- // columns has not been resized, so distribute the width evenly
73
- cols.push.apply(cols, _toConsumableArray(Array.from({
74
- length: colspan
75
- }, function (_) {
76
- var tableWidth = getTableContainerElementWidth(table);
77
- var columnWidth = tableWidth / map.width || 0;
78
- var fixedColWidth = getColWidthFix(columnWidth, map.width || 0);
79
- return ['col', {
80
- style: generateColStyle(fixedColWidth, tableWidth, isCommentEditor, isChromelessEditor, isNested, shouldUseIncreasedScalingPercent, isNumberColumnEnabled, isTableHasWidth)
81
- }];
82
- })));
73
+ if (!isTableScalingEnabled && fg('platform_editor_table_width_refactor')) {
74
+ cols.push.apply(cols, _toConsumableArray(Array.from({
75
+ length: colspan
76
+ }, function (_) {
77
+ return ['col', {
78
+ style: "width: ".concat(tableCellMinWidth, "px;")
79
+ }];
80
+ })));
81
+ } else {
82
+ // columns has not been resized, so distribute the width evenly
83
+ cols.push.apply(cols, _toConsumableArray(Array.from({
84
+ length: colspan
85
+ }, function (_) {
86
+ var tableWidth = getTableContainerElementWidth(table);
87
+ var columnWidth = tableWidth / map.width || 0;
88
+ var fixedColWidth = getColWidthFix(columnWidth, map.width || 0);
89
+ return ['col', {
90
+ style: generateColStyle(fixedColWidth, tableWidth, isCommentEditor, isChromelessEditor, isNested, shouldUseIncreasedScalingPercent, isNumberColumnEnabled, isTableHasWidth)
91
+ }];
92
+ })));
93
+ }
83
94
  }
84
95
  });
85
96
  return cols;
@@ -6,6 +6,7 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
6
6
  import { ResizerBreakoutModeLabel } from '@atlaskit/editor-common/resizer';
7
7
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
8
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
+ import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
9
10
  import FloatingContextualButton from './FloatingContextualButton';
10
11
  import FloatingContextualMenu from './FloatingContextualMenu';
11
12
  import FloatingDeleteButton from './FloatingDeleteButton';
@@ -137,7 +138,8 @@ var ContentComponentInternal = function ContentComponentInternal(_ref) {
137
138
  getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
138
139
  isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
139
140
  isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
140
- api: api
141
+ api: api,
142
+ isDragMenuOpen: isDragAndDropEnabled && expValNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true) ? isDragMenuOpen : undefined
141
143
  }), isDragAndDropEnabled && /*#__PURE__*/React.createElement(FloatingDragMenu, {
142
144
  editorView: editorView,
143
145
  mountPoint: popupsMountPoint,
@@ -46,6 +46,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
46
46
  import { Box, xcss } from '@atlaskit/primitives';
47
47
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
48
48
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
49
+ import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
49
50
  import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, setFocusToCellMenu, toggleContextualMenu } from '../../pm-plugins/commands';
50
51
  import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics } from '../../pm-plugins/commands/commands-with-analytics';
51
52
  import { getPluginState } from '../../pm-plugins/plugin-factory';
@@ -742,6 +743,16 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
742
743
  }));
743
744
  }
744
745
  }
746
+ }, {
747
+ key: "componentDidUpdate",
748
+ value: function componentDidUpdate() {
749
+ var _getPluginState11 = getPluginState(this.props.editorView.state),
750
+ isDragAndDropEnabled = _getPluginState11.isDragAndDropEnabled,
751
+ isContextualMenuOpen = _getPluginState11.isContextualMenuOpen;
752
+ if (isDragAndDropEnabled && this.props.isDragMenuOpen && isContextualMenuOpen && expValNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true)) {
753
+ toggleContextualMenu()(this.props.editorView.state, this.props.editorView.dispatch);
754
+ }
755
+ }
745
756
  }, {
746
757
  key: "render",
747
758
  value: function render() {
@@ -754,8 +765,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
754
765
  editorView = _this$props13.editorView,
755
766
  isCellMenuOpenByKeyboard = _this$props13.isCellMenuOpenByKeyboard,
756
767
  api = _this$props13.api;
757
- var _getPluginState11 = getPluginState(editorView.state),
758
- isDragAndDropEnabled = _getPluginState11.isDragAndDropEnabled;
768
+ var _getPluginState12 = getPluginState(editorView.state),
769
+ isDragAndDropEnabled = _getPluginState12.isDragAndDropEnabled;
759
770
  var items = isDragAndDropEnabled ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
760
771
  var isOpenAllowed = false;
761
772
  isOpenAllowed = isCellMenuOpenByKeyboard ? this.state.isOpenAllowed : isOpen;
@@ -796,7 +807,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
796
807
  };
797
808
  if (expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true)) {
798
809
  return jsx(UserIntentPopupWrapper, {
799
- userIntent: "tablePopupOpen",
810
+ userIntent: "tableContextualMenuPopupOpen",
800
811
  api: api
801
812
  }, popupContent());
802
813
  }
@@ -10,6 +10,7 @@ import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from
10
10
  import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
11
11
  import { fg } from '@atlaskit/platform-feature-flags';
12
12
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
+ import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
13
14
  import { getPluginState } from '../../pm-plugins/plugin-factory';
14
15
  import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize, tablePopupMenuFitHeight } from '../consts';
15
16
 
@@ -29,6 +30,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
29
30
  getEditorFeatureFlags = _ref.getEditorFeatureFlags,
30
31
  isCellMenuOpenByKeyboard = _ref.isCellMenuOpenByKeyboard,
31
32
  isCommentEditor = _ref.isCommentEditor,
33
+ isDragMenuOpen = _ref.isDragMenuOpen,
32
34
  api = _ref.api;
33
35
  if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
34
36
  return null;
@@ -110,7 +112,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
110
112
  getEditorFeatureFlags: getEditorFeatureFlags,
111
113
  isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
112
114
  isCommentEditor: isCommentEditor,
113
- api: api
115
+ api: api,
116
+ isDragMenuOpen: expValNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true) ? isDragMenuOpen : undefined
114
117
  })));
115
118
  };
116
119
  FloatingContextualMenu.displayName = 'FloatingContextualMenu';
@@ -550,7 +550,7 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
550
550
  });
551
551
  return isToolbarAIFCEnabled || expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true) ? jsx(UserIntentPopupWrapper, {
552
552
  api: api,
553
- userIntent: expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true) ? 'tablePopupOpen' : undefined
553
+ userIntent: expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true) ? 'tableDragMenuPopupOpen' : undefined
554
554
  }, Menu) : Menu;
555
555
  });
556
556
  export default injectIntl(DragMenu);
@@ -22,6 +22,7 @@ interface Props {
22
22
  getEditorFeatureFlags?: GetEditorFeatureFlags;
23
23
  isCellMenuOpenByKeyboard?: boolean;
24
24
  isCommentEditor?: boolean;
25
+ isDragMenuOpen?: boolean;
25
26
  isOpen: boolean;
26
27
  mountPoint?: HTMLElement;
27
28
  offset?: Array<number>;
@@ -39,6 +40,7 @@ export declare class ContextualMenu extends Component<Props & WrappedComponentPr
39
40
  };
40
41
  private dropdownMenuRef;
41
42
  componentDidMount(): void;
43
+ componentDidUpdate(): void;
42
44
  render(): jsx.JSX.Element;
43
45
  private handleSubMenuRef;
44
46
  private createBackgroundColorItem;
@@ -16,6 +16,7 @@ interface Props {
16
16
  getEditorFeatureFlags?: GetEditorFeatureFlags;
17
17
  isCellMenuOpenByKeyboard?: boolean;
18
18
  isCommentEditor?: boolean;
19
+ isDragMenuOpen?: boolean;
19
20
  isOpen: boolean;
20
21
  mountPoint?: HTMLElement;
21
22
  pluginConfig?: PluginConfig;
@@ -23,7 +24,7 @@ interface Props {
23
24
  targetCellPosition?: number;
24
25
  }
25
26
  declare const FloatingContextualMenu: {
26
- ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, isCellMenuOpenByKeyboard, isCommentEditor, api, }: Props): jsx.JSX.Element | null;
27
+ ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, isCellMenuOpenByKeyboard, isCommentEditor, isDragMenuOpen, api, }: Props): jsx.JSX.Element | null;
27
28
  displayName: string;
28
29
  };
29
30
  export default FloatingContextualMenu;
@@ -22,6 +22,7 @@ interface Props {
22
22
  getEditorFeatureFlags?: GetEditorFeatureFlags;
23
23
  isCellMenuOpenByKeyboard?: boolean;
24
24
  isCommentEditor?: boolean;
25
+ isDragMenuOpen?: boolean;
25
26
  isOpen: boolean;
26
27
  mountPoint?: HTMLElement;
27
28
  offset?: Array<number>;
@@ -39,6 +40,7 @@ export declare class ContextualMenu extends Component<Props & WrappedComponentPr
39
40
  };
40
41
  private dropdownMenuRef;
41
42
  componentDidMount(): void;
43
+ componentDidUpdate(): void;
42
44
  render(): jsx.JSX.Element;
43
45
  private handleSubMenuRef;
44
46
  private createBackgroundColorItem;
@@ -16,6 +16,7 @@ interface Props {
16
16
  getEditorFeatureFlags?: GetEditorFeatureFlags;
17
17
  isCellMenuOpenByKeyboard?: boolean;
18
18
  isCommentEditor?: boolean;
19
+ isDragMenuOpen?: boolean;
19
20
  isOpen: boolean;
20
21
  mountPoint?: HTMLElement;
21
22
  pluginConfig?: PluginConfig;
@@ -23,7 +24,7 @@ interface Props {
23
24
  targetCellPosition?: number;
24
25
  }
25
26
  declare const FloatingContextualMenu: {
26
- ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, isCellMenuOpenByKeyboard, isCommentEditor, api, }: Props): jsx.JSX.Element | null;
27
+ ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, isCellMenuOpenByKeyboard, isCommentEditor, isDragMenuOpen, api, }: Props): jsx.JSX.Element | null;
27
28
  displayName: string;
28
29
  };
29
30
  export default FloatingContextualMenu;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "15.3.10",
3
+ "version": "15.3.11",
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": "^16.1.0",
60
60
  "@atlaskit/react-ufo": "^4.14.0",
61
61
  "@atlaskit/theme": "^21.0.0",
62
- "@atlaskit/tmp-editor-statsig": "^13.26.0",
62
+ "@atlaskit/tmp-editor-statsig": "^13.30.0",
63
63
  "@atlaskit/toggle": "^15.1.0",
64
64
  "@atlaskit/tokens": "^7.1.0",
65
65
  "@atlaskit/tooltip": "^20.7.0",
@@ -72,7 +72,7 @@
72
72
  "uuid": "^3.1.0"
73
73
  },
74
74
  "peerDependencies": {
75
- "@atlaskit/editor-common": "^110.22.0",
75
+ "@atlaskit/editor-common": "^110.23.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"
@@ -144,6 +144,9 @@
144
144
  },
145
145
  "platform_editor_content_mode_button_mvp": {
146
146
  "type": "boolean"
147
+ },
148
+ "platform_editor_table_width_refactor": {
149
+ "type": "boolean"
147
150
  }
148
151
  }
149
152
  }