@atlaskit/editor-plugin-table 17.0.1 → 17.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/nodeviews/TableComponent.js +45 -47
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +3 -1
- package/dist/cjs/nodeviews/TableContainer.js +4 -4
- package/dist/cjs/nodeviews/TableResizer.js +3 -3
- package/dist/cjs/nodeviews/table-node-views.js +1 -1
- package/dist/cjs/nodeviews/table.js +15 -10
- package/dist/cjs/pm-plugins/main.js +3 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +2 -2
- package/dist/cjs/tablePlugin.js +3 -3
- package/dist/es2019/nodeviews/TableComponent.js +8 -10
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +3 -1
- package/dist/es2019/nodeviews/TableContainer.js +4 -4
- package/dist/es2019/nodeviews/TableResizer.js +3 -3
- package/dist/es2019/nodeviews/table-node-views.js +1 -1
- package/dist/es2019/nodeviews/table.js +13 -9
- package/dist/es2019/pm-plugins/main.js +3 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +2 -2
- package/dist/es2019/tablePlugin.js +3 -3
- package/dist/esm/nodeviews/TableComponent.js +45 -47
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +3 -1
- package/dist/esm/nodeviews/TableContainer.js +4 -4
- package/dist/esm/nodeviews/TableResizer.js +3 -3
- package/dist/esm/nodeviews/table-node-views.js +1 -1
- package/dist/esm/nodeviews/table.js +15 -10
- package/dist/esm/pm-plugins/main.js +3 -2
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +2 -2
- package/dist/esm/tablePlugin.js +3 -3
- package/dist/types/nodeviews/TableComponent.d.ts +1 -0
- package/dist/types/nodeviews/TableComponentWithSharedState.d.ts +2 -1
- package/dist/types/nodeviews/TableContainer.d.ts +4 -4
- package/dist/types/nodeviews/TableResizer.d.ts +2 -2
- package/dist/types/nodeviews/table-node-views.d.ts +1 -0
- package/dist/types/nodeviews/table.d.ts +1 -1
- package/dist/types/nodeviews/types.d.ts +1 -0
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
- package/dist/types/tablePluginType.d.ts +6 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/TableComponentWithSharedState.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -4
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -2
- package/dist/types-ts4.5/nodeviews/table-node-views.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/types.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
- package/dist/types-ts4.5/tablePluginType.d.ts +6 -0
- package/dist/types-ts4.5/types/index.d.ts +1 -0
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 17.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`a218bead9e6a7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a218bead9e6a7) -
|
|
8
|
+
EDITOR-4542 Make isTableWithFixedColumnWidthsOptionEnabled an editor prop instead of using FG
|
|
9
|
+
value
|
|
10
|
+
|
|
3
11
|
## 17.0.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -24,6 +24,7 @@ var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
|
24
24
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
25
25
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
26
26
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
27
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
27
28
|
var _combine = require("@atlaskit/pragmatic-drag-and-drop/combine");
|
|
28
29
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
29
30
|
var _commands = require("../pm-plugins/commands");
|
|
@@ -607,7 +608,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
607
608
|
var isFullWidthModeAndLineLengthChanged = this.updateColGroupFromFullWidthChange && isLineLengthChanged;
|
|
608
609
|
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged || this.state.windowResized;
|
|
609
610
|
if (force || maybeScale || isFullWidthModeAndLineLengthChanged) {
|
|
610
|
-
var _this$containerWidth2, _this$props$options3, _this$props$options4, _this$props$options5;
|
|
611
|
+
var _this$containerWidth2, _this$props0, _getEditorFeatureFlag, _this$props$options3, _this$props$options4, _this$props$options5;
|
|
611
612
|
var isWidthChanged = ((_this$containerWidth2 = this.containerWidth) === null || _this$containerWidth2 === void 0 ? void 0 : _this$containerWidth2.width) !== containerWidthValue;
|
|
612
613
|
var wasTableResized = (0, _colgroup.hasTableBeenResized)(this.node);
|
|
613
614
|
var isTableResized = (0, _colgroup.hasTableBeenResized)(tableNode);
|
|
@@ -625,9 +626,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
625
626
|
isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged,
|
|
626
627
|
isTableResized: isTableResized
|
|
627
628
|
});
|
|
628
|
-
var _getEditorFeatureFlag = getEditorFeatureFlags()
|
|
629
|
-
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
|
|
630
|
-
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
|
|
629
|
+
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;
|
|
631
630
|
var isTableScalingWithFixedColumnWidthsOptionEnabled = !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
|
|
632
631
|
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);
|
|
633
632
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
@@ -692,22 +691,21 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
692
691
|
}, {
|
|
693
692
|
key: "componentDidUpdate",
|
|
694
693
|
value: function componentDidUpdate(_, prevState) {
|
|
695
|
-
var _this$props$options0, _this$props$options1;
|
|
696
|
-
var _this$
|
|
697
|
-
getNode = _this$
|
|
698
|
-
isMediaFullscreen = _this$
|
|
699
|
-
allowColumnResizing = _this$
|
|
700
|
-
allowTableResizing = _this$
|
|
701
|
-
isResizing = _this$
|
|
702
|
-
options = _this$
|
|
703
|
-
isTableScalingEnabled = _this$
|
|
704
|
-
getPos = _this$
|
|
705
|
-
getEditorFeatureFlags = _this$
|
|
694
|
+
var _getEditorFeatureFlag2, _this$props$options0, _this$props$options1;
|
|
695
|
+
var _this$props1 = this.props,
|
|
696
|
+
getNode = _this$props1.getNode,
|
|
697
|
+
isMediaFullscreen = _this$props1.isMediaFullscreen,
|
|
698
|
+
allowColumnResizing = _this$props1.allowColumnResizing,
|
|
699
|
+
allowTableResizing = _this$props1.allowTableResizing,
|
|
700
|
+
isResizing = _this$props1.isResizing,
|
|
701
|
+
options = _this$props1.options,
|
|
702
|
+
isTableScalingEnabled = _this$props1.isTableScalingEnabled,
|
|
703
|
+
getPos = _this$props1.getPos,
|
|
704
|
+
getEditorFeatureFlags = _this$props1.getEditorFeatureFlags,
|
|
705
|
+
allowFixedColumnWidthOption = _this$props1.allowFixedColumnWidthOption;
|
|
706
706
|
var shouldScale = false;
|
|
707
707
|
var shouldHandleColgroupUpdates = false;
|
|
708
|
-
var
|
|
709
|
-
_getEditorFeatureFlag4 = _getEditorFeatureFlag3.tableWithFixedColumnWidthsOption,
|
|
710
|
-
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag4 === void 0 ? false : _getEditorFeatureFlag4;
|
|
708
|
+
var tableWithFixedColumnWidthsOption = ((0, _platformFeatureFlags.fg)('platform_editor_table_fixed_column_width_prop') ? allowFixedColumnWidthOption : (_getEditorFeatureFlag2 = getEditorFeatureFlags()) === null || _getEditorFeatureFlag2 === void 0 ? void 0 : _getEditorFeatureFlag2.tableWithFixedColumnWidthsOption) || false;
|
|
711
709
|
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
712
710
|
shouldScale = true;
|
|
713
711
|
shouldHandleColgroupUpdates = true;
|
|
@@ -770,31 +768,31 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
770
768
|
value: function render() {
|
|
771
769
|
var _this5 = this,
|
|
772
770
|
_this$props$options10;
|
|
773
|
-
var _this$
|
|
774
|
-
view = _this$
|
|
775
|
-
getNode = _this$
|
|
776
|
-
isResizing = _this$
|
|
777
|
-
_this$
|
|
778
|
-
allowControls = _this$
|
|
779
|
-
isHeaderRowEnabled = _this$
|
|
780
|
-
ordering = _this$
|
|
781
|
-
isHeaderColumnEnabled = _this$
|
|
782
|
-
tableActive = _this$
|
|
783
|
-
containerWidth = _this$
|
|
784
|
-
options = _this$
|
|
785
|
-
getPos = _this$
|
|
786
|
-
pluginInjectionApi = _this$
|
|
787
|
-
isDragAndDropEnabled = _this$
|
|
788
|
-
getEditorFeatureFlags = _this$
|
|
789
|
-
isTableScalingEnabled = _this$
|
|
790
|
-
allowTableResizing = _this$
|
|
791
|
-
allowTableAlignment = _this$
|
|
792
|
-
selection = _this$
|
|
793
|
-
isInDanger = _this$
|
|
794
|
-
hoveredRows = _this$
|
|
795
|
-
hoveredCell = _this$
|
|
796
|
-
isTableHovered = _this$
|
|
797
|
-
isWholeTableInDanger = _this$
|
|
771
|
+
var _this$props10 = this.props,
|
|
772
|
+
view = _this$props10.view,
|
|
773
|
+
getNode = _this$props10.getNode,
|
|
774
|
+
isResizing = _this$props10.isResizing,
|
|
775
|
+
_this$props10$allowCo = _this$props10.allowControls,
|
|
776
|
+
allowControls = _this$props10$allowCo === void 0 ? true : _this$props10$allowCo,
|
|
777
|
+
isHeaderRowEnabled = _this$props10.isHeaderRowEnabled,
|
|
778
|
+
ordering = _this$props10.ordering,
|
|
779
|
+
isHeaderColumnEnabled = _this$props10.isHeaderColumnEnabled,
|
|
780
|
+
tableActive = _this$props10.tableActive,
|
|
781
|
+
containerWidth = _this$props10.containerWidth,
|
|
782
|
+
options = _this$props10.options,
|
|
783
|
+
getPos = _this$props10.getPos,
|
|
784
|
+
pluginInjectionApi = _this$props10.pluginInjectionApi,
|
|
785
|
+
isDragAndDropEnabled = _this$props10.isDragAndDropEnabled,
|
|
786
|
+
getEditorFeatureFlags = _this$props10.getEditorFeatureFlags,
|
|
787
|
+
isTableScalingEnabled = _this$props10.isTableScalingEnabled,
|
|
788
|
+
allowTableResizing = _this$props10.allowTableResizing,
|
|
789
|
+
allowTableAlignment = _this$props10.allowTableAlignment,
|
|
790
|
+
selection = _this$props10.selection,
|
|
791
|
+
isInDanger = _this$props10.isInDanger,
|
|
792
|
+
hoveredRows = _this$props10.hoveredRows,
|
|
793
|
+
hoveredCell = _this$props10.hoveredCell,
|
|
794
|
+
isTableHovered = _this$props10.isTableHovered,
|
|
795
|
+
isWholeTableInDanger = _this$props10.isWholeTableInDanger;
|
|
798
796
|
var node = getNode();
|
|
799
797
|
var tableRef = this.table || undefined;
|
|
800
798
|
var headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined;
|
|
@@ -868,9 +866,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
868
866
|
tablePos = undefined;
|
|
869
867
|
}
|
|
870
868
|
var isNested = (0, _nodes.isTableNested)(view.state, tablePos);
|
|
871
|
-
var
|
|
872
|
-
|
|
873
|
-
tableWithFixedColumnWidthsOption =
|
|
869
|
+
var _getEditorFeatureFlag3 = getEditorFeatureFlags(),
|
|
870
|
+
_getEditorFeatureFlag4 = _getEditorFeatureFlag3.tableWithFixedColumnWidthsOption,
|
|
871
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag4 === void 0 ? false : _getEditorFeatureFlag4;
|
|
874
872
|
var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption || !!((_this$props$options10 = this.props.options) !== null && _this$props$options10 !== void 0 && _this$props$options10.isCommentEditor));
|
|
875
873
|
return /*#__PURE__*/_react.default.createElement(_TableContainer.TableContainer
|
|
876
874
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -890,7 +888,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
890
888
|
isTableResizingEnabled: allowTableResizing,
|
|
891
889
|
isResizing: isResizing,
|
|
892
890
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
893
|
-
|
|
891
|
+
allowFixedColumnWidthOption: tableWithFixedColumnWidthsOption,
|
|
894
892
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
895
893
|
isTableAlignmentEnabled: allowTableAlignment,
|
|
896
894
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
@@ -28,7 +28,8 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
|
|
|
28
28
|
getPos = _ref.getPos,
|
|
29
29
|
forwardRef = _ref.forwardRef,
|
|
30
30
|
allowTableAlignment = _ref.allowTableAlignment,
|
|
31
|
-
allowTableResizing = _ref.allowTableResizing
|
|
31
|
+
allowTableResizing = _ref.allowTableResizing,
|
|
32
|
+
allowFixedColumnWidthOption = _ref.allowFixedColumnWidthOption;
|
|
32
33
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['table', 'width', 'media', 'selection', 'editorViewMode', 'interaction'], function (states) {
|
|
33
34
|
var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$mediaState, _states$selectionStat, _states$editorViewMod, _states$widthState, _states$widthState2, _states$interactionSt;
|
|
34
35
|
return {
|
|
@@ -104,6 +105,7 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
|
|
|
104
105
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
105
106
|
allowTableAlignment: allowTableAlignment,
|
|
106
107
|
allowTableResizing: allowTableResizing,
|
|
108
|
+
allowFixedColumnWidthOption: allowFixedColumnWidthOption,
|
|
107
109
|
tableActive: tableActive && !isLivePageViewMode && interaction !== 'hasNotHadInteraction',
|
|
108
110
|
ordering: ordering,
|
|
109
111
|
isResizing: isResizing,
|
|
@@ -142,7 +142,7 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
142
142
|
tableWrapperHeight = _ref4.tableWrapperHeight,
|
|
143
143
|
isWholeTableInDanger = _ref4.isWholeTableInDanger,
|
|
144
144
|
isTableScalingEnabled = _ref4.isTableScalingEnabled,
|
|
145
|
-
|
|
145
|
+
allowFixedColumnWidthOption = _ref4.allowFixedColumnWidthOption,
|
|
146
146
|
isTableAlignmentEnabled = _ref4.isTableAlignmentEnabled,
|
|
147
147
|
shouldUseIncreasedScalingPercent = _ref4.shouldUseIncreasedScalingPercent,
|
|
148
148
|
isCommentEditor = _ref4.isCommentEditor,
|
|
@@ -304,7 +304,7 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
304
304
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
305
305
|
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
306
306
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
307
|
-
|
|
307
|
+
allowFixedColumnWidthOption: allowFixedColumnWidthOption,
|
|
308
308
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
309
309
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
310
310
|
pluginInjectionApi: pluginInjectionApi,
|
|
@@ -357,7 +357,7 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref5) {
|
|
|
357
357
|
isWholeTableInDanger = _ref5.isWholeTableInDanger,
|
|
358
358
|
isTableResizingEnabled = _ref5.isTableResizingEnabled,
|
|
359
359
|
isTableScalingEnabled = _ref5.isTableScalingEnabled,
|
|
360
|
-
|
|
360
|
+
allowFixedColumnWidthOption = _ref5.allowFixedColumnWidthOption,
|
|
361
361
|
isTableAlignmentEnabled = _ref5.isTableAlignmentEnabled,
|
|
362
362
|
shouldUseIncreasedScalingPercent = _ref5.shouldUseIncreasedScalingPercent,
|
|
363
363
|
isCommentEditor = _ref5.isCommentEditor,
|
|
@@ -383,7 +383,7 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref5) {
|
|
|
383
383
|
isResizing: isResizing,
|
|
384
384
|
pluginInjectionApi: pluginInjectionApi,
|
|
385
385
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
386
|
-
|
|
386
|
+
allowFixedColumnWidthOption: allowFixedColumnWidthOption,
|
|
387
387
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
388
388
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
389
389
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
@@ -137,7 +137,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
137
137
|
attachAnalyticsEvent = _ref.attachAnalyticsEvent,
|
|
138
138
|
displayGapCursor = _ref.displayGapCursor,
|
|
139
139
|
isTableScalingEnabled = _ref.isTableScalingEnabled,
|
|
140
|
-
|
|
140
|
+
allowFixedColumnWidthOption = _ref.allowFixedColumnWidthOption,
|
|
141
141
|
isTableAlignmentEnabled = _ref.isTableAlignmentEnabled,
|
|
142
142
|
isWholeTableInDanger = _ref.isWholeTableInDanger,
|
|
143
143
|
shouldUseIncreasedScalingPercent = _ref.shouldUseIncreasedScalingPercent,
|
|
@@ -315,13 +315,13 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
315
315
|
prevNode: node,
|
|
316
316
|
start: pos + 1,
|
|
317
317
|
parentWidth: previewParentWidth
|
|
318
|
-
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled,
|
|
318
|
+
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, allowFixedColumnWidthOption, isCommentEditor);
|
|
319
319
|
(0, _commands.chainCommands)(function (state, dispatch) {
|
|
320
320
|
return switchToCenterAlignment(pos, node, newWidth, state, dispatch);
|
|
321
321
|
}, (0, _misc.updateWidthToWidest)((0, _defineProperty2.default)({}, currentTableNodeLocalId, shouldUpdateWidthToWidest)))(state, dispatch);
|
|
322
322
|
updateWidth(shouldUpdateWidthToWidest ? tableMaxWidth : newWidth);
|
|
323
323
|
return newWidth;
|
|
324
|
-
}, [countFrames, isCommentEditor, isTableScalingEnabled,
|
|
324
|
+
}, [countFrames, isCommentEditor, isTableScalingEnabled, allowFixedColumnWidthOption, isFullWidthModeEnabled, excludeGuidelineConfig, tableRef, node, editorView, updateActiveGuidelines, containerWidth, lineLength, updateWidth, getPos, switchToCenterAlignment]);
|
|
325
325
|
var scheduleResize = (0, _react.useMemo)(function () {
|
|
326
326
|
return (0, _rafSchd.default)(handleResize);
|
|
327
327
|
}, [handleResize]);
|
|
@@ -15,7 +15,7 @@ var _TableRowNativeStickyWithFallback = _interopRequireDefault(require("./TableR
|
|
|
15
15
|
|
|
16
16
|
var tableView = exports.tableView = function tableView(options) {
|
|
17
17
|
return function (node, view, getPos) {
|
|
18
|
-
return (0, _table.createTableView)(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isCommentEditor, options.isChromelessEditor);
|
|
18
|
+
return (0, _table.createTableView)(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isCommentEditor, options.isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption);
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
var tableCellView = exports.tableCellView = function tableCellView(options) {
|
|
@@ -19,6 +19,7 @@ var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/rea
|
|
|
19
19
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
20
20
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
21
21
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
22
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
23
|
var _createPluginConfig = require("../pm-plugins/create-plugin-config");
|
|
23
24
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
24
25
|
var _tableWidth = require("../pm-plugins/table-width");
|
|
@@ -97,11 +98,12 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
97
98
|
}).toDOM(this.node);
|
|
98
99
|
var rendered = _model.DOMSerializer.renderSpec(document, tableDOMStructure);
|
|
99
100
|
if (rendered.dom) {
|
|
100
|
-
var _this$
|
|
101
|
+
var _this$reactComponentP5, _this$getEditorFeatur, _this$options, _this$options2;
|
|
101
102
|
var tableElement = rendered.dom.querySelector('table');
|
|
102
103
|
this.table = tableElement ? tableElement : rendered.dom;
|
|
103
104
|
this.renderedDOM = rendered.dom;
|
|
104
|
-
|
|
105
|
+
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;
|
|
106
|
+
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') {
|
|
105
107
|
var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos(), this.reactComponentProps.allowTableResizing);
|
|
106
108
|
if (tableInlineWidth) {
|
|
107
109
|
handleInlineTableWidth(this.table, tableInlineWidth);
|
|
@@ -184,9 +186,10 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
184
186
|
key: "setDomAttrs",
|
|
185
187
|
value: function setDomAttrs(node) {
|
|
186
188
|
var _this3 = this,
|
|
189
|
+
_this$reactComponentP6,
|
|
190
|
+
_this$getEditorFeatur2,
|
|
187
191
|
_this$options3,
|
|
188
|
-
_this$options4
|
|
189
|
-
_this$getEditorFeatur2;
|
|
192
|
+
_this$options4;
|
|
190
193
|
if (!this.table) {
|
|
191
194
|
return; // width / attribute application to actual table will happen later when table is set
|
|
192
195
|
}
|
|
@@ -196,9 +199,9 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
196
199
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
197
200
|
_this3.table.setAttribute(attr, attrs[attr]);
|
|
198
201
|
});
|
|
199
|
-
|
|
202
|
+
var isTableFixedColumnWidthsOptionEnabled = ((0, _platformFeatureFlags.fg)('platform_editor_table_fixed_column_width_prop') ? (_this$reactComponentP6 = this.reactComponentProps) === null || _this$reactComponentP6 === void 0 ? void 0 : _this$reactComponentP6.allowFixedColumnWidthOption : (_this$getEditorFeatur2 = this.getEditorFeatureFlags) === null || _this$getEditorFeatur2 === void 0 ? void 0 : _this$getEditorFeatur2.call(this).tableWithFixedColumnWidthsOption) || false;
|
|
200
203
|
// Preserve Table Width cannot have inline width set on the table
|
|
201
|
-
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 &&
|
|
204
|
+
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') {
|
|
202
205
|
var _tableWidthPluginKey$;
|
|
203
206
|
// handle inline style when table been resized
|
|
204
207
|
var tableInlineWidth = getInlineWidth(node, this.reactComponentProps.options, this.view.state, this.getPos(), this.reactComponentProps.allowTableResizing);
|
|
@@ -224,7 +227,8 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
224
227
|
allowControls: props.allowControls,
|
|
225
228
|
getPos: props.getPos,
|
|
226
229
|
getEditorFeatureFlags: props.getEditorFeatureFlags,
|
|
227
|
-
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent
|
|
230
|
+
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
231
|
+
allowFixedColumnWidthOption: props.allowFixedColumnWidthOption
|
|
228
232
|
});
|
|
229
233
|
}
|
|
230
234
|
}, {
|
|
@@ -289,7 +293,7 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
289
293
|
}
|
|
290
294
|
}]);
|
|
291
295
|
}(_reactNodeView.default);
|
|
292
|
-
var createTableView = exports.createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isCommentEditor, isChromelessEditor) {
|
|
296
|
+
var createTableView = exports.createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isCommentEditor, isChromelessEditor, allowFixedColumnWidthOption) {
|
|
293
297
|
var _pluginInjectionApi$t;
|
|
294
298
|
var _getPluginState2 = (0, _pluginFactory.getPluginState)(view.state),
|
|
295
299
|
pluginConfig = _getPluginState2.pluginConfig,
|
|
@@ -303,7 +307,7 @@ var createTableView = exports.createTableView = function createTableView(node, v
|
|
|
303
307
|
allowControls = _getPluginConfig.allowControls,
|
|
304
308
|
allowTableResizing = _getPluginConfig.allowTableResizing,
|
|
305
309
|
allowTableAlignment = _getPluginConfig.allowTableAlignment;
|
|
306
|
-
var isTableFixedColumnWidthsOptionEnabled = (getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().tableWithFixedColumnWidthsOption) || false;
|
|
310
|
+
var isTableFixedColumnWidthsOptionEnabled = ((0, _platformFeatureFlags.fg)('platform_editor_table_fixed_column_width_prop') ? allowFixedColumnWidthOption : getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().tableWithFixedColumnWidthsOption) || false;
|
|
307
311
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
308
312
|
return new TableView({
|
|
309
313
|
node: node,
|
|
@@ -328,6 +332,7 @@ var createTableView = exports.createTableView = function createTableView(node, v
|
|
|
328
332
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
329
333
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
330
334
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
331
|
-
pluginInjectionApi: pluginInjectionApi
|
|
335
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
336
|
+
allowFixedColumnWidthOption: allowFixedColumnWidthOption
|
|
332
337
|
}).init();
|
|
333
338
|
};
|
|
@@ -34,7 +34,7 @@ var _decoration = require("./utils/decoration");
|
|
|
34
34
|
var _paste = require("./utils/paste");
|
|
35
35
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
36
36
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
37
|
-
var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor) {
|
|
37
|
+
var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, allowFixedColumnWidthOption) {
|
|
38
38
|
var _accessibilityUtils;
|
|
39
39
|
var state = (0, _pluginFactory.createPluginState)(dispatch, _objectSpread(_objectSpread(_objectSpread({
|
|
40
40
|
pluginConfig: pluginConfig,
|
|
@@ -72,7 +72,8 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
72
72
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
73
73
|
pluginInjectionApi: pluginInjectionApi,
|
|
74
74
|
isCommentEditor: isCommentEditor,
|
|
75
|
-
isChromelessEditor: isChromelessEditor
|
|
75
|
+
isChromelessEditor: isChromelessEditor,
|
|
76
|
+
allowFixedColumnWidthOption: allowFixedColumnWidthOption
|
|
76
77
|
}),
|
|
77
78
|
tableRow: (0, _tableNodeViews.tableRowView)({
|
|
78
79
|
eventDispatcher: eventDispatcher,
|
|
@@ -112,7 +112,7 @@ function scaleTableTo(state, maxSize) {
|
|
|
112
112
|
}
|
|
113
113
|
var previewScaleTable = exports.previewScaleTable = function previewScaleTable(tableRef, options, domAtPos) {
|
|
114
114
|
var isTableScalingEnabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
115
|
-
var
|
|
115
|
+
var allowFixedColumnWidthOption = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
116
116
|
var isCommentEditor = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
117
117
|
var node = options.node,
|
|
118
118
|
start = options.start,
|
|
@@ -126,7 +126,7 @@ var previewScaleTable = exports.previewScaleTable = function previewScaleTable(t
|
|
|
126
126
|
tableRef.style.width = "".concat(width, "px");
|
|
127
127
|
}
|
|
128
128
|
var isTableScalingEnabledOnCurrentTable = isTableScalingEnabled;
|
|
129
|
-
var isTableScalingWithFixedColumnWidthsOptionEnabled = isTableScalingEnabled &&
|
|
129
|
+
var isTableScalingWithFixedColumnWidthsOptionEnabled = isTableScalingEnabled && allowFixedColumnWidthOption;
|
|
130
130
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
131
131
|
isTableScalingEnabledOnCurrentTable = isTableScalingEnabled && node.attrs.displayMode !== 'fixed';
|
|
132
132
|
}
|
package/dist/cjs/tablePlugin.js
CHANGED
|
@@ -85,7 +85,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
87
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
88
|
-
var isTableFixedColumnWidthsOptionEnabled = (options === null || options === void 0 || (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableWithFixedColumnWidthsOption) || false;
|
|
88
|
+
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;
|
|
89
89
|
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
|
|
90
90
|
options === null || options === void 0 ? void 0 : options.isCommentEditor));
|
|
91
91
|
var isTableSelectorEnabled =
|
|
@@ -227,7 +227,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
227
227
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
228
228
|
// TODO: ED-25901 - We need to move this into a plugin config option so we don't accidentally enable nested nodes in Jira
|
|
229
229
|
var isNestingSupported = Boolean(options === null || options === void 0 || (_options$tableOptions2 = options.tableOptions) === null || _options$tableOptions2 === void 0 ? void 0 : _options$tableOptions2.allowNestedTables);
|
|
230
|
-
var isTableFixedColumnWidthsOptionEnabled = (options === null || options === void 0 || (_options$getEditorFea3 = options.getEditorFeatureFlags) === null || _options$getEditorFea3 === void 0 ? void 0 : _options$getEditorFea3.call(options).tableWithFixedColumnWidthsOption) || false;
|
|
230
|
+
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;
|
|
231
231
|
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
|
|
232
232
|
options === null || options === void 0 ? void 0 : options.isCommentEditor));
|
|
233
233
|
var isTableScalingEnabled = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled;
|
|
@@ -296,7 +296,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
296
296
|
isTableScalingEnabled = _ref3.isTableScalingEnabled,
|
|
297
297
|
isCommentEditor = _ref3.isCommentEditor,
|
|
298
298
|
isChromelessEditor = _ref3.isChromelessEditor;
|
|
299
|
-
return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor);
|
|
299
|
+
return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption);
|
|
300
300
|
}
|
|
301
301
|
}, {
|
|
302
302
|
name: 'tablePMColResizing',
|
|
@@ -11,6 +11,7 @@ import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-com
|
|
|
11
11
|
import { isValidPosition } from '@atlaskit/editor-common/utils';
|
|
12
12
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
13
13
|
import { isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
15
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
15
16
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
16
17
|
import { autoSizeTable, clearHoverSelection, setTableRef } from '../pm-plugins/commands';
|
|
@@ -568,7 +569,7 @@ class TableComponent extends React.Component {
|
|
|
568
569
|
const isFullWidthModeAndLineLengthChanged = this.updateColGroupFromFullWidthChange && isLineLengthChanged;
|
|
569
570
|
const maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged || this.state.windowResized;
|
|
570
571
|
if (force || maybeScale || isFullWidthModeAndLineLengthChanged) {
|
|
571
|
-
var _this$containerWidth2, _this$props$options3, _this$props$options4, _this$props$options5;
|
|
572
|
+
var _this$containerWidth2, _this$props, _getEditorFeatureFlag, _this$props$options3, _this$props$options4, _this$props$options5;
|
|
572
573
|
const isWidthChanged = ((_this$containerWidth2 = this.containerWidth) === null || _this$containerWidth2 === void 0 ? void 0 : _this$containerWidth2.width) !== containerWidthValue;
|
|
573
574
|
const wasTableResized = hasTableBeenResized(this.node);
|
|
574
575
|
const isTableResized = hasTableBeenResized(tableNode);
|
|
@@ -586,9 +587,7 @@ class TableComponent extends React.Component {
|
|
|
586
587
|
isFullWidthModeAndLineLengthChanged,
|
|
587
588
|
isTableResized
|
|
588
589
|
});
|
|
589
|
-
const
|
|
590
|
-
tableWithFixedColumnWidthsOption = false
|
|
591
|
-
} = getEditorFeatureFlags();
|
|
590
|
+
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;
|
|
592
591
|
const isTableScalingWithFixedColumnWidthsOptionEnabled = !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
|
|
593
592
|
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);
|
|
594
593
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
@@ -651,7 +650,7 @@ class TableComponent extends React.Component {
|
|
|
651
650
|
// Ignored via go/ees005
|
|
652
651
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
653
652
|
componentDidUpdate(_, prevState) {
|
|
654
|
-
var _this$props$options10, _this$props$options11;
|
|
653
|
+
var _getEditorFeatureFlag2, _this$props$options10, _this$props$options11;
|
|
655
654
|
const {
|
|
656
655
|
getNode,
|
|
657
656
|
isMediaFullscreen,
|
|
@@ -662,13 +661,12 @@ class TableComponent extends React.Component {
|
|
|
662
661
|
isTableScalingEnabled,
|
|
663
662
|
// we could use options.isTableScalingEnabled here
|
|
664
663
|
getPos,
|
|
665
|
-
getEditorFeatureFlags
|
|
664
|
+
getEditorFeatureFlags,
|
|
665
|
+
allowFixedColumnWidthOption
|
|
666
666
|
} = this.props;
|
|
667
667
|
let shouldScale = false;
|
|
668
668
|
let shouldHandleColgroupUpdates = false;
|
|
669
|
-
const
|
|
670
|
-
tableWithFixedColumnWidthsOption = false
|
|
671
|
-
} = getEditorFeatureFlags();
|
|
669
|
+
const tableWithFixedColumnWidthsOption = (fg('platform_editor_table_fixed_column_width_prop') ? allowFixedColumnWidthOption : (_getEditorFeatureFlag2 = getEditorFeatureFlags()) === null || _getEditorFeatureFlag2 === void 0 ? void 0 : _getEditorFeatureFlag2.tableWithFixedColumnWidthsOption) || false;
|
|
672
670
|
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
673
671
|
shouldScale = true;
|
|
674
672
|
shouldHandleColgroupUpdates = true;
|
|
@@ -855,7 +853,7 @@ class TableComponent extends React.Component {
|
|
|
855
853
|
isTableResizingEnabled: allowTableResizing,
|
|
856
854
|
isResizing: isResizing,
|
|
857
855
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
858
|
-
|
|
856
|
+
allowFixedColumnWidthOption: tableWithFixedColumnWidthsOption,
|
|
859
857
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
860
858
|
isTableAlignmentEnabled: allowTableAlignment,
|
|
861
859
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
@@ -22,7 +22,8 @@ export const TableComponentWithSharedState = ({
|
|
|
22
22
|
getPos,
|
|
23
23
|
forwardRef,
|
|
24
24
|
allowTableAlignment,
|
|
25
|
-
allowTableResizing
|
|
25
|
+
allowTableResizing,
|
|
26
|
+
allowFixedColumnWidthOption
|
|
26
27
|
}) => {
|
|
27
28
|
const {
|
|
28
29
|
isTableResizing,
|
|
@@ -100,6 +101,7 @@ export const TableComponentWithSharedState = ({
|
|
|
100
101
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
101
102
|
allowTableAlignment: allowTableAlignment,
|
|
102
103
|
allowTableResizing: allowTableResizing,
|
|
104
|
+
allowFixedColumnWidthOption: allowFixedColumnWidthOption,
|
|
103
105
|
tableActive: tableActive && !isLivePageViewMode && interaction !== 'hasNotHadInteraction',
|
|
104
106
|
ordering: ordering,
|
|
105
107
|
isResizing: isResizing,
|
|
@@ -136,7 +136,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
136
136
|
tableWrapperHeight,
|
|
137
137
|
isWholeTableInDanger,
|
|
138
138
|
isTableScalingEnabled,
|
|
139
|
-
|
|
139
|
+
allowFixedColumnWidthOption,
|
|
140
140
|
isTableAlignmentEnabled,
|
|
141
141
|
shouldUseIncreasedScalingPercent,
|
|
142
142
|
isCommentEditor,
|
|
@@ -298,7 +298,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
298
298
|
isTableAlignmentEnabled,
|
|
299
299
|
isFullWidthModeEnabled,
|
|
300
300
|
isTableScalingEnabled,
|
|
301
|
-
|
|
301
|
+
allowFixedColumnWidthOption,
|
|
302
302
|
isWholeTableInDanger,
|
|
303
303
|
shouldUseIncreasedScalingPercent,
|
|
304
304
|
pluginInjectionApi,
|
|
@@ -352,7 +352,7 @@ export const TableContainer = ({
|
|
|
352
352
|
isWholeTableInDanger,
|
|
353
353
|
isTableResizingEnabled,
|
|
354
354
|
isTableScalingEnabled,
|
|
355
|
-
|
|
355
|
+
allowFixedColumnWidthOption,
|
|
356
356
|
isTableAlignmentEnabled,
|
|
357
357
|
shouldUseIncreasedScalingPercent,
|
|
358
358
|
isCommentEditor,
|
|
@@ -379,7 +379,7 @@ export const TableContainer = ({
|
|
|
379
379
|
isResizing: isResizing,
|
|
380
380
|
pluginInjectionApi: pluginInjectionApi,
|
|
381
381
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
382
|
-
|
|
382
|
+
allowFixedColumnWidthOption: allowFixedColumnWidthOption,
|
|
383
383
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
384
384
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
385
385
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
@@ -123,7 +123,7 @@ export const TableResizer = ({
|
|
|
123
123
|
attachAnalyticsEvent,
|
|
124
124
|
displayGapCursor,
|
|
125
125
|
isTableScalingEnabled,
|
|
126
|
-
|
|
126
|
+
allowFixedColumnWidthOption,
|
|
127
127
|
isTableAlignmentEnabled,
|
|
128
128
|
isWholeTableInDanger,
|
|
129
129
|
shouldUseIncreasedScalingPercent,
|
|
@@ -308,7 +308,7 @@ export const TableResizer = ({
|
|
|
308
308
|
prevNode: node,
|
|
309
309
|
start: pos + 1,
|
|
310
310
|
parentWidth: previewParentWidth
|
|
311
|
-
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled,
|
|
311
|
+
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, allowFixedColumnWidthOption, isCommentEditor);
|
|
312
312
|
chainCommands((state, dispatch) => {
|
|
313
313
|
return switchToCenterAlignment(pos, node, newWidth, state, dispatch);
|
|
314
314
|
}, updateWidthToWidest({
|
|
@@ -316,7 +316,7 @@ export const TableResizer = ({
|
|
|
316
316
|
}))(state, dispatch);
|
|
317
317
|
updateWidth(shouldUpdateWidthToWidest ? tableMaxWidth : newWidth);
|
|
318
318
|
return newWidth;
|
|
319
|
-
}, [countFrames, isCommentEditor, isTableScalingEnabled,
|
|
319
|
+
}, [countFrames, isCommentEditor, isTableScalingEnabled, allowFixedColumnWidthOption, isFullWidthModeEnabled, excludeGuidelineConfig, tableRef, node, editorView, updateActiveGuidelines, containerWidth, lineLength, updateWidth, getPos, switchToCenterAlignment]);
|
|
320
320
|
const scheduleResize = useMemo(() => rafSchd(handleResize), [handleResize]);
|
|
321
321
|
const handleResizeStop = useCallback((originalState, delta) => {
|
|
322
322
|
var _node$attrs$localId2, _node$attrs2;
|
|
@@ -7,7 +7,7 @@ import TableRow from './TableRow';
|
|
|
7
7
|
import TableRowNativeStickyWithFallback from './TableRowNativeStickyWithFallback';
|
|
8
8
|
export const tableView = options => {
|
|
9
9
|
return (node, view, getPos) => {
|
|
10
|
-
return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isCommentEditor, options.isChromelessEditor);
|
|
10
|
+
return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isCommentEditor, options.isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption);
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
export const tableCellView = options => {
|