@atlaskit/editor-plugin-table 7.21.2 → 7.21.4
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 +15 -0
- package/dist/cjs/commands/insert.js +6 -3
- package/dist/cjs/nodeviews/TableComponent.js +26 -10
- 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 +4 -3
- package/dist/cjs/toolbar.js +4 -1
- package/dist/cjs/ui/ColumnResizeWidget/index.js +4 -1
- package/dist/cjs/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +4 -1
- package/dist/cjs/ui/FloatingContextualButton/index.js +4 -1
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +4 -1
- package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -1
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +4 -1
- package/dist/cjs/utils/create.js +6 -1
- package/dist/es2019/commands/insert.js +6 -3
- package/dist/es2019/nodeviews/TableComponent.js +27 -11
- 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 +4 -3
- package/dist/es2019/toolbar.js +4 -1
- package/dist/es2019/ui/ColumnResizeWidget/index.js +4 -1
- package/dist/es2019/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +4 -1
- package/dist/es2019/ui/FloatingContextualButton/index.js +4 -1
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +4 -1
- package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -1
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +4 -1
- package/dist/es2019/utils/create.js +6 -1
- package/dist/esm/commands/insert.js +6 -3
- package/dist/esm/nodeviews/TableComponent.js +27 -11
- 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 +4 -3
- package/dist/esm/toolbar.js +4 -1
- package/dist/esm/ui/ColumnResizeWidget/index.js +4 -1
- package/dist/esm/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +4 -1
- package/dist/esm/ui/FloatingContextualButton/index.js +4 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +4 -1
- package/dist/esm/ui/FloatingContextualMenu/index.js +4 -1
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +4 -1
- 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/ui/ColumnResizeWidget/index.d.ts +4 -1
- package/dist/types/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +4 -1
- package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +4 -1
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +4 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +4 -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/ui/ColumnResizeWidget/index.d.ts +4 -1
- package/dist/types-ts4.5/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +4 -1
- package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +4 -1
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +4 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +4 -1
- package/dist/types-ts4.5/utils/create.d.ts +3 -1
- package/package.json +6 -3
- package/src/commands/insert.ts +6 -0
- package/src/nodeviews/TableComponent.tsx +23 -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 +5 -1
- package/src/toolbar.tsx +4 -1
- package/src/ui/ColumnResizeWidget/index.tsx +4 -1
- package/src/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.tsx +4 -1
- package/src/ui/FloatingContextualButton/index.tsx +4 -1
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +4 -1
- package/src/ui/FloatingContextualMenu/index.tsx +4 -1
- package/src/ui/FloatingDragMenu/DragMenu.tsx +4 -1
- package/src/utils/create.ts +9 -2
|
@@ -11,9 +11,10 @@ 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
|
+
import { handleMouseOut, isTableInFocus } from '../event-handlers';
|
|
17
18
|
import { autoScrollerFactory } from '../pm-plugins/drag-and-drop/utils';
|
|
18
19
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
19
20
|
import { findStickyHeaderForTable, pluginKey as stickyHeadersPluginKey } from '../pm-plugins/sticky-headers';
|
|
@@ -52,6 +53,12 @@ class TableComponent extends React.Component {
|
|
|
52
53
|
tableWrapperWidth: undefined,
|
|
53
54
|
tableWrapperHeight: undefined
|
|
54
55
|
});
|
|
56
|
+
_defineProperty(this, "handleMouseOut", event => {
|
|
57
|
+
if (!isTableInFocus(this.props.view)) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return handleMouseOut(this.props.view, event);
|
|
61
|
+
});
|
|
55
62
|
_defineProperty(this, "handleMouseEnter", () => {
|
|
56
63
|
const node = this.props.getNode();
|
|
57
64
|
const pos = this.props.getPos();
|
|
@@ -338,7 +345,7 @@ class TableComponent extends React.Component {
|
|
|
338
345
|
getEditorFeatureFlags,
|
|
339
346
|
isTableScalingEnabled
|
|
340
347
|
} = this.props;
|
|
341
|
-
if (
|
|
348
|
+
if (fg('platform.editor.table.live-pages-sorting_4malx')) {
|
|
342
349
|
var _this$props$pluginInj, _this$props$pluginInj2;
|
|
343
350
|
const {
|
|
344
351
|
mode
|
|
@@ -348,6 +355,10 @@ class TableComponent extends React.Component {
|
|
|
348
355
|
this === null || this === void 0 ? void 0 : (_this$table = this.table) === null || _this$table === void 0 ? void 0 : _this$table.addEventListener('mouseenter', this.handleMouseEnter);
|
|
349
356
|
}
|
|
350
357
|
}
|
|
358
|
+
if (fg('editor_react_18_fix_table_delete_col_decorations')) {
|
|
359
|
+
var _this$table2;
|
|
360
|
+
this === null || this === void 0 ? void 0 : (_this$table2 = this.table) === null || _this$table2 === void 0 ? void 0 : _this$table2.addEventListener('mouseout', this.handleMouseOut);
|
|
361
|
+
}
|
|
351
362
|
const {
|
|
352
363
|
tableWithFixedColumnWidthsOption = false,
|
|
353
364
|
stickyScrollbar
|
|
@@ -428,9 +439,13 @@ class TableComponent extends React.Component {
|
|
|
428
439
|
if (!(options !== null && options !== void 0 && options.isTableResizingEnabled) && allowColumnResizing) {
|
|
429
440
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
430
441
|
}
|
|
431
|
-
if (
|
|
432
|
-
var _this$
|
|
433
|
-
this === null || this === void 0 ? void 0 : (_this$
|
|
442
|
+
if (fg('platform.editor.table.live-pages-sorting_4malx')) {
|
|
443
|
+
var _this$table3;
|
|
444
|
+
this === null || this === void 0 ? void 0 : (_this$table3 = this.table) === null || _this$table3 === void 0 ? void 0 : _this$table3.removeEventListener('mouseenter', this.handleMouseEnter);
|
|
445
|
+
}
|
|
446
|
+
if (fg('editor_react_18_fix_table_delete_col_decorations')) {
|
|
447
|
+
var _this$table4;
|
|
448
|
+
this === null || this === void 0 ? void 0 : (_this$table4 = this.table) === null || _this$table4 === void 0 ? void 0 : _this$table4.removeEventListener('mouseout', this.handleMouseOut);
|
|
434
449
|
}
|
|
435
450
|
if (this.overflowShadowsObserver) {
|
|
436
451
|
this.overflowShadowsObserver.dispose();
|
|
@@ -485,7 +500,7 @@ class TableComponent extends React.Component {
|
|
|
485
500
|
tableWithFixedColumnWidthsOption = false
|
|
486
501
|
} = getEditorFeatureFlags();
|
|
487
502
|
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 &&
|
|
503
|
+
const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') || false;
|
|
489
504
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
490
505
|
var _this$props$options2;
|
|
491
506
|
const resizeState = getResizeState({
|
|
@@ -534,7 +549,7 @@ class TableComponent extends React.Component {
|
|
|
534
549
|
isInDanger
|
|
535
550
|
} = this.props;
|
|
536
551
|
const table = findTable(view.state.selection);
|
|
537
|
-
if (!
|
|
552
|
+
if (!fg('platform.editor.table.use-shared-state-hook')) {
|
|
538
553
|
const pluginState = getPluginState(view.state);
|
|
539
554
|
isInDanger = pluginState.isInDanger;
|
|
540
555
|
}
|
|
@@ -548,7 +563,7 @@ class TableComponent extends React.Component {
|
|
|
548
563
|
shouldHandleColgroupUpdates = true;
|
|
549
564
|
}
|
|
550
565
|
const isTableScalingWithFixedColumnWidthsOptionEnabled = isTableScalingEnabled && tableWithFixedColumnWidthsOption;
|
|
551
|
-
const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
566
|
+
const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent');
|
|
552
567
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled && getNode().attrs.displayMode !== 'fixed') {
|
|
553
568
|
shouldScale = true;
|
|
554
569
|
shouldHandleColgroupUpdates = true;
|
|
@@ -674,7 +689,7 @@ class TableComponent extends React.Component {
|
|
|
674
689
|
showAfterShadow
|
|
675
690
|
} = this.state;
|
|
676
691
|
const node = getNode();
|
|
677
|
-
if (!
|
|
692
|
+
if (!fg('platform.editor.table.use-shared-state-hook')) {
|
|
678
693
|
const pluginState = getPluginState(view.state);
|
|
679
694
|
isInDanger = pluginState.isInDanger;
|
|
680
695
|
hoveredRows = pluginState.hoveredRows;
|
|
@@ -759,7 +774,7 @@ class TableComponent extends React.Component {
|
|
|
759
774
|
stickyScrollbar,
|
|
760
775
|
tableWithFixedColumnWidthsOption = false
|
|
761
776
|
} = getEditorFeatureFlags();
|
|
762
|
-
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption &&
|
|
777
|
+
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && fg('platform.editor.table.use-increased-scaling-percent');
|
|
763
778
|
return /*#__PURE__*/React.createElement(TableContainer
|
|
764
779
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
765
780
|
, {
|
|
@@ -783,7 +798,8 @@ class TableComponent extends React.Component {
|
|
|
783
798
|
isTableWithFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
784
799
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
785
800
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
786
|
-
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
|
|
801
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
802
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
|
|
787
803
|
}, /*#__PURE__*/React.createElement("div", {
|
|
788
804
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
789
805
|
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,
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -137,7 +137,9 @@ const tablesPlugin = ({
|
|
|
137
137
|
const node = createTableWithWidth({
|
|
138
138
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
139
139
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
|
|
140
|
-
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled
|
|
140
|
+
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
|
|
141
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
142
|
+
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
|
|
141
143
|
})(state.schema);
|
|
142
144
|
return (_api$contentInsertion = api === null || api === void 0 ? void 0 : (_api$contentInsertion2 = api.contentInsertion) === null || _api$contentInsertion2 === void 0 ? void 0 : (_api$contentInsertion3 = _api$contentInsertion2.actions) === null || _api$contentInsertion3 === void 0 ? void 0 : _api$contentInsertion3.insert({
|
|
143
145
|
state,
|
|
@@ -192,9 +194,10 @@ const tablesPlugin = ({
|
|
|
192
194
|
getEditorFeatureFlags,
|
|
193
195
|
dragAndDropEnabled,
|
|
194
196
|
isTableScalingEnabled,
|
|
195
|
-
isTableAlignmentEnabled
|
|
197
|
+
isTableAlignmentEnabled,
|
|
198
|
+
isCommentEditor
|
|
196
199
|
} = options || {};
|
|
197
|
-
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent);
|
|
200
|
+
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor);
|
|
198
201
|
}
|
|
199
202
|
}, {
|
|
200
203
|
name: 'tablePMColResizing',
|
|
@@ -231,9 +234,11 @@ const tablesPlugin = ({
|
|
|
231
234
|
dragAndDropEnabled,
|
|
232
235
|
isTableScalingEnabled = false,
|
|
233
236
|
isTableAlignmentEnabled = false,
|
|
234
|
-
fullWidthEnabled = false
|
|
237
|
+
fullWidthEnabled = false,
|
|
238
|
+
isCommentEditor = false,
|
|
239
|
+
tableResizingEnabled = false
|
|
235
240
|
} = options || {};
|
|
236
|
-
return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent);
|
|
241
|
+
return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, tableResizingEnabled);
|
|
237
242
|
}
|
|
238
243
|
}, {
|
|
239
244
|
name: 'tableSelectionKeymap',
|
|
@@ -294,7 +299,7 @@ const tablesPlugin = ({
|
|
|
294
299
|
dispatch
|
|
295
300
|
}) => {
|
|
296
301
|
var _options$fullWidthEna, _options$isTableScali, _options$isTableAlign;
|
|
297
|
-
return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(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;
|
|
302
|
+
return options !== null && options !== void 0 && options.tableResizingEnabled && !(options !== null && options !== void 0 && options.isCommentEditor) ? createTableWidthPlugin(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;
|
|
298
303
|
}
|
|
299
304
|
},
|
|
300
305
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
@@ -492,7 +497,9 @@ const tablesPlugin = ({
|
|
|
492
497
|
const tableNode = createTableWithWidth({
|
|
493
498
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
494
499
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
|
|
495
|
-
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled
|
|
500
|
+
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
501
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
502
|
+
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
|
|
496
503
|
})(state.schema);
|
|
497
504
|
const tr = insert(tableNode);
|
|
498
505
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
@@ -8,13 +8,13 @@ import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSele
|
|
|
8
8
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
9
9
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand, createTable } from '../commands/insert';
|
|
10
10
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
|
-
export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isTableAlignmentEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl, isCellBackgroundDuplicated = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent) {
|
|
11
|
+
export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isTableAlignmentEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl, isCellBackgroundDuplicated = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent, isCommentEditor, isTableResizingEnabled) {
|
|
12
12
|
var _pluginInjectionApi$a;
|
|
13
13
|
const list = {};
|
|
14
14
|
const ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
15
15
|
bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
|
|
16
16
|
bindKeymapWithCommand(previousCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(-1), list);
|
|
17
|
-
bindKeymapWithCommand(toggleTable.common, createTable(isTableScalingEnabled, isTableAlignmentEnabled, !!isFullWidthEnabled, editorAnalyticsAPI), list);
|
|
17
|
+
bindKeymapWithCommand(toggleTable.common, createTable(isTableScalingEnabled, isTableAlignmentEnabled, !!isFullWidthEnabled, editorAnalyticsAPI, isCommentEditor, isTableResizingEnabled), list);
|
|
18
18
|
bindKeymapWithCommand(backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
|
|
19
19
|
bindKeymapWithCommand(backspace.common, moveCursorBackward, list);
|
|
20
20
|
|
|
@@ -20,7 +20,7 @@ import { isHeaderRowRequired } from '../utils/paste';
|
|
|
20
20
|
import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
|
|
21
21
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
22
22
|
import { pluginKey } from './plugin-key';
|
|
23
|
-
export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent) => {
|
|
23
|
+
export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor) => {
|
|
24
24
|
var _accessibilityUtils;
|
|
25
25
|
const state = createPluginState(dispatch, {
|
|
26
26
|
pluginConfig,
|
|
@@ -261,7 +261,8 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
261
261
|
getEditorFeatureFlags,
|
|
262
262
|
dispatchAnalyticsEvent,
|
|
263
263
|
pluginInjectionApi,
|
|
264
|
-
isTableAlignmentEnabled
|
|
264
|
+
isTableAlignmentEnabled,
|
|
265
|
+
isCommentEditor
|
|
265
266
|
}),
|
|
266
267
|
tableRow: lazyTableRowView({
|
|
267
268
|
eventDispatcher
|
|
@@ -279,7 +280,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
279
280
|
mousedown: withCellTracking(handleMouseDown),
|
|
280
281
|
mouseover: withCellTracking(whenTableInFocus(handleMouseOver)),
|
|
281
282
|
mouseleave: handleMouseLeave,
|
|
282
|
-
mouseout: whenTableInFocus(handleMouseOut),
|
|
283
|
+
mouseout: fg('editor_react_18_fix_table_delete_col_decorations') ? undefined : whenTableInFocus(handleMouseOut),
|
|
283
284
|
mousemove: whenTableInFocus(handleMouseMove),
|
|
284
285
|
mouseenter: handleMouseEnter,
|
|
285
286
|
mouseup: whenTableInFocus(handleMouseUp),
|
package/dist/es2019/toolbar.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
3
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
7
|
import { jsx } from '@emotion/react';
|
|
5
8
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
3
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
7
|
import { jsx } from '@emotion/react';
|
|
5
8
|
import { useIntl } from 'react-intl-next';
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @jsxRuntime classic
|
|
5
|
+
* @jsx jsx
|
|
6
|
+
*/
|
|
4
7
|
import React, { Component } from 'react';
|
|
5
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
9
|
import { jsx } from '@emotion/react';
|
|
@@ -4,15 +4,20 @@ export const createTableWithWidth = ({
|
|
|
4
4
|
isTableScalingEnabled,
|
|
5
5
|
isTableAlignmentEnabled,
|
|
6
6
|
isFullWidthModeEnabled,
|
|
7
|
+
isCommentEditor,
|
|
8
|
+
isTableResizingEnabled,
|
|
7
9
|
createTableProps
|
|
8
10
|
}) => schema => {
|
|
9
11
|
const attrsOverrides = {};
|
|
10
|
-
if (isTableScalingEnabled && isFullWidthModeEnabled) {
|
|
12
|
+
if (isTableScalingEnabled && isFullWidthModeEnabled && !isCommentEditor) {
|
|
11
13
|
attrsOverrides.tableWidth = TABLE_MAX_WIDTH;
|
|
12
14
|
}
|
|
13
15
|
if (isTableAlignmentEnabled && isFullWidthModeEnabled) {
|
|
14
16
|
attrsOverrides.layout = 'align-start';
|
|
15
17
|
}
|
|
18
|
+
if (isCommentEditor && isTableResizingEnabled) {
|
|
19
|
+
attrsOverrides.tableWidth = 'inherit';
|
|
20
|
+
}
|
|
16
21
|
return createTable({
|
|
17
22
|
schema,
|
|
18
23
|
...createTableProps,
|
|
@@ -141,12 +141,14 @@ export var insertRow = function insertRow(row, moveCursorToTheNewRow, isCellBack
|
|
|
141
141
|
return true;
|
|
142
142
|
};
|
|
143
143
|
};
|
|
144
|
-
export var createTable = function createTable(isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI) {
|
|
144
|
+
export var createTable = function createTable(isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI, isCommentEditor, isTableResizingEnabled) {
|
|
145
145
|
return function (state, dispatch) {
|
|
146
146
|
var table = createTableWithWidth({
|
|
147
147
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
148
148
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
149
|
-
isFullWidthModeEnabled: isFullWidthModeEnabled
|
|
149
|
+
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
150
|
+
isCommentEditor: isCommentEditor,
|
|
151
|
+
isTableResizingEnabled: isTableResizingEnabled
|
|
150
152
|
})(state.schema);
|
|
151
153
|
if (dispatch) {
|
|
152
154
|
var tr = safeInsert(table)(state.tr).scrollIntoView();
|
|
@@ -166,7 +168,7 @@ export var createTable = function createTable(isTableScalingEnabled, isTableAlig
|
|
|
166
168
|
return true;
|
|
167
169
|
};
|
|
168
170
|
};
|
|
169
|
-
export var insertTableWithSize = function insertTableWithSize(isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI) {
|
|
171
|
+
export var insertTableWithSize = function insertTableWithSize(isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI, isCommentEditor) {
|
|
170
172
|
return function (rowsCount, colsCount, inputMethod) {
|
|
171
173
|
return function (_ref) {
|
|
172
174
|
var tr = _ref.tr;
|
|
@@ -174,6 +176,7 @@ export var insertTableWithSize = function insertTableWithSize(isFullWidthModeEna
|
|
|
174
176
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
175
177
|
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
176
178
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
179
|
+
isCommentEditor: isCommentEditor,
|
|
177
180
|
createTableProps: {
|
|
178
181
|
rowsCount: rowsCount,
|
|
179
182
|
colsCount: colsCount
|
|
@@ -25,9 +25,10 @@ import { tableMarginSides } from '@atlaskit/editor-common/styles';
|
|
|
25
25
|
import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
|
|
26
26
|
import { akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
|
|
27
27
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
28
|
-
import {
|
|
28
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
29
29
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
30
30
|
import { autoSizeTable, clearHoverSelection } from '../commands';
|
|
31
|
+
import { handleMouseOut, isTableInFocus } from '../event-handlers';
|
|
31
32
|
import { autoScrollerFactory } from '../pm-plugins/drag-and-drop/utils';
|
|
32
33
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
33
34
|
import { findStickyHeaderForTable, pluginKey as stickyHeadersPluginKey } from '../pm-plugins/sticky-headers';
|
|
@@ -67,6 +68,12 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
67
68
|
scroll: 0,
|
|
68
69
|
parentWidth: undefined
|
|
69
70
|
}, _defineProperty(_defineProperty2, ShadowEvent.SHOW_BEFORE_SHADOW, false), _defineProperty(_defineProperty2, ShadowEvent.SHOW_AFTER_SHADOW, false), _defineProperty(_defineProperty2, "tableWrapperWidth", undefined), _defineProperty(_defineProperty2, "tableWrapperHeight", undefined), _defineProperty2));
|
|
71
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseOut", function (event) {
|
|
72
|
+
if (!isTableInFocus(_this.props.view)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
return handleMouseOut(_this.props.view, event);
|
|
76
|
+
});
|
|
70
77
|
_defineProperty(_assertThisInitialized(_this), "handleMouseEnter", function () {
|
|
71
78
|
var node = _this.props.getNode();
|
|
72
79
|
var pos = _this.props.getPos();
|
|
@@ -348,7 +355,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
348
355
|
getNode = _this$props7.getNode,
|
|
349
356
|
getEditorFeatureFlags = _this$props7.getEditorFeatureFlags,
|
|
350
357
|
isTableScalingEnabled = _this$props7.isTableScalingEnabled;
|
|
351
|
-
if (
|
|
358
|
+
if (fg('platform.editor.table.live-pages-sorting_4malx')) {
|
|
352
359
|
var _this$props$pluginInj;
|
|
353
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()) || {},
|
|
354
361
|
mode = _ref.mode;
|
|
@@ -357,6 +364,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
357
364
|
this === null || this === void 0 || (_this$table = this.table) === null || _this$table === void 0 || _this$table.addEventListener('mouseenter', this.handleMouseEnter);
|
|
358
365
|
}
|
|
359
366
|
}
|
|
367
|
+
if (fg('editor_react_18_fix_table_delete_col_decorations')) {
|
|
368
|
+
var _this$table2;
|
|
369
|
+
this === null || this === void 0 || (_this$table2 = this.table) === null || _this$table2 === void 0 || _this$table2.addEventListener('mouseout', this.handleMouseOut);
|
|
370
|
+
}
|
|
360
371
|
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
361
372
|
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
|
|
362
373
|
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2,
|
|
@@ -437,9 +448,13 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
437
448
|
if (!(options !== null && options !== void 0 && options.isTableResizingEnabled) && allowColumnResizing) {
|
|
438
449
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
439
450
|
}
|
|
440
|
-
if (
|
|
441
|
-
var _this$
|
|
442
|
-
this === null || this === void 0 || (_this$
|
|
451
|
+
if (fg('platform.editor.table.live-pages-sorting_4malx')) {
|
|
452
|
+
var _this$table3;
|
|
453
|
+
this === null || this === void 0 || (_this$table3 = this.table) === null || _this$table3 === void 0 || _this$table3.removeEventListener('mouseenter', this.handleMouseEnter);
|
|
454
|
+
}
|
|
455
|
+
if (fg('editor_react_18_fix_table_delete_col_decorations')) {
|
|
456
|
+
var _this$table4;
|
|
457
|
+
this === null || this === void 0 || (_this$table4 = this.table) === null || _this$table4 === void 0 || _this$table4.removeEventListener('mouseout', this.handleMouseOut);
|
|
443
458
|
}
|
|
444
459
|
if (this.overflowShadowsObserver) {
|
|
445
460
|
this.overflowShadowsObserver.dispose();
|
|
@@ -495,7 +510,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
495
510
|
_getEditorFeatureFlag5 = _getEditorFeatureFlag4.tableWithFixedColumnWidthsOption,
|
|
496
511
|
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag5 === void 0 ? false : _getEditorFeatureFlag5;
|
|
497
512
|
var isTableScalingWithFixedColumnWidthsOptionEnabled = ((_this$props$options = this.props.options) === null || _this$props$options === void 0 ? void 0 : _this$props$options.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
|
|
498
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
513
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') || false;
|
|
499
514
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
500
515
|
var _this$props$options2;
|
|
501
516
|
var resizeState = getResizeState({
|
|
@@ -543,7 +558,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
543
558
|
getEditorFeatureFlags = _this$props10.getEditorFeatureFlags;
|
|
544
559
|
var isInDanger = this.props.isInDanger;
|
|
545
560
|
var table = findTable(view.state.selection);
|
|
546
|
-
if (!
|
|
561
|
+
if (!fg('platform.editor.table.use-shared-state-hook')) {
|
|
547
562
|
var pluginState = getPluginState(view.state);
|
|
548
563
|
isInDanger = pluginState.isInDanger;
|
|
549
564
|
}
|
|
@@ -557,7 +572,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
557
572
|
shouldHandleColgroupUpdates = true;
|
|
558
573
|
}
|
|
559
574
|
var isTableScalingWithFixedColumnWidthsOptionEnabled = isTableScalingEnabled && tableWithFixedColumnWidthsOption;
|
|
560
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
575
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent');
|
|
561
576
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled && getNode().attrs.displayMode !== 'fixed') {
|
|
562
577
|
shouldScale = true;
|
|
563
578
|
shouldHandleColgroupUpdates = true;
|
|
@@ -681,7 +696,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
681
696
|
showBeforeShadow = _this$state3.showBeforeShadow,
|
|
682
697
|
showAfterShadow = _this$state3.showAfterShadow;
|
|
683
698
|
var node = getNode();
|
|
684
|
-
if (!
|
|
699
|
+
if (!fg('platform.editor.table.use-shared-state-hook')) {
|
|
685
700
|
var pluginState = getPluginState(view.state);
|
|
686
701
|
isInDanger = pluginState.isInDanger;
|
|
687
702
|
hoveredRows = pluginState.hoveredRows;
|
|
@@ -768,7 +783,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
768
783
|
stickyScrollbar = _getEditorFeatureFlag8.stickyScrollbar,
|
|
769
784
|
_getEditorFeatureFlag9 = _getEditorFeatureFlag8.tableWithFixedColumnWidthsOption,
|
|
770
785
|
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag9 === void 0 ? false : _getEditorFeatureFlag9;
|
|
771
|
-
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption &&
|
|
786
|
+
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && fg('platform.editor.table.use-increased-scaling-percent');
|
|
772
787
|
return /*#__PURE__*/React.createElement(TableContainer
|
|
773
788
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
774
789
|
, {
|
|
@@ -787,7 +802,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
787
802
|
isTableWithFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
788
803
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
789
804
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
790
|
-
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
|
|
805
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
806
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
|
|
791
807
|
}, /*#__PURE__*/React.createElement("div", {
|
|
792
808
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
793
809
|
className: ClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
@@ -118,7 +118,8 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
118
118
|
isTableScalingEnabled = _ref4.isTableScalingEnabled,
|
|
119
119
|
isTableWithFixedColumnWidthsOptionEnabled = _ref4.isTableWithFixedColumnWidthsOptionEnabled,
|
|
120
120
|
isTableAlignmentEnabled = _ref4.isTableAlignmentEnabled,
|
|
121
|
-
shouldUseIncreasedScalingPercent = _ref4.shouldUseIncreasedScalingPercent
|
|
121
|
+
shouldUseIncreasedScalingPercent = _ref4.shouldUseIncreasedScalingPercent,
|
|
122
|
+
isCommentEditor = _ref4.isCommentEditor;
|
|
122
123
|
var containerRef = useRef(null);
|
|
123
124
|
var tableWidthRef = useRef(akEditorDefaultLayoutWidth);
|
|
124
125
|
var _useState = useState(false),
|
|
@@ -201,13 +202,13 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
201
202
|
// containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
|
|
202
203
|
// a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
|
|
203
204
|
// padding left = padding right = akEditorGutterPadding = 32
|
|
204
|
-
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - akEditorGutterPaddingDynamic() * 2 : containerWidth - akEditorGutterPaddingDynamic() * 2 - resizeHandleSpacing;
|
|
205
|
+
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - akEditorGutterPaddingDynamic() * 2 : containerWidth - akEditorGutterPaddingDynamic() * 2 - (isCommentEditor ? 0 : resizeHandleSpacing);
|
|
205
206
|
}
|
|
206
|
-
var width = Math.min(tableWidth, responsiveContainerWidth);
|
|
207
|
+
var width = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
207
208
|
if (!isResizing) {
|
|
208
209
|
tableWidthRef.current = width;
|
|
209
210
|
}
|
|
210
|
-
var maxResizerWidth = Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
|
|
211
|
+
var maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
|
|
211
212
|
var tableResizerProps = {
|
|
212
213
|
width: width,
|
|
213
214
|
maxWidth: maxResizerWidth,
|
|
@@ -282,7 +283,8 @@ export var TableContainer = function TableContainer(_ref6) {
|
|
|
282
283
|
isTableScalingEnabled = _ref6.isTableScalingEnabled,
|
|
283
284
|
isTableWithFixedColumnWidthsOptionEnabled = _ref6.isTableWithFixedColumnWidthsOptionEnabled,
|
|
284
285
|
isTableAlignmentEnabled = _ref6.isTableAlignmentEnabled,
|
|
285
|
-
shouldUseIncreasedScalingPercent = _ref6.shouldUseIncreasedScalingPercent
|
|
286
|
+
shouldUseIncreasedScalingPercent = _ref6.shouldUseIncreasedScalingPercent,
|
|
287
|
+
isCommentEditor = _ref6.isCommentEditor;
|
|
286
288
|
if (isTableResizingEnabled && !isNested) {
|
|
287
289
|
return /*#__PURE__*/React.createElement(ResizableTableContainer
|
|
288
290
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -301,7 +303,8 @@ export var TableContainer = function TableContainer(_ref6) {
|
|
|
301
303
|
isTableWithFixedColumnWidthsOptionEnabled: isTableWithFixedColumnWidthsOptionEnabled,
|
|
302
304
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
303
305
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
304
|
-
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
|
|
306
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
307
|
+
isCommentEditor: isCommentEditor
|
|
305
308
|
}, children);
|
|
306
309
|
}
|
|
307
310
|
return /*#__PURE__*/React.createElement(InnerContainer, {
|