@atlaskit/editor-plugin-table 7.16.18 → 7.16.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/commands/column-resize.js +4 -3
- package/dist/cjs/commands/delete.js +3 -2
- package/dist/cjs/commands/insert.js +12 -8
- package/dist/cjs/commands-with-analytics.js +10 -7
- package/dist/cjs/event-handlers.js +3 -2
- package/dist/cjs/nodeviews/TableComponent.js +32 -19
- package/dist/cjs/nodeviews/TableContainer.js +4 -0
- package/dist/cjs/nodeviews/TableResizer.js +3 -2
- package/dist/cjs/nodeviews/table.js +6 -4
- package/dist/cjs/plugin.js +9 -6
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +12 -13
- package/dist/cjs/pm-plugins/keymap.js +11 -9
- package/dist/cjs/pm-plugins/main.js +4 -1
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +10 -9
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +4 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +4 -3
- package/dist/cjs/toolbar.js +29 -20
- package/dist/cjs/transforms/column-width.js +3 -3
- package/dist/cjs/transforms/delete-columns.js +3 -2
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +21 -15
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +6 -3
- package/dist/cjs/ui/FloatingInsertButton/index.js +7 -8
- package/dist/cjs/utils/drag-menu.js +5 -4
- package/dist/es2019/commands/column-resize.js +4 -3
- package/dist/es2019/commands/delete.js +2 -2
- package/dist/es2019/commands/insert.js +8 -8
- package/dist/es2019/commands-with-analytics.js +9 -8
- package/dist/es2019/event-handlers.js +2 -2
- package/dist/es2019/nodeviews/TableComponent.js +28 -17
- package/dist/es2019/nodeviews/TableContainer.js +4 -0
- package/dist/es2019/nodeviews/TableResizer.js +3 -2
- package/dist/es2019/nodeviews/table.js +5 -4
- package/dist/es2019/plugin.js +9 -6
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +7 -10
- package/dist/es2019/pm-plugins/keymap.js +9 -9
- package/dist/es2019/pm-plugins/main.js +4 -1
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +10 -9
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +4 -4
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +4 -4
- package/dist/es2019/toolbar.js +25 -22
- package/dist/es2019/transforms/column-width.js +2 -3
- package/dist/es2019/transforms/delete-columns.js +2 -2
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +12 -7
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +5 -3
- package/dist/es2019/ui/FloatingInsertButton/index.js +6 -8
- package/dist/es2019/utils/drag-menu.js +4 -4
- package/dist/esm/commands/column-resize.js +4 -3
- package/dist/esm/commands/delete.js +3 -2
- package/dist/esm/commands/insert.js +12 -8
- package/dist/esm/commands-with-analytics.js +10 -7
- package/dist/esm/event-handlers.js +3 -2
- package/dist/esm/nodeviews/TableComponent.js +32 -19
- package/dist/esm/nodeviews/TableContainer.js +4 -0
- package/dist/esm/nodeviews/TableResizer.js +3 -2
- package/dist/esm/nodeviews/table.js +6 -4
- package/dist/esm/plugin.js +9 -6
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +12 -13
- package/dist/esm/pm-plugins/keymap.js +11 -9
- package/dist/esm/pm-plugins/main.js +4 -1
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +10 -9
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +4 -3
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +4 -3
- package/dist/esm/toolbar.js +29 -20
- package/dist/esm/transforms/column-width.js +3 -3
- package/dist/esm/transforms/delete-columns.js +3 -2
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +21 -15
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +6 -3
- package/dist/esm/ui/FloatingInsertButton/index.js +7 -8
- package/dist/esm/utils/drag-menu.js +5 -4
- package/dist/types/commands/column-resize.d.ts +2 -1
- package/dist/types/commands/delete.d.ts +1 -1
- package/dist/types/commands/insert.d.ts +4 -4
- package/dist/types/commands-with-analytics.d.ts +4 -4
- package/dist/types/event-handlers.d.ts +1 -1
- package/dist/types/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/nodeviews/table.d.ts +1 -0
- package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +1 -1
- package/dist/types/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
- package/dist/types/toolbar.d.ts +5 -5
- package/dist/types/transforms/column-width.d.ts +1 -1
- package/dist/types/transforms/delete-columns.d.ts +1 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
- package/dist/types/ui/FloatingInsertButton/index.d.ts +1 -0
- package/dist/types/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/commands/column-resize.d.ts +2 -1
- package/dist/types-ts4.5/commands/delete.d.ts +1 -1
- package/dist/types-ts4.5/commands/insert.d.ts +4 -4
- package/dist/types-ts4.5/commands-with-analytics.d.ts +4 -4
- package/dist/types-ts4.5/event-handlers.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
- package/dist/types-ts4.5/toolbar.d.ts +5 -5
- package/dist/types-ts4.5/transforms/column-width.d.ts +1 -1
- package/dist/types-ts4.5/transforms/delete-columns.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
- package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +1 -0
- package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
- package/package.json +2 -5
- package/src/commands/column-resize.ts +6 -6
- package/src/commands/delete.ts +7 -1
- package/src/commands/insert.ts +33 -5
- package/src/commands-with-analytics.ts +14 -2
- package/src/event-handlers.ts +2 -0
- package/src/nodeviews/TableComponent.tsx +28 -28
- package/src/nodeviews/TableContainer.tsx +6 -0
- package/src/nodeviews/TableResizer.tsx +4 -0
- package/src/nodeviews/table.tsx +4 -2
- package/src/plugin.tsx +17 -7
- package/src/pm-plugins/drag-and-drop/plugin.ts +26 -13
- package/src/pm-plugins/keymap.ts +30 -4
- package/src/pm-plugins/main.ts +2 -0
- package/src/pm-plugins/table-resizing/event-handlers.ts +12 -14
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +5 -5
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +6 -4
- package/src/toolbar.tsx +46 -12
- package/src/transforms/column-width.ts +7 -3
- package/src/transforms/delete-columns.ts +6 -2
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +12 -4
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
- package/src/ui/FloatingDragMenu/index.tsx +4 -4
- package/src/ui/FloatingInsertButton/index.tsx +12 -9
- package/src/utils/drag-menu.ts +13 -4
|
@@ -204,16 +204,15 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
) {
|
|
207
|
+
const { tableWithFixedColumnWidthsOption = false, stickyScrollbar } = getEditorFeatureFlags();
|
|
208
|
+
|
|
209
|
+
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
211
210
|
this.handleColgroupUpdates(true);
|
|
212
211
|
}
|
|
213
212
|
|
|
214
213
|
if (
|
|
215
214
|
isTableScalingEnabled &&
|
|
216
|
-
|
|
215
|
+
tableWithFixedColumnWidthsOption &&
|
|
217
216
|
getNode().attrs.displayMode !== 'fixed'
|
|
218
217
|
) {
|
|
219
218
|
this.handleColgroupUpdates(true);
|
|
@@ -224,8 +223,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
224
223
|
passive: true,
|
|
225
224
|
});
|
|
226
225
|
|
|
227
|
-
const { stickyScrollbar } = getEditorFeatureFlags();
|
|
228
|
-
|
|
229
226
|
if (stickyScrollbar) {
|
|
230
227
|
if (this.table) {
|
|
231
228
|
this.stickyScrollbar = new TableStickyScrollbar(this.wrapper, this.props.view);
|
|
@@ -332,7 +329,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
332
329
|
};
|
|
333
330
|
|
|
334
331
|
handleColgroupUpdates(force = false) {
|
|
335
|
-
const { getNode, containerWidth, isResizing, view, getPos } = this.props;
|
|
332
|
+
const { getNode, containerWidth, isResizing, view, getPos, getEditorFeatureFlags } = this.props;
|
|
336
333
|
|
|
337
334
|
if (!this.table) {
|
|
338
335
|
return;
|
|
@@ -383,12 +380,13 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
383
380
|
isNumberColumnChanged ||
|
|
384
381
|
isNumberOfColumnsChanged;
|
|
385
382
|
|
|
386
|
-
const
|
|
387
|
-
|
|
388
|
-
|
|
383
|
+
const { tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags();
|
|
384
|
+
|
|
385
|
+
const isTableScalingWithFixedColumnWidthsOptionEnabled =
|
|
386
|
+
this.props.options?.isTableScalingEnabled && tableWithFixedColumnWidthsOption;
|
|
389
387
|
|
|
390
388
|
const shouldUseIncreasedScalingPercent =
|
|
391
|
-
(
|
|
389
|
+
(isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
392
390
|
getBooleanFF('platform.editor.table.use-increased-scaling-percent')) ||
|
|
393
391
|
false;
|
|
394
392
|
|
|
@@ -405,14 +403,14 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
405
403
|
});
|
|
406
404
|
|
|
407
405
|
let shouldScaleOnColgroupUpdate = false;
|
|
408
|
-
if (
|
|
409
|
-
this.props.options?.isTableScalingEnabled &&
|
|
410
|
-
!getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')
|
|
411
|
-
) {
|
|
406
|
+
if (this.props.options?.isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
412
407
|
shouldScaleOnColgroupUpdate = true;
|
|
413
408
|
}
|
|
414
409
|
|
|
415
|
-
if (
|
|
410
|
+
if (
|
|
411
|
+
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
412
|
+
tableNode.attrs.displayMode !== 'fixed'
|
|
413
|
+
) {
|
|
416
414
|
shouldScaleOnColgroupUpdate = true;
|
|
417
415
|
}
|
|
418
416
|
|
|
@@ -443,6 +441,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
443
441
|
options,
|
|
444
442
|
isTableScalingEnabled, // we could use options.isTableScalingEnabled here
|
|
445
443
|
getPos,
|
|
444
|
+
getEditorFeatureFlags,
|
|
446
445
|
} = this.props;
|
|
447
446
|
let { isInDanger } = this.props;
|
|
448
447
|
|
|
@@ -455,23 +454,23 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
455
454
|
|
|
456
455
|
let shouldScale = false;
|
|
457
456
|
let shouldHandleColgroupUpdates = false;
|
|
457
|
+
const { tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags();
|
|
458
458
|
|
|
459
|
-
if (
|
|
460
|
-
isTableScalingEnabled &&
|
|
461
|
-
!getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')
|
|
462
|
-
) {
|
|
459
|
+
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
463
460
|
shouldScale = true;
|
|
464
461
|
shouldHandleColgroupUpdates = true;
|
|
465
462
|
}
|
|
466
463
|
|
|
467
|
-
const
|
|
468
|
-
isTableScalingEnabled &&
|
|
469
|
-
getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
|
|
464
|
+
const isTableScalingWithFixedColumnWidthsOptionEnabled =
|
|
465
|
+
isTableScalingEnabled && tableWithFixedColumnWidthsOption;
|
|
470
466
|
const shouldUseIncreasedScalingPercent =
|
|
471
|
-
|
|
467
|
+
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
472
468
|
getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
473
469
|
|
|
474
|
-
if (
|
|
470
|
+
if (
|
|
471
|
+
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
472
|
+
getNode().attrs.displayMode !== 'fixed'
|
|
473
|
+
) {
|
|
475
474
|
shouldScale = true;
|
|
476
475
|
shouldHandleColgroupUpdates = true;
|
|
477
476
|
}
|
|
@@ -743,11 +742,11 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
743
742
|
: this.state.stickyHeader &&
|
|
744
743
|
this.state.stickyHeader.top + this.state.stickyHeader.padding + shadowPadding + 2;
|
|
745
744
|
|
|
746
|
-
const { stickyScrollbar } = getEditorFeatureFlags();
|
|
745
|
+
const { stickyScrollbar, tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags();
|
|
747
746
|
|
|
748
747
|
const shouldUseIncreasedScalingPercent =
|
|
749
748
|
isTableScalingEnabled &&
|
|
750
|
-
|
|
749
|
+
tableWithFixedColumnWidthsOption &&
|
|
751
750
|
getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
752
751
|
|
|
753
752
|
return (
|
|
@@ -770,6 +769,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
770
769
|
isTableResizingEnabled={options?.isTableResizingEnabled}
|
|
771
770
|
isResizing={isResizing}
|
|
772
771
|
isTableScalingEnabled={isTableScalingEnabled}
|
|
772
|
+
isTableWithFixedColumnWidthsOptionEnabled={tableWithFixedColumnWidthsOption}
|
|
773
773
|
isWholeTableInDanger={isWholeTableInDanger}
|
|
774
774
|
isTableAlignmentEnabled={isTableAlignmentEnabled}
|
|
775
775
|
shouldUseIncreasedScalingPercent={shouldUseIncreasedScalingPercent}
|
|
@@ -171,6 +171,7 @@ type ResizableTableContainerProps = {
|
|
|
171
171
|
isWholeTableInDanger?: boolean;
|
|
172
172
|
|
|
173
173
|
isTableScalingEnabled?: boolean;
|
|
174
|
+
isTableWithFixedColumnWidthsOptionEnabled?: boolean;
|
|
174
175
|
isTableAlignmentEnabled?: boolean;
|
|
175
176
|
shouldUseIncreasedScalingPercent?: boolean;
|
|
176
177
|
};
|
|
@@ -190,6 +191,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
190
191
|
tableWrapperHeight,
|
|
191
192
|
isWholeTableInDanger,
|
|
192
193
|
isTableScalingEnabled,
|
|
194
|
+
isTableWithFixedColumnWidthsOptionEnabled,
|
|
193
195
|
isTableAlignmentEnabled,
|
|
194
196
|
shouldUseIncreasedScalingPercent,
|
|
195
197
|
}: PropsWithChildren<ResizableTableContainerProps>) => {
|
|
@@ -319,6 +321,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
319
321
|
isTableAlignmentEnabled,
|
|
320
322
|
isFullWidthModeEnabled,
|
|
321
323
|
isTableScalingEnabled,
|
|
324
|
+
isTableWithFixedColumnWidthsOptionEnabled,
|
|
322
325
|
isWholeTableInDanger,
|
|
323
326
|
shouldUseIncreasedScalingPercent,
|
|
324
327
|
pluginInjectionApi,
|
|
@@ -385,6 +388,7 @@ type TableContainerProps = {
|
|
|
385
388
|
|
|
386
389
|
isTableResizingEnabled: boolean | undefined;
|
|
387
390
|
isTableScalingEnabled?: boolean;
|
|
391
|
+
isTableWithFixedColumnWidthsOptionEnabled?: boolean;
|
|
388
392
|
isTableAlignmentEnabled?: boolean;
|
|
389
393
|
shouldUseIncreasedScalingPercent?: boolean;
|
|
390
394
|
};
|
|
@@ -404,6 +408,7 @@ export const TableContainer = ({
|
|
|
404
408
|
isWholeTableInDanger,
|
|
405
409
|
isTableResizingEnabled,
|
|
406
410
|
isTableScalingEnabled,
|
|
411
|
+
isTableWithFixedColumnWidthsOptionEnabled,
|
|
407
412
|
isTableAlignmentEnabled,
|
|
408
413
|
shouldUseIncreasedScalingPercent,
|
|
409
414
|
}: PropsWithChildren<TableContainerProps>) => {
|
|
@@ -422,6 +427,7 @@ export const TableContainer = ({
|
|
|
422
427
|
isResizing={isResizing}
|
|
423
428
|
pluginInjectionApi={pluginInjectionApi}
|
|
424
429
|
isTableScalingEnabled={isTableScalingEnabled}
|
|
430
|
+
isTableWithFixedColumnWidthsOptionEnabled={isTableWithFixedColumnWidthsOptionEnabled}
|
|
425
431
|
isWholeTableInDanger={isWholeTableInDanger}
|
|
426
432
|
isTableAlignmentEnabled={isTableAlignmentEnabled}
|
|
427
433
|
shouldUseIncreasedScalingPercent={shouldUseIncreasedScalingPercent}
|
|
@@ -78,6 +78,7 @@ interface TableResizerProps {
|
|
|
78
78
|
displayGapCursor: (toggle: boolean) => boolean;
|
|
79
79
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
80
80
|
isTableScalingEnabled?: boolean;
|
|
81
|
+
isTableWithFixedColumnWidthsOptionEnabled?: boolean;
|
|
81
82
|
isTableAlignmentEnabled?: boolean;
|
|
82
83
|
isWholeTableInDanger?: boolean;
|
|
83
84
|
isFullWidthModeEnabled?: boolean;
|
|
@@ -193,6 +194,7 @@ export const TableResizer = ({
|
|
|
193
194
|
attachAnalyticsEvent,
|
|
194
195
|
displayGapCursor,
|
|
195
196
|
isTableScalingEnabled,
|
|
197
|
+
isTableWithFixedColumnWidthsOptionEnabled,
|
|
196
198
|
isTableAlignmentEnabled,
|
|
197
199
|
isWholeTableInDanger,
|
|
198
200
|
shouldUseIncreasedScalingPercent,
|
|
@@ -413,6 +415,7 @@ export const TableResizer = ({
|
|
|
413
415
|
},
|
|
414
416
|
editorView.domAtPos.bind(editorView),
|
|
415
417
|
isTableScalingEnabled,
|
|
418
|
+
isTableWithFixedColumnWidthsOptionEnabled,
|
|
416
419
|
);
|
|
417
420
|
|
|
418
421
|
const editorContainerWidth = isFullWidthModeEnabled
|
|
@@ -470,6 +473,7 @@ export const TableResizer = ({
|
|
|
470
473
|
[
|
|
471
474
|
countFrames,
|
|
472
475
|
isTableScalingEnabled,
|
|
476
|
+
isTableWithFixedColumnWidthsOptionEnabled,
|
|
473
477
|
isFullWidthModeEnabled,
|
|
474
478
|
excludeGuidelineConfig,
|
|
475
479
|
tableRef,
|
package/src/nodeviews/table.tsx
CHANGED
|
@@ -92,6 +92,7 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
92
92
|
eventDispatcher?: EventDispatcher;
|
|
93
93
|
getPos: getPosHandlerNode;
|
|
94
94
|
options;
|
|
95
|
+
getEditorFeatureFlags;
|
|
95
96
|
|
|
96
97
|
constructor(props: Props) {
|
|
97
98
|
super(
|
|
@@ -109,6 +110,7 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
109
110
|
this.getPos = props.getPos;
|
|
110
111
|
this.eventDispatcher = props.eventDispatcher;
|
|
111
112
|
this.options = props.options;
|
|
113
|
+
this.getEditorFeatureFlags = props.getEditorFeatureFlags;
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
getContentDOM() {
|
|
@@ -126,7 +128,7 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
126
128
|
if (
|
|
127
129
|
!this.options?.isTableScalingEnabled ||
|
|
128
130
|
(this.options?.isTableScalingEnabled &&
|
|
129
|
-
|
|
131
|
+
this.getEditorFeatureFlags?.().tableWithFixedColumnWidthsOption &&
|
|
130
132
|
this.node.attrs.displayMode === 'fixed')
|
|
131
133
|
) {
|
|
132
134
|
const tableInlineWidth = getInlineWidth(
|
|
@@ -157,7 +159,7 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
157
159
|
if (
|
|
158
160
|
!this.options?.isTableScalingEnabled ||
|
|
159
161
|
(this.options?.isTableScalingEnabled &&
|
|
160
|
-
|
|
162
|
+
this.getEditorFeatureFlags?.().tableWithFixedColumnWidthsOption &&
|
|
161
163
|
node.attrs.displayMode === 'fixed')
|
|
162
164
|
) {
|
|
163
165
|
// handle inline style when table been resized
|
package/src/plugin.tsx
CHANGED
|
@@ -153,13 +153,15 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
153
153
|
};
|
|
154
154
|
const editorAnalyticsAPI = api?.analytics?.actions;
|
|
155
155
|
|
|
156
|
-
const
|
|
157
|
-
options?.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
156
|
+
const isTableFixedColumnWidthsOptionEnabled =
|
|
157
|
+
options?.getEditorFeatureFlags?.().tableWithFixedColumnWidthsOption || false;
|
|
158
|
+
const shouldUseIncreasedScalingPercent = options?.isTableScalingEnabled;
|
|
159
|
+
isTableFixedColumnWidthsOptionEnabled &&
|
|
161
160
|
getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
162
161
|
|
|
162
|
+
const isCellBackgroundDuplicated =
|
|
163
|
+
options?.getEditorFeatureFlags?.().tableDuplicateCellColouring || false;
|
|
164
|
+
|
|
163
165
|
return {
|
|
164
166
|
name: 'table',
|
|
165
167
|
|
|
@@ -331,6 +333,8 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
331
333
|
fullWidthEnabled,
|
|
332
334
|
api,
|
|
333
335
|
getIntl,
|
|
336
|
+
isCellBackgroundDuplicated,
|
|
337
|
+
isTableFixedColumnWidthsOptionEnabled,
|
|
334
338
|
shouldUseIncreasedScalingPercent,
|
|
335
339
|
);
|
|
336
340
|
},
|
|
@@ -371,7 +375,12 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
371
375
|
name: 'tableDragAndDrop',
|
|
372
376
|
plugin: ({ dispatch }) => {
|
|
373
377
|
return options?.dragAndDropEnabled
|
|
374
|
-
? createDragAndDropPlugin(
|
|
378
|
+
? createDragAndDropPlugin(
|
|
379
|
+
dispatch,
|
|
380
|
+
editorAnalyticsAPI,
|
|
381
|
+
options?.isTableScalingEnabled,
|
|
382
|
+
isTableFixedColumnWidthsOptionEnabled,
|
|
383
|
+
)
|
|
375
384
|
: undefined;
|
|
376
385
|
},
|
|
377
386
|
},
|
|
@@ -533,6 +542,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
533
542
|
isHeaderColumnEnabled={isHeaderColumnEnabled}
|
|
534
543
|
isHeaderRowEnabled={isHeaderRowEnabled}
|
|
535
544
|
isDragAndDropEnabled={isDragAndDropEnabled}
|
|
545
|
+
isTableScalingEnabled={options?.isTableScalingEnabled}
|
|
536
546
|
editorView={editorView}
|
|
537
547
|
mountPoint={popupsMountPoint}
|
|
538
548
|
boundariesElement={popupsBoundariesElement}
|
|
@@ -662,7 +672,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
662
672
|
options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags,
|
|
663
673
|
() => editorViewRef.current,
|
|
664
674
|
options,
|
|
665
|
-
|
|
675
|
+
isTableFixedColumnWidthsOptionEnabled,
|
|
666
676
|
shouldUseIncreasedScalingPercent,
|
|
667
677
|
)(pluginConfig(options?.tableOptions)),
|
|
668
678
|
},
|
|
@@ -29,7 +29,12 @@ import { createPluginState, getPluginState } from './plugin-factory';
|
|
|
29
29
|
import { pluginKey } from './plugin-key';
|
|
30
30
|
import { getDraggableDataFromEvent } from './utils/monitor';
|
|
31
31
|
|
|
32
|
-
const destroyFn = (
|
|
32
|
+
const destroyFn = (
|
|
33
|
+
editorView: EditorView,
|
|
34
|
+
editorAnalyticsAPI: any,
|
|
35
|
+
isTableScalingEnabled: boolean,
|
|
36
|
+
isTableFixedColumnWidthsOptionEnabled: boolean,
|
|
37
|
+
) => {
|
|
33
38
|
const editorPageScrollContainer = document.querySelector('.fabric-editor-popup-scroll-parent');
|
|
34
39
|
|
|
35
40
|
const rowAutoScrollers = editorPageScrollContainer
|
|
@@ -211,24 +216,22 @@ const destroyFn = (editorView: EditorView, editorAnalyticsAPI: any) => {
|
|
|
211
216
|
if (sourceType === 'table-column') {
|
|
212
217
|
const { tableRef, tableNode } = getTablePluginState(editorView.state);
|
|
213
218
|
if (tableRef && tableNode) {
|
|
214
|
-
const { isTableScalingEnabled = false } = getTablePluginState(editorView.state);
|
|
215
|
-
|
|
216
219
|
let isTableScalingEnabledOnCurrentTable = isTableScalingEnabled;
|
|
217
|
-
const
|
|
218
|
-
isTableScalingEnabled &&
|
|
219
|
-
|
|
220
|
-
const shouldUseIncreasedScalingPercent =
|
|
221
|
-
isTableScalingEnabledWithLockButton &&
|
|
222
|
-
getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
223
|
-
|
|
224
|
-
if (isTableScalingEnabledWithLockButton) {
|
|
220
|
+
const isTableScalingWithFixedColumnWidthsOptionEnabled =
|
|
221
|
+
isTableScalingEnabled && isTableFixedColumnWidthsOptionEnabled;
|
|
222
|
+
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
225
223
|
isTableScalingEnabledOnCurrentTable = tableNode.attrs.displayMode !== 'fixed';
|
|
226
224
|
}
|
|
227
225
|
|
|
226
|
+
const shouldUseIncreasedScalingPercent =
|
|
227
|
+
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
228
|
+
getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
229
|
+
|
|
228
230
|
insertColgroupFromNode(
|
|
229
231
|
tableRef,
|
|
230
232
|
tableNode,
|
|
231
233
|
isTableScalingEnabledOnCurrentTable,
|
|
234
|
+
undefined,
|
|
232
235
|
shouldUseIncreasedScalingPercent,
|
|
233
236
|
);
|
|
234
237
|
}
|
|
@@ -241,7 +244,12 @@ const destroyFn = (editorView: EditorView, editorAnalyticsAPI: any) => {
|
|
|
241
244
|
);
|
|
242
245
|
};
|
|
243
246
|
|
|
244
|
-
export const createPlugin = (
|
|
247
|
+
export const createPlugin = (
|
|
248
|
+
dispatch: Dispatch,
|
|
249
|
+
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
250
|
+
isTableScalingEnabled = false,
|
|
251
|
+
isTableFixedColumnWidthsOptionEnabled = false,
|
|
252
|
+
) => {
|
|
245
253
|
return new SafePlugin({
|
|
246
254
|
state: createPluginState(dispatch, (state) => ({
|
|
247
255
|
decorationSet: DecorationSet.empty,
|
|
@@ -310,7 +318,12 @@ export const createPlugin = (dispatch: Dispatch, editorAnalyticsAPI?: EditorAnal
|
|
|
310
318
|
},
|
|
311
319
|
view: (editorView: EditorView) => {
|
|
312
320
|
return {
|
|
313
|
-
destroy: destroyFn(
|
|
321
|
+
destroy: destroyFn(
|
|
322
|
+
editorView,
|
|
323
|
+
editorAnalyticsAPI,
|
|
324
|
+
isTableScalingEnabled,
|
|
325
|
+
isTableFixedColumnWidthsOptionEnabled,
|
|
326
|
+
),
|
|
314
327
|
};
|
|
315
328
|
},
|
|
316
329
|
props: {
|
package/src/pm-plugins/keymap.ts
CHANGED
|
@@ -65,6 +65,8 @@ export function keymapPlugin(
|
|
|
65
65
|
isFullWidthEnabled?: boolean,
|
|
66
66
|
pluginInjectionApi?: PluginInjectionAPIWithA11y,
|
|
67
67
|
getIntl?: () => IntlShape,
|
|
68
|
+
isCellBackgroundDuplicated = false,
|
|
69
|
+
isTableFixedColumnWidthsOptionEnabled = false,
|
|
68
70
|
shouldUseIncreasedScalingPercent?: boolean,
|
|
69
71
|
): SafePlugin {
|
|
70
72
|
const list = {};
|
|
@@ -116,13 +118,23 @@ export function keymapPlugin(
|
|
|
116
118
|
|
|
117
119
|
bindKeymapWithCommand(
|
|
118
120
|
addColumnBefore.common!,
|
|
119
|
-
addColumnBeforeCommand(
|
|
121
|
+
addColumnBeforeCommand(
|
|
122
|
+
isTableScalingEnabled,
|
|
123
|
+
isCellBackgroundDuplicated,
|
|
124
|
+
isTableFixedColumnWidthsOptionEnabled,
|
|
125
|
+
shouldUseIncreasedScalingPercent,
|
|
126
|
+
),
|
|
120
127
|
list,
|
|
121
128
|
);
|
|
122
129
|
|
|
123
130
|
bindKeymapWithCommand(
|
|
124
131
|
addColumnAfter.common!,
|
|
125
|
-
addColumnAfterCommand(
|
|
132
|
+
addColumnAfterCommand(
|
|
133
|
+
isTableScalingEnabled,
|
|
134
|
+
isCellBackgroundDuplicated,
|
|
135
|
+
isTableFixedColumnWidthsOptionEnabled,
|
|
136
|
+
shouldUseIncreasedScalingPercent,
|
|
137
|
+
),
|
|
126
138
|
list,
|
|
127
139
|
);
|
|
128
140
|
|
|
@@ -141,13 +153,23 @@ export function keymapPlugin(
|
|
|
141
153
|
|
|
142
154
|
bindKeymapWithCommand(
|
|
143
155
|
addColumnBeforeVO.common!,
|
|
144
|
-
addColumnBeforeCommand(
|
|
156
|
+
addColumnBeforeCommand(
|
|
157
|
+
isTableScalingEnabled,
|
|
158
|
+
isCellBackgroundDuplicated,
|
|
159
|
+
isTableFixedColumnWidthsOptionEnabled,
|
|
160
|
+
shouldUseIncreasedScalingPercent,
|
|
161
|
+
),
|
|
145
162
|
list,
|
|
146
163
|
);
|
|
147
164
|
|
|
148
165
|
bindKeymapWithCommand(
|
|
149
166
|
addColumnAfterVO.common!,
|
|
150
|
-
addColumnAfterCommand(
|
|
167
|
+
addColumnAfterCommand(
|
|
168
|
+
isTableScalingEnabled,
|
|
169
|
+
isCellBackgroundDuplicated,
|
|
170
|
+
isTableFixedColumnWidthsOptionEnabled,
|
|
171
|
+
shouldUseIncreasedScalingPercent,
|
|
172
|
+
),
|
|
151
173
|
list,
|
|
152
174
|
);
|
|
153
175
|
}
|
|
@@ -191,6 +213,7 @@ export function keymapPlugin(
|
|
|
191
213
|
deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(
|
|
192
214
|
editorAnalyticsAPI,
|
|
193
215
|
isTableScalingEnabled,
|
|
216
|
+
isTableFixedColumnWidthsOptionEnabled,
|
|
194
217
|
shouldUseIncreasedScalingPercent,
|
|
195
218
|
),
|
|
196
219
|
list,
|
|
@@ -201,6 +224,7 @@ export function keymapPlugin(
|
|
|
201
224
|
deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(
|
|
202
225
|
editorAnalyticsAPI,
|
|
203
226
|
isTableScalingEnabled,
|
|
227
|
+
isTableFixedColumnWidthsOptionEnabled,
|
|
204
228
|
shouldUseIncreasedScalingPercent,
|
|
205
229
|
),
|
|
206
230
|
list,
|
|
@@ -243,6 +267,7 @@ export function keymapPlugin(
|
|
|
243
267
|
-10,
|
|
244
268
|
getEditorContainerWidth,
|
|
245
269
|
isTableScalingEnabled,
|
|
270
|
+
isTableFixedColumnWidthsOptionEnabled,
|
|
246
271
|
INPUT_METHOD.SHORTCUT,
|
|
247
272
|
ariaNotifyPlugin,
|
|
248
273
|
getIntl,
|
|
@@ -256,6 +281,7 @@ export function keymapPlugin(
|
|
|
256
281
|
10,
|
|
257
282
|
getEditorContainerWidth,
|
|
258
283
|
isTableScalingEnabled,
|
|
284
|
+
isTableFixedColumnWidthsOptionEnabled,
|
|
259
285
|
INPUT_METHOD.SHORTCUT,
|
|
260
286
|
ariaNotifyPlugin,
|
|
261
287
|
getIntl,
|
package/src/pm-plugins/main.ts
CHANGED
|
@@ -158,6 +158,7 @@ export const createPlugin = (
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
if (tr) {
|
|
161
|
+
const { tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags();
|
|
161
162
|
// "fixTables" removes empty rows as we don't allow that in schema
|
|
162
163
|
const updatedTr = handleCut(
|
|
163
164
|
tr,
|
|
@@ -166,6 +167,7 @@ export const createPlugin = (
|
|
|
166
167
|
editorAnalyticsAPI,
|
|
167
168
|
editorViewRef || undefined,
|
|
168
169
|
isTableScalingEnabled,
|
|
170
|
+
tableWithFixedColumnWidthsOption,
|
|
169
171
|
shouldUseIncreasedScalingPercent,
|
|
170
172
|
);
|
|
171
173
|
return fixTables(updatedTr) || updatedTr;
|
|
@@ -84,10 +84,12 @@ export const handleMouseDown = (
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
let shouldScale = tableDepth === 0 && isTableScalingEnabled;
|
|
87
|
+
const { tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags();
|
|
87
88
|
|
|
88
|
-
const
|
|
89
|
-
isTableScalingEnabled &&
|
|
90
|
-
|
|
89
|
+
const isTableScalingWithFixedColumnWidthsOptionEnabled =
|
|
90
|
+
isTableScalingEnabled && tableWithFixedColumnWidthsOption;
|
|
91
|
+
|
|
92
|
+
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
91
93
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
92
94
|
}
|
|
93
95
|
|
|
@@ -100,7 +102,7 @@ export const handleMouseDown = (
|
|
|
100
102
|
domAtPos,
|
|
101
103
|
isTableScalingEnabled: shouldScale,
|
|
102
104
|
shouldUseIncreasedScalingPercent:
|
|
103
|
-
|
|
105
|
+
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
104
106
|
getBooleanFF('platform.editor.table.use-increased-scaling-percent'),
|
|
105
107
|
});
|
|
106
108
|
|
|
@@ -183,10 +185,8 @@ export const handleMouseDown = (
|
|
|
183
185
|
selectedColumns.indexOf(colIndex) > -1 || selectedColumns.indexOf(colIndex + 1) > -1;
|
|
184
186
|
|
|
185
187
|
let shouldScale = tableDepth === 0 && isTableScalingEnabled;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
|
|
189
|
-
if (isTableScalingEnabledWithLockButton) {
|
|
188
|
+
|
|
189
|
+
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
190
190
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
191
191
|
}
|
|
192
192
|
|
|
@@ -213,7 +213,7 @@ export const handleMouseDown = (
|
|
|
213
213
|
originalTable,
|
|
214
214
|
resizingSelectedColumns ? selectedColumns : undefined,
|
|
215
215
|
shouldScale,
|
|
216
|
-
|
|
216
|
+
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
217
217
|
getBooleanFF('platform.editor.table.use-increased-scaling-percent'),
|
|
218
218
|
);
|
|
219
219
|
tr = updateColumnWidths(newResizeState, table, start)(tr);
|
|
@@ -289,13 +289,11 @@ export const handleMouseDown = (
|
|
|
289
289
|
const colIndex = map.colCount($cell.pos - $cell.start(-1)) + $cell.nodeAfter!.attrs.colspan - 1;
|
|
290
290
|
|
|
291
291
|
let shouldScale = tableDepth === 0 && isTableScalingEnabled;
|
|
292
|
-
|
|
293
|
-
isTableScalingEnabled &&
|
|
294
|
-
getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
|
|
292
|
+
|
|
295
293
|
const shouldUseIncreasedScalingPercent =
|
|
296
|
-
|
|
294
|
+
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
297
295
|
getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
298
|
-
if (
|
|
296
|
+
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
299
297
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
300
298
|
}
|
|
301
299
|
|
|
@@ -325,6 +325,7 @@ export const getNewResizeStateFromSelectedColumns = (
|
|
|
325
325
|
domAtPos: (pos: number) => { node: Node; offset: number },
|
|
326
326
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
327
327
|
isTableScalingEnabled = false,
|
|
328
|
+
isTableFixedColumnWidthsOptionEnabled = false,
|
|
328
329
|
): ResizeStateWithAnalytics | undefined => {
|
|
329
330
|
// Fail early so that we don't do complex calculations for no reason
|
|
330
331
|
const numColumnsSelected = rect.right - rect.left;
|
|
@@ -367,10 +368,9 @@ export const getNewResizeStateFromSelectedColumns = (
|
|
|
367
368
|
let resizeState;
|
|
368
369
|
|
|
369
370
|
let isTableScalingEnabledOnCurrentTable = isTableScalingEnabled;
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
if (isTableScalingEnabledWithLockButton) {
|
|
371
|
+
const isTableScalingWithFixedColumnWidthsOptionEnabled =
|
|
372
|
+
isTableScalingEnabled && isTableFixedColumnWidthsOptionEnabled;
|
|
373
|
+
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
374
374
|
isTableScalingEnabledOnCurrentTable = table.node.attrs.displayMode !== 'fixed';
|
|
375
375
|
}
|
|
376
376
|
|
|
@@ -383,7 +383,7 @@ export const getNewResizeStateFromSelectedColumns = (
|
|
|
383
383
|
domAtPos,
|
|
384
384
|
isTableScalingEnabled: isTableScalingEnabledOnCurrentTable,
|
|
385
385
|
shouldUseIncreasedScalingPercent:
|
|
386
|
-
|
|
386
|
+
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
387
387
|
getBooleanFF('platform.editor.table.use-increased-scaling-percent'),
|
|
388
388
|
});
|
|
389
389
|
|
|
@@ -153,6 +153,7 @@ export const previewScaleTable = (
|
|
|
153
153
|
options: ScaleOptions,
|
|
154
154
|
domAtPos: DomAtPos,
|
|
155
155
|
isTableScalingEnabled: boolean = false,
|
|
156
|
+
isTableWithFixedColumnWidthsOptionEnabled: boolean = false,
|
|
156
157
|
) => {
|
|
157
158
|
const { node, start, parentWidth } = options;
|
|
158
159
|
|
|
@@ -169,9 +170,10 @@ export const previewScaleTable = (
|
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
let isTableScalingEnabledOnCurrentTable = isTableScalingEnabled;
|
|
172
|
-
const
|
|
173
|
-
isTableScalingEnabled &&
|
|
174
|
-
|
|
173
|
+
const isTableScalingWithFixedColumnWidthsOptionEnabled =
|
|
174
|
+
isTableScalingEnabled && isTableWithFixedColumnWidthsOptionEnabled;
|
|
175
|
+
|
|
176
|
+
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
175
177
|
isTableScalingEnabledOnCurrentTable =
|
|
176
178
|
isTableScalingEnabled && node.attrs.displayMode !== 'fixed';
|
|
177
179
|
}
|
|
@@ -183,7 +185,7 @@ export const previewScaleTable = (
|
|
|
183
185
|
}
|
|
184
186
|
|
|
185
187
|
const shouldUseIncreasedScalingPercent =
|
|
186
|
-
|
|
188
|
+
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
187
189
|
getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
188
190
|
|
|
189
191
|
const resizeState = parentWidth
|