@atlaskit/editor-plugin-table 7.25.7 → 7.25.9
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 +17 -0
- package/dist/cjs/commands/column-resize.js +2 -1
- package/dist/cjs/commands/delete.js +5 -5
- package/dist/cjs/commands/insert.js +20 -20
- package/dist/cjs/commands-with-analytics.js +18 -17
- package/dist/cjs/event-handlers.js +5 -5
- package/dist/cjs/nodeviews/TableComponent.js +5 -11
- package/dist/cjs/nodeviews/TableResizer.js +1 -1
- package/dist/cjs/nodeviews/table.js +3 -6
- package/dist/cjs/plugin.js +11 -7
- package/dist/cjs/pm-plugins/keymap.js +19 -19
- package/dist/cjs/pm-plugins/main.js +1 -3
- package/dist/cjs/pm-plugins/table-resizing/commands.js +5 -4
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +5 -4
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +4 -4
- package/dist/cjs/toolbar.js +31 -31
- package/dist/cjs/transforms/column-width.js +4 -3
- package/dist/cjs/transforms/delete-columns.js +5 -5
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/cjs/ui/FloatingDeleteButton/index.js +1 -1
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +2 -1
- package/dist/cjs/ui/FloatingDragMenu/index.js +4 -2
- package/dist/cjs/ui/FloatingInsertButton/index.js +1 -1
- package/dist/cjs/utils/drag-menu.js +10 -10
- package/dist/es2019/commands/column-resize.js +2 -1
- package/dist/es2019/commands/delete.js +2 -2
- package/dist/es2019/commands/insert.js +8 -8
- package/dist/es2019/commands-with-analytics.js +11 -10
- package/dist/es2019/event-handlers.js +2 -2
- package/dist/es2019/nodeviews/TableComponent.js +5 -11
- package/dist/es2019/nodeviews/TableResizer.js +1 -1
- package/dist/es2019/nodeviews/table.js +3 -6
- package/dist/es2019/plugin.js +11 -7
- package/dist/es2019/pm-plugins/keymap.js +9 -9
- package/dist/es2019/pm-plugins/main.js +2 -4
- package/dist/es2019/pm-plugins/table-resizing/commands.js +5 -4
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +5 -4
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +2 -2
- package/dist/es2019/toolbar.js +13 -13
- package/dist/es2019/transforms/column-width.js +4 -5
- package/dist/es2019/transforms/delete-columns.js +2 -2
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/es2019/ui/FloatingDeleteButton/index.js +1 -1
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +2 -1
- package/dist/es2019/ui/FloatingDragMenu/index.js +4 -2
- package/dist/es2019/ui/FloatingInsertButton/index.js +1 -1
- package/dist/es2019/utils/drag-menu.js +4 -4
- package/dist/esm/commands/column-resize.js +2 -1
- package/dist/esm/commands/delete.js +5 -5
- package/dist/esm/commands/insert.js +20 -20
- package/dist/esm/commands-with-analytics.js +18 -17
- package/dist/esm/event-handlers.js +5 -5
- package/dist/esm/nodeviews/TableComponent.js +5 -11
- package/dist/esm/nodeviews/TableResizer.js +1 -1
- package/dist/esm/nodeviews/table.js +3 -6
- package/dist/esm/plugin.js +11 -7
- package/dist/esm/pm-plugins/keymap.js +19 -19
- package/dist/esm/pm-plugins/main.js +2 -4
- package/dist/esm/pm-plugins/table-resizing/commands.js +5 -4
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +5 -4
- package/dist/esm/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +4 -4
- package/dist/esm/toolbar.js +31 -31
- package/dist/esm/transforms/column-width.js +4 -4
- package/dist/esm/transforms/delete-columns.js +5 -5
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/esm/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/esm/ui/FloatingDeleteButton/index.js +1 -1
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +2 -1
- package/dist/esm/ui/FloatingDragMenu/index.js +4 -2
- package/dist/esm/ui/FloatingInsertButton/index.js +1 -1
- package/dist/esm/utils/drag-menu.js +10 -10
- package/dist/types/commands/column-resize.d.ts +3 -1
- package/dist/types/commands/delete.d.ts +2 -1
- package/dist/types/commands/insert.d.ts +5 -4
- package/dist/types/commands-with-analytics.d.ts +6 -6
- package/dist/types/event-handlers.d.ts +2 -1
- package/dist/types/pm-plugins/keymap.d.ts +2 -2
- package/dist/types/pm-plugins/table-resizing/commands.d.ts +4 -2
- package/dist/types/pm-plugins/table-resizing/event-handlers.d.ts +2 -1
- package/dist/types/pm-plugins/table-resizing/plugin.d.ts +2 -2
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +2 -1
- package/dist/types/toolbar.d.ts +4 -4
- package/dist/types/transforms/column-width.d.ts +3 -2
- package/dist/types/transforms/delete-columns.d.ts +2 -1
- package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -0
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +3 -2
- package/dist/types/ui/FloatingDeleteButton/index.d.ts +2 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +3 -2
- package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types/ui/FloatingInsertButton/index.d.ts +2 -0
- package/dist/types/utils/drag-menu.d.ts +2 -2
- package/dist/types-ts4.5/commands/column-resize.d.ts +3 -1
- package/dist/types-ts4.5/commands/delete.d.ts +2 -1
- package/dist/types-ts4.5/commands/insert.d.ts +5 -4
- package/dist/types-ts4.5/commands-with-analytics.d.ts +6 -6
- package/dist/types-ts4.5/event-handlers.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/commands.d.ts +4 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/event-handlers.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/plugin.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +2 -1
- package/dist/types-ts4.5/toolbar.d.ts +4 -4
- package/dist/types-ts4.5/transforms/column-width.d.ts +3 -2
- package/dist/types-ts4.5/transforms/delete-columns.d.ts +2 -1
- package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -0
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +3 -2
- package/dist/types-ts4.5/ui/FloatingDeleteButton/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +3 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +2 -0
- package/dist/types-ts4.5/utils/drag-menu.d.ts +2 -2
- package/package.json +8 -14
- package/src/commands/column-resize.ts +4 -2
- package/src/commands/delete.ts +3 -0
- package/src/commands/insert.ts +9 -0
- package/src/commands-with-analytics.ts +17 -3
- package/src/event-handlers.ts +3 -0
- package/src/nodeviews/TableComponent.tsx +3 -6
- package/src/nodeviews/TableResizer.tsx +1 -0
- package/src/nodeviews/table.tsx +3 -7
- package/src/plugin.tsx +7 -0
- package/src/pm-plugins/keymap.ts +10 -3
- package/src/pm-plugins/main.ts +1 -5
- package/src/pm-plugins/table-resizing/commands.ts +13 -3
- package/src/pm-plugins/table-resizing/event-handlers.ts +5 -2
- package/src/pm-plugins/table-resizing/plugin.ts +3 -1
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +3 -1
- package/src/toolbar.tsx +14 -2
- package/src/transforms/column-width.ts +11 -3
- package/src/transforms/delete-columns.ts +3 -0
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +5 -1
- package/src/ui/FloatingContextualMenu/index.tsx +4 -1
- package/src/ui/FloatingDeleteButton/index.tsx +3 -2
- package/src/ui/FloatingDragMenu/DragMenu.tsx +4 -1
- package/src/ui/FloatingDragMenu/index.tsx +4 -1
- package/src/ui/FloatingInsertButton/index.tsx +3 -0
- package/src/utils/drag-menu.ts +5 -2
package/src/toolbar.tsx
CHANGED
|
@@ -88,6 +88,7 @@ import { canMergeCells } from './transforms';
|
|
|
88
88
|
import type {
|
|
89
89
|
AlignmentOptions,
|
|
90
90
|
PluginConfig,
|
|
91
|
+
PluginInjectionAPI,
|
|
91
92
|
ToolbarMenuConfig,
|
|
92
93
|
ToolbarMenuContext,
|
|
93
94
|
ToolbarMenuState,
|
|
@@ -192,6 +193,7 @@ export const getToolbarCellOptionsConfig = (
|
|
|
192
193
|
initialSelectionRect: Rect,
|
|
193
194
|
{ formatMessage }: ToolbarMenuContext,
|
|
194
195
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
196
|
+
api: PluginInjectionAPI | undefined | null,
|
|
195
197
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
196
198
|
isTableScalingEnabled = false,
|
|
197
199
|
isCellBackgroundDuplicated = false,
|
|
@@ -213,6 +215,7 @@ export const getToolbarCellOptionsConfig = (
|
|
|
213
215
|
const index = selectionRect?.right;
|
|
214
216
|
if (index) {
|
|
215
217
|
insertColumnWithAnalytics(
|
|
218
|
+
api,
|
|
216
219
|
editorAnalyticsAPI,
|
|
217
220
|
isTableScalingEnabled,
|
|
218
221
|
isCellBackgroundDuplicated,
|
|
@@ -256,6 +259,7 @@ export const getToolbarCellOptionsConfig = (
|
|
|
256
259
|
if (selectionRect) {
|
|
257
260
|
deleteColumnsWithAnalytics(
|
|
258
261
|
editorAnalyticsAPI,
|
|
262
|
+
api,
|
|
259
263
|
isTableScalingEnabled,
|
|
260
264
|
isTableFixedColumnWidthsOptionEnabled,
|
|
261
265
|
shouldUseIncreasedScalingPercent,
|
|
@@ -330,7 +334,7 @@ export const getToolbarCellOptionsConfig = (
|
|
|
330
334
|
|
|
331
335
|
const distributeColumnWidths: Command = (state, dispatch) => {
|
|
332
336
|
if (newResizeStateWithAnalytics) {
|
|
333
|
-
distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI)(
|
|
337
|
+
distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI, api)(
|
|
334
338
|
INPUT_METHOD.FLOATING_TB,
|
|
335
339
|
newResizeStateWithAnalytics,
|
|
336
340
|
)(state, dispatch);
|
|
@@ -460,6 +464,7 @@ export const getClosestSelectionOrTableRect = (state: EditorState): Rect | undef
|
|
|
460
464
|
export const getToolbarConfig =
|
|
461
465
|
(
|
|
462
466
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
467
|
+
api: PluginInjectionAPI | undefined | null,
|
|
463
468
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
464
469
|
getEditorFeatureFlags: GetEditorFeatureFlags,
|
|
465
470
|
getEditorView: () => EditorView | null,
|
|
@@ -546,6 +551,7 @@ export const getToolbarConfig =
|
|
|
546
551
|
editorView,
|
|
547
552
|
intl,
|
|
548
553
|
getEditorContainerWidth,
|
|
554
|
+
api,
|
|
549
555
|
editorAnalyticsAPI,
|
|
550
556
|
isTableScalingEnabled,
|
|
551
557
|
isCellBackgroundDuplicated,
|
|
@@ -560,6 +566,7 @@ export const getToolbarConfig =
|
|
|
560
566
|
editorView,
|
|
561
567
|
intl,
|
|
562
568
|
getEditorContainerWidth,
|
|
569
|
+
api,
|
|
563
570
|
editorAnalyticsAPI,
|
|
564
571
|
isTableScalingEnabled,
|
|
565
572
|
isTableFixedColumnWidthsOptionEnabled,
|
|
@@ -660,6 +667,7 @@ const getCellItems = (
|
|
|
660
667
|
view: EditorView | null,
|
|
661
668
|
{ formatMessage }: ToolbarMenuContext,
|
|
662
669
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
670
|
+
api: PluginInjectionAPI | undefined | null,
|
|
663
671
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
664
672
|
isTableScalingEnabled = false,
|
|
665
673
|
isCellBackgroundDuplicated = false,
|
|
@@ -675,6 +683,7 @@ const getCellItems = (
|
|
|
675
683
|
initialSelectionRect,
|
|
676
684
|
{ formatMessage },
|
|
677
685
|
getEditorContainerWidth,
|
|
686
|
+
api,
|
|
678
687
|
editorAnalyticsAPI,
|
|
679
688
|
isTableScalingEnabled,
|
|
680
689
|
isCellBackgroundDuplicated,
|
|
@@ -690,6 +699,7 @@ const getCellItems = (
|
|
|
690
699
|
export const getDistributeConfig =
|
|
691
700
|
(
|
|
692
701
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
702
|
+
api: PluginInjectionAPI | undefined | null,
|
|
693
703
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
694
704
|
isTableScalingEnabled = false,
|
|
695
705
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
@@ -712,7 +722,7 @@ export const getDistributeConfig =
|
|
|
712
722
|
);
|
|
713
723
|
|
|
714
724
|
if (newResizeStateWithAnalytics) {
|
|
715
|
-
distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI)(
|
|
725
|
+
distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI, api)(
|
|
716
726
|
INPUT_METHOD.FLOATING_TB,
|
|
717
727
|
newResizeStateWithAnalytics,
|
|
718
728
|
)(state, dispatch);
|
|
@@ -728,6 +738,7 @@ const getColumnSettingItems = (
|
|
|
728
738
|
editorView: EditorView | undefined | null,
|
|
729
739
|
{ formatMessage }: ToolbarMenuContext,
|
|
730
740
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
741
|
+
api: PluginInjectionAPI | undefined | null,
|
|
731
742
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
732
743
|
isTableScalingEnabled = false,
|
|
733
744
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
@@ -760,6 +771,7 @@ const getColumnSettingItems = (
|
|
|
760
771
|
onClick: (state, dispatch, view) =>
|
|
761
772
|
getDistributeConfig(
|
|
762
773
|
getEditorContainerWidth,
|
|
774
|
+
api,
|
|
763
775
|
editorAnalyticsAPI,
|
|
764
776
|
isTableScalingEnabled,
|
|
765
777
|
isTableFixedColumnWidthsOptionEnabled,
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
import { isMinCellWidthTable } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
17
17
|
import { getResizeState } from '../pm-plugins/table-resizing/utils/resize-state';
|
|
18
18
|
import { scaleTableTo } from '../pm-plugins/table-resizing/utils/scale-table';
|
|
19
|
+
import type { PluginInjectionAPI } from '../types';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Given a new ResizeState object, create a transaction that replaces and updates the table node based on new state.
|
|
@@ -25,7 +26,13 @@ import { scaleTableTo } from '../pm-plugins/table-resizing/utils/scale-table';
|
|
|
25
26
|
* @returns
|
|
26
27
|
*/
|
|
27
28
|
export const updateColumnWidths =
|
|
28
|
-
(
|
|
29
|
+
(
|
|
30
|
+
resizeState: ResizeState,
|
|
31
|
+
table: PMNode,
|
|
32
|
+
start: number,
|
|
33
|
+
// TODO: ED-24636 To be used in a follow up change
|
|
34
|
+
_api: PluginInjectionAPI | undefined | null,
|
|
35
|
+
) =>
|
|
29
36
|
(tr: Transaction): Transaction => {
|
|
30
37
|
const map = TableMap.get(table);
|
|
31
38
|
const updatedCellsAttrs: { [key: number]: CellAttributes } = {};
|
|
@@ -107,6 +114,7 @@ export const rescaleColumns =
|
|
|
107
114
|
isTableScalingEnabled = false,
|
|
108
115
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
109
116
|
shouldUseIncreasedScalingPercent = false,
|
|
117
|
+
api: PluginInjectionAPI | undefined | null,
|
|
110
118
|
) =>
|
|
111
119
|
(table: ContentNodeWithPos, view: EditorView | undefined) =>
|
|
112
120
|
(tr: Transaction): Transaction => {
|
|
@@ -195,7 +203,7 @@ export const rescaleColumns =
|
|
|
195
203
|
tableWidth: previousTableInfo.width,
|
|
196
204
|
overflow: wasTableInOverflow,
|
|
197
205
|
};
|
|
198
|
-
return updateColumnWidths(minWidthResizeState, table.node, table.start)(tr);
|
|
206
|
+
return updateColumnWidths(minWidthResizeState, table.node, table.start, api)(tr);
|
|
199
207
|
}
|
|
200
208
|
|
|
201
209
|
let resizeState = getResizeState({
|
|
@@ -219,5 +227,5 @@ export const rescaleColumns =
|
|
|
219
227
|
resizeState = scaleTableTo(resizeState, previousTableInfo.possibleMaxWidth);
|
|
220
228
|
}
|
|
221
229
|
|
|
222
|
-
return updateColumnWidths(resizeState, table.node, table.start)(tr);
|
|
230
|
+
return updateColumnWidths(resizeState, table.node, table.start, api)(tr);
|
|
223
231
|
};
|
|
@@ -10,6 +10,7 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
10
10
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
11
11
|
|
|
12
12
|
import { META_KEYS } from '../pm-plugins/table-analytics';
|
|
13
|
+
import type { PluginInjectionAPI } from '../types';
|
|
13
14
|
|
|
14
15
|
import { rescaleColumns } from './column-width';
|
|
15
16
|
import { splitCellsInColumns } from './split';
|
|
@@ -243,6 +244,7 @@ export const deleteColumns =
|
|
|
243
244
|
(
|
|
244
245
|
rect: Rect,
|
|
245
246
|
allowCustomStep: boolean,
|
|
247
|
+
api: PluginInjectionAPI | undefined | null,
|
|
246
248
|
view?: EditorView,
|
|
247
249
|
isTableScalingEnabled = false,
|
|
248
250
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
@@ -265,6 +267,7 @@ export const deleteColumns =
|
|
|
265
267
|
isTableScalingEnabled,
|
|
266
268
|
isTableFixedColumnWidthsOptionEnabled,
|
|
267
269
|
shouldUseIncreasedScalingPercent,
|
|
270
|
+
api,
|
|
268
271
|
)(
|
|
269
272
|
table,
|
|
270
273
|
view,
|
|
@@ -72,6 +72,7 @@ import { pluginKey as tablePluginKey } from '../../pm-plugins/plugin-key';
|
|
|
72
72
|
import { getNewResizeStateFromSelectedColumns } from '../../pm-plugins/table-resizing/utils/resize-state';
|
|
73
73
|
import { canMergeCells } from '../../transforms';
|
|
74
74
|
import { TableCssClassName as ClassName } from '../../types';
|
|
75
|
+
import type { PluginInjectionAPI } from '../../types';
|
|
75
76
|
import {
|
|
76
77
|
getMergedCellsPositions,
|
|
77
78
|
getSelectedColumnIndexes,
|
|
@@ -97,6 +98,7 @@ export interface Props {
|
|
|
97
98
|
allowBackgroundColor?: boolean;
|
|
98
99
|
boundariesElement?: HTMLElement;
|
|
99
100
|
offset?: Array<number>;
|
|
101
|
+
api: PluginInjectionAPI | undefined | null;
|
|
100
102
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
101
103
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
102
104
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
@@ -722,7 +724,7 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
722
724
|
);
|
|
723
725
|
|
|
724
726
|
if (newResizeStateWithAnalytics) {
|
|
725
|
-
distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI)(
|
|
727
|
+
distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI, this.props.api)(
|
|
726
728
|
INPUT_METHOD.CONTEXT_MENU,
|
|
727
729
|
newResizeStateWithAnalytics,
|
|
728
730
|
)(state, dispatch);
|
|
@@ -738,6 +740,7 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
738
740
|
break;
|
|
739
741
|
case 'insert_column':
|
|
740
742
|
insertColumnWithAnalytics(
|
|
743
|
+
this.props.api,
|
|
741
744
|
editorAnalyticsAPI,
|
|
742
745
|
isTableScalingEnabled,
|
|
743
746
|
tableDuplicateCellColouring,
|
|
@@ -759,6 +762,7 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
759
762
|
case 'delete_column':
|
|
760
763
|
deleteColumnsWithAnalytics(
|
|
761
764
|
editorAnalyticsAPI,
|
|
765
|
+
this.props.api,
|
|
762
766
|
isTableScalingEnabled,
|
|
763
767
|
tableWithFixedColumnWidthsOption,
|
|
764
768
|
shouldUseIncreasedScalingPercent,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from '@atlaskit/editor-tables/utils';
|
|
22
22
|
|
|
23
23
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
24
|
-
import type { PluginConfig } from '../../types';
|
|
24
|
+
import type { PluginConfig, PluginInjectionAPI } from '../../types';
|
|
25
25
|
import {
|
|
26
26
|
contextualMenuDropdownWidth,
|
|
27
27
|
contextualMenuDropdownWidthDnD,
|
|
@@ -36,6 +36,7 @@ export interface Props {
|
|
|
36
36
|
editorView: EditorView;
|
|
37
37
|
isOpen: boolean;
|
|
38
38
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
39
|
+
api: PluginInjectionAPI | undefined | null;
|
|
39
40
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
40
41
|
targetCellPosition?: number;
|
|
41
42
|
mountPoint?: HTMLElement;
|
|
@@ -59,6 +60,7 @@ const FloatingContextualMenu = ({
|
|
|
59
60
|
getEditorFeatureFlags,
|
|
60
61
|
isCellMenuOpenByKeyboard,
|
|
61
62
|
isCommentEditor,
|
|
63
|
+
api,
|
|
62
64
|
}: Props) => {
|
|
63
65
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
64
66
|
const { targetCellPosition, isDragAndDropEnabled } = getPluginState(editorView.state);
|
|
@@ -117,6 +119,7 @@ const FloatingContextualMenu = ({
|
|
|
117
119
|
getEditorFeatureFlags={getEditorFeatureFlags}
|
|
118
120
|
isCellMenuOpenByKeyboard={isCellMenuOpenByKeyboard}
|
|
119
121
|
isCommentEditor={isCommentEditor}
|
|
122
|
+
api={api}
|
|
120
123
|
/>
|
|
121
124
|
</div>
|
|
122
125
|
</Popup>
|
|
@@ -18,7 +18,7 @@ import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
|
|
|
18
18
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics } from '../../commands-with-analytics';
|
|
19
19
|
import { getPluginState as getTablePluginState } from '../../pm-plugins/plugin-factory';
|
|
20
20
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
21
|
-
import type { TableDirection } from '../../types';
|
|
21
|
+
import type { PluginInjectionAPI, TableDirection } from '../../types';
|
|
22
22
|
import { TableCssClassName as ClassName } from '../../types';
|
|
23
23
|
import {
|
|
24
24
|
getColumnDeleteButtonParams,
|
|
@@ -35,6 +35,7 @@ import type { CellSelectionType } from './types';
|
|
|
35
35
|
export interface Props {
|
|
36
36
|
editorView: EditorView;
|
|
37
37
|
selection: Selection;
|
|
38
|
+
api: PluginInjectionAPI | undefined | null;
|
|
38
39
|
tableRef?: HTMLTableElement;
|
|
39
40
|
mountPoint?: HTMLElement;
|
|
40
41
|
boundariesElement?: HTMLElement;
|
|
@@ -257,7 +258,7 @@ class FloatingDeleteButton extends Component<Props, State> {
|
|
|
257
258
|
if (rect) {
|
|
258
259
|
switch (this.state.selectionType) {
|
|
259
260
|
case 'column': {
|
|
260
|
-
deleteColumnsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.BUTTON, rect)(
|
|
261
|
+
deleteColumnsWithAnalytics(editorAnalyticsAPI, this.props.api)(INPUT_METHOD.BUTTON, rect)(
|
|
261
262
|
state,
|
|
262
263
|
dispatch,
|
|
263
264
|
this.props.editorView,
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
import { toggleDragMenu } from '../../pm-plugins/drag-and-drop/commands';
|
|
56
56
|
import { getPluginState } from '../../pm-plugins/drag-and-drop/plugin-factory';
|
|
57
57
|
import { getPluginState as getTablePluginState } from '../../pm-plugins/plugin-factory';
|
|
58
|
-
import type { PluginConfig, TableDirection } from '../../types';
|
|
58
|
+
import type { PluginConfig, PluginInjectionAPI, TableDirection } from '../../types';
|
|
59
59
|
import { TableCssClassName as ClassName } from '../../types';
|
|
60
60
|
import {
|
|
61
61
|
checkIfHeaderColumnEnabled,
|
|
@@ -86,6 +86,7 @@ type DragMenuProps = {
|
|
|
86
86
|
targetCellPosition?: number;
|
|
87
87
|
pluginConfig?: PluginConfig;
|
|
88
88
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
89
|
+
api: PluginInjectionAPI | undefined | null;
|
|
89
90
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
90
91
|
fitWidth?: number;
|
|
91
92
|
fitHeight?: number;
|
|
@@ -270,6 +271,7 @@ export const DragMenu = React.memo(
|
|
|
270
271
|
tableNode,
|
|
271
272
|
targetCellPosition,
|
|
272
273
|
getEditorContainerWidth,
|
|
274
|
+
api,
|
|
273
275
|
editorAnalyticsAPI,
|
|
274
276
|
pluginConfig,
|
|
275
277
|
intl: { formatMessage },
|
|
@@ -303,6 +305,7 @@ export const DragMenu = React.memo(
|
|
|
303
305
|
getEditorContainerWidth,
|
|
304
306
|
hasMergedCellsInTable,
|
|
305
307
|
editorView,
|
|
308
|
+
api,
|
|
306
309
|
tableMap,
|
|
307
310
|
index,
|
|
308
311
|
targetCellPosition,
|
|
@@ -14,7 +14,7 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
|
|
16
16
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
17
|
-
import type { PluginConfig, TableDirection } from '../../types';
|
|
17
|
+
import type { PluginConfig, PluginInjectionAPI, TableDirection } from '../../types';
|
|
18
18
|
import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
|
|
19
19
|
|
|
20
20
|
import DragMenu from './DragMenu';
|
|
@@ -31,6 +31,7 @@ export interface Props {
|
|
|
31
31
|
index?: number;
|
|
32
32
|
targetCellPosition?: number;
|
|
33
33
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
34
|
+
api: PluginInjectionAPI | undefined | null;
|
|
34
35
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
35
36
|
stickyHeaders?: RowStickyState;
|
|
36
37
|
pluginConfig?: PluginConfig;
|
|
@@ -59,6 +60,7 @@ const FloatingDragMenu = ({
|
|
|
59
60
|
isTableScalingEnabled,
|
|
60
61
|
getEditorFeatureFlags,
|
|
61
62
|
ariaNotifyPlugin,
|
|
63
|
+
api,
|
|
62
64
|
}: Props) => {
|
|
63
65
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
64
66
|
return null;
|
|
@@ -127,6 +129,7 @@ const FloatingDragMenu = ({
|
|
|
127
129
|
isTableFixedColumnWidthsOptionEnabled={tableWithFixedColumnWidthsOption}
|
|
128
130
|
tableSortColumnReorder={tableSortColumnReorder}
|
|
129
131
|
ariaNotifyPlugin={ariaNotifyPlugin}
|
|
132
|
+
api={api}
|
|
130
133
|
/>
|
|
131
134
|
</Popup>
|
|
132
135
|
);
|
|
@@ -29,6 +29,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
29
29
|
|
|
30
30
|
import { insertColumnWithAnalytics, insertRowWithAnalytics } from '../../commands-with-analytics';
|
|
31
31
|
import { TableCssClassName as ClassName } from '../../types';
|
|
32
|
+
import type { PluginInjectionAPI } from '../../types';
|
|
32
33
|
import { checkIfNumberColumnEnabled } from '../../utils';
|
|
33
34
|
|
|
34
35
|
import getPopupOptions from './getPopupOptions';
|
|
@@ -49,6 +50,7 @@ export interface Props {
|
|
|
49
50
|
boundariesElement?: HTMLElement;
|
|
50
51
|
scrollableElement?: HTMLElement;
|
|
51
52
|
hasStickyHeaders?: boolean;
|
|
53
|
+
api: PluginInjectionAPI | undefined | null;
|
|
52
54
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
53
55
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
54
56
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
@@ -280,6 +282,7 @@ export class FloatingInsertButton extends React.Component<Props & WrappedCompone
|
|
|
280
282
|
|
|
281
283
|
const { state, dispatch } = editorView;
|
|
282
284
|
insertColumnWithAnalytics(
|
|
285
|
+
this.props.api,
|
|
283
286
|
editorAnalyticsAPI,
|
|
284
287
|
isTableScalingEnabled,
|
|
285
288
|
tableDuplicateCellColouring,
|
package/src/utils/drag-menu.ts
CHANGED
|
@@ -49,7 +49,7 @@ import { moveSourceWithAnalytics } from '../pm-plugins/drag-and-drop/commands-wi
|
|
|
49
49
|
import { getPluginState as getTablePluginState } from '../pm-plugins/plugin-factory';
|
|
50
50
|
import { getNewResizeStateFromSelectedColumns } from '../pm-plugins/table-resizing/utils/resize-state';
|
|
51
51
|
import { getClosestSelectionRect } from '../toolbar';
|
|
52
|
-
import type { DraggableData, DraggableType, TableDirection } from '../types';
|
|
52
|
+
import type { DraggableData, DraggableType, PluginInjectionAPI, TableDirection } from '../types';
|
|
53
53
|
import { AddColLeftIcon, AddColRightIcon, AddRowAboveIcon, AddRowBelowIcon } from '../ui/icons';
|
|
54
54
|
|
|
55
55
|
import {
|
|
@@ -139,6 +139,7 @@ export const getDragMenuConfig = (
|
|
|
139
139
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
140
140
|
hasMergedCellsInTable: boolean,
|
|
141
141
|
editorView: EditorView,
|
|
142
|
+
api: PluginInjectionAPI | undefined | null,
|
|
142
143
|
tableMap?: TableMap,
|
|
143
144
|
index?: number,
|
|
144
145
|
targetCellPosition?: number,
|
|
@@ -275,6 +276,7 @@ export const getDragMenuConfig = (
|
|
|
275
276
|
)(state, dispatch);
|
|
276
277
|
} else {
|
|
277
278
|
insertColumnWithAnalytics(
|
|
279
|
+
api,
|
|
278
280
|
editorAnalyticsAPI,
|
|
279
281
|
isTableScalingEnabled,
|
|
280
282
|
tableDuplicateCellColouring,
|
|
@@ -304,7 +306,7 @@ export const getDragMenuConfig = (
|
|
|
304
306
|
);
|
|
305
307
|
|
|
306
308
|
if (newResizeState) {
|
|
307
|
-
distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI)(
|
|
309
|
+
distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI, api)(
|
|
308
310
|
INPUT_METHOD.TABLE_CONTEXT_MENU,
|
|
309
311
|
newResizeState,
|
|
310
312
|
)(state, dispatch);
|
|
@@ -343,6 +345,7 @@ export const getDragMenuConfig = (
|
|
|
343
345
|
} else {
|
|
344
346
|
deleteColumnsWithAnalytics(
|
|
345
347
|
editorAnalyticsAPI,
|
|
348
|
+
api,
|
|
346
349
|
isTableScalingEnabled,
|
|
347
350
|
isTableFixedColumnWidthsOptionEnabled,
|
|
348
351
|
shouldUseIncreasedScalingPercent,
|