@atlaskit/editor-plugin-table 15.2.0 → 15.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/nodeviews/TableComponentLegacy.js +18 -34
- package/dist/cjs/nodeviews/TableComponentNext.js +19 -34
- package/dist/cjs/nodeviews/TableContainer.js +31 -215
- package/dist/cjs/nodeviews/TableResizer.js +3 -10
- package/dist/cjs/nodeviews/table.js +1 -2
- package/dist/cjs/nodeviews/toDOM.js +9 -27
- package/dist/cjs/pm-plugins/main.js +0 -31
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +1 -2
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +5 -8
- package/dist/cjs/ui/common-styles.js +1 -1
- package/dist/es2019/nodeviews/TableComponentLegacy.js +9 -25
- package/dist/es2019/nodeviews/TableComponentNext.js +10 -25
- package/dist/es2019/nodeviews/TableContainer.js +9 -190
- package/dist/es2019/nodeviews/TableResizer.js +3 -10
- package/dist/es2019/nodeviews/table.js +1 -2
- package/dist/es2019/nodeviews/toDOM.js +9 -28
- package/dist/es2019/pm-plugins/main.js +1 -32
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +1 -2
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +2 -5
- package/dist/es2019/ui/common-styles.js +4 -3
- package/dist/esm/nodeviews/TableComponentLegacy.js +18 -34
- package/dist/esm/nodeviews/TableComponentNext.js +19 -34
- package/dist/esm/nodeviews/TableContainer.js +31 -215
- package/dist/esm/nodeviews/TableResizer.js +3 -10
- package/dist/esm/nodeviews/table.js +1 -2
- package/dist/esm/nodeviews/toDOM.js +10 -28
- package/dist/esm/pm-plugins/main.js +1 -32
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +1 -2
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +5 -8
- package/dist/esm/ui/common-styles.js +2 -2
- package/dist/types/nodeviews/TableContainer.d.ts +1 -3
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +1 -3
- package/package.json +8 -5
|
@@ -300,7 +300,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
300
300
|
isNumberOfColumnsChanged = params.isNumberOfColumnsChanged,
|
|
301
301
|
isFullWidthModeAndLineLengthChanged = params.isFullWidthModeAndLineLengthChanged;
|
|
302
302
|
var isFullPageEditor = !((_this$props$options = _this.props.options) !== null && _this$props$options !== void 0 && _this$props$options.isCommentEditor) && !((_this$props$options2 = _this.props.options) !== null && _this$props$options2 !== void 0 && _this$props$options2.isChromelessEditor);
|
|
303
|
-
if (
|
|
303
|
+
if (isFullPageEditor) {
|
|
304
304
|
return !!isWindowResized || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
305
305
|
}
|
|
306
306
|
return isWidthChanged || isTableWidthChanged || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
@@ -382,10 +382,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
});
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}
|
|
385
|
+
|
|
386
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
387
|
+
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
389
388
|
}
|
|
390
389
|
}
|
|
391
390
|
}, {
|
|
@@ -400,9 +399,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
400
399
|
allowTableResizing = _this$props6.allowTableResizing,
|
|
401
400
|
eventDispatcher = _this$props6.eventDispatcher,
|
|
402
401
|
isDragAndDropEnabled = _this$props6.isDragAndDropEnabled,
|
|
403
|
-
getNode = _this$props6.getNode
|
|
404
|
-
getEditorFeatureFlags = _this$props6.getEditorFeatureFlags,
|
|
405
|
-
isTableScalingEnabled = _this$props6.isTableScalingEnabled;
|
|
402
|
+
getNode = _this$props6.getNode;
|
|
406
403
|
|
|
407
404
|
// Ignored via go/ees005
|
|
408
405
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -415,17 +412,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
415
412
|
// Ignored via go/ees005
|
|
416
413
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
417
414
|
this === null || this === void 0 || (_this$table3 = this.table) === null || _this$table3 === void 0 || _this$table3.addEventListener('mouseover', this.handleMouseOver);
|
|
418
|
-
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
419
|
-
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
|
|
420
|
-
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
|
|
421
|
-
if (!expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
422
|
-
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
423
|
-
this.handleColgroupUpdates(true);
|
|
424
|
-
}
|
|
425
|
-
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
426
|
-
this.handleColgroupUpdates(true);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
415
|
if (this.wrapper) {
|
|
430
416
|
this.wrapperReisizeObserver = new ResizeObserver(function (entries) {
|
|
431
417
|
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
@@ -526,10 +512,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
526
512
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
527
513
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
528
514
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
}
|
|
515
|
+
|
|
516
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
517
|
+
window.removeEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
533
518
|
|
|
534
519
|
// Ignored via go/ees005
|
|
535
520
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -616,7 +601,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
616
601
|
containerLineLength = containerWidth.lineLength;
|
|
617
602
|
var isLineLengthChanged = ((_this$containerWidth = this.containerWidth) === null || _this$containerWidth === void 0 ? void 0 : _this$containerWidth.lineLength) !== containerLineLength;
|
|
618
603
|
var isFullWidthModeAndLineLengthChanged = this.updateColGroupFromFullWidthChange && isLineLengthChanged && fg('platform_editor_table_overflow_in_full_width_fix');
|
|
619
|
-
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged ||
|
|
604
|
+
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged || this.state.windowResized;
|
|
620
605
|
if (force || maybeScale || isFullWidthModeAndLineLengthChanged) {
|
|
621
606
|
var _this$containerWidth2, _this$props$options3, _this$props$options4, _this$props$options5;
|
|
622
607
|
var isWidthChanged = ((_this$containerWidth2 = this.containerWidth) === null || _this$containerWidth2 === void 0 ? void 0 : _this$containerWidth2.width) !== containerWidthValue;
|
|
@@ -635,9 +620,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
635
620
|
isNumberOfColumnsChanged: isNumberOfColumnsChanged,
|
|
636
621
|
isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged
|
|
637
622
|
});
|
|
638
|
-
var
|
|
639
|
-
|
|
640
|
-
tableWithFixedColumnWidthsOption =
|
|
623
|
+
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
624
|
+
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
|
|
625
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
|
|
641
626
|
var isTableScalingWithFixedColumnWidthsOptionEnabled = !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
|
|
642
627
|
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);
|
|
643
628
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
@@ -718,9 +703,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
718
703
|
var table = findTable(view.state.selection);
|
|
719
704
|
var shouldScale = false;
|
|
720
705
|
var shouldHandleColgroupUpdates = false;
|
|
721
|
-
var
|
|
722
|
-
|
|
723
|
-
tableWithFixedColumnWidthsOption =
|
|
706
|
+
var _getEditorFeatureFlag3 = getEditorFeatureFlags(),
|
|
707
|
+
_getEditorFeatureFlag4 = _getEditorFeatureFlag3.tableWithFixedColumnWidthsOption,
|
|
708
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag4 === void 0 ? false : _getEditorFeatureFlag4;
|
|
724
709
|
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
725
710
|
shouldScale = true;
|
|
726
711
|
shouldHandleColgroupUpdates = true;
|
|
@@ -731,7 +716,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
731
716
|
shouldScale = true;
|
|
732
717
|
shouldHandleColgroupUpdates = true;
|
|
733
718
|
}
|
|
734
|
-
if (
|
|
719
|
+
if (this.state.windowResized) {
|
|
735
720
|
shouldHandleColgroupUpdates = true;
|
|
736
721
|
}
|
|
737
722
|
if (shouldHandleColgroupUpdates) {
|
|
@@ -889,9 +874,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
889
874
|
tablePos = undefined;
|
|
890
875
|
}
|
|
891
876
|
var isNested = isTableNested(view.state, tablePos);
|
|
892
|
-
var
|
|
893
|
-
|
|
894
|
-
tableWithFixedColumnWidthsOption =
|
|
877
|
+
var _getEditorFeatureFlag5 = getEditorFeatureFlags(),
|
|
878
|
+
_getEditorFeatureFlag6 = _getEditorFeatureFlag5.tableWithFixedColumnWidthsOption,
|
|
879
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag6 === void 0 ? false : _getEditorFeatureFlag6;
|
|
895
880
|
var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption || !!((_this$props$options10 = this.props.options) !== null && _this$props$options10 !== void 0 && _this$props$options10.isCommentEditor));
|
|
896
881
|
return /*#__PURE__*/React.createElement(TableContainer
|
|
897
882
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -7,8 +7,6 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
7
7
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
8
8
|
import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
11
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
11
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
14
12
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -75,8 +73,8 @@ var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
|
75
73
|
}, [alignment]);
|
|
76
74
|
return /*#__PURE__*/React.createElement("div", {
|
|
77
75
|
"data-testid": "table-alignment-container",
|
|
78
|
-
"data-ssr-placeholder":
|
|
79
|
-
"data-ssr-placeholder-replace":
|
|
76
|
+
"data-ssr-placeholder": "table-".concat(node.attrs.localId),
|
|
77
|
+
"data-ssr-placeholder-replace": "table-".concat(node.attrs.localId)
|
|
80
78
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
81
79
|
,
|
|
82
80
|
style: style
|
|
@@ -92,8 +90,8 @@ var AlignmentTableContainerWrapper = function AlignmentTableContainerWrapper(_re
|
|
|
92
90
|
if (!isTableAlignmentEnabled) {
|
|
93
91
|
return /*#__PURE__*/React.createElement("div", {
|
|
94
92
|
"data-testid": "table-alignment-container",
|
|
95
|
-
"data-ssr-placeholder":
|
|
96
|
-
"data-ssr-placeholder-replace":
|
|
93
|
+
"data-ssr-placeholder": "table-".concat(node.attrs.localId),
|
|
94
|
+
"data-ssr-placeholder-replace": "table-".concat(node.attrs.localId),
|
|
97
95
|
style: {
|
|
98
96
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
99
97
|
display: 'flex',
|
|
@@ -120,7 +118,7 @@ var getPadding = function getPadding(containerWidth) {
|
|
|
120
118
|
exposure: true
|
|
121
119
|
}) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
122
120
|
};
|
|
123
|
-
var
|
|
121
|
+
export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
124
122
|
var children = _ref4.children,
|
|
125
123
|
className = _ref4.className,
|
|
126
124
|
node = _ref4.node,
|
|
@@ -137,7 +135,9 @@ var ResizableTableContainerLegacy = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
137
135
|
isTableWithFixedColumnWidthsOptionEnabled = _ref4.isTableWithFixedColumnWidthsOptionEnabled,
|
|
138
136
|
isTableAlignmentEnabled = _ref4.isTableAlignmentEnabled,
|
|
139
137
|
shouldUseIncreasedScalingPercent = _ref4.shouldUseIncreasedScalingPercent,
|
|
140
|
-
isCommentEditor = _ref4.isCommentEditor
|
|
138
|
+
isCommentEditor = _ref4.isCommentEditor,
|
|
139
|
+
isChromelessEditor = _ref4.isChromelessEditor;
|
|
140
|
+
var tableWidth = getTableContainerWidth(node);
|
|
141
141
|
var containerRef = useRef(null);
|
|
142
142
|
var tableWidthRef = useRef(akEditorDefaultLayoutWidth);
|
|
143
143
|
var _useState = useState(false),
|
|
@@ -201,186 +201,6 @@ var ResizableTableContainerLegacy = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
201
201
|
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$s;
|
|
202
202
|
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
203
203
|
}, [pluginInjectionApi]);
|
|
204
|
-
var tableWidth = getTableContainerWidth(node);
|
|
205
|
-
var responsiveContainerWidth = 0;
|
|
206
|
-
var resizeHandleSpacing = 12;
|
|
207
|
-
var padding = getPadding(containerWidth);
|
|
208
|
-
// When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
|
|
209
|
-
// updating Settings -> Appearance -> Show scroll bars from "When scrolling" to "Always". It causes
|
|
210
|
-
// issues when viwport width is less than full width Editor's width. To detect avoid them
|
|
211
|
-
// we need to use lineLength to defined responsiveWidth instead of containerWidth
|
|
212
|
-
// (which does not get updated when Mac setting changes) in Full-width editor.
|
|
213
|
-
if (isFullWidthModeEnabled) {
|
|
214
|
-
// When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
|
|
215
|
-
// When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
|
|
216
|
-
// scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
|
|
217
|
-
responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - padding * 2 - resizeHandleSpacing;
|
|
218
|
-
|
|
219
|
-
// platform_editor_table_fw_numcol_overflow_fix:
|
|
220
|
-
// lineLength is undefined on first paint → width: NaN → wrapper expands to page
|
|
221
|
-
// width. rAF col-sizing then runs before the number-column padding and
|
|
222
|
-
// the final shrink, so column widths are locked in wrong.
|
|
223
|
-
// With the flag ON, if the value isn’t finite we fall back to gutterWidth
|
|
224
|
-
// for that first frame—no flash, no premature rAF.
|
|
225
|
-
//
|
|
226
|
-
// Type clean-up comes later:
|
|
227
|
-
// 1) ship this runtime guard (quick fix, no breakage);
|
|
228
|
-
// 2) TODO: widen lineLength to `number|undefined` and remove this block.
|
|
229
|
-
if (fg('platform_editor_table_fw_numcol_overflow_fix')) {
|
|
230
|
-
if (isTableScalingEnabled && !Number.isFinite(responsiveContainerWidth)) {
|
|
231
|
-
responsiveContainerWidth = containerWidth - padding * 2 - resizeHandleSpacing;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
} else if (isCommentEditor) {
|
|
235
|
-
responsiveContainerWidth = containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR;
|
|
236
|
-
} else {
|
|
237
|
-
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
238
|
-
// containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
|
|
239
|
-
// a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
|
|
240
|
-
// padding left = padding right = akEditorGutterPadding = 32
|
|
241
|
-
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - padding * 2 : containerWidth - padding * 2 - resizeHandleSpacing;
|
|
242
|
-
}
|
|
243
|
-
// Fix for HOT-119925: Ensure table width is properly constrained and responsive
|
|
244
|
-
// For wide tables, ensure they don't exceed container width and can be scrolled
|
|
245
|
-
var calculatedWidth = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
246
|
-
|
|
247
|
-
// Ensure minimum width for usability while respecting container constraints
|
|
248
|
-
var width = Math.max(calculatedWidth, Math.min(responsiveContainerWidth * 0.5, 300));
|
|
249
|
-
if (!isResizing) {
|
|
250
|
-
tableWidthRef.current = width;
|
|
251
|
-
}
|
|
252
|
-
var maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
|
|
253
|
-
var tableResizerProps = {
|
|
254
|
-
width: width,
|
|
255
|
-
maxWidth: maxResizerWidth,
|
|
256
|
-
containerWidth: containerWidth,
|
|
257
|
-
lineLength: lineLength,
|
|
258
|
-
updateWidth: updateWidth,
|
|
259
|
-
editorView: editorView,
|
|
260
|
-
getPos: getPos,
|
|
261
|
-
node: node,
|
|
262
|
-
tableRef: tableRef,
|
|
263
|
-
displayGuideline: displayGuideline,
|
|
264
|
-
attachAnalyticsEvent: attachAnalyticsEvent,
|
|
265
|
-
displayGapCursor: displayGapCursor,
|
|
266
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
267
|
-
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
268
|
-
isTableScalingEnabled: isTableScalingEnabled,
|
|
269
|
-
isTableWithFixedColumnWidthsOptionEnabled: isTableWithFixedColumnWidthsOptionEnabled,
|
|
270
|
-
isWholeTableInDanger: isWholeTableInDanger,
|
|
271
|
-
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
272
|
-
pluginInjectionApi: pluginInjectionApi,
|
|
273
|
-
onResizeStart: onResizeStart,
|
|
274
|
-
onResizeStop: onResizeStop,
|
|
275
|
-
isCommentEditor: isCommentEditor
|
|
276
|
-
};
|
|
277
|
-
var isLivePageViewMode = mode === 'view';
|
|
278
|
-
return /*#__PURE__*/React.createElement(AlignmentTableContainerWrapper, {
|
|
279
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
280
|
-
node: node,
|
|
281
|
-
pluginInjectionApi: pluginInjectionApi,
|
|
282
|
-
getPos: getPos,
|
|
283
|
-
editorView: editorView
|
|
284
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
285
|
-
style: {
|
|
286
|
-
width: tableWidthRef.current,
|
|
287
|
-
height: resizing ? updateContainerHeight(tableWrapperHeight !== null && tableWrapperHeight !== void 0 ? tableWrapperHeight : 'auto') : 'auto',
|
|
288
|
-
position: isLivePageViewMode ? 'relative' : 'unset'
|
|
289
|
-
}
|
|
290
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
291
|
-
,
|
|
292
|
-
className: ClassName.TABLE_RESIZER_CONTAINER,
|
|
293
|
-
ref: containerRef
|
|
294
|
-
}, /*#__PURE__*/React.createElement(TableResizer, _extends({}, tableResizerProps, {
|
|
295
|
-
disabled: isLivePageViewMode
|
|
296
|
-
}), /*#__PURE__*/React.createElement(InnerContainer, {
|
|
297
|
-
className: className,
|
|
298
|
-
node: node
|
|
299
|
-
}, children))));
|
|
300
|
-
});
|
|
301
|
-
var ResizableTableContainerNext = /*#__PURE__*/React.memo(function (_ref5) {
|
|
302
|
-
var children = _ref5.children,
|
|
303
|
-
className = _ref5.className,
|
|
304
|
-
node = _ref5.node,
|
|
305
|
-
containerWidth = _ref5.containerWidth,
|
|
306
|
-
lineLength = _ref5.lineLength,
|
|
307
|
-
editorView = _ref5.editorView,
|
|
308
|
-
getPos = _ref5.getPos,
|
|
309
|
-
tableRef = _ref5.tableRef,
|
|
310
|
-
isResizing = _ref5.isResizing,
|
|
311
|
-
pluginInjectionApi = _ref5.pluginInjectionApi,
|
|
312
|
-
tableWrapperHeight = _ref5.tableWrapperHeight,
|
|
313
|
-
isWholeTableInDanger = _ref5.isWholeTableInDanger,
|
|
314
|
-
isTableScalingEnabled = _ref5.isTableScalingEnabled,
|
|
315
|
-
isTableWithFixedColumnWidthsOptionEnabled = _ref5.isTableWithFixedColumnWidthsOptionEnabled,
|
|
316
|
-
isTableAlignmentEnabled = _ref5.isTableAlignmentEnabled,
|
|
317
|
-
shouldUseIncreasedScalingPercent = _ref5.shouldUseIncreasedScalingPercent,
|
|
318
|
-
isCommentEditor = _ref5.isCommentEditor,
|
|
319
|
-
isChromelessEditor = _ref5.isChromelessEditor;
|
|
320
|
-
var tableWidth = getTableContainerWidth(node);
|
|
321
|
-
var containerRef = useRef(null);
|
|
322
|
-
var tableWidthRef = useRef(akEditorDefaultLayoutWidth);
|
|
323
|
-
var _useState3 = useState(false),
|
|
324
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
325
|
-
resizing = _useState4[0],
|
|
326
|
-
setIsResizing = _useState4[1];
|
|
327
|
-
var _useSharedPluginState3 = useSharedPluginStateWithSelector(pluginInjectionApi, ['table', 'editorViewMode'], selector),
|
|
328
|
-
tableState = _useSharedPluginState3.tableState,
|
|
329
|
-
editorViewModeState = _useSharedPluginState3.editorViewModeState;
|
|
330
|
-
var isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
|
|
331
|
-
var mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
332
|
-
var updateContainerHeight = useCallback(function (height) {
|
|
333
|
-
var _containerRef$current3;
|
|
334
|
-
// current StickyHeader State is not stable to be fetch.
|
|
335
|
-
// we need to update stickyHeader plugin to make sure state can be
|
|
336
|
-
// consistently fetch and refactor below
|
|
337
|
-
var stickyHeaders = (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.getElementsByClassName('pm-table-sticky');
|
|
338
|
-
if (!stickyHeaders || stickyHeaders.length < 1) {
|
|
339
|
-
// when starting to drag, we need to keep the original space,
|
|
340
|
-
// -- When sticky header not appear, margin top(24px) and margin bottom(16px), should be 40px,
|
|
341
|
-
// 1px is border width but collapse make it 0.5.
|
|
342
|
-
// -- When sticky header appear, we should add first row height but reduce
|
|
343
|
-
// collapsed border
|
|
344
|
-
return typeof height === 'number' ? "".concat(height + 40.5, "px") : 'auto';
|
|
345
|
-
} else {
|
|
346
|
-
var _containerRef$current4;
|
|
347
|
-
var stickyHeaderHeight = ((_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.getElementsByTagName('th')[0].getBoundingClientRect().height) || 0;
|
|
348
|
-
return typeof height === 'number' ? "".concat(height + stickyHeaderHeight + 39.5, "px") : 'auto';
|
|
349
|
-
}
|
|
350
|
-
}, []);
|
|
351
|
-
var onResizeStart = useCallback(function () {
|
|
352
|
-
setIsResizing(true);
|
|
353
|
-
}, []);
|
|
354
|
-
var onResizeStop = useCallback(function () {
|
|
355
|
-
setIsResizing(false);
|
|
356
|
-
}, []);
|
|
357
|
-
var updateWidth = useCallback(function (width) {
|
|
358
|
-
if (!containerRef.current) {
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// make sure during resizing
|
|
363
|
-
// the pm-table-resizer-container width is the same as its child div resizer-item
|
|
364
|
-
// otherwise when resize table from wider to narrower , pm-table-resizer-container stays wider
|
|
365
|
-
// and cause the fabric-editor-popup-scroll-parent to overflow
|
|
366
|
-
if (containerRef.current.style.width !== "".concat(width, "px")) {
|
|
367
|
-
containerRef.current.style.width = "".concat(width, "px");
|
|
368
|
-
}
|
|
369
|
-
}, []);
|
|
370
|
-
var displayGuideline = useCallback(function (guidelines) {
|
|
371
|
-
var _pluginInjectionApi$g3, _pluginInjectionApi$g4;
|
|
372
|
-
return (_pluginInjectionApi$g3 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$g4 = pluginInjectionApi.guideline) === null || _pluginInjectionApi$g4 === void 0 || (_pluginInjectionApi$g4 = _pluginInjectionApi$g4.actions) === null || _pluginInjectionApi$g4 === void 0 ? void 0 : _pluginInjectionApi$g4.displayGuideline(editorView)({
|
|
373
|
-
guidelines: guidelines
|
|
374
|
-
})) !== null && _pluginInjectionApi$g3 !== void 0 ? _pluginInjectionApi$g3 : false;
|
|
375
|
-
}, [pluginInjectionApi, editorView]);
|
|
376
|
-
var attachAnalyticsEvent = useCallback(function (payload) {
|
|
377
|
-
var _pluginInjectionApi$a3;
|
|
378
|
-
return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions.attachAnalyticsEvent(payload);
|
|
379
|
-
}, [pluginInjectionApi]);
|
|
380
|
-
var displayGapCursor = useCallback(function (toggle) {
|
|
381
|
-
var _pluginInjectionApi$c3, _pluginInjectionApi$c4, _pluginInjectionApi$s2;
|
|
382
|
-
return (_pluginInjectionApi$c3 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c4 = pluginInjectionApi.core) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s2 = pluginInjectionApi.selection) === null || _pluginInjectionApi$s2 === void 0 ? void 0 : _pluginInjectionApi$s2.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c3 !== void 0 ? _pluginInjectionApi$c3 : false;
|
|
383
|
-
}, [pluginInjectionApi]);
|
|
384
204
|
var isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
|
|
385
205
|
var _useMemo = useMemo(function () {
|
|
386
206
|
var responsiveContainerWidth = 0;
|
|
@@ -510,32 +330,28 @@ var ResizableTableContainerNext = /*#__PURE__*/React.memo(function (_ref5) {
|
|
|
510
330
|
node: node
|
|
511
331
|
}, children))));
|
|
512
332
|
});
|
|
513
|
-
export var
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
isTableAlignmentEnabled = _ref6.isTableAlignmentEnabled,
|
|
536
|
-
shouldUseIncreasedScalingPercent = _ref6.shouldUseIncreasedScalingPercent,
|
|
537
|
-
isCommentEditor = _ref6.isCommentEditor,
|
|
538
|
-
isChromelessEditor = _ref6.isChromelessEditor;
|
|
333
|
+
export var TableContainer = function TableContainer(_ref5) {
|
|
334
|
+
var children = _ref5.children,
|
|
335
|
+
node = _ref5.node,
|
|
336
|
+
className = _ref5.className,
|
|
337
|
+
_ref5$containerWidth = _ref5.containerWidth,
|
|
338
|
+
editorWidth = _ref5$containerWidth.width,
|
|
339
|
+
lineLength = _ref5$containerWidth.lineLength,
|
|
340
|
+
editorView = _ref5.editorView,
|
|
341
|
+
getPos = _ref5.getPos,
|
|
342
|
+
tableRef = _ref5.tableRef,
|
|
343
|
+
isNested = _ref5.isNested,
|
|
344
|
+
tableWrapperHeight = _ref5.tableWrapperHeight,
|
|
345
|
+
isResizing = _ref5.isResizing,
|
|
346
|
+
pluginInjectionApi = _ref5.pluginInjectionApi,
|
|
347
|
+
isWholeTableInDanger = _ref5.isWholeTableInDanger,
|
|
348
|
+
isTableResizingEnabled = _ref5.isTableResizingEnabled,
|
|
349
|
+
isTableScalingEnabled = _ref5.isTableScalingEnabled,
|
|
350
|
+
isTableWithFixedColumnWidthsOptionEnabled = _ref5.isTableWithFixedColumnWidthsOptionEnabled,
|
|
351
|
+
isTableAlignmentEnabled = _ref5.isTableAlignmentEnabled,
|
|
352
|
+
shouldUseIncreasedScalingPercent = _ref5.shouldUseIncreasedScalingPercent,
|
|
353
|
+
isCommentEditor = _ref5.isCommentEditor,
|
|
354
|
+
isChromelessEditor = _ref5.isChromelessEditor;
|
|
539
355
|
if (isTableResizingEnabled && !isNested) {
|
|
540
356
|
return /*#__PURE__*/React.createElement(ResizableTableContainer
|
|
541
357
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -568,7 +384,7 @@ export var TableContainer = function TableContainer(_ref6) {
|
|
|
568
384
|
var _getPluginState = getPluginState(editorView.state),
|
|
569
385
|
isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
|
|
570
386
|
var isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
|
|
571
|
-
var resizableTableWidth =
|
|
387
|
+
var resizableTableWidth = isFullPageAppearance ? getTableResizerContainerForFullPageWidthInCSS(node, isTableScalingEnabled) : "calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))";
|
|
572
388
|
return /*#__PURE__*/React.createElement(InnerContainer, {
|
|
573
389
|
node: node
|
|
574
390
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -409,15 +409,8 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
409
409
|
}, [editorView, getPos, node, isCommentEditor, widthToWidest, isToolbarAIFCEnabled, endMeasure, displayGapCursor, displayGuideline, updateWidth, scheduleResize, onResizeStop, pluginInjectionApi, attachAnalyticsEvent, tableRef, isTableScalingEnabled, shouldUseIncreasedScalingPercent, formatMessage]);
|
|
410
410
|
var handleTableSizeChangeOnKeypress = useCallback(function (step) {
|
|
411
411
|
var newWidth = width + step;
|
|
412
|
-
if (
|
|
413
|
-
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
} else {
|
|
417
|
-
// maxWidth when platform_editor_tables_scaling_css off is always a number
|
|
418
|
-
if (newWidth > maxWidth || newWidth < resizerMinWidth) {
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
412
|
+
if (newWidth < resizerMinWidth) {
|
|
413
|
+
return;
|
|
421
414
|
}
|
|
422
415
|
handleResizeStop({
|
|
423
416
|
width: width,
|
|
@@ -428,7 +421,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
428
421
|
width: step,
|
|
429
422
|
height: 0
|
|
430
423
|
});
|
|
431
|
-
}, [width, handleResizeStop,
|
|
424
|
+
}, [width, handleResizeStop, resizerMinWidth]);
|
|
432
425
|
var handleEscape = useCallback(function () {
|
|
433
426
|
editorView === null || editorView === void 0 || editorView.focus();
|
|
434
427
|
}, [editorView]);
|
|
@@ -16,7 +16,6 @@ import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
|
16
16
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
17
17
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
18
18
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
19
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
20
19
|
import { pluginConfig as getPluginConfig } from '../pm-plugins/create-plugin-config';
|
|
21
20
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
22
21
|
import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
|
|
@@ -142,7 +141,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
142
141
|
if (this.view.state.selection.visible) {
|
|
143
142
|
selectionBookmark = this.view.state.selection.getBookmark();
|
|
144
143
|
}
|
|
145
|
-
if (this.dom
|
|
144
|
+
if (this.dom) {
|
|
146
145
|
this.dom.setAttribute('data-ssr-placeholder', "table-nodeview-".concat(this.node.attrs.localId));
|
|
147
146
|
this.dom.setAttribute('data-ssr-placeholder-replace', "table-nodeview-".concat(this.node.attrs.localId));
|
|
148
147
|
}
|
|
@@ -6,10 +6,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
6
6
|
import kebabCase from 'lodash/kebabCase';
|
|
7
7
|
import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
|
|
8
8
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
9
|
-
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
10
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
|
-
import {
|
|
12
|
-
import { generateColgroup, generateColgroupFromNode, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
10
|
+
import { generateColgroupFromNode, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
13
11
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
|
|
14
12
|
import { getTableResizerContainerMaxWidthInCSS, getTableResizerContainerForFullPageWidthInCSS, getTableResizerItemWidthInCSS } from '../pm-plugins/table-resizing/utils/misc';
|
|
15
13
|
import { getAlignmentStyle } from './table-container-styles';
|
|
@@ -17,16 +15,6 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
17
15
|
var tableNode = config.isNestingSupported ? tableWithNestedTable : table;
|
|
18
16
|
return _objectSpread(_objectSpread({}, tableNode), {}, {
|
|
19
17
|
toDOM: function toDOM(node) {
|
|
20
|
-
var _node$attrs$width;
|
|
21
|
-
var gutterPadding = function gutterPadding() {
|
|
22
|
-
if (editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
23
|
-
exposure: true
|
|
24
|
-
})) {
|
|
25
|
-
return 'calc(var(--ak-editor--large-gutter-padding) * 2)';
|
|
26
|
-
} else {
|
|
27
|
-
return "".concat(akEditorGutterPaddingDynamic() * 2, "px");
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
18
|
var alignmentStyle = Object.entries(getAlignmentStyle(node.attrs.layout)).map(function (_ref) {
|
|
31
19
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
32
20
|
k = _ref2[0],
|
|
@@ -34,29 +22,23 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
34
22
|
return "".concat(kebabCase(k), ": ").concat(kebabCase(v));
|
|
35
23
|
}).join(';');
|
|
36
24
|
var tableMinWidth = getResizerMinWidth(node);
|
|
37
|
-
var tableWidthAttribute = node.attrs.width ? "".concat(node.attrs.width, "px") : "100%";
|
|
38
25
|
var isFullPageEditor = !config.isChromelessEditor && !config.isCommentEditor;
|
|
39
|
-
var attrs =
|
|
26
|
+
var attrs = {
|
|
40
27
|
'data-number-column': node.attrs.isNumberColumnEnabled,
|
|
41
28
|
'data-layout': node.attrs.layout,
|
|
42
29
|
'data-autosize': node.attrs.__autoSize,
|
|
43
30
|
'data-table-local-id': node.attrs.localId,
|
|
44
|
-
'data-table-width': node.attrs.width
|
|
45
|
-
}, expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true) && {
|
|
31
|
+
'data-table-width': node.attrs.width,
|
|
46
32
|
'data-ssr-placeholder': "table-".concat(node.attrs.localId),
|
|
47
33
|
'data-ssr-placeholder-replace': "table-".concat(node.attrs.localId)
|
|
48
|
-
}
|
|
34
|
+
};
|
|
49
35
|
|
|
50
36
|
// This would be used for table scaling in colgroup CSS
|
|
51
37
|
// cqw, or px is well supported
|
|
52
|
-
var resizableTableWidth =
|
|
38
|
+
var resizableTableWidth = isFullPageEditor ? getTableResizerContainerForFullPageWidthInCSS(node, config.isTableScalingEnabled) : "calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))";
|
|
53
39
|
var colgroup = '';
|
|
54
40
|
if (config.allowColumnResizing) {
|
|
55
|
-
|
|
56
|
-
colgroup = ['colgroup', {}].concat(_toConsumableArray(generateColgroupFromNode(node, config.isCommentEditor, config.isChromelessEditor, config.isNested, config.isTableScalingEnabled, config.shouldUseIncreasedScalingPercent)));
|
|
57
|
-
} else {
|
|
58
|
-
colgroup = ['colgroup', {}].concat(_toConsumableArray(generateColgroup(node)));
|
|
59
|
-
}
|
|
41
|
+
colgroup = ['colgroup', {}].concat(_toConsumableArray(generateColgroupFromNode(node, config.isCommentEditor, config.isChromelessEditor, config.isNested, config.isTableScalingEnabled, config.shouldUseIncreasedScalingPercent)));
|
|
60
42
|
}
|
|
61
43
|
|
|
62
44
|
// For Chromeless editor, and nested tables in full page editor
|
|
@@ -105,7 +87,7 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
105
87
|
'data-testid': 'sticky-sentinel-bottom'
|
|
106
88
|
}]];
|
|
107
89
|
var tableContainerDiv = expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant1') || expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant2') || expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant3') ? tableContainerDivNext : tableContainerDivLegacy;
|
|
108
|
-
if (!config.tableResizingEnabled ||
|
|
90
|
+
if (!config.tableResizingEnabled || config.isNested) {
|
|
109
91
|
return ['div', {
|
|
110
92
|
class: 'tableView-content-wrap',
|
|
111
93
|
'data-prosemirror-initial-toDOM-render': 'true',
|
|
@@ -122,7 +104,7 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
122
104
|
style: convertToInlineCss({
|
|
123
105
|
'--ak-editor-table-gutter-padding': config.isTableScalingEnabled ? 'calc(var(--ak-editor--large-gutter-padding) * 2)' : 'calc(var(--ak-editor--large-gutter-padding) * 2 - var(--ak-editor-resizer-handle-spacing))',
|
|
124
106
|
'--ak-editor-table-width': resizableTableWidth,
|
|
125
|
-
width:
|
|
107
|
+
width: "var(--ak-editor-table-width)"
|
|
126
108
|
})
|
|
127
109
|
}, ['div', {
|
|
128
110
|
class: 'resizer-item display-handle',
|
|
@@ -133,8 +115,8 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
133
115
|
'--ak-editor-table-max-width': "".concat(TABLE_MAX_WIDTH, "px"),
|
|
134
116
|
'--ak-editor-table-min-width': "".concat(tableMinWidth, "px"),
|
|
135
117
|
minWidth: 'var(--ak-editor-table-min-width)',
|
|
136
|
-
maxWidth:
|
|
137
|
-
width:
|
|
118
|
+
maxWidth: getTableResizerContainerMaxWidthInCSS(config.isCommentEditor, config.isChromelessEditor, config.isTableScalingEnabled),
|
|
119
|
+
width: getTableResizerItemWidthInCSS(node, config.isCommentEditor, config.isChromelessEditor)
|
|
138
120
|
})
|
|
139
121
|
}, ['span', {
|
|
140
122
|
class: 'resizer-hover-zone'
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
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; }
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import { insideTable
|
|
5
|
+
import { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
7
|
import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveOpenNestedExpand } from '@atlaskit/editor-common/transforms';
|
|
8
8
|
import { browser, closestElement } from '@atlaskit/editor-common/utils';
|
|
@@ -10,7 +10,6 @@ import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-p
|
|
|
10
10
|
import { TableMap } from '@atlaskit/editor-tables';
|
|
11
11
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
13
|
import { tableCellView, tableHeaderView, tableRowView, tableView } from '../nodeviews/table-node-views';
|
|
15
14
|
import { pluginKey as decorationsPluginKey } from '../pm-plugins/decorations/plugin';
|
|
16
15
|
import { TableCssClassName as ClassName } from '../types';
|
|
@@ -54,36 +53,6 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
54
53
|
return editorView.state;
|
|
55
54
|
};
|
|
56
55
|
var getNodeView = function getNodeView() {
|
|
57
|
-
// Because the layout shift issues has been fixed under experiment platform_editor_tables_scaling_css, so still want to load nodeview on SSR if experiment is enabled
|
|
58
|
-
if (expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
59
|
-
return {
|
|
60
|
-
table: tableView({
|
|
61
|
-
portalProviderAPI: portalProviderAPI,
|
|
62
|
-
eventDispatcher: eventDispatcher,
|
|
63
|
-
getEditorContainerWidth: getEditorContainerWidth,
|
|
64
|
-
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
65
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
66
|
-
pluginInjectionApi: pluginInjectionApi,
|
|
67
|
-
isCommentEditor: isCommentEditor,
|
|
68
|
-
isChromelessEditor: isChromelessEditor
|
|
69
|
-
}),
|
|
70
|
-
tableRow: tableRowView({
|
|
71
|
-
eventDispatcher: eventDispatcher,
|
|
72
|
-
pluginInjectionApi: pluginInjectionApi
|
|
73
|
-
}),
|
|
74
|
-
tableCell: tableCellView({
|
|
75
|
-
eventDispatcher: eventDispatcher,
|
|
76
|
-
pluginInjectionApi: pluginInjectionApi
|
|
77
|
-
}),
|
|
78
|
-
tableHeader: tableHeaderView({
|
|
79
|
-
eventDispatcher: eventDispatcher,
|
|
80
|
-
pluginInjectionApi: pluginInjectionApi
|
|
81
|
-
})
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
if (isSSR()) {
|
|
85
|
-
return undefined;
|
|
86
|
-
}
|
|
87
56
|
return {
|
|
88
57
|
table: tableView({
|
|
89
58
|
portalProviderAPI: portalProviderAPI,
|