@atlaskit/editor-plugin-table 25.0.0 → 25.0.2

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,21 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 25.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7a8d5e478d5d1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7a8d5e478d5d1) -
8
+ Clean up feature gate `platform_editor_table_fixed_column_width_prop`
9
+ - Updated dependencies
10
+
11
+ ## 25.0.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [`ae5ca1873aef4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ae5ca1873aef4) -
16
+ Clean up feature gate `platform_editor_nested_dnd_styles_changes`
17
+ - Updated dependencies
18
+
3
19
  ## 25.0.0
4
20
 
5
21
  ### Major Changes
@@ -26,7 +26,6 @@ var _table = require("@atlaskit/editor-common/table");
26
26
  var _utils = require("@atlaskit/editor-common/utils");
27
27
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
28
28
  var _utils2 = require("@atlaskit/editor-tables/utils");
29
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
30
29
  var _combine = require("@atlaskit/pragmatic-drag-and-drop/combine");
31
30
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
32
31
  var _commands = require("../pm-plugins/commands");
@@ -608,7 +607,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
608
607
  isResizing = _this$props9.isResizing,
609
608
  view = _this$props9.view,
610
609
  getPos = _this$props9.getPos,
611
- getEditorFeatureFlags = _this$props9.getEditorFeatureFlags,
612
610
  options = _this$props9.options;
613
611
  if (!this.table) {
614
612
  return;
@@ -639,7 +637,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
639
637
  var isFullWidthModeAndLineLengthChanged = this.updateColGroupFromFullWidthChange && isLineLengthChanged;
640
638
  var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged || this.state.windowResized;
641
639
  if (force || maybeScale || isFullWidthModeAndLineLengthChanged) {
642
- var _this$containerWidth2, _this$props0, _getEditorFeatureFlag, _this$props$options3, _this$props$options4, _this$props$options5;
640
+ var _this$containerWidth2, _this$props0, _this$props$options3, _this$props$options4, _this$props$options5;
643
641
  var isWidthChanged = ((_this$containerWidth2 = this.containerWidth) === null || _this$containerWidth2 === void 0 ? void 0 : _this$containerWidth2.width) !== containerWidthValue;
644
642
  var wasTableResized = (0, _colgroup.hasTableBeenResized)(this.node);
645
643
  var isTableResized = (0, _colgroup.hasTableBeenResized)(tableNode);
@@ -657,7 +655,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
657
655
  isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged,
658
656
  isTableResized: isTableResized
659
657
  });
660
- var tableWithFixedColumnWidthsOption = ((0, _platformFeatureFlags.fg)('platform_editor_table_fixed_column_width_prop') ? (_this$props0 = this.props) === null || _this$props0 === void 0 ? void 0 : _this$props0.allowFixedColumnWidthOption : (_getEditorFeatureFlag = getEditorFeatureFlags()) === null || _getEditorFeatureFlag === void 0 ? void 0 : _getEditorFeatureFlag.tableWithFixedColumnWidthsOption) || false;
658
+ var tableWithFixedColumnWidthsOption = ((_this$props0 = this.props) === null || _this$props0 === void 0 ? void 0 : _this$props0.allowFixedColumnWidthOption) || false;
661
659
  var isTableScalingWithFixedColumnWidthsOptionEnabled = !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
662
660
  var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled || !!((_this$props$options4 = this.props.options) !== null && _this$props$options4 !== void 0 && _this$props$options4.isTableScalingEnabled) && !!((_this$props$options5 = this.props.options) !== null && _this$props$options5 !== void 0 && _this$props$options5.isCommentEditor);
663
661
  if (force || !isResizing && shouldUpdateColgroup) {
@@ -722,7 +720,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
722
720
  }, {
723
721
  key: "componentDidUpdate",
724
722
  value: function componentDidUpdate(_, prevState) {
725
- var _getEditorFeatureFlag2, _this$props$options0, _this$props$options1;
723
+ var _this$props$options0, _this$props$options1;
726
724
  var _this$props1 = this.props,
727
725
  getNode = _this$props1.getNode,
728
726
  isMediaFullscreen = _this$props1.isMediaFullscreen,
@@ -732,11 +730,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
732
730
  options = _this$props1.options,
733
731
  isTableScalingEnabled = _this$props1.isTableScalingEnabled,
734
732
  getPos = _this$props1.getPos,
735
- getEditorFeatureFlags = _this$props1.getEditorFeatureFlags,
736
733
  allowFixedColumnWidthOption = _this$props1.allowFixedColumnWidthOption;
737
734
  var shouldScale = false;
738
735
  var shouldHandleColgroupUpdates = false;
739
- var tableWithFixedColumnWidthsOption = ((0, _platformFeatureFlags.fg)('platform_editor_table_fixed_column_width_prop') ? allowFixedColumnWidthOption : (_getEditorFeatureFlag2 = getEditorFeatureFlags()) === null || _getEditorFeatureFlag2 === void 0 ? void 0 : _getEditorFeatureFlag2.tableWithFixedColumnWidthsOption) || false;
736
+ var tableWithFixedColumnWidthsOption = allowFixedColumnWidthOption || false;
740
737
  if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
741
738
  shouldScale = true;
742
739
  shouldHandleColgroupUpdates = true;
@@ -921,9 +918,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
921
918
  tablePos = undefined;
922
919
  }
923
920
  var isNested = (0, _nodes.isTableNested)(view.state, tablePos);
924
- var _getEditorFeatureFlag3 = getEditorFeatureFlags(),
925
- _getEditorFeatureFlag4 = _getEditorFeatureFlag3.tableWithFixedColumnWidthsOption,
926
- tableWithFixedColumnWidthsOption = _getEditorFeatureFlag4 === void 0 ? false : _getEditorFeatureFlag4;
921
+ var _getEditorFeatureFlag = getEditorFeatureFlags(),
922
+ _getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
923
+ tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
927
924
  var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption || !!((_this$props$options12 = this.props.options) !== null && _this$props$options12 !== void 0 && _this$props$options12.isCommentEditor));
928
925
  return /*#__PURE__*/_react.default.createElement(_TableContainer.TableContainer
929
926
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -23,7 +23,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
23
23
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
24
24
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
25
25
  var _tableMap = require("@atlaskit/editor-tables/table-map");
26
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
27
26
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
28
27
  var _createPluginConfig = require("../pm-plugins/create-plugin-config");
29
28
  var _pluginFactory = require("../pm-plugins/plugin-factory");
@@ -112,11 +111,11 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
112
111
  }).toDOM(this.node);
113
112
  var rendered = _model.DOMSerializer.renderSpec(document, tableDOMStructure);
114
113
  if (rendered.dom) {
115
- var _this$reactComponentP5, _this$getEditorFeatur, _this$options, _this$options2;
114
+ var _this$reactComponentP5, _this$options, _this$options2;
116
115
  var tableElement = rendered.dom.querySelector('table');
117
116
  this.table = tableElement ? tableElement : rendered.dom;
118
117
  this.renderedDOM = rendered.dom;
119
- var allowFixedColumnWidthOption = ((0, _platformFeatureFlags.fg)('platform_editor_table_fixed_column_width_prop') ? (_this$reactComponentP5 = this.reactComponentProps) === null || _this$reactComponentP5 === void 0 ? void 0 : _this$reactComponentP5.allowFixedColumnWidthOption : (_this$getEditorFeatur = this.getEditorFeatureFlags) === null || _this$getEditorFeatur === void 0 ? void 0 : _this$getEditorFeatur.call(this).tableWithFixedColumnWidthsOption) || false;
118
+ var allowFixedColumnWidthOption = ((_this$reactComponentP5 = this.reactComponentProps) === null || _this$reactComponentP5 === void 0 ? void 0 : _this$reactComponentP5.allowFixedColumnWidthOption) || false;
120
119
  if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled) || (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled && allowFixedColumnWidthOption && this.node.attrs.displayMode === 'fixed') {
121
120
  var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos(), this.reactComponentProps.allowTableResizing);
122
121
  if (tableInlineWidth) {
@@ -228,7 +227,6 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
228
227
  _this$reactComponentP7,
229
228
  _this3 = this,
230
229
  _this$reactComponentP8,
231
- _this$getEditorFeatur2,
232
230
  _this$options3,
233
231
  _this$options4;
234
232
  if (!this.table) {
@@ -254,7 +252,7 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
254
252
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
255
253
  _this3.table.setAttribute(attr, attrs[attr]);
256
254
  });
257
- var isTableFixedColumnWidthsOptionEnabled = ((0, _platformFeatureFlags.fg)('platform_editor_table_fixed_column_width_prop') ? (_this$reactComponentP8 = this.reactComponentProps) === null || _this$reactComponentP8 === void 0 ? void 0 : _this$reactComponentP8.allowFixedColumnWidthOption : (_this$getEditorFeatur2 = this.getEditorFeatureFlags) === null || _this$getEditorFeatur2 === void 0 ? void 0 : _this$getEditorFeatur2.call(this).tableWithFixedColumnWidthsOption) || false;
255
+ var isTableFixedColumnWidthsOptionEnabled = ((_this$reactComponentP8 = this.reactComponentProps) === null || _this$reactComponentP8 === void 0 ? void 0 : _this$reactComponentP8.allowFixedColumnWidthOption) || false;
258
256
  // Preserve Table Width cannot have inline width set on the table
259
257
  if (!((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.isTableScalingEnabled) || (_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.isTableScalingEnabled && isTableFixedColumnWidthsOptionEnabled && node.attrs.displayMode === 'fixed') {
260
258
  var _tableWidthPluginKey$;
@@ -377,7 +375,7 @@ var createTableView = exports.createTableView = function createTableView(node, v
377
375
  allowControls = _getPluginConfig.allowControls,
378
376
  allowTableResizing = _getPluginConfig.allowTableResizing,
379
377
  allowTableAlignment = _getPluginConfig.allowTableAlignment;
380
- var isTableFixedColumnWidthsOptionEnabled = ((0, _platformFeatureFlags.fg)('platform_editor_table_fixed_column_width_prop') ? allowFixedColumnWidthOption : getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().tableWithFixedColumnWidthsOption) || false;
378
+ var isTableFixedColumnWidthsOptionEnabled = allowFixedColumnWidthOption || false;
381
379
  var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
382
380
  return new TableView({
383
381
  node: node,
@@ -72,7 +72,7 @@ var TABLE_WIDTH_INFO_TIMEOUT = 10000;
72
72
  * from `@atlaskit/editor-core`.
73
73
  */
74
74
  var tablePlugin = function tablePlugin(_ref) {
75
- var _config$tableOptions, _api$analytics, _options$getEditorFea, _options$getEditorFea2;
75
+ var _config$tableOptions, _api$analytics, _options$getEditorFea;
76
76
  var config = _ref.config,
77
77
  api = _ref.api;
78
78
  var editorViewRef = {
@@ -89,12 +89,12 @@ var tablePlugin = function tablePlugin(_ref) {
89
89
  };
90
90
  };
91
91
  var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
92
- var isTableFixedColumnWidthsOptionEnabled = (0, _platformFeatureFlags.fg)('platform_editor_table_fixed_column_width_prop') ? options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption : (options === null || options === void 0 || (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableWithFixedColumnWidthsOption) || false;
92
+ var isTableFixedColumnWidthsOptionEnabled = options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption;
93
93
  var shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && (isTableFixedColumnWidthsOptionEnabled || ( // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
94
94
  options === null || options === void 0 ? void 0 : options.isCommentEditor));
95
95
  var isTableSelectorEnabled =
96
96
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
97
- !(options !== null && options !== void 0 && options.isChromelessEditor) && !(options !== null && options !== void 0 && options.isCommentEditor) && (options === null || options === void 0 || (_options$getEditorFea2 = options.getEditorFeatureFlags) === null || _options$getEditorFea2 === void 0 ? void 0 : _options$getEditorFea2.call(options).tableSelector) && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1');
97
+ !(options !== null && options !== void 0 && options.isChromelessEditor) && !(options !== null && options !== void 0 && options.isCommentEditor) && (options === null || options === void 0 || (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableSelector) && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1');
98
98
  if ((0, _expValEquals.expValEquals)('platform_editor_table_menu_updates', 'isEnabled', true)) {
99
99
  var _api$uiControlRegistr;
100
100
  api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register((0, _getTableMenuComponents.getTableMenuComponents)({
@@ -244,14 +244,11 @@ var tablePlugin = function tablePlugin(_ref) {
244
244
  }
245
245
  },
246
246
  nodes: function nodes() {
247
- var _options$tableOptions2, _options$getEditorFea3;
247
+ var _options$tableOptions2;
248
248
  var _pluginConfig = (0, _createPluginConfig.pluginConfig)(options === null || options === void 0 ? void 0 : options.tableOptions),
249
249
  allowColumnResizing = _pluginConfig.allowColumnResizing;
250
250
  // TODO: ED-25901 - We need to move this into a plugin config option so we don't accidentally enable nested nodes in Jira
251
251
  var isNestingSupported = Boolean(options === null || options === void 0 || (_options$tableOptions2 = options.tableOptions) === null || _options$tableOptions2 === void 0 ? void 0 : _options$tableOptions2.allowNestedTables);
252
- var isTableFixedColumnWidthsOptionEnabled = ((0, _platformFeatureFlags.fg)('platform_editor_table_fixed_column_width_prop') ? options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption : options === null || options === void 0 || (_options$getEditorFea3 = options.getEditorFeatureFlags) === null || _options$getEditorFea3 === void 0 ? void 0 : _options$getEditorFea3.call(options).tableWithFixedColumnWidthsOption) || false;
253
- var shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && (isTableFixedColumnWidthsOptionEnabled || ( // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
254
- options === null || options === void 0 ? void 0 : options.isCommentEditor));
255
252
  var isTableScalingEnabled = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled;
256
253
  var isCommentEditor = options === null || options === void 0 ? void 0 : options.isCommentEditor;
257
254
  var isChromelessEditor = options === null || options === void 0 ? void 0 : options.isChromelessEditor;
@@ -318,7 +315,7 @@ var tablePlugin = function tablePlugin(_ref) {
318
315
  isCommentEditor = _ref3.isCommentEditor,
319
316
  isChromelessEditor = _ref3.isChromelessEditor,
320
317
  __livePage = _ref3.__livePage;
321
- return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption, __livePage);
318
+ return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, isTableFixedColumnWidthsOptionEnabled, __livePage);
322
319
  }
323
320
  }, {
324
321
  name: 'tablePMColResizing',
@@ -8,12 +8,8 @@ exports.default = exports.TableFloatingControls = void 0;
8
8
  var _react = require("react");
9
9
  var _react2 = require("@emotion/react");
10
10
  var _browser = require("@atlaskit/editor-common/browser");
11
- var _utils = require("@atlaskit/editor-tables/utils");
12
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
11
  var _commands = require("../../pm-plugins/commands");
14
- var _nodes = require("../../pm-plugins/utils/nodes");
15
12
  var _types = require("../../types");
16
- var _DragCornerControls = require("./CornerControls/DragCornerControls");
17
13
  var _NumberColumn = _interopRequireDefault(require("./NumberColumn"));
18
14
  var _DragControls = require("./RowControls/DragControls");
19
15
  /**
@@ -25,7 +21,6 @@ var _DragControls = require("./RowControls/DragControls");
25
21
 
26
22
  // Row controls
27
23
  var TableFloatingControls = exports.TableFloatingControls = function TableFloatingControls(_ref) {
28
- var _findTable;
29
24
  var editorView = _ref.editorView,
30
25
  tableRef = _ref.tableRef,
31
26
  tableNode = _ref.tableNode,
@@ -87,11 +82,6 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
87
82
  }
88
83
  var stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
89
84
  var wrapperClassName = isDragAndDropEnabled ? isChromelessEditor ? _types.TableCssClassName.DRAG_ROW_CONTROLS_WRAPPER + ' ' + _types.TableCssClassName.TABLE_CHROMELESS : _types.TableCssClassName.DRAG_ROW_CONTROLS_WRAPPER : _types.TableCssClassName.ROW_CONTROLS_WRAPPER;
90
- var tablePos = (_findTable = (0, _utils.findTable)(editorView.state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos;
91
- // Ignored via go/ees005
92
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
93
- var isNested = tablePos !== undefined && (0, _nodes.isTableNested)(editorView.state, tablePos);
94
- var shouldShowCornerControls = isNested && !(0, _platformFeatureFlags.fg)('platform_editor_nested_dnd_styles_changes');
95
85
  return (0, _react2.jsx)("div", {
96
86
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
97
87
  className: wrapperClassName
@@ -113,13 +103,7 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
113
103
  updateCellHoverLocation: updateCellHoverLocation,
114
104
  stickyTop: stickyTop,
115
105
  isDragAndDropEnabled: isDragAndDropEnabled
116
- }) : null, tableActive && (0, _react2.jsx)(_react.Fragment, null, shouldShowCornerControls && (0, _react2.jsx)(_DragCornerControls.DragCornerControlsWithSelection, {
117
- editorView: editorView,
118
- tableRef: tableRef,
119
- isInDanger: isInDanger,
120
- isResizing: isResizing,
121
- api: api
122
- }), (0, _react2.jsx)(_DragControls.DragControlsWithSelection, {
106
+ }) : null, tableActive && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_DragControls.DragControlsWithSelection, {
123
107
  tableRef: tableRef,
124
108
  tableNode: tableNode,
125
109
  hoveredCell: hoveredCell,
@@ -13,7 +13,6 @@ import { isTableInContentMode } from '@atlaskit/editor-common/table';
13
13
  import { isValidPosition } from '@atlaskit/editor-common/utils';
14
14
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
15
15
  import { isTableSelected } from '@atlaskit/editor-tables/utils';
16
- import { fg } from '@atlaskit/platform-feature-flags';
17
16
  import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
18
17
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
19
18
  import { autoSizeTable, clearHoverSelection, setTableRef } from '../pm-plugins/commands';
@@ -566,7 +565,6 @@ class TableComponent extends React.Component {
566
565
  isResizing,
567
566
  view,
568
567
  getPos,
569
- getEditorFeatureFlags,
570
568
  options
571
569
  } = this.props;
572
570
  if (!this.table) {
@@ -600,7 +598,7 @@ class TableComponent extends React.Component {
600
598
  const isFullWidthModeAndLineLengthChanged = this.updateColGroupFromFullWidthChange && isLineLengthChanged;
601
599
  const maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged || this.state.windowResized;
602
600
  if (force || maybeScale || isFullWidthModeAndLineLengthChanged) {
603
- var _this$containerWidth2, _this$props, _getEditorFeatureFlag, _this$props$options3, _this$props$options4, _this$props$options5;
601
+ var _this$containerWidth2, _this$props, _this$props$options3, _this$props$options4, _this$props$options5;
604
602
  const isWidthChanged = ((_this$containerWidth2 = this.containerWidth) === null || _this$containerWidth2 === void 0 ? void 0 : _this$containerWidth2.width) !== containerWidthValue;
605
603
  const wasTableResized = hasTableBeenResized(this.node);
606
604
  const isTableResized = hasTableBeenResized(tableNode);
@@ -618,7 +616,7 @@ class TableComponent extends React.Component {
618
616
  isFullWidthModeAndLineLengthChanged,
619
617
  isTableResized
620
618
  });
621
- const tableWithFixedColumnWidthsOption = (fg('platform_editor_table_fixed_column_width_prop') ? (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.allowFixedColumnWidthOption : (_getEditorFeatureFlag = getEditorFeatureFlags()) === null || _getEditorFeatureFlag === void 0 ? void 0 : _getEditorFeatureFlag.tableWithFixedColumnWidthsOption) || false;
619
+ const tableWithFixedColumnWidthsOption = ((_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.allowFixedColumnWidthOption) || false;
622
620
  const isTableScalingWithFixedColumnWidthsOptionEnabled = !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
623
621
  const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled || !!((_this$props$options4 = this.props.options) !== null && _this$props$options4 !== void 0 && _this$props$options4.isTableScalingEnabled) && !!((_this$props$options5 = this.props.options) !== null && _this$props$options5 !== void 0 && _this$props$options5.isCommentEditor);
624
622
  if (force || !isResizing && shouldUpdateColgroup) {
@@ -681,7 +679,7 @@ class TableComponent extends React.Component {
681
679
  // Ignored via go/ees005
682
680
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
683
681
  componentDidUpdate(_, prevState) {
684
- var _getEditorFeatureFlag2, _this$props$options10, _this$props$options11;
682
+ var _this$props$options10, _this$props$options11;
685
683
  const {
686
684
  getNode,
687
685
  isMediaFullscreen,
@@ -692,12 +690,11 @@ class TableComponent extends React.Component {
692
690
  isTableScalingEnabled,
693
691
  // we could use options.isTableScalingEnabled here
694
692
  getPos,
695
- getEditorFeatureFlags,
696
693
  allowFixedColumnWidthOption
697
694
  } = this.props;
698
695
  let shouldScale = false;
699
696
  let shouldHandleColgroupUpdates = false;
700
- const tableWithFixedColumnWidthsOption = (fg('platform_editor_table_fixed_column_width_prop') ? allowFixedColumnWidthOption : (_getEditorFeatureFlag2 = getEditorFeatureFlags()) === null || _getEditorFeatureFlag2 === void 0 ? void 0 : _getEditorFeatureFlag2.tableWithFixedColumnWidthsOption) || false;
697
+ const tableWithFixedColumnWidthsOption = allowFixedColumnWidthOption || false;
701
698
  if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
702
699
  shouldScale = true;
703
700
  shouldHandleColgroupUpdates = true;
@@ -9,7 +9,6 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
9
9
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
10
10
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
11
11
  import { TableMap } from '@atlaskit/editor-tables/table-map';
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
12
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
14
13
  import { pluginConfig as getPluginConfig } from '../pm-plugins/create-plugin-config';
15
14
  import { getPluginState } from '../pm-plugins/plugin-factory';
@@ -85,11 +84,11 @@ export default class TableView extends ReactNodeView {
85
84
  }).toDOM(this.node);
86
85
  const rendered = DOMSerializer.renderSpec(document, tableDOMStructure);
87
86
  if (rendered.dom) {
88
- var _this$reactComponentP5, _this$getEditorFeatur, _this$options, _this$options2;
87
+ var _this$reactComponentP5, _this$options, _this$options2;
89
88
  const tableElement = rendered.dom.querySelector('table');
90
89
  this.table = tableElement ? tableElement : rendered.dom;
91
90
  this.renderedDOM = rendered.dom;
92
- const allowFixedColumnWidthOption = (fg('platform_editor_table_fixed_column_width_prop') ? (_this$reactComponentP5 = this.reactComponentProps) === null || _this$reactComponentP5 === void 0 ? void 0 : _this$reactComponentP5.allowFixedColumnWidthOption : (_this$getEditorFeatur = this.getEditorFeatureFlags) === null || _this$getEditorFeatur === void 0 ? void 0 : _this$getEditorFeatur.call(this).tableWithFixedColumnWidthsOption) || false;
91
+ const allowFixedColumnWidthOption = ((_this$reactComponentP5 = this.reactComponentProps) === null || _this$reactComponentP5 === void 0 ? void 0 : _this$reactComponentP5.allowFixedColumnWidthOption) || false;
93
92
  if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled) || (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled && allowFixedColumnWidthOption && this.node.attrs.displayMode === 'fixed') {
94
93
  const tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos(), this.reactComponentProps.allowTableResizing);
95
94
  if (tableInlineWidth) {
@@ -194,7 +193,7 @@ export default class TableView extends ReactNodeView {
194
193
  }
195
194
  }
196
195
  setDomAttrs(node) {
197
- var _this$reactComponentP6, _this$reactComponentP7, _this$reactComponentP8, _this$getEditorFeatur2, _this$options3, _this$options4;
196
+ var _this$reactComponentP6, _this$reactComponentP7, _this$reactComponentP8, _this$options3, _this$options4;
198
197
  if (!this.table) {
199
198
  return; // width / attribute application to actual table will happen later when table is set
200
199
  }
@@ -218,7 +217,7 @@ export default class TableView extends ReactNodeView {
218
217
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
219
218
  this.table.setAttribute(attr, attrs[attr]);
220
219
  });
221
- const isTableFixedColumnWidthsOptionEnabled = (fg('platform_editor_table_fixed_column_width_prop') ? (_this$reactComponentP8 = this.reactComponentProps) === null || _this$reactComponentP8 === void 0 ? void 0 : _this$reactComponentP8.allowFixedColumnWidthOption : (_this$getEditorFeatur2 = this.getEditorFeatureFlags) === null || _this$getEditorFeatur2 === void 0 ? void 0 : _this$getEditorFeatur2.call(this).tableWithFixedColumnWidthsOption) || false;
220
+ const isTableFixedColumnWidthsOptionEnabled = ((_this$reactComponentP8 = this.reactComponentProps) === null || _this$reactComponentP8 === void 0 ? void 0 : _this$reactComponentP8.allowFixedColumnWidthOption) || false;
222
221
  // Preserve Table Width cannot have inline width set on the table
223
222
  if (!((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.isTableScalingEnabled) || (_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.isTableScalingEnabled && isTableFixedColumnWidthsOptionEnabled && node.attrs.displayMode === 'fixed') {
224
223
  var _tableWidthPluginKey$;
@@ -336,7 +335,7 @@ export const createTableView = (node, view, getPos, portalProviderAPI, eventDisp
336
335
  allowTableResizing,
337
336
  allowTableAlignment
338
337
  } = getPluginConfig(pluginConfig);
339
- const isTableFixedColumnWidthsOptionEnabled = (fg('platform_editor_table_fixed_column_width_prop') ? allowFixedColumnWidthOption : getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().tableWithFixedColumnWidthsOption) || false;
338
+ const isTableFixedColumnWidthsOptionEnabled = allowFixedColumnWidthOption || false;
340
339
  const shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
341
340
  return new TableView({
342
341
  node,
@@ -61,7 +61,7 @@ const tablePlugin = ({
61
61
  config,
62
62
  api
63
63
  }) => {
64
- var _config$tableOptions, _api$analytics, _options$getEditorFea, _options$getEditorFea2;
64
+ var _config$tableOptions, _api$analytics, _options$getEditorFea;
65
65
  const editorViewRef = {
66
66
  current: null
67
67
  };
@@ -77,12 +77,12 @@ const tablePlugin = ({
77
77
  };
78
78
  };
79
79
  const editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
80
- const isTableFixedColumnWidthsOptionEnabled = fg('platform_editor_table_fixed_column_width_prop') ? options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption : (options === null || options === void 0 ? void 0 : (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableWithFixedColumnWidthsOption) || false;
80
+ const isTableFixedColumnWidthsOptionEnabled = options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption;
81
81
  const shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && (isTableFixedColumnWidthsOptionEnabled || ( // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
82
82
  options === null || options === void 0 ? void 0 : options.isCommentEditor));
83
83
  const isTableSelectorEnabled =
84
84
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
85
- !(options !== null && options !== void 0 && options.isChromelessEditor) && !(options !== null && options !== void 0 && options.isCommentEditor) && (options === null || options === void 0 ? void 0 : (_options$getEditorFea2 = options.getEditorFeatureFlags) === null || _options$getEditorFea2 === void 0 ? void 0 : _options$getEditorFea2.call(options).tableSelector) && editorExperiment('platform_editor_controls', 'variant1');
85
+ !(options !== null && options !== void 0 && options.isChromelessEditor) && !(options !== null && options !== void 0 && options.isCommentEditor) && (options === null || options === void 0 ? void 0 : (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableSelector) && editorExperiment('platform_editor_controls', 'variant1');
86
86
  if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
87
87
  var _api$uiControlRegistr;
88
88
  api === null || api === void 0 ? void 0 : (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 ? void 0 : _api$uiControlRegistr.actions.register(getTableMenuComponents({
@@ -230,15 +230,12 @@ const tablePlugin = ({
230
230
  })
231
231
  },
232
232
  nodes() {
233
- var _options$tableOptions2, _options$getEditorFea3;
233
+ var _options$tableOptions2;
234
234
  const {
235
235
  allowColumnResizing
236
236
  } = pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions);
237
237
  // TODO: ED-25901 - We need to move this into a plugin config option so we don't accidentally enable nested nodes in Jira
238
238
  const isNestingSupported = Boolean(options === null || options === void 0 ? void 0 : (_options$tableOptions2 = options.tableOptions) === null || _options$tableOptions2 === void 0 ? void 0 : _options$tableOptions2.allowNestedTables);
239
- const isTableFixedColumnWidthsOptionEnabled = (fg('platform_editor_table_fixed_column_width_prop') ? options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption : options === null || options === void 0 ? void 0 : (_options$getEditorFea3 = options.getEditorFeatureFlags) === null || _options$getEditorFea3 === void 0 ? void 0 : _options$getEditorFea3.call(options).tableWithFixedColumnWidthsOption) || false;
240
- const shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && (isTableFixedColumnWidthsOptionEnabled || ( // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
241
- options === null || options === void 0 ? void 0 : options.isCommentEditor));
242
239
  const isTableScalingEnabled = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled;
243
240
  const isCommentEditor = options === null || options === void 0 ? void 0 : options.isCommentEditor;
244
241
  const isChromelessEditor = options === null || options === void 0 ? void 0 : options.isChromelessEditor;
@@ -307,7 +304,7 @@ const tablePlugin = ({
307
304
  isChromelessEditor,
308
305
  __livePage
309
306
  } = options || {};
310
- return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption, __livePage);
307
+ return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, isTableFixedColumnWidthsOptionEnabled, __livePage);
311
308
  }
312
309
  }, {
313
310
  name: 'tablePMColResizing',
@@ -7,12 +7,8 @@ import { Fragment, useCallback } from 'react';
7
7
  /* eslint-disable @typescript-eslint/consistent-type-imports, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic */
8
8
  import { jsx } from '@emotion/react';
9
9
  import { getBrowserInfo } from '@atlaskit/editor-common/browser';
10
- import { findTable } from '@atlaskit/editor-tables/utils';
11
- import { fg } from '@atlaskit/platform-feature-flags';
12
10
  import { hoverCell, hoverRows, selectRow, selectRows } from '../../pm-plugins/commands';
13
- import { isTableNested } from '../../pm-plugins/utils/nodes';
14
11
  import { TableCssClassName as ClassName } from '../../types';
15
- import { DragCornerControlsWithSelection } from './CornerControls/DragCornerControls';
16
12
  import NumberColumn from './NumberColumn';
17
13
  import { DragControlsWithSelection } from './RowControls/DragControls';
18
14
  // Row controls
@@ -34,7 +30,6 @@ export const TableFloatingControls = ({
34
30
  api,
35
31
  isChromelessEditor
36
32
  }) => {
37
- var _findTable;
38
33
  const _selectRow = useCallback((row, expand) => {
39
34
  const {
40
35
  state,
@@ -88,11 +83,6 @@ export const TableFloatingControls = ({
88
83
  }
89
84
  const stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
90
85
  const wrapperClassName = isDragAndDropEnabled ? isChromelessEditor ? ClassName.DRAG_ROW_CONTROLS_WRAPPER + ' ' + ClassName.TABLE_CHROMELESS : ClassName.DRAG_ROW_CONTROLS_WRAPPER : ClassName.ROW_CONTROLS_WRAPPER;
91
- const tablePos = (_findTable = findTable(editorView.state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos;
92
- // Ignored via go/ees005
93
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
94
- const isNested = tablePos !== undefined && isTableNested(editorView.state, tablePos);
95
- const shouldShowCornerControls = isNested && !fg('platform_editor_nested_dnd_styles_changes');
96
86
  return jsx("div", {
97
87
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
98
88
  className: wrapperClassName
@@ -112,13 +102,7 @@ export const TableFloatingControls = ({
112
102
  updateCellHoverLocation: updateCellHoverLocation,
113
103
  stickyTop: stickyTop,
114
104
  isDragAndDropEnabled: isDragAndDropEnabled
115
- }) : null, tableActive && jsx(Fragment, null, shouldShowCornerControls && jsx(DragCornerControlsWithSelection, {
116
- editorView: editorView,
117
- tableRef: tableRef,
118
- isInDanger: isInDanger,
119
- isResizing: isResizing,
120
- api: api
121
- }), jsx(DragControlsWithSelection, {
105
+ }) : null, tableActive && jsx(Fragment, null, jsx(DragControlsWithSelection, {
122
106
  tableRef: tableRef,
123
107
  tableNode: tableNode,
124
108
  hoveredCell: hoveredCell,
@@ -26,7 +26,6 @@ import { isTableInContentMode } from '@atlaskit/editor-common/table';
26
26
  import { isValidPosition } from '@atlaskit/editor-common/utils';
27
27
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
28
28
  import { isTableSelected } from '@atlaskit/editor-tables/utils';
29
- import { fg } from '@atlaskit/platform-feature-flags';
30
29
  import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
31
30
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
32
31
  import { autoSizeTable, clearHoverSelection, setTableRef } from '../pm-plugins/commands';
@@ -602,7 +601,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
602
601
  isResizing = _this$props9.isResizing,
603
602
  view = _this$props9.view,
604
603
  getPos = _this$props9.getPos,
605
- getEditorFeatureFlags = _this$props9.getEditorFeatureFlags,
606
604
  options = _this$props9.options;
607
605
  if (!this.table) {
608
606
  return;
@@ -633,7 +631,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
633
631
  var isFullWidthModeAndLineLengthChanged = this.updateColGroupFromFullWidthChange && isLineLengthChanged;
634
632
  var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged || this.state.windowResized;
635
633
  if (force || maybeScale || isFullWidthModeAndLineLengthChanged) {
636
- var _this$containerWidth2, _this$props0, _getEditorFeatureFlag, _this$props$options3, _this$props$options4, _this$props$options5;
634
+ var _this$containerWidth2, _this$props0, _this$props$options3, _this$props$options4, _this$props$options5;
637
635
  var isWidthChanged = ((_this$containerWidth2 = this.containerWidth) === null || _this$containerWidth2 === void 0 ? void 0 : _this$containerWidth2.width) !== containerWidthValue;
638
636
  var wasTableResized = hasTableBeenResized(this.node);
639
637
  var isTableResized = hasTableBeenResized(tableNode);
@@ -651,7 +649,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
651
649
  isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged,
652
650
  isTableResized: isTableResized
653
651
  });
654
- var tableWithFixedColumnWidthsOption = (fg('platform_editor_table_fixed_column_width_prop') ? (_this$props0 = this.props) === null || _this$props0 === void 0 ? void 0 : _this$props0.allowFixedColumnWidthOption : (_getEditorFeatureFlag = getEditorFeatureFlags()) === null || _getEditorFeatureFlag === void 0 ? void 0 : _getEditorFeatureFlag.tableWithFixedColumnWidthsOption) || false;
652
+ var tableWithFixedColumnWidthsOption = ((_this$props0 = this.props) === null || _this$props0 === void 0 ? void 0 : _this$props0.allowFixedColumnWidthOption) || false;
655
653
  var isTableScalingWithFixedColumnWidthsOptionEnabled = !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
656
654
  var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled || !!((_this$props$options4 = this.props.options) !== null && _this$props$options4 !== void 0 && _this$props$options4.isTableScalingEnabled) && !!((_this$props$options5 = this.props.options) !== null && _this$props$options5 !== void 0 && _this$props$options5.isCommentEditor);
657
655
  if (force || !isResizing && shouldUpdateColgroup) {
@@ -716,7 +714,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
716
714
  }, {
717
715
  key: "componentDidUpdate",
718
716
  value: function componentDidUpdate(_, prevState) {
719
- var _getEditorFeatureFlag2, _this$props$options0, _this$props$options1;
717
+ var _this$props$options0, _this$props$options1;
720
718
  var _this$props1 = this.props,
721
719
  getNode = _this$props1.getNode,
722
720
  isMediaFullscreen = _this$props1.isMediaFullscreen,
@@ -726,11 +724,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
726
724
  options = _this$props1.options,
727
725
  isTableScalingEnabled = _this$props1.isTableScalingEnabled,
728
726
  getPos = _this$props1.getPos,
729
- getEditorFeatureFlags = _this$props1.getEditorFeatureFlags,
730
727
  allowFixedColumnWidthOption = _this$props1.allowFixedColumnWidthOption;
731
728
  var shouldScale = false;
732
729
  var shouldHandleColgroupUpdates = false;
733
- var tableWithFixedColumnWidthsOption = (fg('platform_editor_table_fixed_column_width_prop') ? allowFixedColumnWidthOption : (_getEditorFeatureFlag2 = getEditorFeatureFlags()) === null || _getEditorFeatureFlag2 === void 0 ? void 0 : _getEditorFeatureFlag2.tableWithFixedColumnWidthsOption) || false;
730
+ var tableWithFixedColumnWidthsOption = allowFixedColumnWidthOption || false;
734
731
  if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
735
732
  shouldScale = true;
736
733
  shouldHandleColgroupUpdates = true;
@@ -915,9 +912,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
915
912
  tablePos = undefined;
916
913
  }
917
914
  var isNested = isTableNested(view.state, tablePos);
918
- var _getEditorFeatureFlag3 = getEditorFeatureFlags(),
919
- _getEditorFeatureFlag4 = _getEditorFeatureFlag3.tableWithFixedColumnWidthsOption,
920
- tableWithFixedColumnWidthsOption = _getEditorFeatureFlag4 === void 0 ? false : _getEditorFeatureFlag4;
915
+ var _getEditorFeatureFlag = getEditorFeatureFlags(),
916
+ _getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
917
+ tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
921
918
  var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption || !!((_this$props$options12 = this.props.options) !== null && _this$props$options12 !== void 0 && _this$props$options12.isCommentEditor));
922
919
  return /*#__PURE__*/React.createElement(TableContainer
923
920
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -19,7 +19,6 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
19
19
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
20
20
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
21
21
  import { TableMap } from '@atlaskit/editor-tables/table-map';
22
- import { fg } from '@atlaskit/platform-feature-flags';
23
22
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
24
23
  import { pluginConfig as getPluginConfig } from '../pm-plugins/create-plugin-config';
25
24
  import { getPluginState } from '../pm-plugins/plugin-factory';
@@ -105,11 +104,11 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
105
104
  }).toDOM(this.node);
106
105
  var rendered = DOMSerializer.renderSpec(document, tableDOMStructure);
107
106
  if (rendered.dom) {
108
- var _this$reactComponentP5, _this$getEditorFeatur, _this$options, _this$options2;
107
+ var _this$reactComponentP5, _this$options, _this$options2;
109
108
  var tableElement = rendered.dom.querySelector('table');
110
109
  this.table = tableElement ? tableElement : rendered.dom;
111
110
  this.renderedDOM = rendered.dom;
112
- var allowFixedColumnWidthOption = (fg('platform_editor_table_fixed_column_width_prop') ? (_this$reactComponentP5 = this.reactComponentProps) === null || _this$reactComponentP5 === void 0 ? void 0 : _this$reactComponentP5.allowFixedColumnWidthOption : (_this$getEditorFeatur = this.getEditorFeatureFlags) === null || _this$getEditorFeatur === void 0 ? void 0 : _this$getEditorFeatur.call(this).tableWithFixedColumnWidthsOption) || false;
111
+ var allowFixedColumnWidthOption = ((_this$reactComponentP5 = this.reactComponentProps) === null || _this$reactComponentP5 === void 0 ? void 0 : _this$reactComponentP5.allowFixedColumnWidthOption) || false;
113
112
  if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled) || (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled && allowFixedColumnWidthOption && this.node.attrs.displayMode === 'fixed') {
114
113
  var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos(), this.reactComponentProps.allowTableResizing);
115
114
  if (tableInlineWidth) {
@@ -221,7 +220,6 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
221
220
  _this$reactComponentP7,
222
221
  _this3 = this,
223
222
  _this$reactComponentP8,
224
- _this$getEditorFeatur2,
225
223
  _this$options3,
226
224
  _this$options4;
227
225
  if (!this.table) {
@@ -247,7 +245,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
247
245
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
248
246
  _this3.table.setAttribute(attr, attrs[attr]);
249
247
  });
250
- var isTableFixedColumnWidthsOptionEnabled = (fg('platform_editor_table_fixed_column_width_prop') ? (_this$reactComponentP8 = this.reactComponentProps) === null || _this$reactComponentP8 === void 0 ? void 0 : _this$reactComponentP8.allowFixedColumnWidthOption : (_this$getEditorFeatur2 = this.getEditorFeatureFlags) === null || _this$getEditorFeatur2 === void 0 ? void 0 : _this$getEditorFeatur2.call(this).tableWithFixedColumnWidthsOption) || false;
248
+ var isTableFixedColumnWidthsOptionEnabled = ((_this$reactComponentP8 = this.reactComponentProps) === null || _this$reactComponentP8 === void 0 ? void 0 : _this$reactComponentP8.allowFixedColumnWidthOption) || false;
251
249
  // Preserve Table Width cannot have inline width set on the table
252
250
  if (!((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.isTableScalingEnabled) || (_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.isTableScalingEnabled && isTableFixedColumnWidthsOptionEnabled && node.attrs.displayMode === 'fixed') {
253
251
  var _tableWidthPluginKey$;
@@ -371,7 +369,7 @@ export var createTableView = function createTableView(node, view, getPos, portal
371
369
  allowControls = _getPluginConfig.allowControls,
372
370
  allowTableResizing = _getPluginConfig.allowTableResizing,
373
371
  allowTableAlignment = _getPluginConfig.allowTableAlignment;
374
- var isTableFixedColumnWidthsOptionEnabled = (fg('platform_editor_table_fixed_column_width_prop') ? allowFixedColumnWidthOption : getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().tableWithFixedColumnWidthsOption) || false;
372
+ var isTableFixedColumnWidthsOptionEnabled = allowFixedColumnWidthOption || false;
375
373
  var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
376
374
  return new TableView({
377
375
  node: node,
@@ -63,7 +63,7 @@ var TABLE_WIDTH_INFO_TIMEOUT = 10000;
63
63
  * from `@atlaskit/editor-core`.
64
64
  */
65
65
  var tablePlugin = function tablePlugin(_ref) {
66
- var _config$tableOptions, _api$analytics, _options$getEditorFea, _options$getEditorFea2;
66
+ var _config$tableOptions, _api$analytics, _options$getEditorFea;
67
67
  var config = _ref.config,
68
68
  api = _ref.api;
69
69
  var editorViewRef = {
@@ -80,12 +80,12 @@ var tablePlugin = function tablePlugin(_ref) {
80
80
  };
81
81
  };
82
82
  var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
83
- var isTableFixedColumnWidthsOptionEnabled = fg('platform_editor_table_fixed_column_width_prop') ? options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption : (options === null || options === void 0 || (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableWithFixedColumnWidthsOption) || false;
83
+ var isTableFixedColumnWidthsOptionEnabled = options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption;
84
84
  var shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && (isTableFixedColumnWidthsOptionEnabled || ( // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
85
85
  options === null || options === void 0 ? void 0 : options.isCommentEditor));
86
86
  var isTableSelectorEnabled =
87
87
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
88
- !(options !== null && options !== void 0 && options.isChromelessEditor) && !(options !== null && options !== void 0 && options.isCommentEditor) && (options === null || options === void 0 || (_options$getEditorFea2 = options.getEditorFeatureFlags) === null || _options$getEditorFea2 === void 0 ? void 0 : _options$getEditorFea2.call(options).tableSelector) && editorExperiment('platform_editor_controls', 'variant1');
88
+ !(options !== null && options !== void 0 && options.isChromelessEditor) && !(options !== null && options !== void 0 && options.isCommentEditor) && (options === null || options === void 0 || (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableSelector) && editorExperiment('platform_editor_controls', 'variant1');
89
89
  if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
90
90
  var _api$uiControlRegistr;
91
91
  api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register(getTableMenuComponents({
@@ -235,14 +235,11 @@ var tablePlugin = function tablePlugin(_ref) {
235
235
  }
236
236
  },
237
237
  nodes: function nodes() {
238
- var _options$tableOptions2, _options$getEditorFea3;
238
+ var _options$tableOptions2;
239
239
  var _pluginConfig = pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions),
240
240
  allowColumnResizing = _pluginConfig.allowColumnResizing;
241
241
  // TODO: ED-25901 - We need to move this into a plugin config option so we don't accidentally enable nested nodes in Jira
242
242
  var isNestingSupported = Boolean(options === null || options === void 0 || (_options$tableOptions2 = options.tableOptions) === null || _options$tableOptions2 === void 0 ? void 0 : _options$tableOptions2.allowNestedTables);
243
- var isTableFixedColumnWidthsOptionEnabled = (fg('platform_editor_table_fixed_column_width_prop') ? options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption : options === null || options === void 0 || (_options$getEditorFea3 = options.getEditorFeatureFlags) === null || _options$getEditorFea3 === void 0 ? void 0 : _options$getEditorFea3.call(options).tableWithFixedColumnWidthsOption) || false;
244
- var shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && (isTableFixedColumnWidthsOptionEnabled || ( // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
245
- options === null || options === void 0 ? void 0 : options.isCommentEditor));
246
243
  var isTableScalingEnabled = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled;
247
244
  var isCommentEditor = options === null || options === void 0 ? void 0 : options.isCommentEditor;
248
245
  var isChromelessEditor = options === null || options === void 0 ? void 0 : options.isChromelessEditor;
@@ -309,7 +306,7 @@ var tablePlugin = function tablePlugin(_ref) {
309
306
  isCommentEditor = _ref3.isCommentEditor,
310
307
  isChromelessEditor = _ref3.isChromelessEditor,
311
308
  __livePage = _ref3.__livePage;
312
- return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption, __livePage);
309
+ return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, isTableFixedColumnWidthsOptionEnabled, __livePage);
313
310
  }
314
311
  }, {
315
312
  name: 'tablePMColResizing',
@@ -7,17 +7,12 @@ import { Fragment, useCallback } from 'react';
7
7
  /* eslint-disable @typescript-eslint/consistent-type-imports, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic */
8
8
  import { jsx } from '@emotion/react';
9
9
  import { getBrowserInfo } from '@atlaskit/editor-common/browser';
10
- import { findTable } from '@atlaskit/editor-tables/utils';
11
- import { fg } from '@atlaskit/platform-feature-flags';
12
10
  import { hoverCell, hoverRows, selectRow, selectRows } from '../../pm-plugins/commands';
13
- import { isTableNested } from '../../pm-plugins/utils/nodes';
14
11
  import { TableCssClassName as ClassName } from '../../types';
15
- import { DragCornerControlsWithSelection } from './CornerControls/DragCornerControls';
16
12
  import NumberColumn from './NumberColumn';
17
13
  import { DragControlsWithSelection } from './RowControls/DragControls';
18
14
  // Row controls
19
15
  export var TableFloatingControls = function TableFloatingControls(_ref) {
20
- var _findTable;
21
16
  var editorView = _ref.editorView,
22
17
  tableRef = _ref.tableRef,
23
18
  tableNode = _ref.tableNode,
@@ -79,11 +74,6 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
79
74
  }
80
75
  var stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
81
76
  var wrapperClassName = isDragAndDropEnabled ? isChromelessEditor ? ClassName.DRAG_ROW_CONTROLS_WRAPPER + ' ' + ClassName.TABLE_CHROMELESS : ClassName.DRAG_ROW_CONTROLS_WRAPPER : ClassName.ROW_CONTROLS_WRAPPER;
82
- var tablePos = (_findTable = findTable(editorView.state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos;
83
- // Ignored via go/ees005
84
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
85
- var isNested = tablePos !== undefined && isTableNested(editorView.state, tablePos);
86
- var shouldShowCornerControls = isNested && !fg('platform_editor_nested_dnd_styles_changes');
87
77
  return jsx("div", {
88
78
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
89
79
  className: wrapperClassName
@@ -105,13 +95,7 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
105
95
  updateCellHoverLocation: updateCellHoverLocation,
106
96
  stickyTop: stickyTop,
107
97
  isDragAndDropEnabled: isDragAndDropEnabled
108
- }) : null, tableActive && jsx(Fragment, null, shouldShowCornerControls && jsx(DragCornerControlsWithSelection, {
109
- editorView: editorView,
110
- tableRef: tableRef,
111
- isInDanger: isInDanger,
112
- isResizing: isResizing,
113
- api: api
114
- }), jsx(DragControlsWithSelection, {
98
+ }) : null, tableActive && jsx(Fragment, null, jsx(DragControlsWithSelection, {
115
99
  tableRef: tableRef,
116
100
  tableNode: tableNode,
117
101
  hoveredCell: hoveredCell,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "25.0.0",
3
+ "version": "25.0.2",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,7 +29,7 @@
29
29
  "@atlaskit/editor-plugin-batch-attribute-updates": "^13.0.0",
30
30
  "@atlaskit/editor-plugin-content-insertion": "^13.0.0",
31
31
  "@atlaskit/editor-plugin-editor-viewmode": "^15.0.0",
32
- "@atlaskit/editor-plugin-extension": "16.0.0",
32
+ "@atlaskit/editor-plugin-extension": "16.0.1",
33
33
  "@atlaskit/editor-plugin-guideline": "^13.0.0",
34
34
  "@atlaskit/editor-plugin-interaction": "^24.0.0",
35
35
  "@atlaskit/editor-plugin-limited-mode": "^10.0.0",
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.0.0",
54
54
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^2.0.0",
55
55
  "@atlaskit/primitives": "^22.2.0",
56
- "@atlaskit/tmp-editor-statsig": "^138.0.0",
56
+ "@atlaskit/tmp-editor-statsig": "^138.1.0",
57
57
  "@atlaskit/toggle": "^17.1.0",
58
58
  "@atlaskit/tokens": "^16.3.0",
59
59
  "@atlaskit/tooltip": "^24.0.0",
@@ -107,9 +107,6 @@
107
107
  "platform_editor_paste_full_table_inside_empty_cell": {
108
108
  "type": "boolean"
109
109
  },
110
- "platform_editor_nested_dnd_styles_changes": {
111
- "type": "boolean"
112
- },
113
110
  "platform_editor_tables_table_selector": {
114
111
  "type": "boolean"
115
112
  },
@@ -137,9 +134,6 @@
137
134
  "platform_editor_enable_table_scaling": {
138
135
  "type": "boolean"
139
136
  },
140
- "platform_editor_table_fixed_column_width_prop": {
141
- "type": "boolean"
142
- },
143
137
  "platform_editor_table_nested_renderer_fix": {
144
138
  "type": "boolean"
145
139
  },
@@ -1,118 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.DragCornerControlsWithSelection = exports.DragCornerControls = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _classnames = _interopRequireDefault(require("classnames"));
11
- var _reactIntl = require("react-intl");
12
- var _hooks = require("@atlaskit/editor-common/hooks");
13
- var _messages = require("@atlaskit/editor-common/messages");
14
- var _utils = require("@atlaskit/editor-tables/utils");
15
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
16
- var _commands = require("../../../pm-plugins/commands");
17
- var _types = require("../../../types");
18
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
19
- var DragCornerControlsComponent = function DragCornerControlsComponent(_ref) {
20
- var editorView = _ref.editorView,
21
- isInDanger = _ref.isInDanger,
22
- isResizing = _ref.isResizing,
23
- formatMessage = _ref.intl.formatMessage;
24
- var handleOnClick = function handleOnClick() {
25
- var state = editorView.state,
26
- dispatch = editorView.dispatch;
27
- dispatch((0, _utils.selectTable)(state.tr).setMeta('addToHistory', false));
28
- };
29
- var handleMouseOut = function handleMouseOut() {
30
- var state = editorView.state,
31
- dispatch = editorView.dispatch;
32
- (0, _commands.clearHoverSelection)()(state, dispatch);
33
- };
34
- var isActive = (0, _react.useMemo)(function () {
35
- var selection = editorView.state.selection;
36
- var table = (0, _utils.findTable)(selection);
37
- if (!table) {
38
- return false;
39
- }
40
- return (0, _utils.isTableSelected)(selection);
41
- }, [editorView.state]);
42
- if (isResizing) {
43
- return null;
44
- }
45
- return /*#__PURE__*/_react.default.createElement("button", {
46
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
47
- className: (0, _classnames.default)(_types.TableCssClassName.DRAG_CORNER_BUTTON, {
48
- active: isActive,
49
- danger: isActive && isInDanger
50
- }),
51
- "aria-label": formatMessage(_messages.tableMessages.cornerControl),
52
- type: "button",
53
- onClick: handleOnClick,
54
- onMouseOut: handleMouseOut,
55
- onBlur: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? handleMouseOut : undefined,
56
- contentEditable: false
57
- }, /*#__PURE__*/_react.default.createElement("div", {
58
- className: _types.TableCssClassName.DRAG_CORNER_BUTTON_INNER
59
- }));
60
- };
61
- var DragCornerControlsComponentWithSelection = function DragCornerControlsComponentWithSelection(_ref2) {
62
- var editorView = _ref2.editorView,
63
- isInDanger = _ref2.isInDanger,
64
- isResizing = _ref2.isResizing,
65
- formatMessage = _ref2.intl.formatMessage,
66
- api = _ref2.api;
67
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['selection'], function (states) {
68
- var _states$selectionStat;
69
- return {
70
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
71
- };
72
- }),
73
- selection = _useSharedPluginState.selection;
74
- var handleOnClick = function handleOnClick() {
75
- var state = editorView.state,
76
- dispatch = editorView.dispatch;
77
- dispatch((0, _utils.selectTable)(state.tr).setMeta('addToHistory', false));
78
- };
79
- var handleMouseOut = function handleMouseOut() {
80
- var state = editorView.state,
81
- dispatch = editorView.dispatch;
82
- (0, _commands.clearHoverSelection)()(state, dispatch);
83
- };
84
- var isActive = (0, _react.useMemo)(function () {
85
- if (!selection) {
86
- return;
87
- }
88
- var table = (0, _utils.findTable)(selection);
89
- if (!table) {
90
- return false;
91
- }
92
- return (0, _utils.isTableSelected)(selection);
93
- }, [selection]);
94
- if (isResizing) {
95
- return null;
96
- }
97
- return /*#__PURE__*/_react.default.createElement("button", {
98
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
99
- className: (0, _classnames.default)(_types.TableCssClassName.DRAG_CORNER_BUTTON, {
100
- active: isActive,
101
- danger: isActive && isInDanger
102
- }),
103
- "aria-label": formatMessage(_messages.tableMessages.cornerControl),
104
- type: "button",
105
- onClick: handleOnClick,
106
- onMouseOut: handleMouseOut,
107
- onBlur: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? handleMouseOut : undefined,
108
- contentEditable: false
109
- }, /*#__PURE__*/_react.default.createElement("div", {
110
- className: _types.TableCssClassName.DRAG_CORNER_BUTTON_INNER
111
- }));
112
- };
113
-
114
- // eslint-disable-next-line @typescript-eslint/ban-types
115
- var DragCornerControlsWithSelection = exports.DragCornerControlsWithSelection = (0, _reactIntl.injectIntl)(DragCornerControlsComponentWithSelection);
116
-
117
- // eslint-disable-next-line @typescript-eslint/ban-types
118
- var DragCornerControls = exports.DragCornerControls = (0, _reactIntl.injectIntl)(DragCornerControlsComponent);
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1,126 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import classnames from 'classnames';
3
- import { injectIntl } from 'react-intl';
4
- import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
- import { tableMessages as messages } from '@atlaskit/editor-common/messages';
6
- import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
7
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
- import { clearHoverSelection } from '../../../pm-plugins/commands';
9
- import { TableCssClassName as ClassName } from '../../../types';
10
- const DragCornerControlsComponent = ({
11
- editorView,
12
- isInDanger,
13
- isResizing,
14
- intl: {
15
- formatMessage
16
- }
17
- }) => {
18
- const handleOnClick = () => {
19
- const {
20
- state,
21
- dispatch
22
- } = editorView;
23
- dispatch(selectTable(state.tr).setMeta('addToHistory', false));
24
- };
25
- const handleMouseOut = () => {
26
- const {
27
- state,
28
- dispatch
29
- } = editorView;
30
- clearHoverSelection()(state, dispatch);
31
- };
32
- const isActive = useMemo(() => {
33
- const {
34
- selection
35
- } = editorView.state;
36
- const table = findTable(selection);
37
- if (!table) {
38
- return false;
39
- }
40
- return isTableSelected(selection);
41
- }, [editorView.state]);
42
- if (isResizing) {
43
- return null;
44
- }
45
- return /*#__PURE__*/React.createElement("button", {
46
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
47
- className: classnames(ClassName.DRAG_CORNER_BUTTON, {
48
- active: isActive,
49
- danger: isActive && isInDanger
50
- }),
51
- "aria-label": formatMessage(messages.cornerControl),
52
- type: "button",
53
- onClick: handleOnClick,
54
- onMouseOut: handleMouseOut,
55
- onBlur: expValEquals('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? handleMouseOut : undefined,
56
- contentEditable: false
57
- }, /*#__PURE__*/React.createElement("div", {
58
- className: ClassName.DRAG_CORNER_BUTTON_INNER
59
- }));
60
- };
61
- const DragCornerControlsComponentWithSelection = ({
62
- editorView,
63
- isInDanger,
64
- isResizing,
65
- intl: {
66
- formatMessage
67
- },
68
- api
69
- }) => {
70
- const {
71
- selection
72
- } = useSharedPluginStateWithSelector(api, ['selection'], states => {
73
- var _states$selectionStat;
74
- return {
75
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
76
- };
77
- });
78
- const handleOnClick = () => {
79
- const {
80
- state,
81
- dispatch
82
- } = editorView;
83
- dispatch(selectTable(state.tr).setMeta('addToHistory', false));
84
- };
85
- const handleMouseOut = () => {
86
- const {
87
- state,
88
- dispatch
89
- } = editorView;
90
- clearHoverSelection()(state, dispatch);
91
- };
92
- const isActive = useMemo(() => {
93
- if (!selection) {
94
- return;
95
- }
96
- const table = findTable(selection);
97
- if (!table) {
98
- return false;
99
- }
100
- return isTableSelected(selection);
101
- }, [selection]);
102
- if (isResizing) {
103
- return null;
104
- }
105
- return /*#__PURE__*/React.createElement("button", {
106
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
107
- className: classnames(ClassName.DRAG_CORNER_BUTTON, {
108
- active: isActive,
109
- danger: isActive && isInDanger
110
- }),
111
- "aria-label": formatMessage(messages.cornerControl),
112
- type: "button",
113
- onClick: handleOnClick,
114
- onMouseOut: handleMouseOut,
115
- onBlur: expValEquals('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? handleMouseOut : undefined,
116
- contentEditable: false
117
- }, /*#__PURE__*/React.createElement("div", {
118
- className: ClassName.DRAG_CORNER_BUTTON_INNER
119
- }));
120
- };
121
-
122
- // eslint-disable-next-line @typescript-eslint/ban-types
123
- export const DragCornerControlsWithSelection = injectIntl(DragCornerControlsComponentWithSelection);
124
-
125
- // eslint-disable-next-line @typescript-eslint/ban-types
126
- export const DragCornerControls = injectIntl(DragCornerControlsComponent);
@@ -1,109 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import classnames from 'classnames';
3
- import { injectIntl } from 'react-intl';
4
- import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
- import { tableMessages as messages } from '@atlaskit/editor-common/messages';
6
- import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
7
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
- import { clearHoverSelection } from '../../../pm-plugins/commands';
9
- import { TableCssClassName as ClassName } from '../../../types';
10
- var DragCornerControlsComponent = function DragCornerControlsComponent(_ref) {
11
- var editorView = _ref.editorView,
12
- isInDanger = _ref.isInDanger,
13
- isResizing = _ref.isResizing,
14
- formatMessage = _ref.intl.formatMessage;
15
- var handleOnClick = function handleOnClick() {
16
- var state = editorView.state,
17
- dispatch = editorView.dispatch;
18
- dispatch(selectTable(state.tr).setMeta('addToHistory', false));
19
- };
20
- var handleMouseOut = function handleMouseOut() {
21
- var state = editorView.state,
22
- dispatch = editorView.dispatch;
23
- clearHoverSelection()(state, dispatch);
24
- };
25
- var isActive = useMemo(function () {
26
- var selection = editorView.state.selection;
27
- var table = findTable(selection);
28
- if (!table) {
29
- return false;
30
- }
31
- return isTableSelected(selection);
32
- }, [editorView.state]);
33
- if (isResizing) {
34
- return null;
35
- }
36
- return /*#__PURE__*/React.createElement("button", {
37
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
38
- className: classnames(ClassName.DRAG_CORNER_BUTTON, {
39
- active: isActive,
40
- danger: isActive && isInDanger
41
- }),
42
- "aria-label": formatMessage(messages.cornerControl),
43
- type: "button",
44
- onClick: handleOnClick,
45
- onMouseOut: handleMouseOut,
46
- onBlur: expValEquals('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? handleMouseOut : undefined,
47
- contentEditable: false
48
- }, /*#__PURE__*/React.createElement("div", {
49
- className: ClassName.DRAG_CORNER_BUTTON_INNER
50
- }));
51
- };
52
- var DragCornerControlsComponentWithSelection = function DragCornerControlsComponentWithSelection(_ref2) {
53
- var editorView = _ref2.editorView,
54
- isInDanger = _ref2.isInDanger,
55
- isResizing = _ref2.isResizing,
56
- formatMessage = _ref2.intl.formatMessage,
57
- api = _ref2.api;
58
- var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
59
- var _states$selectionStat;
60
- return {
61
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
62
- };
63
- }),
64
- selection = _useSharedPluginState.selection;
65
- var handleOnClick = function handleOnClick() {
66
- var state = editorView.state,
67
- dispatch = editorView.dispatch;
68
- dispatch(selectTable(state.tr).setMeta('addToHistory', false));
69
- };
70
- var handleMouseOut = function handleMouseOut() {
71
- var state = editorView.state,
72
- dispatch = editorView.dispatch;
73
- clearHoverSelection()(state, dispatch);
74
- };
75
- var isActive = useMemo(function () {
76
- if (!selection) {
77
- return;
78
- }
79
- var table = findTable(selection);
80
- if (!table) {
81
- return false;
82
- }
83
- return isTableSelected(selection);
84
- }, [selection]);
85
- if (isResizing) {
86
- return null;
87
- }
88
- return /*#__PURE__*/React.createElement("button", {
89
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
90
- className: classnames(ClassName.DRAG_CORNER_BUTTON, {
91
- active: isActive,
92
- danger: isActive && isInDanger
93
- }),
94
- "aria-label": formatMessage(messages.cornerControl),
95
- type: "button",
96
- onClick: handleOnClick,
97
- onMouseOut: handleMouseOut,
98
- onBlur: expValEquals('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? handleMouseOut : undefined,
99
- contentEditable: false
100
- }, /*#__PURE__*/React.createElement("div", {
101
- className: ClassName.DRAG_CORNER_BUTTON_INNER
102
- }));
103
- };
104
-
105
- // eslint-disable-next-line @typescript-eslint/ban-types
106
- export var DragCornerControlsWithSelection = injectIntl(DragCornerControlsComponentWithSelection);
107
-
108
- // eslint-disable-next-line @typescript-eslint/ban-types
109
- export var DragCornerControls = injectIntl(DragCornerControlsComponent);
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import type { WithIntlProps, WrappedComponentProps } from 'react-intl';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { TablePlugin } from '../../../tablePluginType';
5
- import type { CornerControlProps } from './types';
6
- export declare const DragCornerControlsWithSelection: React.FC<WithIntlProps<CornerControlProps & WrappedComponentProps & {
7
- api?: ExtractInjectionAPI<TablePlugin>;
8
- }>> & {
9
- WrappedComponent: React.ComponentType<CornerControlProps & WrappedComponentProps & {
10
- api?: ExtractInjectionAPI<TablePlugin>;
11
- }>;
12
- };
13
- export declare const DragCornerControls: React.FC<WithIntlProps<CornerControlProps & WrappedComponentProps>> & {
14
- WrappedComponent: React.ComponentType<CornerControlProps & WrappedComponentProps>;
15
- };
@@ -1,11 +0,0 @@
1
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- export type CornerControlProps = {
3
- editorView: EditorView;
4
- hoveredRows?: number[];
5
- isHeaderColumnEnabled?: boolean;
6
- isHeaderRowEnabled?: boolean;
7
- isInDanger?: boolean;
8
- isResizing?: boolean;
9
- stickyTop?: number;
10
- tableRef?: HTMLTableElement;
11
- };