@atlaskit/editor-plugin-table 7.5.4 → 7.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/commands/column-resize.js +3 -3
- package/dist/cjs/commands/delete.js +2 -2
- package/dist/cjs/commands/insert.js +15 -15
- package/dist/cjs/commands-with-analytics.js +7 -7
- package/dist/cjs/event-handlers.js +2 -2
- package/dist/cjs/nodeviews/TableComponent.js +46 -59
- package/dist/cjs/nodeviews/TableContainer.js +5 -5
- package/dist/cjs/nodeviews/TableResizer.js +12 -12
- package/dist/cjs/nodeviews/table.js +9 -9
- package/dist/cjs/plugin.js +58 -56
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +13 -13
- package/dist/cjs/pm-plugins/keymap.js +6 -8
- package/dist/cjs/pm-plugins/main.js +4 -6
- package/dist/cjs/pm-plugins/sticky-headers/plugin.js +2 -3
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +12 -12
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/consts.js +4 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/index.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +3 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +3 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +11 -12
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +13 -13
- package/dist/cjs/pm-plugins/table-width.js +6 -2
- package/dist/cjs/toolbar.js +21 -21
- package/dist/cjs/transforms/column-width.js +4 -4
- package/dist/cjs/transforms/delete-columns.js +2 -2
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +53 -55
- package/dist/cjs/ui/FloatingContextualMenu/index.js +2 -4
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +2 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +6 -6
- package/dist/cjs/ui/FloatingInsertButton/index.js +6 -7
- package/dist/cjs/utils/create.js +2 -5
- package/dist/cjs/utils/drag-menu.js +4 -4
- package/dist/es2019/commands/column-resize.js +3 -3
- package/dist/es2019/commands/delete.js +2 -2
- package/dist/es2019/commands/insert.js +12 -12
- package/dist/es2019/commands-with-analytics.js +6 -6
- package/dist/es2019/event-handlers.js +2 -2
- package/dist/es2019/nodeviews/TableComponent.js +25 -36
- package/dist/es2019/nodeviews/TableContainer.js +5 -5
- package/dist/es2019/nodeviews/TableResizer.js +12 -12
- package/dist/es2019/nodeviews/table.js +9 -9
- package/dist/es2019/plugin.js +17 -17
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +6 -6
- package/dist/es2019/pm-plugins/keymap.js +5 -8
- package/dist/es2019/pm-plugins/main.js +3 -5
- package/dist/es2019/pm-plugins/sticky-headers/plugin.js +1 -1
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +5 -5
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/consts.js +3 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +3 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +12 -13
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +13 -13
- package/dist/es2019/pm-plugins/table-width.js +6 -2
- package/dist/es2019/toolbar.js +15 -15
- package/dist/es2019/transforms/column-width.js +5 -5
- package/dist/es2019/transforms/delete-columns.js +2 -2
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +9 -12
- package/dist/es2019/ui/FloatingContextualMenu/index.js +2 -4
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +2 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +5 -5
- package/dist/es2019/ui/FloatingInsertButton/index.js +5 -6
- package/dist/es2019/utils/create.js +2 -5
- package/dist/es2019/utils/drag-menu.js +4 -4
- package/dist/esm/commands/column-resize.js +3 -3
- package/dist/esm/commands/delete.js +2 -2
- package/dist/esm/commands/insert.js +15 -15
- package/dist/esm/commands-with-analytics.js +7 -7
- package/dist/esm/event-handlers.js +2 -2
- package/dist/esm/nodeviews/TableComponent.js +45 -58
- package/dist/esm/nodeviews/TableContainer.js +5 -5
- package/dist/esm/nodeviews/TableResizer.js +12 -12
- package/dist/esm/nodeviews/table.js +9 -9
- package/dist/esm/plugin.js +58 -56
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +13 -13
- package/dist/esm/pm-plugins/keymap.js +6 -8
- package/dist/esm/pm-plugins/main.js +4 -6
- package/dist/esm/pm-plugins/sticky-headers/plugin.js +2 -3
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +12 -12
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/utils/consts.js +3 -1
- package/dist/esm/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +4 -3
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +13 -14
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +13 -13
- package/dist/esm/pm-plugins/table-width.js +6 -2
- package/dist/esm/toolbar.js +21 -21
- package/dist/esm/transforms/column-width.js +5 -5
- package/dist/esm/transforms/delete-columns.js +2 -2
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +53 -55
- package/dist/esm/ui/FloatingContextualMenu/index.js +2 -4
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +2 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +6 -6
- package/dist/esm/ui/FloatingInsertButton/index.js +6 -7
- package/dist/esm/utils/create.js +2 -5
- package/dist/esm/utils/drag-menu.js +4 -4
- package/dist/types/commands/column-resize.d.ts +1 -1
- package/dist/types/commands/delete.d.ts +1 -1
- package/dist/types/commands/insert.d.ts +7 -7
- package/dist/types/commands-with-analytics.d.ts +3 -3
- package/dist/types/event-handlers.d.ts +1 -1
- package/dist/types/nodeviews/TableComponent.d.ts +2 -3
- package/dist/types/nodeviews/TableContainer.d.ts +4 -4
- package/dist/types/nodeviews/TableResizer.d.ts +2 -2
- 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/drag-and-drop/plugin.d.ts +1 -2
- package/dist/types/pm-plugins/keymap.d.ts +2 -2
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/sticky-headers/plugin.d.ts +2 -3
- package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/consts.d.ts +1 -0
- package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -1
- package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -4
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
- package/dist/types/pm-plugins/table-width.d.ts +1 -2
- package/dist/types/toolbar.d.ts +2 -2
- package/dist/types/transforms/column-width.d.ts +1 -1
- package/dist/types/transforms/delete-columns.d.ts +1 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -2
- package/dist/types/ui/FloatingDragMenu/index.d.ts +2 -3
- package/dist/types/ui/FloatingInsertButton/index.d.ts +1 -2
- package/dist/types/utils/create.d.ts +1 -2
- package/dist/types/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/commands/column-resize.d.ts +1 -1
- package/dist/types-ts4.5/commands/delete.d.ts +1 -1
- package/dist/types-ts4.5/commands/insert.d.ts +7 -7
- package/dist/types-ts4.5/commands-with-analytics.d.ts +3 -3
- package/dist/types-ts4.5/event-handlers.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +2 -3
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -4
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -2
- 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/drag-and-drop/plugin.d.ts +1 -2
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/sticky-headers/plugin.d.ts +2 -3
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/consts.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -4
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
- package/dist/types-ts4.5/pm-plugins/table-width.d.ts +1 -2
- package/dist/types-ts4.5/toolbar.d.ts +2 -2
- 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/types.d.ts +1 -0
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +2 -3
- package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +1 -2
- package/dist/types-ts4.5/utils/create.d.ts +1 -2
- package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
- package/package.json +2 -2
- package/src/commands/column-resize.ts +4 -3
- package/src/commands/delete.ts +2 -2
- package/src/commands/insert.ts +15 -27
- package/src/commands-with-analytics.ts +6 -9
- package/src/event-handlers.ts +2 -2
- package/src/nodeviews/TableComponent.tsx +31 -46
- package/src/nodeviews/TableContainer.tsx +7 -7
- package/src/nodeviews/TableResizer.tsx +14 -14
- package/src/nodeviews/table.tsx +6 -5
- package/src/nodeviews/types.ts +1 -0
- package/src/plugin.tsx +12 -28
- package/src/pm-plugins/drag-and-drop/plugin.ts +10 -15
- package/src/pm-plugins/keymap.ts +6 -13
- package/src/pm-plugins/main.ts +3 -3
- package/src/pm-plugins/sticky-headers/plugin.ts +2 -11
- package/src/pm-plugins/table-resizing/event-handlers.ts +6 -4
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +2 -2
- package/src/pm-plugins/table-resizing/utils/consts.ts +2 -0
- package/src/pm-plugins/table-resizing/utils/index.ts +1 -1
- package/src/pm-plugins/table-resizing/utils/misc.ts +2 -2
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +5 -2
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +18 -13
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +14 -14
- package/src/pm-plugins/table-width.ts +4 -6
- package/src/toolbar.tsx +16 -19
- package/src/transforms/column-width.ts +7 -6
- package/src/transforms/delete-columns.ts +2 -2
- package/src/types.ts +1 -0
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +11 -16
- package/src/ui/FloatingContextualMenu/index.tsx +0 -2
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -3
- package/src/ui/FloatingDragMenu/index.tsx +4 -8
- package/src/ui/FloatingInsertButton/index.tsx +11 -22
- package/src/utils/create.ts +2 -5
- package/src/utils/drag-menu.ts +7 -12
|
@@ -22,11 +22,7 @@ import type {
|
|
|
22
22
|
EditorContainerWidth,
|
|
23
23
|
GetEditorFeatureFlags,
|
|
24
24
|
} from '@atlaskit/editor-common/types';
|
|
25
|
-
import {
|
|
26
|
-
browser,
|
|
27
|
-
calcTableColumnWidths,
|
|
28
|
-
isValidPosition,
|
|
29
|
-
} from '@atlaskit/editor-common/utils';
|
|
25
|
+
import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
|
|
30
26
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
31
27
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
32
28
|
import {
|
|
@@ -59,6 +55,7 @@ import {
|
|
|
59
55
|
updateColgroup,
|
|
60
56
|
} from '../pm-plugins/table-resizing/utils';
|
|
61
57
|
import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
58
|
+
import { TABLE_EDITOR_MARGIN } from '../pm-plugins/table-resizing/utils/consts';
|
|
62
59
|
import { updateControls } from '../pm-plugins/table-resizing/utils/dom';
|
|
63
60
|
import type { PluginInjectionAPI } from '../types';
|
|
64
61
|
import { TableCssClassName as ClassName, ShadowEvent } from '../types';
|
|
@@ -102,13 +99,13 @@ export interface ComponentProps {
|
|
|
102
99
|
isHeaderColumnEnabled: boolean;
|
|
103
100
|
isMediaFullscreen?: boolean;
|
|
104
101
|
isDragAndDropEnabled?: boolean;
|
|
102
|
+
isTableScalingEnabled?: boolean;
|
|
105
103
|
tableActive: boolean;
|
|
106
104
|
ordering: TableColumnOrdering;
|
|
107
105
|
isResizing?: boolean;
|
|
108
106
|
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
109
107
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
110
108
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
111
|
-
tableRef?: HTMLElement | undefined;
|
|
112
109
|
}
|
|
113
110
|
|
|
114
111
|
interface TableState {
|
|
@@ -142,8 +139,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
142
139
|
|
|
143
140
|
private dragAndDropCleanupFn?: CleanupFn;
|
|
144
141
|
|
|
145
|
-
private tableColumnWidths?: number[];
|
|
146
|
-
|
|
147
142
|
constructor(props: ComponentProps) {
|
|
148
143
|
super(props);
|
|
149
144
|
const { options, containerWidth, getNode } = props;
|
|
@@ -182,8 +177,13 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
182
177
|
isDragAndDropEnabled,
|
|
183
178
|
getNode,
|
|
184
179
|
getEditorFeatureFlags,
|
|
180
|
+
isTableScalingEnabled,
|
|
185
181
|
} = this.props;
|
|
186
182
|
|
|
183
|
+
if (isTableScalingEnabled) {
|
|
184
|
+
this.handleColgroupUpdates(true);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
187
|
if (allowColumnResizing && this.wrapper && !isIE11) {
|
|
188
188
|
this.wrapper.addEventListener('scroll', this.handleScrollDebounced, {
|
|
189
189
|
passive: true,
|
|
@@ -288,20 +288,17 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
handleColgroupUpdates() {
|
|
292
|
-
const { getNode, containerWidth, isResizing, view, getPos
|
|
293
|
-
this.props;
|
|
291
|
+
handleColgroupUpdates(force = false) {
|
|
292
|
+
const { getNode, containerWidth, isResizing, view, getPos } = this.props;
|
|
294
293
|
|
|
295
|
-
if (!
|
|
294
|
+
if (!this.table) {
|
|
296
295
|
return;
|
|
297
296
|
}
|
|
298
297
|
|
|
299
|
-
const TABLE_MARGIN = 76;
|
|
300
|
-
|
|
301
298
|
// Remove any widths styles after resizing preview is completed
|
|
302
|
-
|
|
299
|
+
this.table.style.width = '';
|
|
303
300
|
|
|
304
|
-
const tableRenderWidth = containerWidth.width -
|
|
301
|
+
const tableRenderWidth = containerWidth.width - TABLE_EDITOR_MARGIN;
|
|
305
302
|
const tableNode = getNode();
|
|
306
303
|
const start = getPos() || 0;
|
|
307
304
|
const depth = view.state.doc.resolve(start).depth;
|
|
@@ -312,39 +309,25 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
312
309
|
}
|
|
313
310
|
|
|
314
311
|
const { width: tableNodeWidth } = tableNode.attrs;
|
|
315
|
-
const tableColumnWidths = calcTableColumnWidths(tableNode);
|
|
316
312
|
const shouldTableScale = tableRenderWidth < tableNodeWidth;
|
|
317
|
-
|
|
318
|
-
if (this.tableColumnWidths) {
|
|
319
|
-
isTableColumnWidthsSame = tableColumnWidths?.every(
|
|
320
|
-
(width, index) => width === this.tableColumnWidths![index],
|
|
321
|
-
);
|
|
322
|
-
}
|
|
313
|
+
|
|
323
314
|
const { width: containerWidthValue } = containerWidth;
|
|
324
315
|
const isWidthChanged = this.containerWidth?.width !== containerWidthValue;
|
|
325
316
|
|
|
326
|
-
if (
|
|
327
|
-
shouldTableScale &&
|
|
328
|
-
!isResizing &&
|
|
329
|
-
(!isTableColumnWidthsSame || isWidthChanged)
|
|
330
|
-
) {
|
|
317
|
+
if (force || (shouldTableScale && !isResizing && isWidthChanged)) {
|
|
331
318
|
const resizeState = getResizeState({
|
|
332
319
|
minWidth: COLUMN_MIN_WIDTH,
|
|
333
320
|
maxSize: tableRenderWidth,
|
|
334
321
|
table: tableNode,
|
|
335
|
-
tableRef: this.table
|
|
322
|
+
tableRef: this.table,
|
|
336
323
|
start,
|
|
337
324
|
domAtPos: view.domAtPos,
|
|
338
|
-
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
requestAnimationFrame(() => {
|
|
342
|
-
updateColgroup(resizeState, this.table!, true);
|
|
325
|
+
isTableScalingEnabled: true,
|
|
343
326
|
});
|
|
344
327
|
|
|
345
|
-
this.
|
|
346
|
-
this.containerWidth = containerWidth;
|
|
328
|
+
updateColgroup(resizeState, this.table!, tableNode, true);
|
|
347
329
|
}
|
|
330
|
+
this.containerWidth = containerWidth;
|
|
348
331
|
}
|
|
349
332
|
|
|
350
333
|
componentDidUpdate(_: any, prevState: TableState) {
|
|
@@ -355,13 +338,12 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
355
338
|
allowColumnResizing,
|
|
356
339
|
isResizing,
|
|
357
340
|
options,
|
|
358
|
-
|
|
341
|
+
isTableScalingEnabled,
|
|
359
342
|
} = this.props;
|
|
360
343
|
const { isInDanger } = getPluginState(view.state);
|
|
361
|
-
const { tablePreserveWidth = false } = getEditorFeatureFlags();
|
|
362
344
|
const table = findTable(view.state.selection);
|
|
363
345
|
|
|
364
|
-
if (
|
|
346
|
+
if (isTableScalingEnabled) {
|
|
365
347
|
this.handleColgroupUpdates();
|
|
366
348
|
}
|
|
367
349
|
|
|
@@ -424,7 +406,11 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
424
406
|
isResizing);
|
|
425
407
|
|
|
426
408
|
if (shouldRecreateResizeCols) {
|
|
427
|
-
insertColgroupFromNode(
|
|
409
|
+
insertColgroupFromNode(
|
|
410
|
+
this.table,
|
|
411
|
+
currentTable,
|
|
412
|
+
isTableScalingEnabled,
|
|
413
|
+
);
|
|
428
414
|
}
|
|
429
415
|
|
|
430
416
|
updateControls()(view.state);
|
|
@@ -517,6 +503,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
517
503
|
pluginInjectionApi,
|
|
518
504
|
isDragAndDropEnabled,
|
|
519
505
|
getEditorFeatureFlags,
|
|
506
|
+
isTableScalingEnabled,
|
|
520
507
|
} = this.props;
|
|
521
508
|
|
|
522
509
|
const { showBeforeShadow, showAfterShadow } = this.state;
|
|
@@ -610,7 +597,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
610
597
|
shadowPadding +
|
|
611
598
|
2;
|
|
612
599
|
|
|
613
|
-
const { stickyScrollbar
|
|
600
|
+
const { stickyScrollbar } = getEditorFeatureFlags();
|
|
614
601
|
|
|
615
602
|
return (
|
|
616
603
|
<TableContainer
|
|
@@ -630,7 +617,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
630
617
|
pluginInjectionApi={pluginInjectionApi}
|
|
631
618
|
isTableResizingEnabled={options?.isTableResizingEnabled}
|
|
632
619
|
isResizing={isResizing}
|
|
633
|
-
|
|
620
|
+
isTableScalingEnabled={isTableScalingEnabled}
|
|
634
621
|
>
|
|
635
622
|
<div
|
|
636
623
|
className={ClassName.TABLE_STICKY_SENTINEL_TOP}
|
|
@@ -860,7 +847,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
860
847
|
getPos,
|
|
861
848
|
containerWidth,
|
|
862
849
|
options,
|
|
863
|
-
|
|
850
|
+
isTableScalingEnabled,
|
|
864
851
|
} = this.props;
|
|
865
852
|
const node = getNode();
|
|
866
853
|
const { state, dispatch } = view;
|
|
@@ -874,8 +861,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
874
861
|
|
|
875
862
|
this.scaleTableDebounced.cancel();
|
|
876
863
|
|
|
877
|
-
const { tablePreserveWidth = false } = getEditorFeatureFlags();
|
|
878
|
-
|
|
879
864
|
const tr = scaleTable(
|
|
880
865
|
this.table,
|
|
881
866
|
{
|
|
@@ -888,7 +873,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
888
873
|
...options,
|
|
889
874
|
},
|
|
890
875
|
domAtPos,
|
|
891
|
-
|
|
876
|
+
isTableScalingEnabled,
|
|
892
877
|
)(state.tr);
|
|
893
878
|
|
|
894
879
|
dispatch(tr);
|
|
@@ -77,7 +77,7 @@ type ResizableTableContainerProps = {
|
|
|
77
77
|
tableRef: HTMLTableElement;
|
|
78
78
|
isResizing?: boolean;
|
|
79
79
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
80
|
-
|
|
80
|
+
isTableScalingEnabled?: boolean;
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
export const ResizableTableContainer = React.memo(
|
|
@@ -91,7 +91,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
91
91
|
tableRef,
|
|
92
92
|
isResizing,
|
|
93
93
|
pluginInjectionApi,
|
|
94
|
-
|
|
94
|
+
isTableScalingEnabled,
|
|
95
95
|
}: PropsWithChildren<ResizableTableContainerProps>) => {
|
|
96
96
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
97
97
|
const tableWidthRef = useRef<number>(akEditorDefaultLayoutWidth);
|
|
@@ -191,7 +191,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
191
191
|
|
|
192
192
|
const tableWidth = getTableContainerWidth(node);
|
|
193
193
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
194
|
-
const responsiveContainerWidth =
|
|
194
|
+
const responsiveContainerWidth = isTableScalingEnabled
|
|
195
195
|
? containerWidth -
|
|
196
196
|
akEditorGutterPadding * 2 -
|
|
197
197
|
akEditorMediaResizeHandlerPaddingWide / 2
|
|
@@ -218,7 +218,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
218
218
|
displayGuideline,
|
|
219
219
|
attachAnalyticsEvent,
|
|
220
220
|
displayGapCursor,
|
|
221
|
-
|
|
221
|
+
isTableScalingEnabled,
|
|
222
222
|
};
|
|
223
223
|
|
|
224
224
|
if (getBooleanFF('platform.editor.resizing-table-height-improvement')) {
|
|
@@ -266,7 +266,7 @@ type TableContainerProps = {
|
|
|
266
266
|
isNested: boolean;
|
|
267
267
|
isResizing?: boolean;
|
|
268
268
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
269
|
-
|
|
269
|
+
isTableScalingEnabled?: boolean;
|
|
270
270
|
};
|
|
271
271
|
|
|
272
272
|
export const TableContainer = ({
|
|
@@ -282,7 +282,7 @@ export const TableContainer = ({
|
|
|
282
282
|
isNested,
|
|
283
283
|
isResizing,
|
|
284
284
|
pluginInjectionApi,
|
|
285
|
-
|
|
285
|
+
isTableScalingEnabled,
|
|
286
286
|
}: PropsWithChildren<TableContainerProps>) => {
|
|
287
287
|
if (isTableResizingEnabled && !isNested) {
|
|
288
288
|
return (
|
|
@@ -295,7 +295,7 @@ export const TableContainer = ({
|
|
|
295
295
|
tableRef={tableRef}
|
|
296
296
|
isResizing={isResizing}
|
|
297
297
|
pluginInjectionApi={pluginInjectionApi}
|
|
298
|
-
|
|
298
|
+
isTableScalingEnabled={isTableScalingEnabled}
|
|
299
299
|
>
|
|
300
300
|
{children}
|
|
301
301
|
</ResizableTableContainer>
|
|
@@ -75,7 +75,7 @@ interface TableResizerProps {
|
|
|
75
75
|
payload: TableEventPayload,
|
|
76
76
|
) => ((tr: Transaction) => boolean) | undefined;
|
|
77
77
|
displayGapCursor: (toggle: boolean) => boolean;
|
|
78
|
-
|
|
78
|
+
isTableScalingEnabled?: boolean;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
export interface TableResizerImprovementProps extends TableResizerProps {
|
|
@@ -170,7 +170,7 @@ export const TableResizer = ({
|
|
|
170
170
|
displayGuideline,
|
|
171
171
|
attachAnalyticsEvent,
|
|
172
172
|
displayGapCursor,
|
|
173
|
-
|
|
173
|
+
isTableScalingEnabled,
|
|
174
174
|
}: PropsWithChildren<TableResizerImprovementProps>) => {
|
|
175
175
|
const currentGap = useRef(0);
|
|
176
176
|
// track resizing state - use ref over state to avoid re-render
|
|
@@ -218,7 +218,7 @@ export const TableResizer = ({
|
|
|
218
218
|
if (gap !== currentGap.current) {
|
|
219
219
|
currentGap.current = gap;
|
|
220
220
|
const visibleGuidelines = getVisibleGuidelines(
|
|
221
|
-
|
|
221
|
+
isTableScalingEnabled
|
|
222
222
|
? defaultGuidelinesForPreserveTable(containerWidth)
|
|
223
223
|
: defaultGuidelines,
|
|
224
224
|
containerWidth,
|
|
@@ -234,19 +234,19 @@ export const TableResizer = ({
|
|
|
234
234
|
);
|
|
235
235
|
}
|
|
236
236
|
},
|
|
237
|
-
[
|
|
237
|
+
[isTableScalingEnabled, containerWidth, displayGuideline],
|
|
238
238
|
);
|
|
239
239
|
|
|
240
240
|
const guidelineSnaps = useMemo(
|
|
241
241
|
() =>
|
|
242
242
|
snappingEnabled
|
|
243
243
|
? {
|
|
244
|
-
x:
|
|
244
|
+
x: isTableScalingEnabled
|
|
245
245
|
? defaultTablePreserveSnappingWidths(containerWidth)
|
|
246
246
|
: defaultSnappingWidths,
|
|
247
247
|
}
|
|
248
248
|
: undefined,
|
|
249
|
-
[snappingEnabled,
|
|
249
|
+
[snappingEnabled, isTableScalingEnabled, containerWidth],
|
|
250
250
|
);
|
|
251
251
|
|
|
252
252
|
useEffect(() => {
|
|
@@ -282,7 +282,7 @@ export const TableResizer = ({
|
|
|
282
282
|
dispatch(tr);
|
|
283
283
|
|
|
284
284
|
const visibleGuidelines = getVisibleGuidelines(
|
|
285
|
-
|
|
285
|
+
isTableScalingEnabled
|
|
286
286
|
? defaultGuidelinesForPreserveTable(containerWidth)
|
|
287
287
|
: defaultGuidelines,
|
|
288
288
|
containerWidth,
|
|
@@ -299,7 +299,7 @@ export const TableResizer = ({
|
|
|
299
299
|
startMeasure,
|
|
300
300
|
editorView,
|
|
301
301
|
displayGapCursor,
|
|
302
|
-
|
|
302
|
+
isTableScalingEnabled,
|
|
303
303
|
containerWidth,
|
|
304
304
|
displayGuideline,
|
|
305
305
|
onResizeStart,
|
|
@@ -328,16 +328,16 @@ export const TableResizer = ({
|
|
|
328
328
|
parentWidth: newWidth,
|
|
329
329
|
},
|
|
330
330
|
editorView.domAtPos.bind(editorView),
|
|
331
|
-
|
|
331
|
+
isTableScalingEnabled,
|
|
332
332
|
);
|
|
333
333
|
|
|
334
334
|
updateActiveGuidelines(
|
|
335
335
|
findClosestSnap(
|
|
336
336
|
newWidth,
|
|
337
|
-
|
|
337
|
+
isTableScalingEnabled
|
|
338
338
|
? defaultTablePreserveSnappingWidths(containerWidth)
|
|
339
339
|
: defaultSnappingWidths,
|
|
340
|
-
|
|
340
|
+
isTableScalingEnabled
|
|
341
341
|
? defaultGuidelinesForPreserveTable(containerWidth)
|
|
342
342
|
: defaultGuidelines,
|
|
343
343
|
TABLE_HIGHLIGHT_GAP,
|
|
@@ -350,7 +350,7 @@ export const TableResizer = ({
|
|
|
350
350
|
},
|
|
351
351
|
[
|
|
352
352
|
countFrames,
|
|
353
|
-
|
|
353
|
+
isTableScalingEnabled,
|
|
354
354
|
tableRef,
|
|
355
355
|
node,
|
|
356
356
|
editorView,
|
|
@@ -400,7 +400,7 @@ export const TableResizer = ({
|
|
|
400
400
|
parentWidth: newWidth,
|
|
401
401
|
},
|
|
402
402
|
editorView.domAtPos.bind(editorView),
|
|
403
|
-
|
|
403
|
+
isTableScalingEnabled,
|
|
404
404
|
)(tr);
|
|
405
405
|
|
|
406
406
|
const scaledNode = tr.doc.nodeAt(pos)!;
|
|
@@ -441,7 +441,7 @@ export const TableResizer = ({
|
|
|
441
441
|
attachAnalyticsEvent,
|
|
442
442
|
endMeasure,
|
|
443
443
|
onResizeStop,
|
|
444
|
-
|
|
444
|
+
isTableScalingEnabled,
|
|
445
445
|
],
|
|
446
446
|
);
|
|
447
447
|
|
package/src/nodeviews/table.tsx
CHANGED
|
@@ -102,7 +102,7 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
102
102
|
private resizeObserver?: ResizeObserver;
|
|
103
103
|
eventDispatcher?: EventDispatcher;
|
|
104
104
|
getPos: getPosHandlerNode;
|
|
105
|
-
|
|
105
|
+
options;
|
|
106
106
|
|
|
107
107
|
constructor(props: Props) {
|
|
108
108
|
super(
|
|
@@ -119,7 +119,7 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
119
119
|
);
|
|
120
120
|
this.getPos = props.getPos;
|
|
121
121
|
this.eventDispatcher = props.eventDispatcher;
|
|
122
|
-
this.
|
|
122
|
+
this.options = props.options;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
getContentDOM() {
|
|
@@ -133,9 +133,8 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
133
133
|
|
|
134
134
|
if (rendered.dom) {
|
|
135
135
|
this.table = rendered.dom;
|
|
136
|
-
const { tablePreserveWidth = false } = this.getEditorFeatureFlags();
|
|
137
136
|
// Preserve Table Width cannot have inline width set on the table
|
|
138
|
-
if (!
|
|
137
|
+
if (!this.options?.isTableScalingEnabled) {
|
|
139
138
|
const tableInlineWidth = getInlineWidth(
|
|
140
139
|
this.node,
|
|
141
140
|
this.reactComponentProps.options,
|
|
@@ -255,6 +254,7 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
255
254
|
isHeaderRowEnabled={pluginState!.isHeaderRowEnabled}
|
|
256
255
|
isHeaderColumnEnabled={pluginState!.isHeaderColumnEnabled}
|
|
257
256
|
isDragAndDropEnabled={pluginState!.isDragAndDropEnabled}
|
|
257
|
+
isTableScalingEnabled={pluginState!.isTableScalingEnabled}
|
|
258
258
|
tableActive={tableActive}
|
|
259
259
|
ordering={pluginState!.ordering as TableColumnOrdering}
|
|
260
260
|
isResizing={isResizing}
|
|
@@ -264,7 +264,6 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
264
264
|
getEditorFeatureFlags={props.getEditorFeatureFlags}
|
|
265
265
|
dispatchAnalyticsEvent={props.dispatchAnalyticsEvent}
|
|
266
266
|
pluginInjectionApi={props.pluginInjectionApi}
|
|
267
|
-
tableRef={this.table}
|
|
268
267
|
/>
|
|
269
268
|
);
|
|
270
269
|
}}
|
|
@@ -362,6 +361,7 @@ export const createTableView = (
|
|
|
362
361
|
wasFullWidthModeEnabled,
|
|
363
362
|
isTableResizingEnabled,
|
|
364
363
|
isDragAndDropEnabled,
|
|
364
|
+
isTableScalingEnabled,
|
|
365
365
|
} = getPluginState(view.state);
|
|
366
366
|
const { allowColumnResizing } = getPluginConfig(pluginConfig);
|
|
367
367
|
const hasIntlContext = true;
|
|
@@ -379,6 +379,7 @@ export const createTableView = (
|
|
|
379
379
|
wasFullWidthModeEnabled,
|
|
380
380
|
isTableResizingEnabled,
|
|
381
381
|
isDragAndDropEnabled,
|
|
382
|
+
isTableScalingEnabled,
|
|
382
383
|
},
|
|
383
384
|
getEditorContainerWidth,
|
|
384
385
|
getEditorFeatureFlags,
|
package/src/nodeviews/types.ts
CHANGED
package/src/plugin.tsx
CHANGED
|
@@ -52,6 +52,7 @@ import {
|
|
|
52
52
|
} from './pm-plugins/drag-and-drop';
|
|
53
53
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
54
54
|
import { createPlugin } from './pm-plugins/main';
|
|
55
|
+
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
55
56
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
56
57
|
import { createPlugin as createTableSafariDeleteCompositionTextIssueWorkaroundPlugin } from './pm-plugins/safari-delete-composition-text-issue-workaround';
|
|
57
58
|
import {
|
|
@@ -92,6 +93,7 @@ export interface TablePluginOptions {
|
|
|
92
93
|
fullWidthEnabled?: boolean;
|
|
93
94
|
wasFullWidthEnabled?: boolean;
|
|
94
95
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
96
|
+
isTableScalingEnabled?: boolean;
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
@@ -157,8 +159,8 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
157
159
|
(analyticsPayload): Command =>
|
|
158
160
|
(state, dispatch) => {
|
|
159
161
|
const node = createTableWithWidth(
|
|
162
|
+
options?.isTableScalingEnabled,
|
|
160
163
|
options?.fullWidthEnabled,
|
|
161
|
-
options?.getEditorFeatureFlags,
|
|
162
164
|
)(state.schema);
|
|
163
165
|
|
|
164
166
|
return (
|
|
@@ -179,7 +181,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
179
181
|
commands: {
|
|
180
182
|
insertTableWithSize: insertTableWithSize(
|
|
181
183
|
options?.fullWidthEnabled,
|
|
182
|
-
options?.
|
|
184
|
+
options?.isTableScalingEnabled,
|
|
183
185
|
api?.analytics?.actions,
|
|
184
186
|
),
|
|
185
187
|
},
|
|
@@ -216,6 +218,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
216
218
|
tableOptions,
|
|
217
219
|
getEditorFeatureFlags,
|
|
218
220
|
dragAndDropEnabled,
|
|
221
|
+
isTableScalingEnabled,
|
|
219
222
|
} = options || ({} as TablePluginOptions);
|
|
220
223
|
return createPlugin(
|
|
221
224
|
dispatchAnalyticsEvent,
|
|
@@ -233,6 +236,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
233
236
|
dragAndDropEnabled,
|
|
234
237
|
editorAnalyticsAPI,
|
|
235
238
|
api,
|
|
239
|
+
isTableScalingEnabled,
|
|
236
240
|
);
|
|
237
241
|
},
|
|
238
242
|
},
|
|
@@ -261,14 +265,14 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
261
265
|
{
|
|
262
266
|
name: 'tableKeymap',
|
|
263
267
|
plugin: () => {
|
|
264
|
-
const { dragAndDropEnabled,
|
|
268
|
+
const { dragAndDropEnabled, isTableScalingEnabled = false } =
|
|
265
269
|
options || ({} as TablePluginOptions);
|
|
266
270
|
|
|
267
271
|
return keymapPlugin(
|
|
268
272
|
defaultGetEditorContainerWidth,
|
|
269
273
|
editorAnalyticsAPI,
|
|
270
|
-
getEditorFeatureFlags,
|
|
271
274
|
dragAndDropEnabled,
|
|
275
|
+
isTableScalingEnabled,
|
|
272
276
|
);
|
|
273
277
|
},
|
|
274
278
|
},
|
|
@@ -308,26 +312,14 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
308
312
|
name: 'tableStickyHeaders',
|
|
309
313
|
plugin: ({ dispatch, eventDispatcher }) =>
|
|
310
314
|
options && options.tableOptions.stickyHeaders
|
|
311
|
-
? createStickyHeadersPlugin(
|
|
312
|
-
dispatch,
|
|
313
|
-
eventDispatcher,
|
|
314
|
-
() => [],
|
|
315
|
-
options?.getEditorFeatureFlags ||
|
|
316
|
-
defaultGetEditorFeatureFlags,
|
|
317
|
-
)
|
|
315
|
+
? createStickyHeadersPlugin(dispatch, () => [])
|
|
318
316
|
: undefined,
|
|
319
317
|
},
|
|
320
318
|
{
|
|
321
319
|
name: 'tableDragAndDrop',
|
|
322
320
|
plugin: ({ dispatch }) => {
|
|
323
|
-
const { getEditorFeatureFlags } =
|
|
324
|
-
options || ({} as TablePluginOptions);
|
|
325
321
|
return options?.dragAndDropEnabled
|
|
326
|
-
? createDragAndDropPlugin(
|
|
327
|
-
dispatch,
|
|
328
|
-
getEditorFeatureFlags,
|
|
329
|
-
editorAnalyticsAPI,
|
|
330
|
-
)
|
|
322
|
+
? createDragAndDropPlugin(dispatch, editorAnalyticsAPI)
|
|
331
323
|
: undefined;
|
|
332
324
|
},
|
|
333
325
|
},
|
|
@@ -343,7 +335,6 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
343
335
|
dispatch,
|
|
344
336
|
dispatchAnalyticsEvent,
|
|
345
337
|
options?.fullWidthEnabled ?? false,
|
|
346
|
-
options?.getEditorFeatureFlags,
|
|
347
338
|
)
|
|
348
339
|
: undefined,
|
|
349
340
|
},
|
|
@@ -511,10 +502,6 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
511
502
|
dispatchAnalyticsEvent={dispatchAnalyticsEvent}
|
|
512
503
|
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
513
504
|
getEditorContainerWidth={defaultGetEditorContainerWidth}
|
|
514
|
-
getEditorFeatureFlags={
|
|
515
|
-
options?.getEditorFeatureFlags ||
|
|
516
|
-
defaultGetEditorFeatureFlags
|
|
517
|
-
}
|
|
518
505
|
/>
|
|
519
506
|
)}
|
|
520
507
|
{options?.allowContextualMenu && (
|
|
@@ -548,10 +535,6 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
548
535
|
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
549
536
|
stickyHeaders={stickyHeader}
|
|
550
537
|
pluginConfig={pluginConfig}
|
|
551
|
-
getEditorFeatureFlags={
|
|
552
|
-
options?.getEditorFeatureFlags ||
|
|
553
|
-
defaultGetEditorFeatureFlags
|
|
554
|
-
}
|
|
555
538
|
/>
|
|
556
539
|
)}
|
|
557
540
|
{allowControls && !isDragAndDropEnabled && !isResizing && (
|
|
@@ -591,11 +574,12 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
591
574
|
action(insert, state) {
|
|
592
575
|
// see comment on tablesPlugin.getSharedState on usage
|
|
593
576
|
const tableState = api?.table?.sharedState.currentState();
|
|
577
|
+
const { isTableScalingEnabled = false } = getPluginState(state);
|
|
594
578
|
|
|
595
579
|
const tr = insert(
|
|
596
580
|
createTableWithWidth(
|
|
581
|
+
isTableScalingEnabled,
|
|
597
582
|
tableState?.isFullWidthModeEnabled,
|
|
598
|
-
options?.getEditorFeatureFlags,
|
|
599
583
|
)(state.schema),
|
|
600
584
|
);
|
|
601
585
|
editorAnalyticsAPI?.attachAnalyticsEvent({
|
|
@@ -2,7 +2,6 @@ import { INPUT_METHOD, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
-
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
6
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
6
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
8
7
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
@@ -34,11 +33,7 @@ import { createPluginState, getPluginState } from './plugin-factory';
|
|
|
34
33
|
import { pluginKey } from './plugin-key';
|
|
35
34
|
import { getDraggableDataFromEvent } from './utils/monitor';
|
|
36
35
|
|
|
37
|
-
const destroyFn = (
|
|
38
|
-
editorView: EditorView,
|
|
39
|
-
editorAnalyticsAPI: any,
|
|
40
|
-
getEditorFeatureFlags?: GetEditorFeatureFlags,
|
|
41
|
-
) => {
|
|
36
|
+
const destroyFn = (editorView: EditorView, editorAnalyticsAPI: any) => {
|
|
42
37
|
const editorPageScrollContainer = document.querySelector(
|
|
43
38
|
'.fabric-editor-popup-scroll-parent',
|
|
44
39
|
);
|
|
@@ -223,9 +218,14 @@ const destroyFn = (
|
|
|
223
218
|
editorView.state,
|
|
224
219
|
);
|
|
225
220
|
if (tableRef && tableNode) {
|
|
226
|
-
const {
|
|
227
|
-
|
|
228
|
-
|
|
221
|
+
const { isTableScalingEnabled = false } = getTablePluginState(
|
|
222
|
+
editorView.state,
|
|
223
|
+
);
|
|
224
|
+
insertColgroupFromNode(
|
|
225
|
+
tableRef,
|
|
226
|
+
tableNode,
|
|
227
|
+
isTableScalingEnabled,
|
|
228
|
+
);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
|
|
@@ -238,7 +238,6 @@ const destroyFn = (
|
|
|
238
238
|
|
|
239
239
|
export const createPlugin = (
|
|
240
240
|
dispatch: Dispatch,
|
|
241
|
-
getEditorFeatureFlags?: GetEditorFeatureFlags,
|
|
242
241
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
243
242
|
) => {
|
|
244
243
|
return new SafePlugin({
|
|
@@ -311,11 +310,7 @@ export const createPlugin = (
|
|
|
311
310
|
},
|
|
312
311
|
view: (editorView: EditorView) => {
|
|
313
312
|
return {
|
|
314
|
-
destroy: destroyFn(
|
|
315
|
-
editorView,
|
|
316
|
-
editorAnalyticsAPI,
|
|
317
|
-
getEditorFeatureFlags,
|
|
318
|
-
),
|
|
313
|
+
destroy: destroyFn(editorView, editorAnalyticsAPI),
|
|
319
314
|
};
|
|
320
315
|
},
|
|
321
316
|
props: {
|