@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
|
@@ -468,14 +468,15 @@ export class ContextualMenu extends Component<
|
|
|
468
468
|
(!isDragAndDropEnabled ||
|
|
469
469
|
!getBooleanFF('platform.editor.table.new-cell-context-menu-styling'))
|
|
470
470
|
) {
|
|
471
|
-
const {
|
|
472
|
-
|
|
471
|
+
const { isTableScalingEnabled = false } = getPluginState(
|
|
472
|
+
editorView.state,
|
|
473
|
+
);
|
|
473
474
|
const newResizeState = getNewResizeStateFromSelectedColumns(
|
|
474
475
|
selectionRect,
|
|
475
476
|
editorView.state,
|
|
476
477
|
editorView.domAtPos.bind(editorView),
|
|
477
478
|
getEditorContainerWidth,
|
|
478
|
-
|
|
479
|
+
isTableScalingEnabled,
|
|
479
480
|
);
|
|
480
481
|
|
|
481
482
|
const wouldChange = newResizeState?.changed ?? false;
|
|
@@ -590,12 +591,11 @@ export class ContextualMenu extends Component<
|
|
|
590
591
|
selectionRect,
|
|
591
592
|
editorAnalyticsAPI,
|
|
592
593
|
getEditorContainerWidth,
|
|
593
|
-
getEditorFeatureFlags,
|
|
594
594
|
} = this.props;
|
|
595
595
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
596
596
|
const { state, dispatch } = editorView;
|
|
597
|
-
const { targetCellPosition } =
|
|
598
|
-
|
|
597
|
+
const { targetCellPosition, isTableScalingEnabled = false } =
|
|
598
|
+
getPluginState(state);
|
|
599
599
|
|
|
600
600
|
switch (item.value.name) {
|
|
601
601
|
case 'sort_column_desc':
|
|
@@ -635,7 +635,7 @@ export class ContextualMenu extends Component<
|
|
|
635
635
|
state,
|
|
636
636
|
editorView.domAtPos.bind(editorView),
|
|
637
637
|
getEditorContainerWidth,
|
|
638
|
-
|
|
638
|
+
isTableScalingEnabled,
|
|
639
639
|
);
|
|
640
640
|
|
|
641
641
|
if (newResizeStateWithAnalytics) {
|
|
@@ -654,15 +654,10 @@ export class ContextualMenu extends Component<
|
|
|
654
654
|
this.toggleOpen();
|
|
655
655
|
break;
|
|
656
656
|
case 'insert_column':
|
|
657
|
-
insertColumnWithAnalytics(
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(
|
|
662
|
-
state,
|
|
663
|
-
dispatch,
|
|
664
|
-
editorView,
|
|
665
|
-
);
|
|
657
|
+
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(
|
|
658
|
+
INPUT_METHOD.CONTEXT_MENU,
|
|
659
|
+
selectionRect.right,
|
|
660
|
+
)(state, dispatch, editorView);
|
|
666
661
|
this.toggleOpen();
|
|
667
662
|
break;
|
|
668
663
|
case 'insert_row':
|
|
@@ -53,7 +53,6 @@ const FloatingContextualMenu = ({
|
|
|
53
53
|
pluginConfig,
|
|
54
54
|
editorAnalyticsAPI,
|
|
55
55
|
getEditorContainerWidth,
|
|
56
|
-
getEditorFeatureFlags,
|
|
57
56
|
}: Props) => {
|
|
58
57
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
59
58
|
const { targetCellPosition, isDragAndDropEnabled } = getPluginState(
|
|
@@ -123,7 +122,6 @@ const FloatingContextualMenu = ({
|
|
|
123
122
|
boundariesElement={boundariesElement}
|
|
124
123
|
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
125
124
|
getEditorContainerWidth={getEditorContainerWidth}
|
|
126
|
-
getEditorFeatureFlags={getEditorFeatureFlags}
|
|
127
125
|
/>
|
|
128
126
|
</div>
|
|
129
127
|
</Popup>
|
|
@@ -101,7 +101,7 @@ type DragMenuProps = {
|
|
|
101
101
|
mountPoint?: HTMLElement;
|
|
102
102
|
boundariesElement?: HTMLElement;
|
|
103
103
|
scrollableElement?: HTMLElement;
|
|
104
|
-
|
|
104
|
+
isTableScalingEnabled?: boolean;
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
type PluralOptionType = 'noOfCols' | 'noOfRows' | 'noOfCells' | null;
|
|
@@ -280,7 +280,7 @@ export const DragMenu = React.memo(
|
|
|
280
280
|
mountPoint,
|
|
281
281
|
scrollableElement,
|
|
282
282
|
boundariesElement,
|
|
283
|
-
|
|
283
|
+
isTableScalingEnabled,
|
|
284
284
|
}: DragMenuProps & WrappedComponentProps) => {
|
|
285
285
|
const { state, dispatch } = editorView;
|
|
286
286
|
const { selection } = state;
|
|
@@ -313,7 +313,7 @@ export const DragMenu = React.memo(
|
|
|
313
313
|
selectionRect,
|
|
314
314
|
editorAnalyticsAPI,
|
|
315
315
|
pluginConfig?.isHeaderRowRequired,
|
|
316
|
-
|
|
316
|
+
isTableScalingEnabled,
|
|
317
317
|
);
|
|
318
318
|
|
|
319
319
|
const { menuItems, menuCallback } = convertToDropdownItems(
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import type {
|
|
5
|
-
GetEditorContainerWidth,
|
|
6
|
-
GetEditorFeatureFlags,
|
|
7
|
-
} from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
8
5
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
9
6
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
10
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -14,6 +11,7 @@ import {
|
|
|
14
11
|
} from '@atlaskit/editor-shared-styles';
|
|
15
12
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
16
13
|
|
|
14
|
+
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
17
15
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
18
16
|
import type { PluginConfig, TableDirection } from '../../types';
|
|
19
17
|
import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
|
|
@@ -35,7 +33,6 @@ export interface Props {
|
|
|
35
33
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
36
34
|
stickyHeaders?: RowStickyState;
|
|
37
35
|
pluginConfig?: PluginConfig;
|
|
38
|
-
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
39
36
|
}
|
|
40
37
|
|
|
41
38
|
const FloatingDragMenu = ({
|
|
@@ -52,7 +49,6 @@ const FloatingDragMenu = ({
|
|
|
52
49
|
editorAnalyticsAPI,
|
|
53
50
|
stickyHeaders,
|
|
54
51
|
pluginConfig,
|
|
55
|
-
getEditorFeatureFlags,
|
|
56
52
|
}: Props) => {
|
|
57
53
|
if (
|
|
58
54
|
!isOpen ||
|
|
@@ -77,7 +73,7 @@ const FloatingDragMenu = ({
|
|
|
77
73
|
return null;
|
|
78
74
|
}
|
|
79
75
|
|
|
80
|
-
const {
|
|
76
|
+
const { isTableScalingEnabled = false } = getPluginState(editorView.state);
|
|
81
77
|
|
|
82
78
|
return (
|
|
83
79
|
<Popup
|
|
@@ -117,7 +113,7 @@ const FloatingDragMenu = ({
|
|
|
117
113
|
mountPoint={mountPoint}
|
|
118
114
|
boundariesElement={boundariesElement}
|
|
119
115
|
scrollableElement={scrollableElement}
|
|
120
|
-
|
|
116
|
+
isTableScalingEnabled={isTableScalingEnabled}
|
|
121
117
|
/>
|
|
122
118
|
</Popup>
|
|
123
119
|
);
|
|
@@ -15,10 +15,7 @@ import {
|
|
|
15
15
|
EVENT_TYPE,
|
|
16
16
|
INPUT_METHOD,
|
|
17
17
|
} from '@atlaskit/editor-common/analytics';
|
|
18
|
-
import type {
|
|
19
|
-
GetEditorContainerWidth,
|
|
20
|
-
GetEditorFeatureFlags,
|
|
21
|
-
} from '@atlaskit/editor-common/types';
|
|
18
|
+
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
22
19
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
23
20
|
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
24
21
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -33,6 +30,7 @@ import {
|
|
|
33
30
|
insertColumnWithAnalytics,
|
|
34
31
|
insertRowWithAnalytics,
|
|
35
32
|
} from '../../commands-with-analytics';
|
|
33
|
+
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
36
34
|
import { TableCssClassName as ClassName } from '../../types';
|
|
37
35
|
import { checkIfNumberColumnEnabled } from '../../utils';
|
|
38
36
|
|
|
@@ -55,7 +53,6 @@ export interface Props {
|
|
|
55
53
|
hasStickyHeaders?: boolean;
|
|
56
54
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
57
55
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
58
|
-
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
59
56
|
}
|
|
60
57
|
|
|
61
58
|
export class FloatingInsertButton extends React.Component<
|
|
@@ -278,29 +275,21 @@ export class FloatingInsertButton extends React.Component<
|
|
|
278
275
|
}
|
|
279
276
|
|
|
280
277
|
private insertColumn(event: React.SyntheticEvent) {
|
|
281
|
-
const {
|
|
282
|
-
|
|
283
|
-
insertColumnButtonIndex,
|
|
284
|
-
editorAnalyticsAPI,
|
|
285
|
-
getEditorContainerWidth,
|
|
286
|
-
} = this.props;
|
|
278
|
+
const { editorView, insertColumnButtonIndex, editorAnalyticsAPI } =
|
|
279
|
+
this.props;
|
|
287
280
|
|
|
288
281
|
if (typeof insertColumnButtonIndex !== 'undefined') {
|
|
289
282
|
event.preventDefault();
|
|
290
283
|
|
|
291
|
-
const {
|
|
292
|
-
|
|
284
|
+
const { isTableScalingEnabled = false } = getPluginState(
|
|
285
|
+
editorView.state,
|
|
286
|
+
);
|
|
293
287
|
|
|
294
288
|
const { state, dispatch } = editorView;
|
|
295
|
-
insertColumnWithAnalytics(
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(
|
|
300
|
-
state,
|
|
301
|
-
dispatch,
|
|
302
|
-
editorView,
|
|
303
|
-
);
|
|
289
|
+
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(
|
|
290
|
+
INPUT_METHOD.BUTTON,
|
|
291
|
+
insertColumnButtonIndex,
|
|
292
|
+
)(state, dispatch, editorView);
|
|
304
293
|
}
|
|
305
294
|
}
|
|
306
295
|
}
|
package/src/utils/create.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
2
1
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
3
2
|
import { createTable } from '@atlaskit/editor-tables/utils';
|
|
4
3
|
|
|
@@ -6,17 +5,15 @@ import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
|
|
|
6
5
|
|
|
7
6
|
export const createTableWithWidth =
|
|
8
7
|
(
|
|
8
|
+
isTableScalingEnabled?: boolean,
|
|
9
9
|
isFullWidthModeEnabled?: boolean,
|
|
10
|
-
getEditorFeatureFlags?: GetEditorFeatureFlags,
|
|
11
10
|
createTableProps?: {
|
|
12
11
|
rowsCount?: number;
|
|
13
12
|
colsCount?: number;
|
|
14
13
|
},
|
|
15
14
|
) =>
|
|
16
15
|
(schema: Schema) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (tablePreserveWidth && isFullWidthModeEnabled) {
|
|
16
|
+
if (isTableScalingEnabled && isFullWidthModeEnabled) {
|
|
20
17
|
return createTable({
|
|
21
18
|
schema,
|
|
22
19
|
tableWidth: TABLE_MAX_WIDTH,
|
package/src/utils/drag-menu.ts
CHANGED
|
@@ -159,7 +159,7 @@ export const getDragMenuConfig = (
|
|
|
159
159
|
selectionRect?: Rect,
|
|
160
160
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
161
161
|
isHeaderRowRequired?: boolean,
|
|
162
|
-
|
|
162
|
+
isTableScalingEnabled = false,
|
|
163
163
|
): DragMenuConfig[] => {
|
|
164
164
|
const addOptions =
|
|
165
165
|
direction === 'row'
|
|
@@ -294,15 +294,10 @@ export const getDragMenuConfig = (
|
|
|
294
294
|
},
|
|
295
295
|
)(state, dispatch);
|
|
296
296
|
} else {
|
|
297
|
-
insertColumnWithAnalytics(
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index ?? 0) + offset)(
|
|
302
|
-
state,
|
|
303
|
-
dispatch,
|
|
304
|
-
editorView,
|
|
305
|
-
);
|
|
297
|
+
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(
|
|
298
|
+
INPUT_METHOD.TABLE_CONTEXT_MENU,
|
|
299
|
+
(index ?? 0) + offset,
|
|
300
|
+
)(state, dispatch, editorView);
|
|
306
301
|
}
|
|
307
302
|
return true;
|
|
308
303
|
},
|
|
@@ -321,7 +316,7 @@ export const getDragMenuConfig = (
|
|
|
321
316
|
state,
|
|
322
317
|
editorView.domAtPos.bind(editorView),
|
|
323
318
|
getEditorContainerWidth,
|
|
324
|
-
|
|
319
|
+
isTableScalingEnabled,
|
|
325
320
|
);
|
|
326
321
|
|
|
327
322
|
if (newResizeState) {
|
|
@@ -362,7 +357,7 @@ export const getDragMenuConfig = (
|
|
|
362
357
|
!!isHeaderRowRequired,
|
|
363
358
|
)(state, dispatch);
|
|
364
359
|
} else {
|
|
365
|
-
deleteColumnsWithAnalytics(editorAnalyticsAPI,
|
|
360
|
+
deleteColumnsWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(
|
|
366
361
|
INPUT_METHOD.TABLE_CONTEXT_MENU,
|
|
367
362
|
selectionRect ?? defaultSelectionRect,
|
|
368
363
|
)(state, dispatch, editorView);
|