@atlaskit/editor-plugin-table 7.21.2 → 7.21.3
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 +7 -0
- package/dist/cjs/commands/insert.js +6 -3
- package/dist/cjs/nodeviews/TableComponent.js +9 -8
- package/dist/cjs/nodeviews/TableContainer.js +9 -6
- package/dist/cjs/nodeviews/lazy-node-views.js +4 -3
- package/dist/cjs/nodeviews/table.js +8 -3
- package/dist/cjs/plugin.js +16 -7
- package/dist/cjs/pm-plugins/keymap.js +3 -1
- package/dist/cjs/pm-plugins/main.js +3 -2
- package/dist/cjs/utils/create.js +6 -1
- package/dist/es2019/commands/insert.js +6 -3
- package/dist/es2019/nodeviews/TableComponent.js +10 -9
- package/dist/es2019/nodeviews/TableContainer.js +9 -6
- package/dist/es2019/nodeviews/lazy-node-views.js +4 -3
- package/dist/es2019/nodeviews/table.js +8 -3
- package/dist/es2019/plugin.js +14 -7
- package/dist/es2019/pm-plugins/keymap.js +2 -2
- package/dist/es2019/pm-plugins/main.js +3 -2
- package/dist/es2019/utils/create.js +6 -1
- package/dist/esm/commands/insert.js +6 -3
- package/dist/esm/nodeviews/TableComponent.js +10 -9
- package/dist/esm/nodeviews/TableContainer.js +9 -6
- package/dist/esm/nodeviews/lazy-node-views.js +4 -3
- package/dist/esm/nodeviews/table.js +8 -3
- package/dist/esm/plugin.js +16 -7
- package/dist/esm/pm-plugins/keymap.js +3 -1
- package/dist/esm/pm-plugins/main.js +3 -2
- package/dist/esm/utils/create.js +6 -1
- package/dist/types/commands/insert.d.ts +2 -2
- package/dist/types/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types/nodeviews/lazy-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/plugin.d.ts +1 -0
- package/dist/types/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/utils/create.d.ts +3 -1
- package/dist/types-ts4.5/commands/insert.d.ts +2 -2
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types-ts4.5/nodeviews/lazy-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/plugin.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/utils/create.d.ts +3 -1
- package/package.json +1 -1
- package/src/commands/insert.ts +6 -0
- package/src/nodeviews/TableComponent.tsx +9 -8
- package/src/nodeviews/TableContainer.tsx +15 -3
- package/src/nodeviews/lazy-node-views.ts +4 -0
- package/src/nodeviews/table.tsx +7 -1
- package/src/nodeviews/types.ts +1 -0
- package/src/plugin.tsx +12 -1
- package/src/pm-plugins/keymap.ts +4 -0
- package/src/pm-plugins/main.ts +2 -0
- package/src/utils/create.ts +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.21.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`3b20c735bc9ee`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3b20c735bc9ee) -
|
|
8
|
+
[ux] Insert full-width table in comment editor when table resizing is enabled.
|
|
9
|
+
|
|
3
10
|
## 7.21.2
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -150,12 +150,14 @@ var insertRow = exports.insertRow = function insertRow(row, moveCursorToTheNewRo
|
|
|
150
150
|
return true;
|
|
151
151
|
};
|
|
152
152
|
};
|
|
153
|
-
var createTable = exports.createTable = function createTable(isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI) {
|
|
153
|
+
var createTable = exports.createTable = function createTable(isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI, isCommentEditor, isTableResizingEnabled) {
|
|
154
154
|
return function (state, dispatch) {
|
|
155
155
|
var table = (0, _utils3.createTableWithWidth)({
|
|
156
156
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
157
157
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
158
|
-
isFullWidthModeEnabled: isFullWidthModeEnabled
|
|
158
|
+
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
159
|
+
isCommentEditor: isCommentEditor,
|
|
160
|
+
isTableResizingEnabled: isTableResizingEnabled
|
|
159
161
|
})(state.schema);
|
|
160
162
|
if (dispatch) {
|
|
161
163
|
var tr = (0, _utils.safeInsert)(table)(state.tr).scrollIntoView();
|
|
@@ -175,7 +177,7 @@ var createTable = exports.createTable = function createTable(isTableScalingEnabl
|
|
|
175
177
|
return true;
|
|
176
178
|
};
|
|
177
179
|
};
|
|
178
|
-
var insertTableWithSize = exports.insertTableWithSize = function insertTableWithSize(isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI) {
|
|
180
|
+
var insertTableWithSize = exports.insertTableWithSize = function insertTableWithSize(isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI, isCommentEditor) {
|
|
179
181
|
return function (rowsCount, colsCount, inputMethod) {
|
|
180
182
|
return function (_ref) {
|
|
181
183
|
var tr = _ref.tr;
|
|
@@ -183,6 +185,7 @@ var insertTableWithSize = exports.insertTableWithSize = function insertTableWith
|
|
|
183
185
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
184
186
|
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
185
187
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
188
|
+
isCommentEditor: isCommentEditor,
|
|
186
189
|
createTableProps: {
|
|
187
190
|
rowsCount: rowsCount,
|
|
188
191
|
colsCount: colsCount
|
|
@@ -355,7 +355,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
355
355
|
getNode = _this$props7.getNode,
|
|
356
356
|
getEditorFeatureFlags = _this$props7.getEditorFeatureFlags,
|
|
357
357
|
isTableScalingEnabled = _this$props7.isTableScalingEnabled;
|
|
358
|
-
if ((0, _platformFeatureFlags.
|
|
358
|
+
if ((0, _platformFeatureFlags.fg)('platform.editor.table.live-pages-sorting_4malx')) {
|
|
359
359
|
var _this$props$pluginInj;
|
|
360
360
|
var _ref = ((_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 || (_this$props$pluginInj = _this$props$pluginInj.editorViewMode) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.sharedState.currentState()) || {},
|
|
361
361
|
mode = _ref.mode;
|
|
@@ -444,7 +444,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
444
444
|
if (!(options !== null && options !== void 0 && options.isTableResizingEnabled) && allowColumnResizing) {
|
|
445
445
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
446
446
|
}
|
|
447
|
-
if ((0, _platformFeatureFlags.
|
|
447
|
+
if ((0, _platformFeatureFlags.fg)('platform.editor.table.live-pages-sorting_4malx')) {
|
|
448
448
|
var _this$table2;
|
|
449
449
|
this === null || this === void 0 || (_this$table2 = this.table) === null || _this$table2 === void 0 || _this$table2.removeEventListener('mouseenter', this.handleMouseEnter);
|
|
450
450
|
}
|
|
@@ -502,7 +502,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
502
502
|
_getEditorFeatureFlag5 = _getEditorFeatureFlag4.tableWithFixedColumnWidthsOption,
|
|
503
503
|
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag5 === void 0 ? false : _getEditorFeatureFlag5;
|
|
504
504
|
var isTableScalingWithFixedColumnWidthsOptionEnabled = ((_this$props$options = this.props.options) === null || _this$props$options === void 0 ? void 0 : _this$props$options.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
|
|
505
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && (0, _platformFeatureFlags.
|
|
505
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && (0, _platformFeatureFlags.fg)('platform.editor.table.use-increased-scaling-percent') || false;
|
|
506
506
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
507
507
|
var _this$props$options2;
|
|
508
508
|
var resizeState = (0, _utils4.getResizeState)({
|
|
@@ -550,7 +550,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
550
550
|
getEditorFeatureFlags = _this$props10.getEditorFeatureFlags;
|
|
551
551
|
var isInDanger = this.props.isInDanger;
|
|
552
552
|
var table = (0, _utils2.findTable)(view.state.selection);
|
|
553
|
-
if (!(0, _platformFeatureFlags.
|
|
553
|
+
if (!(0, _platformFeatureFlags.fg)('platform.editor.table.use-shared-state-hook')) {
|
|
554
554
|
var pluginState = (0, _pluginFactory.getPluginState)(view.state);
|
|
555
555
|
isInDanger = pluginState.isInDanger;
|
|
556
556
|
}
|
|
@@ -564,7 +564,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
564
564
|
shouldHandleColgroupUpdates = true;
|
|
565
565
|
}
|
|
566
566
|
var isTableScalingWithFixedColumnWidthsOptionEnabled = isTableScalingEnabled && tableWithFixedColumnWidthsOption;
|
|
567
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && (0, _platformFeatureFlags.
|
|
567
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && (0, _platformFeatureFlags.fg)('platform.editor.table.use-increased-scaling-percent');
|
|
568
568
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled && getNode().attrs.displayMode !== 'fixed') {
|
|
569
569
|
shouldScale = true;
|
|
570
570
|
shouldHandleColgroupUpdates = true;
|
|
@@ -688,7 +688,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
688
688
|
showBeforeShadow = _this$state3.showBeforeShadow,
|
|
689
689
|
showAfterShadow = _this$state3.showAfterShadow;
|
|
690
690
|
var node = getNode();
|
|
691
|
-
if (!(0, _platformFeatureFlags.
|
|
691
|
+
if (!(0, _platformFeatureFlags.fg)('platform.editor.table.use-shared-state-hook')) {
|
|
692
692
|
var pluginState = (0, _pluginFactory.getPluginState)(view.state);
|
|
693
693
|
isInDanger = pluginState.isInDanger;
|
|
694
694
|
hoveredRows = pluginState.hoveredRows;
|
|
@@ -775,7 +775,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
775
775
|
stickyScrollbar = _getEditorFeatureFlag8.stickyScrollbar,
|
|
776
776
|
_getEditorFeatureFlag9 = _getEditorFeatureFlag8.tableWithFixedColumnWidthsOption,
|
|
777
777
|
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag9 === void 0 ? false : _getEditorFeatureFlag9;
|
|
778
|
-
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && (0, _platformFeatureFlags.
|
|
778
|
+
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && (0, _platformFeatureFlags.fg)('platform.editor.table.use-increased-scaling-percent');
|
|
779
779
|
return /*#__PURE__*/_react.default.createElement(_TableContainer.TableContainer
|
|
780
780
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
781
781
|
, {
|
|
@@ -794,7 +794,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
794
794
|
isTableWithFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
795
795
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
796
796
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
797
|
-
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
|
|
797
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
798
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
|
|
798
799
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
799
800
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
800
801
|
className: _types.TableCssClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
@@ -128,7 +128,8 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
128
128
|
isTableScalingEnabled = _ref4.isTableScalingEnabled,
|
|
129
129
|
isTableWithFixedColumnWidthsOptionEnabled = _ref4.isTableWithFixedColumnWidthsOptionEnabled,
|
|
130
130
|
isTableAlignmentEnabled = _ref4.isTableAlignmentEnabled,
|
|
131
|
-
shouldUseIncreasedScalingPercent = _ref4.shouldUseIncreasedScalingPercent
|
|
131
|
+
shouldUseIncreasedScalingPercent = _ref4.shouldUseIncreasedScalingPercent,
|
|
132
|
+
isCommentEditor = _ref4.isCommentEditor;
|
|
132
133
|
var containerRef = (0, _react.useRef)(null);
|
|
133
134
|
var tableWidthRef = (0, _react.useRef)(_editorSharedStyles.akEditorDefaultLayoutWidth);
|
|
134
135
|
var _useState = (0, _react.useState)(false),
|
|
@@ -211,13 +212,13 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
211
212
|
// containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
|
|
212
213
|
// a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
|
|
213
214
|
// padding left = padding right = akEditorGutterPadding = 32
|
|
214
|
-
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2 : containerWidth - (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2 - resizeHandleSpacing;
|
|
215
|
+
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2 : containerWidth - (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2 - (isCommentEditor ? 0 : resizeHandleSpacing);
|
|
215
216
|
}
|
|
216
|
-
var width = Math.min(tableWidth, responsiveContainerWidth);
|
|
217
|
+
var width = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
217
218
|
if (!isResizing) {
|
|
218
219
|
tableWidthRef.current = width;
|
|
219
220
|
}
|
|
220
|
-
var maxResizerWidth = Math.min(responsiveContainerWidth, _utils.TABLE_MAX_WIDTH);
|
|
221
|
+
var maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, _utils.TABLE_MAX_WIDTH);
|
|
221
222
|
var tableResizerProps = {
|
|
222
223
|
width: width,
|
|
223
224
|
maxWidth: maxResizerWidth,
|
|
@@ -292,7 +293,8 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref6) {
|
|
|
292
293
|
isTableScalingEnabled = _ref6.isTableScalingEnabled,
|
|
293
294
|
isTableWithFixedColumnWidthsOptionEnabled = _ref6.isTableWithFixedColumnWidthsOptionEnabled,
|
|
294
295
|
isTableAlignmentEnabled = _ref6.isTableAlignmentEnabled,
|
|
295
|
-
shouldUseIncreasedScalingPercent = _ref6.shouldUseIncreasedScalingPercent
|
|
296
|
+
shouldUseIncreasedScalingPercent = _ref6.shouldUseIncreasedScalingPercent,
|
|
297
|
+
isCommentEditor = _ref6.isCommentEditor;
|
|
296
298
|
if (isTableResizingEnabled && !isNested) {
|
|
297
299
|
return /*#__PURE__*/_react.default.createElement(ResizableTableContainer
|
|
298
300
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -311,7 +313,8 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref6) {
|
|
|
311
313
|
isTableWithFixedColumnWidthsOptionEnabled: isTableWithFixedColumnWidthsOptionEnabled,
|
|
312
314
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
313
315
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
314
|
-
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
|
|
316
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
317
|
+
isCommentEditor: isCommentEditor
|
|
315
318
|
}, children);
|
|
316
319
|
}
|
|
317
320
|
return /*#__PURE__*/_react.default.createElement(InnerContainer, {
|
|
@@ -16,7 +16,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
16
16
|
var lazyTableView = exports.lazyTableView = function lazyTableView(options) {
|
|
17
17
|
if (!(0, _platformFeatureFlags.fg)('platform_editor_lazy-node-views')) {
|
|
18
18
|
return function (node, view, getPos) {
|
|
19
|
-
return (0, _table.createTableView)(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isTableAlignmentEnabled);
|
|
19
|
+
return (0, _table.createTableView)(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isTableAlignmentEnabled, options.isCommentEditor);
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
var loader = function loader() {
|
|
@@ -33,8 +33,9 @@ var lazyTableView = exports.lazyTableView = function lazyTableView(options) {
|
|
|
33
33
|
getEditorFeatureFlags = _getNodeViewOptions.getEditorFeatureFlags,
|
|
34
34
|
dispatchAnalyticsEvent = _getNodeViewOptions.dispatchAnalyticsEvent,
|
|
35
35
|
pluginInjectionApi = _getNodeViewOptions.pluginInjectionApi,
|
|
36
|
-
isTableAlignmentEnabled = _getNodeViewOptions.isTableAlignmentEnabled
|
|
37
|
-
|
|
36
|
+
isTableAlignmentEnabled = _getNodeViewOptions.isTableAlignmentEnabled,
|
|
37
|
+
isCommentEditor = _getNodeViewOptions.isCommentEditor;
|
|
38
|
+
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled, isCommentEditor);
|
|
38
39
|
};
|
|
39
40
|
});
|
|
40
41
|
return result;
|
|
@@ -41,11 +41,15 @@ var tableAttributes = function tableAttributes(node) {
|
|
|
41
41
|
'data-layout': node.attrs.layout,
|
|
42
42
|
'data-autosize': node.attrs.__autoSize,
|
|
43
43
|
'data-table-local-id': node.attrs.localId || '',
|
|
44
|
-
'data-table-width': node.attrs.width,
|
|
44
|
+
'data-table-width': node.attrs.width || 'inherit',
|
|
45
45
|
'data-table-display-mode': node.attrs.displayMode
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
48
|
var getInlineWidth = function getInlineWidth(node, options, state, pos) {
|
|
49
|
+
if (!node.attrs.width && options !== null && options !== void 0 && options.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
49
53
|
// provide a width for tables when custom table width is supported
|
|
50
54
|
// this is to ensure 'responsive' tables (colgroup widths are undefined) become fixed to
|
|
51
55
|
// support screen size adjustments
|
|
@@ -286,7 +290,7 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
286
290
|
}]);
|
|
287
291
|
return TableView;
|
|
288
292
|
}(_reactNodeView.default);
|
|
289
|
-
var createTableView = exports.createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled) {
|
|
293
|
+
var createTableView = exports.createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled, isCommentEditor) {
|
|
290
294
|
var _getPluginState2 = (0, _pluginFactory.getPluginState)(view.state),
|
|
291
295
|
pluginConfig = _getPluginState2.pluginConfig,
|
|
292
296
|
isFullWidthModeEnabled = _getPluginState2.isFullWidthModeEnabled,
|
|
@@ -312,7 +316,8 @@ var createTableView = exports.createTableView = function createTableView(node, v
|
|
|
312
316
|
isDragAndDropEnabled: isDragAndDropEnabled,
|
|
313
317
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
314
318
|
// same as options.isTableScalingEnabled
|
|
315
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled
|
|
319
|
+
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
320
|
+
isCommentEditor: isCommentEditor
|
|
316
321
|
},
|
|
317
322
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
318
323
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -148,7 +148,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
148
148
|
var node = (0, _utils2.createTableWithWidth)({
|
|
149
149
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
150
150
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
|
|
151
|
-
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled
|
|
151
|
+
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
|
|
152
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
153
|
+
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
|
|
152
154
|
})(state.schema);
|
|
153
155
|
return (_api$contentInsertion = api === null || api === void 0 || (_api$contentInsertion2 = api.contentInsertion) === null || _api$contentInsertion2 === void 0 || (_api$contentInsertion2 = _api$contentInsertion2.actions) === null || _api$contentInsertion2 === void 0 ? void 0 : _api$contentInsertion2.insert({
|
|
154
156
|
state: state,
|
|
@@ -201,8 +203,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
201
203
|
getEditorFeatureFlags = _ref3.getEditorFeatureFlags,
|
|
202
204
|
dragAndDropEnabled = _ref3.dragAndDropEnabled,
|
|
203
205
|
isTableScalingEnabled = _ref3.isTableScalingEnabled,
|
|
204
|
-
isTableAlignmentEnabled = _ref3.isTableAlignmentEnabled
|
|
205
|
-
|
|
206
|
+
isTableAlignmentEnabled = _ref3.isTableAlignmentEnabled,
|
|
207
|
+
isCommentEditor = _ref3.isCommentEditor;
|
|
208
|
+
return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor);
|
|
206
209
|
}
|
|
207
210
|
}, {
|
|
208
211
|
name: 'tablePMColResizing',
|
|
@@ -240,8 +243,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
240
243
|
_ref7$isTableAlignmen = _ref7.isTableAlignmentEnabled,
|
|
241
244
|
isTableAlignmentEnabled = _ref7$isTableAlignmen === void 0 ? false : _ref7$isTableAlignmen,
|
|
242
245
|
_ref7$fullWidthEnable = _ref7.fullWidthEnabled,
|
|
243
|
-
fullWidthEnabled = _ref7$fullWidthEnable === void 0 ? false : _ref7$fullWidthEnable
|
|
244
|
-
|
|
246
|
+
fullWidthEnabled = _ref7$fullWidthEnable === void 0 ? false : _ref7$fullWidthEnable,
|
|
247
|
+
_ref7$isCommentEditor = _ref7.isCommentEditor,
|
|
248
|
+
isCommentEditor = _ref7$isCommentEditor === void 0 ? false : _ref7$isCommentEditor,
|
|
249
|
+
_ref7$tableResizingEn = _ref7.tableResizingEnabled,
|
|
250
|
+
tableResizingEnabled = _ref7$tableResizingEn === void 0 ? false : _ref7$tableResizingEn;
|
|
251
|
+
return (0, _keymap.keymapPlugin)(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, tableResizingEnabled);
|
|
245
252
|
}
|
|
246
253
|
}, {
|
|
247
254
|
name: 'tableSelectionKeymap',
|
|
@@ -303,7 +310,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
303
310
|
var _options$fullWidthEna, _options$isTableScali, _options$isTableAlign;
|
|
304
311
|
var dispatchAnalyticsEvent = _ref14.dispatchAnalyticsEvent,
|
|
305
312
|
dispatch = _ref14.dispatch;
|
|
306
|
-
return options !== null && options !== void 0 && options.tableResizingEnabled ? (0, _tableWidth.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$isTableAlign = options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled) !== null && _options$isTableAlign !== void 0 ? _options$isTableAlign : false) : undefined;
|
|
313
|
+
return options !== null && options !== void 0 && options.tableResizingEnabled && !(options !== null && options !== void 0 && options.isCommentEditor) ? (0, _tableWidth.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$isTableAlign = options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled) !== null && _options$isTableAlign !== void 0 ? _options$isTableAlign : false) : undefined;
|
|
307
314
|
}
|
|
308
315
|
},
|
|
309
316
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
@@ -498,7 +505,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
498
505
|
var tableNode = (0, _utils2.createTableWithWidth)({
|
|
499
506
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
500
507
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
|
|
501
|
-
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled
|
|
508
|
+
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
509
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
510
|
+
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
|
|
502
511
|
})(state.schema);
|
|
503
512
|
var tr = insert(tableNode);
|
|
504
513
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
@@ -25,11 +25,13 @@ function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEn
|
|
|
25
25
|
var isCellBackgroundDuplicated = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
26
26
|
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
27
27
|
var shouldUseIncreasedScalingPercent = arguments.length > 10 ? arguments[10] : undefined;
|
|
28
|
+
var isCommentEditor = arguments.length > 11 ? arguments[11] : undefined;
|
|
29
|
+
var isTableResizingEnabled = arguments.length > 12 ? arguments[12] : undefined;
|
|
28
30
|
var list = {};
|
|
29
31
|
var ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
30
32
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.nextCell.common, (0, _commands2.goToNextCell)(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
|
|
31
33
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.previousCell.common, (0, _commands2.goToNextCell)(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(-1), list);
|
|
32
|
-
(0, _keymaps.bindKeymapWithCommand)(_keymaps.toggleTable.common, (0, _insert.createTable)(isTableScalingEnabled, isTableAlignmentEnabled, !!isFullWidthEnabled, editorAnalyticsAPI), list);
|
|
34
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.toggleTable.common, (0, _insert.createTable)(isTableScalingEnabled, isTableAlignmentEnabled, !!isFullWidthEnabled, editorAnalyticsAPI, isCommentEditor, isTableResizingEnabled), list);
|
|
33
35
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.backspace.common, (0, _commands.chainCommands)((0, _commandsWithAnalytics.deleteTableIfSelectedWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD), (0, _commandsWithAnalytics.emptyMultipleCellsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD)), list);
|
|
34
36
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.backspace.common, _commands2.moveCursorBackward, list);
|
|
35
37
|
|
|
@@ -30,7 +30,7 @@ var _pluginFactory = require("./plugin-factory");
|
|
|
30
30
|
var _pluginKey = require("./plugin-key");
|
|
31
31
|
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; }
|
|
32
32
|
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; }
|
|
33
|
-
var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent) {
|
|
33
|
+
var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor) {
|
|
34
34
|
var _accessibilityUtils;
|
|
35
35
|
var state = (0, _pluginFactory.createPluginState)(dispatch, _objectSpread(_objectSpread(_objectSpread({
|
|
36
36
|
pluginConfig: pluginConfig,
|
|
@@ -263,7 +263,8 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
263
263
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
264
264
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
265
265
|
pluginInjectionApi: pluginInjectionApi,
|
|
266
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled
|
|
266
|
+
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
267
|
+
isCommentEditor: isCommentEditor
|
|
267
268
|
}),
|
|
268
269
|
tableRow: (0, _lazyNodeViews.lazyTableRowView)({
|
|
269
270
|
eventDispatcher: eventDispatcher
|
package/dist/cjs/utils/create.js
CHANGED
|
@@ -14,15 +14,20 @@ var createTableWithWidth = exports.createTableWithWidth = function createTableWi
|
|
|
14
14
|
var isTableScalingEnabled = _ref.isTableScalingEnabled,
|
|
15
15
|
isTableAlignmentEnabled = _ref.isTableAlignmentEnabled,
|
|
16
16
|
isFullWidthModeEnabled = _ref.isFullWidthModeEnabled,
|
|
17
|
+
isCommentEditor = _ref.isCommentEditor,
|
|
18
|
+
isTableResizingEnabled = _ref.isTableResizingEnabled,
|
|
17
19
|
createTableProps = _ref.createTableProps;
|
|
18
20
|
return function (schema) {
|
|
19
21
|
var attrsOverrides = {};
|
|
20
|
-
if (isTableScalingEnabled && isFullWidthModeEnabled) {
|
|
22
|
+
if (isTableScalingEnabled && isFullWidthModeEnabled && !isCommentEditor) {
|
|
21
23
|
attrsOverrides.tableWidth = _utils2.TABLE_MAX_WIDTH;
|
|
22
24
|
}
|
|
23
25
|
if (isTableAlignmentEnabled && isFullWidthModeEnabled) {
|
|
24
26
|
attrsOverrides.layout = 'align-start';
|
|
25
27
|
}
|
|
28
|
+
if (isCommentEditor && isTableResizingEnabled) {
|
|
29
|
+
attrsOverrides.tableWidth = 'inherit';
|
|
30
|
+
}
|
|
26
31
|
return (0, _utils.createTable)(_objectSpread(_objectSpread({
|
|
27
32
|
schema: schema
|
|
28
33
|
}, createTableProps), attrsOverrides));
|
|
@@ -119,11 +119,13 @@ export const insertRow = (row, moveCursorToTheNewRow, isCellBackgroundDuplicated
|
|
|
119
119
|
}
|
|
120
120
|
return true;
|
|
121
121
|
};
|
|
122
|
-
export const createTable = (isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI) => (state, dispatch) => {
|
|
122
|
+
export const createTable = (isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI, isCommentEditor, isTableResizingEnabled) => (state, dispatch) => {
|
|
123
123
|
const table = createTableWithWidth({
|
|
124
124
|
isTableScalingEnabled,
|
|
125
125
|
isTableAlignmentEnabled,
|
|
126
|
-
isFullWidthModeEnabled
|
|
126
|
+
isFullWidthModeEnabled,
|
|
127
|
+
isCommentEditor,
|
|
128
|
+
isTableResizingEnabled
|
|
127
129
|
})(state.schema);
|
|
128
130
|
if (dispatch) {
|
|
129
131
|
const tr = safeInsert(table)(state.tr).scrollIntoView();
|
|
@@ -142,7 +144,7 @@ export const createTable = (isTableScalingEnabled, isTableAlignmentEnabled, isFu
|
|
|
142
144
|
}
|
|
143
145
|
return true;
|
|
144
146
|
};
|
|
145
|
-
export const insertTableWithSize = (isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI) => (rowsCount, colsCount, inputMethod) => {
|
|
147
|
+
export const insertTableWithSize = (isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI, isCommentEditor) => (rowsCount, colsCount, inputMethod) => {
|
|
146
148
|
return ({
|
|
147
149
|
tr
|
|
148
150
|
}) => {
|
|
@@ -150,6 +152,7 @@ export const insertTableWithSize = (isFullWidthModeEnabled, isTableScalingEnable
|
|
|
150
152
|
isTableScalingEnabled,
|
|
151
153
|
isFullWidthModeEnabled,
|
|
152
154
|
isTableAlignmentEnabled,
|
|
155
|
+
isCommentEditor,
|
|
153
156
|
createTableProps: {
|
|
154
157
|
rowsCount: rowsCount,
|
|
155
158
|
colsCount: colsCount
|
|
@@ -11,7 +11,7 @@ import { tableMarginSides } from '@atlaskit/editor-common/styles';
|
|
|
11
11
|
import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
|
|
12
12
|
import { akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
|
|
13
13
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
14
|
-
import {
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
16
16
|
import { autoSizeTable, clearHoverSelection } from '../commands';
|
|
17
17
|
import { autoScrollerFactory } from '../pm-plugins/drag-and-drop/utils';
|
|
@@ -338,7 +338,7 @@ class TableComponent extends React.Component {
|
|
|
338
338
|
getEditorFeatureFlags,
|
|
339
339
|
isTableScalingEnabled
|
|
340
340
|
} = this.props;
|
|
341
|
-
if (
|
|
341
|
+
if (fg('platform.editor.table.live-pages-sorting_4malx')) {
|
|
342
342
|
var _this$props$pluginInj, _this$props$pluginInj2;
|
|
343
343
|
const {
|
|
344
344
|
mode
|
|
@@ -428,7 +428,7 @@ class TableComponent extends React.Component {
|
|
|
428
428
|
if (!(options !== null && options !== void 0 && options.isTableResizingEnabled) && allowColumnResizing) {
|
|
429
429
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
430
430
|
}
|
|
431
|
-
if (
|
|
431
|
+
if (fg('platform.editor.table.live-pages-sorting_4malx')) {
|
|
432
432
|
var _this$table2;
|
|
433
433
|
this === null || this === void 0 ? void 0 : (_this$table2 = this.table) === null || _this$table2 === void 0 ? void 0 : _this$table2.removeEventListener('mouseenter', this.handleMouseEnter);
|
|
434
434
|
}
|
|
@@ -485,7 +485,7 @@ class TableComponent extends React.Component {
|
|
|
485
485
|
tableWithFixedColumnWidthsOption = false
|
|
486
486
|
} = getEditorFeatureFlags();
|
|
487
487
|
const isTableScalingWithFixedColumnWidthsOptionEnabled = ((_this$props$options = this.props.options) === null || _this$props$options === void 0 ? void 0 : _this$props$options.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
|
|
488
|
-
const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
488
|
+
const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') || false;
|
|
489
489
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
490
490
|
var _this$props$options2;
|
|
491
491
|
const resizeState = getResizeState({
|
|
@@ -534,7 +534,7 @@ class TableComponent extends React.Component {
|
|
|
534
534
|
isInDanger
|
|
535
535
|
} = this.props;
|
|
536
536
|
const table = findTable(view.state.selection);
|
|
537
|
-
if (!
|
|
537
|
+
if (!fg('platform.editor.table.use-shared-state-hook')) {
|
|
538
538
|
const pluginState = getPluginState(view.state);
|
|
539
539
|
isInDanger = pluginState.isInDanger;
|
|
540
540
|
}
|
|
@@ -548,7 +548,7 @@ class TableComponent extends React.Component {
|
|
|
548
548
|
shouldHandleColgroupUpdates = true;
|
|
549
549
|
}
|
|
550
550
|
const isTableScalingWithFixedColumnWidthsOptionEnabled = isTableScalingEnabled && tableWithFixedColumnWidthsOption;
|
|
551
|
-
const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
551
|
+
const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent');
|
|
552
552
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled && getNode().attrs.displayMode !== 'fixed') {
|
|
553
553
|
shouldScale = true;
|
|
554
554
|
shouldHandleColgroupUpdates = true;
|
|
@@ -674,7 +674,7 @@ class TableComponent extends React.Component {
|
|
|
674
674
|
showAfterShadow
|
|
675
675
|
} = this.state;
|
|
676
676
|
const node = getNode();
|
|
677
|
-
if (!
|
|
677
|
+
if (!fg('platform.editor.table.use-shared-state-hook')) {
|
|
678
678
|
const pluginState = getPluginState(view.state);
|
|
679
679
|
isInDanger = pluginState.isInDanger;
|
|
680
680
|
hoveredRows = pluginState.hoveredRows;
|
|
@@ -759,7 +759,7 @@ class TableComponent extends React.Component {
|
|
|
759
759
|
stickyScrollbar,
|
|
760
760
|
tableWithFixedColumnWidthsOption = false
|
|
761
761
|
} = getEditorFeatureFlags();
|
|
762
|
-
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption &&
|
|
762
|
+
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && fg('platform.editor.table.use-increased-scaling-percent');
|
|
763
763
|
return /*#__PURE__*/React.createElement(TableContainer
|
|
764
764
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
765
765
|
, {
|
|
@@ -783,7 +783,8 @@ class TableComponent extends React.Component {
|
|
|
783
783
|
isTableWithFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
784
784
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
785
785
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
786
|
-
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
|
|
786
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
787
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
|
|
787
788
|
}, /*#__PURE__*/React.createElement("div", {
|
|
788
789
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
789
790
|
className: ClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
@@ -125,7 +125,8 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
125
125
|
isTableScalingEnabled,
|
|
126
126
|
isTableWithFixedColumnWidthsOptionEnabled,
|
|
127
127
|
isTableAlignmentEnabled,
|
|
128
|
-
shouldUseIncreasedScalingPercent
|
|
128
|
+
shouldUseIncreasedScalingPercent,
|
|
129
|
+
isCommentEditor
|
|
129
130
|
}) => {
|
|
130
131
|
const containerRef = useRef(null);
|
|
131
132
|
const tableWidthRef = useRef(akEditorDefaultLayoutWidth);
|
|
@@ -209,13 +210,13 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
209
210
|
// containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
|
|
210
211
|
// a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
|
|
211
212
|
// padding left = padding right = akEditorGutterPadding = 32
|
|
212
|
-
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - akEditorGutterPaddingDynamic() * 2 : containerWidth - akEditorGutterPaddingDynamic() * 2 - resizeHandleSpacing;
|
|
213
|
+
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - akEditorGutterPaddingDynamic() * 2 : containerWidth - akEditorGutterPaddingDynamic() * 2 - (isCommentEditor ? 0 : resizeHandleSpacing);
|
|
213
214
|
}
|
|
214
|
-
let width = Math.min(tableWidth, responsiveContainerWidth);
|
|
215
|
+
let width = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
215
216
|
if (!isResizing) {
|
|
216
217
|
tableWidthRef.current = width;
|
|
217
218
|
}
|
|
218
|
-
const maxResizerWidth = Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
|
|
219
|
+
const maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
|
|
219
220
|
const tableResizerProps = {
|
|
220
221
|
width,
|
|
221
222
|
maxWidth: maxResizerWidth,
|
|
@@ -291,7 +292,8 @@ export const TableContainer = ({
|
|
|
291
292
|
isTableScalingEnabled,
|
|
292
293
|
isTableWithFixedColumnWidthsOptionEnabled,
|
|
293
294
|
isTableAlignmentEnabled,
|
|
294
|
-
shouldUseIncreasedScalingPercent
|
|
295
|
+
shouldUseIncreasedScalingPercent,
|
|
296
|
+
isCommentEditor
|
|
295
297
|
}) => {
|
|
296
298
|
if (isTableResizingEnabled && !isNested) {
|
|
297
299
|
return /*#__PURE__*/React.createElement(ResizableTableContainer
|
|
@@ -311,7 +313,8 @@ export const TableContainer = ({
|
|
|
311
313
|
isTableWithFixedColumnWidthsOptionEnabled: isTableWithFixedColumnWidthsOptionEnabled,
|
|
312
314
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
313
315
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
314
|
-
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
|
|
316
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
317
|
+
isCommentEditor: isCommentEditor
|
|
315
318
|
}, children);
|
|
316
319
|
}
|
|
317
320
|
return /*#__PURE__*/React.createElement(InnerContainer, {
|
|
@@ -7,7 +7,7 @@ import TableRow from './TableRow';
|
|
|
7
7
|
export const lazyTableView = options => {
|
|
8
8
|
if (!fg('platform_editor_lazy-node-views')) {
|
|
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.isTableAlignmentEnabled);
|
|
10
|
+
return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isTableAlignmentEnabled, options.isCommentEditor);
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
const loader = () => {
|
|
@@ -23,9 +23,10 @@ export const lazyTableView = options => {
|
|
|
23
23
|
getEditorFeatureFlags,
|
|
24
24
|
dispatchAnalyticsEvent,
|
|
25
25
|
pluginInjectionApi,
|
|
26
|
-
isTableAlignmentEnabled
|
|
26
|
+
isTableAlignmentEnabled,
|
|
27
|
+
isCommentEditor
|
|
27
28
|
} = getNodeViewOptions();
|
|
28
|
-
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled);
|
|
29
|
+
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled, isCommentEditor);
|
|
29
30
|
};
|
|
30
31
|
});
|
|
31
32
|
return result;
|
|
@@ -23,11 +23,15 @@ const tableAttributes = node => {
|
|
|
23
23
|
'data-layout': node.attrs.layout,
|
|
24
24
|
'data-autosize': node.attrs.__autoSize,
|
|
25
25
|
'data-table-local-id': node.attrs.localId || '',
|
|
26
|
-
'data-table-width': node.attrs.width,
|
|
26
|
+
'data-table-width': node.attrs.width || 'inherit',
|
|
27
27
|
'data-table-display-mode': node.attrs.displayMode
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
const getInlineWidth = (node, options, state, pos) => {
|
|
31
|
+
if (!node.attrs.width && options !== null && options !== void 0 && options.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
31
35
|
// provide a width for tables when custom table width is supported
|
|
32
36
|
// this is to ensure 'responsive' tables (colgroup widths are undefined) become fixed to
|
|
33
37
|
// support screen size adjustments
|
|
@@ -251,7 +255,7 @@ export default class TableView extends ReactNodeView {
|
|
|
251
255
|
super.destroy();
|
|
252
256
|
}
|
|
253
257
|
}
|
|
254
|
-
export const createTableView = (node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled) => {
|
|
258
|
+
export const createTableView = (node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled, isCommentEditor) => {
|
|
255
259
|
const {
|
|
256
260
|
pluginConfig,
|
|
257
261
|
isFullWidthModeEnabled,
|
|
@@ -279,7 +283,8 @@ export const createTableView = (node, view, getPos, portalProviderAPI, eventDisp
|
|
|
279
283
|
isDragAndDropEnabled,
|
|
280
284
|
isTableScalingEnabled,
|
|
281
285
|
// same as options.isTableScalingEnabled
|
|
282
|
-
isTableAlignmentEnabled
|
|
286
|
+
isTableAlignmentEnabled,
|
|
287
|
+
isCommentEditor
|
|
283
288
|
},
|
|
284
289
|
getEditorContainerWidth,
|
|
285
290
|
getEditorFeatureFlags,
|