@atlaskit/editor-plugin-table 7.12.6 → 7.13.1
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 +24 -0
- package/dist/cjs/commands/insert.js +6 -4
- package/dist/cjs/commands-with-analytics.js +4 -2
- package/dist/cjs/plugin.js +7 -4
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +11 -7
- package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +7 -2
- package/dist/cjs/ui/FloatingInsertButton/index.js +10 -4
- package/dist/cjs/utils/drag-menu.js +3 -2
- package/dist/es2019/commands/insert.js +6 -6
- package/dist/es2019/commands-with-analytics.js +4 -4
- package/dist/es2019/plugin.js +7 -4
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +7 -3
- package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +7 -2
- package/dist/es2019/ui/FloatingInsertButton/index.js +10 -4
- package/dist/es2019/utils/drag-menu.js +3 -3
- package/dist/esm/commands/insert.js +6 -4
- package/dist/esm/commands-with-analytics.js +4 -2
- package/dist/esm/plugin.js +7 -4
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +11 -7
- package/dist/esm/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +7 -2
- package/dist/esm/ui/FloatingInsertButton/index.js +10 -4
- package/dist/esm/utils/drag-menu.js +3 -2
- package/dist/types/commands/insert.d.ts +3 -3
- package/dist/types/commands-with-analytics.d.ts +2 -2
- package/dist/types/plugin.d.ts +1 -0
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
- package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types/ui/FloatingInsertButton/index.d.ts +2 -1
- package/dist/types/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/commands/insert.d.ts +3 -3
- package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -2
- package/dist/types-ts4.5/plugin.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +2 -1
- package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
- package/package.json +2 -2
- package/src/commands/insert.ts +16 -6
- package/src/commands-with-analytics.ts +13 -3
- package/src/plugin.tsx +12 -0
- package/src/pm-plugins/main.ts +1 -0
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +21 -8
- package/src/ui/FloatingContextualMenu/index.tsx +2 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
- package/src/ui/FloatingDragMenu/index.tsx +11 -1
- package/src/ui/FloatingInsertButton/index.tsx +38 -11
- package/src/utils/drag-menu.ts +17 -11
package/src/commands/insert.ts
CHANGED
|
@@ -44,7 +44,10 @@ function addColumnAtCustomStep(column: number) {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export function addColumnAt(
|
|
47
|
+
export function addColumnAt(
|
|
48
|
+
isTableScalingEnabled = false,
|
|
49
|
+
isCellBackgroundDuplicated?: boolean,
|
|
50
|
+
) {
|
|
48
51
|
return (
|
|
49
52
|
column: number,
|
|
50
53
|
allowAddColumnCustomStep: boolean = false,
|
|
@@ -55,7 +58,10 @@ export function addColumnAt(isTableScalingEnabled = false) {
|
|
|
55
58
|
if (allowAddColumnCustomStep) {
|
|
56
59
|
updatedTr = addColumnAtCustomStep(column)(updatedTr);
|
|
57
60
|
} else {
|
|
58
|
-
updatedTr = addColumnAtPMUtils(
|
|
61
|
+
updatedTr = addColumnAtPMUtils(
|
|
62
|
+
column,
|
|
63
|
+
isCellBackgroundDuplicated,
|
|
64
|
+
)(updatedTr);
|
|
59
65
|
}
|
|
60
66
|
const table = findTable(updatedTr.selection);
|
|
61
67
|
if (table) {
|
|
@@ -126,10 +132,10 @@ export const addColumnAfter =
|
|
|
126
132
|
};
|
|
127
133
|
|
|
128
134
|
export const insertColumn =
|
|
129
|
-
(isTableScalingEnabled = false) =>
|
|
135
|
+
(isTableScalingEnabled = false, isCellBackgroundDuplicated?: boolean) =>
|
|
130
136
|
(column: number): Command =>
|
|
131
137
|
(state, dispatch, view) => {
|
|
132
|
-
let tr = addColumnAt(isTableScalingEnabled)(
|
|
138
|
+
let tr = addColumnAt(isTableScalingEnabled, isCellBackgroundDuplicated)(
|
|
133
139
|
column,
|
|
134
140
|
getAllowAddColumnCustomStep(state),
|
|
135
141
|
view,
|
|
@@ -150,7 +156,11 @@ export const insertColumn =
|
|
|
150
156
|
};
|
|
151
157
|
|
|
152
158
|
export const insertRow =
|
|
153
|
-
(
|
|
159
|
+
(
|
|
160
|
+
row: number,
|
|
161
|
+
moveCursorToTheNewRow: boolean,
|
|
162
|
+
isCellBackgroundDuplicated?: boolean,
|
|
163
|
+
): Command =>
|
|
154
164
|
(state, dispatch) => {
|
|
155
165
|
// Don't clone the header row
|
|
156
166
|
const headerRowEnabled = checkIfHeaderRowEnabled(state.selection);
|
|
@@ -165,7 +175,7 @@ export const insertRow =
|
|
|
165
175
|
|
|
166
176
|
const tr = clonePreviousRow
|
|
167
177
|
? copyPreviousRow(state.schema)(row)(state.tr)
|
|
168
|
-
: addRowAt(row)(state.tr);
|
|
178
|
+
: addRowAt(row, undefined, isCellBackgroundDuplicated)(state.tr);
|
|
169
179
|
|
|
170
180
|
const table = findTable(tr.selection);
|
|
171
181
|
if (!table) {
|
|
@@ -240,7 +240,10 @@ export const addRowAroundSelection =
|
|
|
240
240
|
};
|
|
241
241
|
|
|
242
242
|
export const insertRowWithAnalytics =
|
|
243
|
-
(
|
|
243
|
+
(
|
|
244
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
245
|
+
isCellbackgroundDuplicated = false,
|
|
246
|
+
) =>
|
|
244
247
|
(inputMethod: InsertRowMethods, options: InsertRowOptions) =>
|
|
245
248
|
withEditorAnalyticsAPI((state) => {
|
|
246
249
|
const { totalRowCount, totalColumnCount } = getSelectedTableInfo(
|
|
@@ -259,7 +262,11 @@ export const insertRowWithAnalytics =
|
|
|
259
262
|
eventType: EVENT_TYPE.TRACK,
|
|
260
263
|
};
|
|
261
264
|
})(editorAnalyticsAPI)(
|
|
262
|
-
insertRow(
|
|
265
|
+
insertRow(
|
|
266
|
+
options.index,
|
|
267
|
+
options.moveCursorToInsertedRow,
|
|
268
|
+
isCellbackgroundDuplicated,
|
|
269
|
+
),
|
|
263
270
|
);
|
|
264
271
|
|
|
265
272
|
export const changeColumnWidthByStepWithAnalytics =
|
|
@@ -308,6 +315,7 @@ export const insertColumnWithAnalytics =
|
|
|
308
315
|
(
|
|
309
316
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
310
317
|
isTableScalingEnabled = false,
|
|
318
|
+
isCellbackgroundDuplicated = false,
|
|
311
319
|
) =>
|
|
312
320
|
(
|
|
313
321
|
inputMethod:
|
|
@@ -334,7 +342,9 @@ export const insertColumnWithAnalytics =
|
|
|
334
342
|
},
|
|
335
343
|
eventType: EVENT_TYPE.TRACK,
|
|
336
344
|
};
|
|
337
|
-
})(editorAnalyticsAPI)(
|
|
345
|
+
})(editorAnalyticsAPI)(
|
|
346
|
+
insertColumn(isTableScalingEnabled, isCellbackgroundDuplicated)(position),
|
|
347
|
+
);
|
|
338
348
|
|
|
339
349
|
export const deleteRowsWithAnalytics =
|
|
340
350
|
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
package/src/plugin.tsx
CHANGED
|
@@ -102,6 +102,7 @@ export interface TablePluginOptions {
|
|
|
102
102
|
wasFullWidthEnabled?: boolean;
|
|
103
103
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
104
104
|
isTableScalingEnabled?: boolean;
|
|
105
|
+
isTableAlignmentEnabled?: boolean;
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
@@ -267,7 +268,9 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
267
268
|
getEditorFeatureFlags,
|
|
268
269
|
dragAndDropEnabled,
|
|
269
270
|
isTableScalingEnabled,
|
|
271
|
+
isTableAlignmentEnabled,
|
|
270
272
|
} = options || ({} as TablePluginOptions);
|
|
273
|
+
|
|
271
274
|
return createPlugin(
|
|
272
275
|
dispatchAnalyticsEvent,
|
|
273
276
|
dispatch,
|
|
@@ -284,6 +287,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
284
287
|
editorAnalyticsAPI,
|
|
285
288
|
api,
|
|
286
289
|
isTableScalingEnabled,
|
|
290
|
+
isTableAlignmentEnabled,
|
|
287
291
|
);
|
|
288
292
|
},
|
|
289
293
|
},
|
|
@@ -548,6 +552,10 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
548
552
|
dispatchAnalyticsEvent={dispatchAnalyticsEvent}
|
|
549
553
|
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
550
554
|
getEditorContainerWidth={defaultGetEditorContainerWidth}
|
|
555
|
+
getEditorFeatureFlags={
|
|
556
|
+
options?.getEditorFeatureFlags ||
|
|
557
|
+
defaultGetEditorFeatureFlags
|
|
558
|
+
}
|
|
551
559
|
/>
|
|
552
560
|
)}
|
|
553
561
|
{options?.allowContextualMenu && (
|
|
@@ -582,6 +590,10 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
582
590
|
stickyHeaders={stickyHeader}
|
|
583
591
|
pluginConfig={pluginConfig}
|
|
584
592
|
isTableScalingEnabled={options?.isTableScalingEnabled}
|
|
593
|
+
getEditorFeatureFlags={
|
|
594
|
+
options?.getEditorFeatureFlags ||
|
|
595
|
+
defaultGetEditorFeatureFlags
|
|
596
|
+
}
|
|
585
597
|
/>
|
|
586
598
|
)}
|
|
587
599
|
{allowControls && !isDragAndDropEnabled && !isResizing && (
|
package/src/pm-plugins/main.ts
CHANGED
|
@@ -115,6 +115,7 @@ export const createPlugin = (
|
|
|
115
115
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
116
116
|
pluginInjectionApi?: PluginInjectionAPI,
|
|
117
117
|
isTableScalingEnabled?: boolean,
|
|
118
|
+
isTableAlignmentEnabled?: boolean,
|
|
118
119
|
) => {
|
|
119
120
|
const state = createPluginState(dispatch, {
|
|
120
121
|
pluginConfig,
|
|
@@ -539,12 +539,17 @@ export class ContextualMenu extends Component<
|
|
|
539
539
|
selectionRect,
|
|
540
540
|
editorAnalyticsAPI,
|
|
541
541
|
getEditorContainerWidth,
|
|
542
|
+
getEditorFeatureFlags,
|
|
542
543
|
} = this.props;
|
|
543
544
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
544
545
|
const { state, dispatch } = editorView;
|
|
545
546
|
const { targetCellPosition, isTableScalingEnabled = false } =
|
|
546
547
|
getPluginState(state);
|
|
547
548
|
|
|
549
|
+
const { tableDuplicateCellColouring = false } = getEditorFeatureFlags
|
|
550
|
+
? getEditorFeatureFlags()
|
|
551
|
+
: {};
|
|
552
|
+
|
|
548
553
|
switch (item.value.name) {
|
|
549
554
|
case 'sort_column_desc':
|
|
550
555
|
sortColumnWithAnalytics(editorAnalyticsAPI)(
|
|
@@ -602,17 +607,25 @@ export class ContextualMenu extends Component<
|
|
|
602
607
|
this.toggleOpen();
|
|
603
608
|
break;
|
|
604
609
|
case 'insert_column':
|
|
605
|
-
insertColumnWithAnalytics(
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
610
|
+
insertColumnWithAnalytics(
|
|
611
|
+
editorAnalyticsAPI,
|
|
612
|
+
isTableScalingEnabled,
|
|
613
|
+
tableDuplicateCellColouring,
|
|
614
|
+
)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(
|
|
615
|
+
state,
|
|
616
|
+
dispatch,
|
|
617
|
+
editorView,
|
|
618
|
+
);
|
|
609
619
|
this.toggleOpen();
|
|
610
620
|
break;
|
|
611
621
|
case 'insert_row':
|
|
612
|
-
insertRowWithAnalytics(editorAnalyticsAPI)(
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
622
|
+
insertRowWithAnalytics(editorAnalyticsAPI, tableDuplicateCellColouring)(
|
|
623
|
+
INPUT_METHOD.CONTEXT_MENU,
|
|
624
|
+
{
|
|
625
|
+
index: selectionRect.bottom,
|
|
626
|
+
moveCursorToInsertedRow: true,
|
|
627
|
+
},
|
|
628
|
+
)(state, dispatch);
|
|
616
629
|
this.toggleOpen();
|
|
617
630
|
break;
|
|
618
631
|
case 'delete_column':
|
|
@@ -53,6 +53,7 @@ const FloatingContextualMenu = ({
|
|
|
53
53
|
pluginConfig,
|
|
54
54
|
editorAnalyticsAPI,
|
|
55
55
|
getEditorContainerWidth,
|
|
56
|
+
getEditorFeatureFlags,
|
|
56
57
|
}: Props) => {
|
|
57
58
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
58
59
|
const { targetCellPosition, isDragAndDropEnabled } = getPluginState(
|
|
@@ -122,6 +123,7 @@ const FloatingContextualMenu = ({
|
|
|
122
123
|
boundariesElement={boundariesElement}
|
|
123
124
|
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
124
125
|
getEditorContainerWidth={getEditorContainerWidth}
|
|
126
|
+
getEditorFeatureFlags={getEditorFeatureFlags}
|
|
125
127
|
/>
|
|
126
128
|
</div>
|
|
127
129
|
</Popup>
|
|
@@ -102,6 +102,7 @@ type DragMenuProps = {
|
|
|
102
102
|
boundariesElement?: HTMLElement;
|
|
103
103
|
scrollableElement?: HTMLElement;
|
|
104
104
|
isTableScalingEnabled?: boolean;
|
|
105
|
+
tableDuplicateCellColouring?: boolean;
|
|
105
106
|
};
|
|
106
107
|
|
|
107
108
|
type PluralOptionType = 'noOfCols' | 'noOfRows' | 'noOfCells' | null;
|
|
@@ -281,6 +282,7 @@ export const DragMenu = React.memo(
|
|
|
281
282
|
scrollableElement,
|
|
282
283
|
boundariesElement,
|
|
283
284
|
isTableScalingEnabled,
|
|
285
|
+
tableDuplicateCellColouring,
|
|
284
286
|
}: DragMenuProps & WrappedComponentProps) => {
|
|
285
287
|
const { state, dispatch } = editorView;
|
|
286
288
|
const { selection } = state;
|
|
@@ -324,6 +326,7 @@ export const DragMenu = React.memo(
|
|
|
324
326
|
editorAnalyticsAPI,
|
|
325
327
|
pluginConfig?.isHeaderRowRequired,
|
|
326
328
|
isTableScalingEnabled,
|
|
329
|
+
tableDuplicateCellColouring,
|
|
327
330
|
);
|
|
328
331
|
|
|
329
332
|
const { menuItems, menuCallback } = convertToDropdownItems(
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
GetEditorContainerWidth,
|
|
6
|
+
GetEditorFeatureFlags,
|
|
7
|
+
} from '@atlaskit/editor-common/types';
|
|
5
8
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
6
9
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
10
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -33,6 +36,7 @@ export interface Props {
|
|
|
33
36
|
stickyHeaders?: RowStickyState;
|
|
34
37
|
pluginConfig?: PluginConfig;
|
|
35
38
|
isTableScalingEnabled?: boolean;
|
|
39
|
+
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
const FloatingDragMenu = ({
|
|
@@ -50,6 +54,7 @@ const FloatingDragMenu = ({
|
|
|
50
54
|
stickyHeaders,
|
|
51
55
|
pluginConfig,
|
|
52
56
|
isTableScalingEnabled,
|
|
57
|
+
getEditorFeatureFlags,
|
|
53
58
|
}: Props) => {
|
|
54
59
|
if (
|
|
55
60
|
!isOpen ||
|
|
@@ -74,6 +79,10 @@ const FloatingDragMenu = ({
|
|
|
74
79
|
return null;
|
|
75
80
|
}
|
|
76
81
|
|
|
82
|
+
const { tableDuplicateCellColouring = false } = getEditorFeatureFlags
|
|
83
|
+
? getEditorFeatureFlags()
|
|
84
|
+
: {};
|
|
85
|
+
|
|
77
86
|
return (
|
|
78
87
|
<Popup
|
|
79
88
|
alignX={direction === 'row' ? 'right' : undefined}
|
|
@@ -113,6 +122,7 @@ const FloatingDragMenu = ({
|
|
|
113
122
|
boundariesElement={boundariesElement}
|
|
114
123
|
scrollableElement={scrollableElement}
|
|
115
124
|
isTableScalingEnabled={isTableScalingEnabled}
|
|
125
|
+
tableDuplicateCellColouring={tableDuplicateCellColouring}
|
|
116
126
|
/>
|
|
117
127
|
</Popup>
|
|
118
128
|
);
|
|
@@ -15,7 +15,10 @@ import {
|
|
|
15
15
|
EVENT_TYPE,
|
|
16
16
|
INPUT_METHOD,
|
|
17
17
|
} from '@atlaskit/editor-common/analytics';
|
|
18
|
-
import type {
|
|
18
|
+
import type {
|
|
19
|
+
GetEditorContainerWidth,
|
|
20
|
+
GetEditorFeatureFlags,
|
|
21
|
+
} from '@atlaskit/editor-common/types';
|
|
19
22
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
20
23
|
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
21
24
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -53,6 +56,7 @@ export interface Props {
|
|
|
53
56
|
hasStickyHeaders?: boolean;
|
|
54
57
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
55
58
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
59
|
+
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
export class FloatingInsertButton extends React.Component<
|
|
@@ -94,8 +98,8 @@ export class FloatingInsertButton extends React.Component<
|
|
|
94
98
|
typeof insertColumnButtonIndex !== 'undefined'
|
|
95
99
|
? 'column'
|
|
96
100
|
: typeof insertRowButtonIndex !== 'undefined'
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
? 'row'
|
|
102
|
+
: null;
|
|
99
103
|
|
|
100
104
|
if (!tableNode || !tableRef || !type) {
|
|
101
105
|
return null;
|
|
@@ -261,13 +265,23 @@ export class FloatingInsertButton extends React.Component<
|
|
|
261
265
|
}
|
|
262
266
|
|
|
263
267
|
private insertRow(event: React.SyntheticEvent) {
|
|
264
|
-
const {
|
|
268
|
+
const {
|
|
269
|
+
editorView,
|
|
270
|
+
insertRowButtonIndex,
|
|
271
|
+
editorAnalyticsAPI,
|
|
272
|
+
getEditorFeatureFlags,
|
|
273
|
+
} = this.props;
|
|
265
274
|
|
|
266
275
|
if (typeof insertRowButtonIndex !== 'undefined') {
|
|
267
276
|
event.preventDefault();
|
|
268
277
|
|
|
269
278
|
const { state, dispatch } = editorView;
|
|
270
|
-
|
|
279
|
+
const featureFlags = !!getEditorFeatureFlags && getEditorFeatureFlags();
|
|
280
|
+
|
|
281
|
+
insertRowWithAnalytics(
|
|
282
|
+
editorAnalyticsAPI,
|
|
283
|
+
featureFlags && featureFlags.tableDuplicateCellColouring,
|
|
284
|
+
)(INPUT_METHOD.BUTTON, {
|
|
271
285
|
index: insertRowButtonIndex,
|
|
272
286
|
moveCursorToInsertedRow: true,
|
|
273
287
|
})(state, dispatch);
|
|
@@ -275,8 +289,12 @@ export class FloatingInsertButton extends React.Component<
|
|
|
275
289
|
}
|
|
276
290
|
|
|
277
291
|
private insertColumn(event: React.SyntheticEvent) {
|
|
278
|
-
const {
|
|
279
|
-
|
|
292
|
+
const {
|
|
293
|
+
editorView,
|
|
294
|
+
insertColumnButtonIndex,
|
|
295
|
+
editorAnalyticsAPI,
|
|
296
|
+
getEditorFeatureFlags,
|
|
297
|
+
} = this.props;
|
|
280
298
|
|
|
281
299
|
if (typeof insertColumnButtonIndex !== 'undefined') {
|
|
282
300
|
event.preventDefault();
|
|
@@ -285,11 +303,20 @@ export class FloatingInsertButton extends React.Component<
|
|
|
285
303
|
editorView.state,
|
|
286
304
|
);
|
|
287
305
|
|
|
306
|
+
const { tableDuplicateCellColouring = false } = getEditorFeatureFlags
|
|
307
|
+
? getEditorFeatureFlags()
|
|
308
|
+
: {};
|
|
309
|
+
|
|
288
310
|
const { state, dispatch } = editorView;
|
|
289
|
-
insertColumnWithAnalytics(
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
311
|
+
insertColumnWithAnalytics(
|
|
312
|
+
editorAnalyticsAPI,
|
|
313
|
+
isTableScalingEnabled,
|
|
314
|
+
tableDuplicateCellColouring,
|
|
315
|
+
)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(
|
|
316
|
+
state,
|
|
317
|
+
dispatch,
|
|
318
|
+
editorView,
|
|
319
|
+
);
|
|
293
320
|
}
|
|
294
321
|
}
|
|
295
322
|
}
|
package/src/utils/drag-menu.ts
CHANGED
|
@@ -177,6 +177,7 @@ export const getDragMenuConfig = (
|
|
|
177
177
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
178
178
|
isHeaderRowRequired?: boolean,
|
|
179
179
|
isTableScalingEnabled = false,
|
|
180
|
+
tableDuplicateCellColouring = false,
|
|
180
181
|
): DragMenuConfig[] => {
|
|
181
182
|
const addOptions =
|
|
182
183
|
direction === 'row'
|
|
@@ -303,18 +304,23 @@ export const getDragMenuConfig = (
|
|
|
303
304
|
icon,
|
|
304
305
|
onClick: (state: EditorState, dispatch?: CommandDispatch) => {
|
|
305
306
|
if (direction === 'row') {
|
|
306
|
-
insertRowWithAnalytics(
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
)(state, dispatch);
|
|
307
|
+
insertRowWithAnalytics(
|
|
308
|
+
editorAnalyticsAPI,
|
|
309
|
+
tableDuplicateCellColouring,
|
|
310
|
+
)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
|
|
311
|
+
index: (index ?? 0) + offset,
|
|
312
|
+
moveCursorToInsertedRow: true,
|
|
313
|
+
})(state, dispatch);
|
|
313
314
|
} else {
|
|
314
|
-
insertColumnWithAnalytics(
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
315
|
+
insertColumnWithAnalytics(
|
|
316
|
+
editorAnalyticsAPI,
|
|
317
|
+
isTableScalingEnabled,
|
|
318
|
+
tableDuplicateCellColouring,
|
|
319
|
+
)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index ?? 0) + offset)(
|
|
320
|
+
state,
|
|
321
|
+
dispatch,
|
|
322
|
+
editorView,
|
|
323
|
+
);
|
|
318
324
|
}
|
|
319
325
|
return true;
|
|
320
326
|
},
|