@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
|
@@ -6,8 +6,6 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
6
6
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
7
7
|
import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
10
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
9
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
10
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
13
11
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -79,8 +77,8 @@ const AlignmentTableContainer = ({
|
|
|
79
77
|
}, [alignment]);
|
|
80
78
|
return /*#__PURE__*/React.createElement("div", {
|
|
81
79
|
"data-testid": "table-alignment-container",
|
|
82
|
-
"data-ssr-placeholder":
|
|
83
|
-
"data-ssr-placeholder-replace":
|
|
80
|
+
"data-ssr-placeholder": `table-${node.attrs.localId}`,
|
|
81
|
+
"data-ssr-placeholder-replace": `table-${node.attrs.localId}`
|
|
84
82
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
85
83
|
,
|
|
86
84
|
style: style
|
|
@@ -97,8 +95,8 @@ const AlignmentTableContainerWrapper = ({
|
|
|
97
95
|
if (!isTableAlignmentEnabled) {
|
|
98
96
|
return /*#__PURE__*/React.createElement("div", {
|
|
99
97
|
"data-testid": "table-alignment-container",
|
|
100
|
-
"data-ssr-placeholder":
|
|
101
|
-
"data-ssr-placeholder-replace":
|
|
98
|
+
"data-ssr-placeholder": `table-${node.attrs.localId}`,
|
|
99
|
+
"data-ssr-placeholder-replace": `table-${node.attrs.localId}`,
|
|
102
100
|
style: {
|
|
103
101
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
104
102
|
display: 'flex',
|
|
@@ -123,7 +121,7 @@ const getPadding = containerWidth => {
|
|
|
123
121
|
exposure: true
|
|
124
122
|
}) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
125
123
|
};
|
|
126
|
-
const
|
|
124
|
+
export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
127
125
|
children,
|
|
128
126
|
className,
|
|
129
127
|
node,
|
|
@@ -140,8 +138,10 @@ const ResizableTableContainerLegacy = /*#__PURE__*/React.memo(({
|
|
|
140
138
|
isTableWithFixedColumnWidthsOptionEnabled,
|
|
141
139
|
isTableAlignmentEnabled,
|
|
142
140
|
shouldUseIncreasedScalingPercent,
|
|
143
|
-
isCommentEditor
|
|
141
|
+
isCommentEditor,
|
|
142
|
+
isChromelessEditor
|
|
144
143
|
}) => {
|
|
144
|
+
const tableWidth = getTableContainerWidth(node);
|
|
145
145
|
const containerRef = useRef(null);
|
|
146
146
|
const tableWidthRef = useRef(akEditorDefaultLayoutWidth);
|
|
147
147
|
const [resizing, setIsResizing] = useState(false);
|
|
@@ -203,185 +203,6 @@ const ResizableTableContainerLegacy = /*#__PURE__*/React.memo(({
|
|
|
203
203
|
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$s;
|
|
204
204
|
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? 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;
|
|
205
205
|
}, [pluginInjectionApi]);
|
|
206
|
-
const tableWidth = getTableContainerWidth(node);
|
|
207
|
-
let responsiveContainerWidth = 0;
|
|
208
|
-
const resizeHandleSpacing = 12;
|
|
209
|
-
const padding = getPadding(containerWidth);
|
|
210
|
-
// When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
|
|
211
|
-
// updating Settings -> Appearance -> Show scroll bars from "When scrolling" to "Always". It causes
|
|
212
|
-
// issues when viwport width is less than full width Editor's width. To detect avoid them
|
|
213
|
-
// we need to use lineLength to defined responsiveWidth instead of containerWidth
|
|
214
|
-
// (which does not get updated when Mac setting changes) in Full-width editor.
|
|
215
|
-
if (isFullWidthModeEnabled) {
|
|
216
|
-
// When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
|
|
217
|
-
// When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
|
|
218
|
-
// scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
|
|
219
|
-
responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - padding * 2 - resizeHandleSpacing;
|
|
220
|
-
|
|
221
|
-
// platform_editor_table_fw_numcol_overflow_fix:
|
|
222
|
-
// lineLength is undefined on first paint → width: NaN → wrapper expands to page
|
|
223
|
-
// width. rAF col-sizing then runs before the number-column padding and
|
|
224
|
-
// the final shrink, so column widths are locked in wrong.
|
|
225
|
-
// With the flag ON, if the value isn’t finite we fall back to gutterWidth
|
|
226
|
-
// for that first frame—no flash, no premature rAF.
|
|
227
|
-
//
|
|
228
|
-
// Type clean-up comes later:
|
|
229
|
-
// 1) ship this runtime guard (quick fix, no breakage);
|
|
230
|
-
// 2) TODO: widen lineLength to `number|undefined` and remove this block.
|
|
231
|
-
if (fg('platform_editor_table_fw_numcol_overflow_fix')) {
|
|
232
|
-
if (isTableScalingEnabled && !Number.isFinite(responsiveContainerWidth)) {
|
|
233
|
-
responsiveContainerWidth = containerWidth - padding * 2 - resizeHandleSpacing;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
} else if (isCommentEditor) {
|
|
237
|
-
responsiveContainerWidth = containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR;
|
|
238
|
-
} else {
|
|
239
|
-
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
240
|
-
// containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
|
|
241
|
-
// a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
|
|
242
|
-
// padding left = padding right = akEditorGutterPadding = 32
|
|
243
|
-
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - padding * 2 : containerWidth - padding * 2 - resizeHandleSpacing;
|
|
244
|
-
}
|
|
245
|
-
// Fix for HOT-119925: Ensure table width is properly constrained and responsive
|
|
246
|
-
// For wide tables, ensure they don't exceed container width and can be scrolled
|
|
247
|
-
const calculatedWidth = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
248
|
-
|
|
249
|
-
// Ensure minimum width for usability while respecting container constraints
|
|
250
|
-
const width = Math.max(calculatedWidth, Math.min(responsiveContainerWidth * 0.5, 300));
|
|
251
|
-
if (!isResizing) {
|
|
252
|
-
tableWidthRef.current = width;
|
|
253
|
-
}
|
|
254
|
-
const maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
|
|
255
|
-
const tableResizerProps = {
|
|
256
|
-
width,
|
|
257
|
-
maxWidth: maxResizerWidth,
|
|
258
|
-
containerWidth,
|
|
259
|
-
lineLength,
|
|
260
|
-
updateWidth,
|
|
261
|
-
editorView,
|
|
262
|
-
getPos,
|
|
263
|
-
node,
|
|
264
|
-
tableRef,
|
|
265
|
-
displayGuideline,
|
|
266
|
-
attachAnalyticsEvent,
|
|
267
|
-
displayGapCursor,
|
|
268
|
-
isTableAlignmentEnabled,
|
|
269
|
-
isFullWidthModeEnabled,
|
|
270
|
-
isTableScalingEnabled,
|
|
271
|
-
isTableWithFixedColumnWidthsOptionEnabled,
|
|
272
|
-
isWholeTableInDanger,
|
|
273
|
-
shouldUseIncreasedScalingPercent,
|
|
274
|
-
pluginInjectionApi,
|
|
275
|
-
onResizeStart,
|
|
276
|
-
onResizeStop,
|
|
277
|
-
isCommentEditor
|
|
278
|
-
};
|
|
279
|
-
const isLivePageViewMode = mode === 'view';
|
|
280
|
-
return /*#__PURE__*/React.createElement(AlignmentTableContainerWrapper, {
|
|
281
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
282
|
-
node: node,
|
|
283
|
-
pluginInjectionApi: pluginInjectionApi,
|
|
284
|
-
getPos: getPos,
|
|
285
|
-
editorView: editorView
|
|
286
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
287
|
-
style: {
|
|
288
|
-
width: tableWidthRef.current,
|
|
289
|
-
height: resizing ? updateContainerHeight(tableWrapperHeight !== null && tableWrapperHeight !== void 0 ? tableWrapperHeight : 'auto') : 'auto',
|
|
290
|
-
position: isLivePageViewMode ? 'relative' : 'unset'
|
|
291
|
-
}
|
|
292
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
293
|
-
,
|
|
294
|
-
className: ClassName.TABLE_RESIZER_CONTAINER,
|
|
295
|
-
ref: containerRef
|
|
296
|
-
}, /*#__PURE__*/React.createElement(TableResizer, _extends({}, tableResizerProps, {
|
|
297
|
-
disabled: isLivePageViewMode
|
|
298
|
-
}), /*#__PURE__*/React.createElement(InnerContainer, {
|
|
299
|
-
className: className,
|
|
300
|
-
node: node
|
|
301
|
-
}, children))));
|
|
302
|
-
});
|
|
303
|
-
const ResizableTableContainerNext = /*#__PURE__*/React.memo(({
|
|
304
|
-
children,
|
|
305
|
-
className,
|
|
306
|
-
node,
|
|
307
|
-
containerWidth,
|
|
308
|
-
lineLength,
|
|
309
|
-
editorView,
|
|
310
|
-
getPos,
|
|
311
|
-
tableRef,
|
|
312
|
-
isResizing,
|
|
313
|
-
pluginInjectionApi,
|
|
314
|
-
tableWrapperHeight,
|
|
315
|
-
isWholeTableInDanger,
|
|
316
|
-
isTableScalingEnabled,
|
|
317
|
-
isTableWithFixedColumnWidthsOptionEnabled,
|
|
318
|
-
isTableAlignmentEnabled,
|
|
319
|
-
shouldUseIncreasedScalingPercent,
|
|
320
|
-
isCommentEditor,
|
|
321
|
-
isChromelessEditor
|
|
322
|
-
}) => {
|
|
323
|
-
const tableWidth = getTableContainerWidth(node);
|
|
324
|
-
const containerRef = useRef(null);
|
|
325
|
-
const tableWidthRef = useRef(akEditorDefaultLayoutWidth);
|
|
326
|
-
const [resizing, setIsResizing] = useState(false);
|
|
327
|
-
const {
|
|
328
|
-
tableState,
|
|
329
|
-
editorViewModeState
|
|
330
|
-
} = useSharedPluginStateWithSelector(pluginInjectionApi, ['table', 'editorViewMode'], selector);
|
|
331
|
-
const isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
|
|
332
|
-
const mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
333
|
-
const updateContainerHeight = useCallback(height => {
|
|
334
|
-
var _containerRef$current3;
|
|
335
|
-
// current StickyHeader State is not stable to be fetch.
|
|
336
|
-
// we need to update stickyHeader plugin to make sure state can be
|
|
337
|
-
// consistently fetch and refactor below
|
|
338
|
-
const stickyHeaders = (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.getElementsByClassName('pm-table-sticky');
|
|
339
|
-
if (!stickyHeaders || stickyHeaders.length < 1) {
|
|
340
|
-
// when starting to drag, we need to keep the original space,
|
|
341
|
-
// -- When sticky header not appear, margin top(24px) and margin bottom(16px), should be 40px,
|
|
342
|
-
// 1px is border width but collapse make it 0.5.
|
|
343
|
-
// -- When sticky header appear, we should add first row height but reduce
|
|
344
|
-
// collapsed border
|
|
345
|
-
return typeof height === 'number' ? `${height + 40.5}px` : 'auto';
|
|
346
|
-
} else {
|
|
347
|
-
var _containerRef$current4;
|
|
348
|
-
const stickyHeaderHeight = ((_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.getElementsByTagName('th')[0].getBoundingClientRect().height) || 0;
|
|
349
|
-
return typeof height === 'number' ? `${height + stickyHeaderHeight + 39.5}px` : 'auto';
|
|
350
|
-
}
|
|
351
|
-
}, []);
|
|
352
|
-
const onResizeStart = useCallback(() => {
|
|
353
|
-
setIsResizing(true);
|
|
354
|
-
}, []);
|
|
355
|
-
const onResizeStop = useCallback(() => {
|
|
356
|
-
setIsResizing(false);
|
|
357
|
-
}, []);
|
|
358
|
-
const updateWidth = useCallback(width => {
|
|
359
|
-
if (!containerRef.current) {
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
// make sure during resizing
|
|
364
|
-
// the pm-table-resizer-container width is the same as its child div resizer-item
|
|
365
|
-
// otherwise when resize table from wider to narrower , pm-table-resizer-container stays wider
|
|
366
|
-
// and cause the fabric-editor-popup-scroll-parent to overflow
|
|
367
|
-
if (containerRef.current.style.width !== `${width}px`) {
|
|
368
|
-
containerRef.current.style.width = `${width}px`;
|
|
369
|
-
}
|
|
370
|
-
}, []);
|
|
371
|
-
const displayGuideline = useCallback(guidelines => {
|
|
372
|
-
var _pluginInjectionApi$g4, _pluginInjectionApi$g5, _pluginInjectionApi$g6;
|
|
373
|
-
return (_pluginInjectionApi$g4 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$g5 = pluginInjectionApi.guideline) === null || _pluginInjectionApi$g5 === void 0 ? void 0 : (_pluginInjectionApi$g6 = _pluginInjectionApi$g5.actions) === null || _pluginInjectionApi$g6 === void 0 ? void 0 : _pluginInjectionApi$g6.displayGuideline(editorView)({
|
|
374
|
-
guidelines
|
|
375
|
-
})) !== null && _pluginInjectionApi$g4 !== void 0 ? _pluginInjectionApi$g4 : false;
|
|
376
|
-
}, [pluginInjectionApi, editorView]);
|
|
377
|
-
const attachAnalyticsEvent = useCallback(payload => {
|
|
378
|
-
var _pluginInjectionApi$a3;
|
|
379
|
-
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions.attachAnalyticsEvent(payload);
|
|
380
|
-
}, [pluginInjectionApi]);
|
|
381
|
-
const displayGapCursor = useCallback(toggle => {
|
|
382
|
-
var _pluginInjectionApi$c3, _pluginInjectionApi$c4, _pluginInjectionApi$s2;
|
|
383
|
-
return (_pluginInjectionApi$c3 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c4 = pluginInjectionApi.core) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? 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;
|
|
384
|
-
}, [pluginInjectionApi]);
|
|
385
206
|
const isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
|
|
386
207
|
const {
|
|
387
208
|
width,
|
|
@@ -512,7 +333,6 @@ const ResizableTableContainerNext = /*#__PURE__*/React.memo(({
|
|
|
512
333
|
node: node
|
|
513
334
|
}, children))));
|
|
514
335
|
});
|
|
515
|
-
export const ResizableTableContainer = componentWithCondition(() => expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true), ResizableTableContainerNext, ResizableTableContainerLegacy);
|
|
516
336
|
export const TableContainer = ({
|
|
517
337
|
children,
|
|
518
338
|
node,
|
|
@@ -537,7 +357,6 @@ export const TableContainer = ({
|
|
|
537
357
|
isCommentEditor,
|
|
538
358
|
isChromelessEditor
|
|
539
359
|
}) => {
|
|
540
|
-
var _node$attrs$width;
|
|
541
360
|
if (isTableResizingEnabled && !isNested) {
|
|
542
361
|
return /*#__PURE__*/React.createElement(ResizableTableContainer
|
|
543
362
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -571,7 +390,7 @@ export const TableContainer = ({
|
|
|
571
390
|
isDragAndDropEnabled
|
|
572
391
|
} = getPluginState(editorView.state);
|
|
573
392
|
const isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
|
|
574
|
-
const resizableTableWidth =
|
|
393
|
+
const resizableTableWidth = isFullPageAppearance ? getTableResizerContainerForFullPageWidthInCSS(node, isTableScalingEnabled) : `calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))`;
|
|
575
394
|
return /*#__PURE__*/React.createElement(InnerContainer, {
|
|
576
395
|
node: node
|
|
577
396
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -414,15 +414,8 @@ export const TableResizer = ({
|
|
|
414
414
|
}, [editorView, getPos, node, isCommentEditor, widthToWidest, isToolbarAIFCEnabled, endMeasure, displayGapCursor, displayGuideline, updateWidth, scheduleResize, onResizeStop, pluginInjectionApi, attachAnalyticsEvent, tableRef, isTableScalingEnabled, shouldUseIncreasedScalingPercent, formatMessage]);
|
|
415
415
|
const handleTableSizeChangeOnKeypress = useCallback(step => {
|
|
416
416
|
const newWidth = width + step;
|
|
417
|
-
if (
|
|
418
|
-
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
} else {
|
|
422
|
-
// maxWidth when platform_editor_tables_scaling_css off is always a number
|
|
423
|
-
if (newWidth > maxWidth || newWidth < resizerMinWidth) {
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
417
|
+
if (newWidth < resizerMinWidth) {
|
|
418
|
+
return;
|
|
426
419
|
}
|
|
427
420
|
handleResizeStop({
|
|
428
421
|
width: width,
|
|
@@ -433,7 +426,7 @@ export const TableResizer = ({
|
|
|
433
426
|
width: step,
|
|
434
427
|
height: 0
|
|
435
428
|
});
|
|
436
|
-
}, [width, handleResizeStop,
|
|
429
|
+
}, [width, handleResizeStop, resizerMinWidth]);
|
|
437
430
|
const handleEscape = useCallback(() => {
|
|
438
431
|
editorView === null || editorView === void 0 ? void 0 : editorView.focus();
|
|
439
432
|
}, [editorView]);
|
|
@@ -6,7 +6,6 @@ import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
|
6
6
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
7
7
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
9
|
import { pluginConfig as getPluginConfig } from '../pm-plugins/create-plugin-config';
|
|
11
10
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
12
11
|
import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
|
|
@@ -121,7 +120,7 @@ export default class TableView extends ReactNodeView {
|
|
|
121
120
|
if (this.view.state.selection.visible) {
|
|
122
121
|
selectionBookmark = this.view.state.selection.getBookmark();
|
|
123
122
|
}
|
|
124
|
-
if (this.dom
|
|
123
|
+
if (this.dom) {
|
|
125
124
|
this.dom.setAttribute('data-ssr-placeholder', `table-nodeview-${this.node.attrs.localId}`);
|
|
126
125
|
this.dom.setAttribute('data-ssr-placeholder-replace', `table-nodeview-${this.node.attrs.localId}`);
|
|
127
126
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import kebabCase from 'lodash/kebabCase';
|
|
2
2
|
import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
|
|
3
3
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
4
|
-
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
5
4
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
|
-
import {
|
|
7
|
-
import { generateColgroup, generateColgroupFromNode, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
5
|
+
import { generateColgroupFromNode, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
8
6
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
|
|
9
7
|
import { getTableResizerContainerMaxWidthInCSS, getTableResizerContainerForFullPageWidthInCSS, getTableResizerItemWidthInCSS } from '../pm-plugins/table-resizing/utils/misc';
|
|
10
8
|
import { getAlignmentStyle } from './table-container-styles';
|
|
@@ -13,19 +11,8 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
13
11
|
return {
|
|
14
12
|
...tableNode,
|
|
15
13
|
toDOM: node => {
|
|
16
|
-
var _node$attrs$width;
|
|
17
|
-
const gutterPadding = () => {
|
|
18
|
-
if (editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
19
|
-
exposure: true
|
|
20
|
-
})) {
|
|
21
|
-
return 'calc(var(--ak-editor--large-gutter-padding) * 2)';
|
|
22
|
-
} else {
|
|
23
|
-
return `${akEditorGutterPaddingDynamic() * 2}px`;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
14
|
const alignmentStyle = Object.entries(getAlignmentStyle(node.attrs.layout)).map(([k, v]) => `${kebabCase(k)}: ${kebabCase(v)}`).join(';');
|
|
27
15
|
const tableMinWidth = getResizerMinWidth(node);
|
|
28
|
-
const tableWidthAttribute = node.attrs.width ? `${node.attrs.width}px` : `100%`;
|
|
29
16
|
const isFullPageEditor = !config.isChromelessEditor && !config.isCommentEditor;
|
|
30
17
|
const attrs = {
|
|
31
18
|
'data-number-column': node.attrs.isNumberColumnEnabled,
|
|
@@ -33,22 +20,16 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
33
20
|
'data-autosize': node.attrs.__autoSize,
|
|
34
21
|
'data-table-local-id': node.attrs.localId,
|
|
35
22
|
'data-table-width': node.attrs.width,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
'data-ssr-placeholder-replace': `table-${node.attrs.localId}`
|
|
39
|
-
})
|
|
23
|
+
'data-ssr-placeholder': `table-${node.attrs.localId}`,
|
|
24
|
+
'data-ssr-placeholder-replace': `table-${node.attrs.localId}`
|
|
40
25
|
};
|
|
41
26
|
|
|
42
27
|
// This would be used for table scaling in colgroup CSS
|
|
43
28
|
// cqw, or px is well supported
|
|
44
|
-
const resizableTableWidth =
|
|
29
|
+
const resizableTableWidth = isFullPageEditor ? getTableResizerContainerForFullPageWidthInCSS(node, config.isTableScalingEnabled) : `calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))`;
|
|
45
30
|
let colgroup = '';
|
|
46
31
|
if (config.allowColumnResizing) {
|
|
47
|
-
|
|
48
|
-
colgroup = ['colgroup', {}, ...generateColgroupFromNode(node, config.isCommentEditor, config.isChromelessEditor, config.isNested, config.isTableScalingEnabled, config.shouldUseIncreasedScalingPercent)];
|
|
49
|
-
} else {
|
|
50
|
-
colgroup = ['colgroup', {}, ...generateColgroup(node)];
|
|
51
|
-
}
|
|
32
|
+
colgroup = ['colgroup', {}, ...generateColgroupFromNode(node, config.isCommentEditor, config.isChromelessEditor, config.isNested, config.isTableScalingEnabled, config.shouldUseIncreasedScalingPercent)];
|
|
52
33
|
}
|
|
53
34
|
|
|
54
35
|
// For Chromeless editor, and nested tables in full page editor
|
|
@@ -97,7 +78,7 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
97
78
|
'data-testid': 'sticky-sentinel-bottom'
|
|
98
79
|
}]];
|
|
99
80
|
const 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;
|
|
100
|
-
if (!config.tableResizingEnabled ||
|
|
81
|
+
if (!config.tableResizingEnabled || config.isNested) {
|
|
101
82
|
return ['div', {
|
|
102
83
|
class: 'tableView-content-wrap',
|
|
103
84
|
'data-prosemirror-initial-toDOM-render': 'true',
|
|
@@ -114,7 +95,7 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
114
95
|
style: convertToInlineCss({
|
|
115
96
|
'--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))',
|
|
116
97
|
'--ak-editor-table-width': resizableTableWidth,
|
|
117
|
-
width:
|
|
98
|
+
width: `var(--ak-editor-table-width)`
|
|
118
99
|
})
|
|
119
100
|
}, ['div', {
|
|
120
101
|
class: 'resizer-item display-handle',
|
|
@@ -125,8 +106,8 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
125
106
|
'--ak-editor-table-max-width': `${TABLE_MAX_WIDTH}px`,
|
|
126
107
|
'--ak-editor-table-min-width': `${tableMinWidth}px`,
|
|
127
108
|
minWidth: 'var(--ak-editor-table-min-width)',
|
|
128
|
-
maxWidth:
|
|
129
|
-
width:
|
|
109
|
+
maxWidth: getTableResizerContainerMaxWidthInCSS(config.isCommentEditor, config.isChromelessEditor, config.isTableScalingEnabled),
|
|
110
|
+
width: getTableResizerItemWidthInCSS(node, config.isCommentEditor, config.isChromelessEditor)
|
|
130
111
|
})
|
|
131
112
|
}, ['span', {
|
|
132
113
|
class: 'resizer-hover-zone'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { insideTable
|
|
2
|
+
import { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveOpenNestedExpand } from '@atlaskit/editor-common/transforms';
|
|
5
5
|
import { browser, closestElement } from '@atlaskit/editor-common/utils';
|
|
@@ -7,7 +7,6 @@ import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-p
|
|
|
7
7
|
import { TableMap } from '@atlaskit/editor-tables';
|
|
8
8
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
10
|
import { tableCellView, tableHeaderView, tableRowView, tableView } from '../nodeviews/table-node-views';
|
|
12
11
|
import { pluginKey as decorationsPluginKey } from '../pm-plugins/decorations/plugin';
|
|
13
12
|
import { TableCssClassName as ClassName } from '../types';
|
|
@@ -52,36 +51,6 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
52
51
|
return editorView.state;
|
|
53
52
|
};
|
|
54
53
|
const getNodeView = () => {
|
|
55
|
-
// 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
|
|
56
|
-
if (expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
57
|
-
return {
|
|
58
|
-
table: tableView({
|
|
59
|
-
portalProviderAPI,
|
|
60
|
-
eventDispatcher,
|
|
61
|
-
getEditorContainerWidth,
|
|
62
|
-
getEditorFeatureFlags,
|
|
63
|
-
dispatchAnalyticsEvent,
|
|
64
|
-
pluginInjectionApi,
|
|
65
|
-
isCommentEditor,
|
|
66
|
-
isChromelessEditor
|
|
67
|
-
}),
|
|
68
|
-
tableRow: tableRowView({
|
|
69
|
-
eventDispatcher,
|
|
70
|
-
pluginInjectionApi
|
|
71
|
-
}),
|
|
72
|
-
tableCell: tableCellView({
|
|
73
|
-
eventDispatcher,
|
|
74
|
-
pluginInjectionApi
|
|
75
|
-
}),
|
|
76
|
-
tableHeader: tableHeaderView({
|
|
77
|
-
eventDispatcher,
|
|
78
|
-
pluginInjectionApi
|
|
79
|
-
})
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
if (isSSR()) {
|
|
83
|
-
return undefined;
|
|
84
|
-
}
|
|
85
54
|
return {
|
|
86
55
|
table: tableView({
|
|
87
56
|
portalProviderAPI,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
2
2
|
import { tableCellMinWidth, tableNewColumnMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
|
|
4
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
4
|
import { getSelectedTableInfo } from '../../utils/analytics';
|
|
6
5
|
import { getColWidthFix, hasTableBeenResized, insertColgroupFromNode } from './colgroup';
|
|
7
6
|
import { getCellsRefsInColumn, getColumnStateFromDOM } from './column-state';
|
|
@@ -80,7 +79,7 @@ export const getResizeState = ({
|
|
|
80
79
|
|
|
81
80
|
// updates Colgroup DOM node with new widths
|
|
82
81
|
export const updateColgroup = (state, tableRef, tableNode, isTableScalingEnabled, scalePercent) => {
|
|
83
|
-
const cols =
|
|
82
|
+
const cols = tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll(':scope > colgroup > col');
|
|
84
83
|
const columnsCount = cols === null || cols === void 0 ? void 0 : cols.length;
|
|
85
84
|
/**
|
|
86
85
|
updateColgroup will update whole table scale when click the column resize handle, this behavior will affect when table overflowed, when now resize handle been dragged and extend to make table overflowed, table will show overflow. This need to be confirmed because it conflict with how isTableScalingEnabled work.
|
|
@@ -4,7 +4,6 @@ import classnames from 'classnames';
|
|
|
4
4
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
5
5
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { isRowSelected } from '@atlaskit/editor-tables/utils';
|
|
7
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
7
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
9
8
|
import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
|
|
10
9
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
@@ -96,7 +95,7 @@ export default class NumberColumn extends Component {
|
|
|
96
95
|
updateCellHoverLocation
|
|
97
96
|
} = this.props;
|
|
98
97
|
const rowHeights = getRowHeights(tableRef);
|
|
99
|
-
if (isSSR()
|
|
98
|
+
if (isSSR()) {
|
|
100
99
|
return /*#__PURE__*/React.createElement("div", {
|
|
101
100
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
102
101
|
className: ClassName.NUMBERED_COLUMN,
|
|
@@ -122,9 +121,7 @@ export default class NumberColumn extends Component {
|
|
|
122
121
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
123
122
|
isDragAndDropEnabled && tableActive ? `1px solid ${tableBorderColor}` : undefined,
|
|
124
123
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
125
|
-
|
|
126
|
-
visibility: 'visible'
|
|
127
|
-
} : {})
|
|
124
|
+
visibility: 'visible'
|
|
128
125
|
},
|
|
129
126
|
contentEditable: false
|
|
130
127
|
}, rowHeights.map((rowHeight, index) => isDragAndDropEnabled ?
|
|
@@ -8,7 +8,7 @@ import { css } from '@emotion/react';
|
|
|
8
8
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
9
9
|
import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
|
|
10
10
|
import { SORTABLE_COLUMN_ICON_CLASSNAME } from '@atlaskit/editor-common/table';
|
|
11
|
-
import { akEditorSelectedNodeClassName, akEditorSmallZIndex, akEditorStickyHeaderZIndex, akEditorTableCellOnStickyHeaderZIndex, akEditorTableNumberColumnWidth, akEditorTableToolbarSize, akEditorUnitZIndex, getSelectionStyles, MAX_BROWSER_SCROLLBAR_HEIGHT,
|
|
11
|
+
import { akEditorSelectedNodeClassName, akEditorSmallZIndex, akEditorStickyHeaderZIndex, akEditorTableCellOnStickyHeaderZIndex, akEditorTableNumberColumnWidth, akEditorTableToolbarSize, akEditorUnitZIndex, getSelectionStyles, MAX_BROWSER_SCROLLBAR_HEIGHT, SelectionStyle, relativeSizeToBaseFontSize, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
12
12
|
import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
14
|
import { N0, N40A, R500 } from '@atlaskit/theme/colors';
|
|
@@ -849,9 +849,10 @@ export const baseTableStyles = props => {
|
|
|
849
849
|
box-sizing: border-box;
|
|
850
850
|
margin-top: -1px;
|
|
851
851
|
padding-bottom: 2px;
|
|
852
|
-
padding: 10px
|
|
852
|
+
padding: ${expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ? relativeSizeToBaseFontSize(10) : `10px`}
|
|
853
|
+
2px;
|
|
853
854
|
text-align: center;
|
|
854
|
-
font-size: ${relativeFontSizeToBase16(14)};
|
|
855
|
+
font-size: ${expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ? relativeSizeToBaseFontSize(14) : relativeFontSizeToBase16(14)};
|
|
855
856
|
background-color: ${tableHeaderCellBackgroundColor};
|
|
856
857
|
color: ${tableTextColor};
|
|
857
858
|
border-color: ${tableBorderColor};
|
|
@@ -357,7 +357,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
357
357
|
isNumberOfColumnsChanged = params.isNumberOfColumnsChanged,
|
|
358
358
|
isFullWidthModeAndLineLengthChanged = params.isFullWidthModeAndLineLengthChanged;
|
|
359
359
|
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);
|
|
360
|
-
if (
|
|
360
|
+
if (isFullPageEditor) {
|
|
361
361
|
return !!isWindowResized || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
362
362
|
}
|
|
363
363
|
return isWidthChanged || isTableWidthChanged || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
@@ -441,10 +441,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
443
|
});
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
447
|
-
}
|
|
444
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
445
|
+
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
448
446
|
}
|
|
449
447
|
}
|
|
450
448
|
}, {
|
|
@@ -459,9 +457,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
459
457
|
allowTableResizing = _this$props7.allowTableResizing,
|
|
460
458
|
eventDispatcher = _this$props7.eventDispatcher,
|
|
461
459
|
isDragAndDropEnabled = _this$props7.isDragAndDropEnabled,
|
|
462
|
-
getNode = _this$props7.getNode
|
|
463
|
-
getEditorFeatureFlags = _this$props7.getEditorFeatureFlags,
|
|
464
|
-
isTableScalingEnabled = _this$props7.isTableScalingEnabled;
|
|
460
|
+
getNode = _this$props7.getNode;
|
|
465
461
|
|
|
466
462
|
// Ignored via go/ees005
|
|
467
463
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -474,17 +470,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
474
470
|
// Ignored via go/ees005
|
|
475
471
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
476
472
|
this === null || this === void 0 || (_this$table3 = this.table) === null || _this$table3 === void 0 || _this$table3.addEventListener('mouseover', this.handleMouseOver);
|
|
477
|
-
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
478
|
-
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
|
|
479
|
-
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
|
|
480
|
-
if (!expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
481
|
-
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
482
|
-
this.handleColgroupUpdates(true);
|
|
483
|
-
}
|
|
484
|
-
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
485
|
-
this.handleColgroupUpdates(true);
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
473
|
if (this.wrapper) {
|
|
489
474
|
this.wrapperReisizeObserver = new ResizeObserver(function (entries) {
|
|
490
475
|
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
@@ -589,10 +574,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
589
574
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
590
575
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
591
576
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
}
|
|
577
|
+
|
|
578
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
579
|
+
window.removeEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
596
580
|
|
|
597
581
|
// Ignored via go/ees005
|
|
598
582
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -682,7 +666,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
682
666
|
containerLineLength = containerWidth.lineLength;
|
|
683
667
|
var isLineLengthChanged = ((_this$containerWidth = this.containerWidth) === null || _this$containerWidth === void 0 ? void 0 : _this$containerWidth.lineLength) !== containerLineLength;
|
|
684
668
|
var isFullWidthModeAndLineLengthChanged = this.updateColGroupFromFullWidthChange && isLineLengthChanged && fg('platform_editor_table_overflow_in_full_width_fix');
|
|
685
|
-
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged ||
|
|
669
|
+
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged || this.state.windowResized;
|
|
686
670
|
if (force || maybeScale || isFullWidthModeAndLineLengthChanged) {
|
|
687
671
|
var _this$containerWidth2, _this$props$options3, _this$props$options4, _this$props$options5;
|
|
688
672
|
var isWidthChanged = ((_this$containerWidth2 = this.containerWidth) === null || _this$containerWidth2 === void 0 ? void 0 : _this$containerWidth2.width) !== containerWidthValue;
|
|
@@ -701,9 +685,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
701
685
|
isNumberOfColumnsChanged: isNumberOfColumnsChanged,
|
|
702
686
|
isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged
|
|
703
687
|
});
|
|
704
|
-
var
|
|
705
|
-
|
|
706
|
-
tableWithFixedColumnWidthsOption =
|
|
688
|
+
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
689
|
+
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
|
|
690
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
|
|
707
691
|
var isTableScalingWithFixedColumnWidthsOptionEnabled = !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
|
|
708
692
|
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);
|
|
709
693
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
@@ -787,9 +771,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
787
771
|
var table = findTable(view.state.selection);
|
|
788
772
|
var shouldScale = false;
|
|
789
773
|
var shouldHandleColgroupUpdates = false;
|
|
790
|
-
var
|
|
791
|
-
|
|
792
|
-
tableWithFixedColumnWidthsOption =
|
|
774
|
+
var _getEditorFeatureFlag3 = getEditorFeatureFlags(),
|
|
775
|
+
_getEditorFeatureFlag4 = _getEditorFeatureFlag3.tableWithFixedColumnWidthsOption,
|
|
776
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag4 === void 0 ? false : _getEditorFeatureFlag4;
|
|
793
777
|
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
794
778
|
shouldScale = true;
|
|
795
779
|
shouldHandleColgroupUpdates = true;
|
|
@@ -800,7 +784,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
800
784
|
shouldScale = true;
|
|
801
785
|
shouldHandleColgroupUpdates = true;
|
|
802
786
|
}
|
|
803
|
-
if (
|
|
787
|
+
if (this.state.windowResized) {
|
|
804
788
|
shouldHandleColgroupUpdates = true;
|
|
805
789
|
}
|
|
806
790
|
if (shouldHandleColgroupUpdates) {
|
|
@@ -1015,9 +999,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1015
999
|
var topShadowPadding = isDragAndDropEnabled ? 0 : shadowPadding;
|
|
1016
1000
|
var topOffset = 0;
|
|
1017
1001
|
var topStickyShadowPosition = !this.props.limitedMode && this.state.stickyHeader && topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
|
|
1018
|
-
var
|
|
1019
|
-
|
|
1020
|
-
tableWithFixedColumnWidthsOption =
|
|
1002
|
+
var _getEditorFeatureFlag5 = getEditorFeatureFlags(),
|
|
1003
|
+
_getEditorFeatureFlag6 = _getEditorFeatureFlag5.tableWithFixedColumnWidthsOption,
|
|
1004
|
+
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag6 === void 0 ? false : _getEditorFeatureFlag6;
|
|
1021
1005
|
var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption || !!((_this$props$options10 = this.props.options) !== null && _this$props$options10 !== void 0 && _this$props$options10.isCommentEditor));
|
|
1022
1006
|
return /*#__PURE__*/React.createElement(TableContainer
|
|
1023
1007
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|