@atlaskit/editor-plugin-table 7.31.1 → 7.31.3
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/insert.js +16 -19
- package/dist/cjs/commands-with-analytics.js +5 -7
- package/dist/cjs/plugin.js +2 -3
- package/dist/cjs/pm-plugins/keymap.js +9 -10
- package/dist/cjs/toolbar.js +9 -12
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +12 -19
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +8 -12
- package/dist/cjs/ui/FloatingDragMenu/index.js +3 -8
- package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -2
- package/dist/cjs/ui/FloatingInsertButton/index.js +3 -7
- package/dist/cjs/utils/drag-menu.js +7 -9
- package/dist/es2019/commands/insert.js +10 -10
- package/dist/es2019/commands-with-analytics.js +4 -4
- package/dist/es2019/plugin.js +2 -3
- package/dist/es2019/pm-plugins/keymap.js +5 -5
- package/dist/es2019/toolbar.js +5 -6
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +3 -11
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +8 -10
- package/dist/es2019/ui/FloatingDragMenu/index.js +3 -6
- package/dist/es2019/ui/FloatingDragMenu/styles.js +2 -2
- package/dist/es2019/ui/FloatingInsertButton/index.js +3 -6
- package/dist/es2019/utils/drag-menu.js +4 -4
- package/dist/esm/commands/insert.js +16 -19
- package/dist/esm/commands-with-analytics.js +5 -7
- package/dist/esm/plugin.js +2 -3
- package/dist/esm/pm-plugins/keymap.js +9 -10
- package/dist/esm/toolbar.js +9 -12
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +12 -19
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +8 -12
- package/dist/esm/ui/FloatingDragMenu/index.js +3 -8
- package/dist/esm/ui/FloatingDragMenu/styles.js +1 -2
- package/dist/esm/ui/FloatingInsertButton/index.js +3 -7
- package/dist/esm/utils/drag-menu.js +7 -9
- package/dist/types/commands/insert.d.ts +5 -5
- package/dist/types/commands-with-analytics.d.ts +3 -4
- package/dist/types/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/toolbar.d.ts +1 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +0 -2
- package/dist/types/ui/FloatingDragMenu/styles.d.ts +1 -1
- package/dist/types/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/commands/insert.d.ts +5 -5
- package/dist/types-ts4.5/commands-with-analytics.d.ts +3 -4
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +0 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/styles.d.ts +1 -1
- package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
- package/package.json +3 -3
- package/src/commands/insert.ts +3 -10
- package/src/commands-with-analytics.ts +7 -8
- package/src/plugin.tsx +0 -4
- package/src/pm-plugins/keymap.ts +0 -5
- package/src/toolbar.tsx +0 -8
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +8 -15
- package/src/ui/FloatingDragMenu/DragMenu.tsx +5 -17
- package/src/ui/FloatingDragMenu/index.tsx +1 -7
- package/src/ui/FloatingDragMenu/styles.ts +4 -6
- package/src/ui/FloatingInsertButton/index.tsx +5 -10
- package/src/utils/drag-menu.ts +5 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.31.
|
|
3
|
+
"version": "7.31.3",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@atlaskit/adf-schema": "^44.2.0",
|
|
31
31
|
"@atlaskit/button": "^20.3.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.8.0",
|
|
33
|
-
"@atlaskit/editor-common": "^94.
|
|
33
|
+
"@atlaskit/editor-common": "^94.23.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.6.3",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
52
52
|
"@atlaskit/primitives": "^13.2.0",
|
|
53
53
|
"@atlaskit/theme": "^14.0.0",
|
|
54
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
54
|
+
"@atlaskit/tmp-editor-statsig": "^2.19.0",
|
|
55
55
|
"@atlaskit/toggle": "^13.4.0",
|
|
56
56
|
"@atlaskit/tokens": "^2.2.0",
|
|
57
57
|
"@atlaskit/tooltip": "^18.9.0",
|
package/src/commands/insert.ts
CHANGED
|
@@ -42,7 +42,6 @@ function addColumnAtCustomStep(column: number) {
|
|
|
42
42
|
export function addColumnAt(
|
|
43
43
|
api: PluginInjectionAPI | undefined | null,
|
|
44
44
|
isTableScalingEnabled = false,
|
|
45
|
-
isCellBackgroundDuplicated?: boolean,
|
|
46
45
|
isTableFixedColumnWidthsOptionEnabled?: boolean,
|
|
47
46
|
shouldUseIncreasedScalingPercent?: boolean,
|
|
48
47
|
isCommentEditor?: boolean,
|
|
@@ -57,7 +56,7 @@ export function addColumnAt(
|
|
|
57
56
|
if (allowAddColumnCustomStep) {
|
|
58
57
|
updatedTr = addColumnAtCustomStep(column)(updatedTr);
|
|
59
58
|
} else {
|
|
60
|
-
updatedTr = addColumnAtPMUtils(column
|
|
59
|
+
updatedTr = addColumnAtPMUtils(column)(updatedTr);
|
|
61
60
|
}
|
|
62
61
|
const table = findTable(updatedTr.selection);
|
|
63
62
|
if (table) {
|
|
@@ -96,7 +95,6 @@ export const addColumnBefore =
|
|
|
96
95
|
(
|
|
97
96
|
api: PluginInjectionAPI | undefined | null,
|
|
98
97
|
isTableScalingEnabled = false,
|
|
99
|
-
isCellBackgroundDuplicated = false,
|
|
100
98
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
101
99
|
shouldUseIncreasedScalingPercent = false,
|
|
102
100
|
isCommentEditor = false,
|
|
@@ -112,7 +110,6 @@ export const addColumnBefore =
|
|
|
112
110
|
addColumnAt(
|
|
113
111
|
api,
|
|
114
112
|
isTableScalingEnabled,
|
|
115
|
-
isCellBackgroundDuplicated,
|
|
116
113
|
isTableFixedColumnWidthsOptionEnabled,
|
|
117
114
|
shouldUseIncreasedScalingPercent,
|
|
118
115
|
isCommentEditor,
|
|
@@ -132,7 +129,6 @@ export const addColumnAfter =
|
|
|
132
129
|
(
|
|
133
130
|
api: PluginInjectionAPI | undefined | null,
|
|
134
131
|
isTableScalingEnabled?: boolean,
|
|
135
|
-
isCellBackgroundDuplicated?: boolean,
|
|
136
132
|
isTableFixedColumnWidthsOptionEnabled?: boolean,
|
|
137
133
|
shouldUseIncreasedScalingPercent?: boolean,
|
|
138
134
|
isCommentEditor?: boolean,
|
|
@@ -149,7 +145,6 @@ export const addColumnAfter =
|
|
|
149
145
|
addColumnAt(
|
|
150
146
|
api,
|
|
151
147
|
isTableScalingEnabled,
|
|
152
|
-
isCellBackgroundDuplicated,
|
|
153
148
|
isTableFixedColumnWidthsOptionEnabled,
|
|
154
149
|
shouldUseIncreasedScalingPercent,
|
|
155
150
|
isCommentEditor,
|
|
@@ -167,7 +162,6 @@ export const insertColumn =
|
|
|
167
162
|
(
|
|
168
163
|
api: PluginInjectionAPI | undefined | null,
|
|
169
164
|
isTableScalingEnabled = false,
|
|
170
|
-
isCellBackgroundDuplicated?: boolean,
|
|
171
165
|
isTableFixedColumnWidthsOptionEnabled?: boolean,
|
|
172
166
|
shouldUseIncreasedScalingPercent?: boolean,
|
|
173
167
|
isCommentEditor?: boolean,
|
|
@@ -177,7 +171,6 @@ export const insertColumn =
|
|
|
177
171
|
let tr = addColumnAt(
|
|
178
172
|
api,
|
|
179
173
|
isTableScalingEnabled,
|
|
180
|
-
isCellBackgroundDuplicated,
|
|
181
174
|
isTableFixedColumnWidthsOptionEnabled,
|
|
182
175
|
shouldUseIncreasedScalingPercent,
|
|
183
176
|
isCommentEditor,
|
|
@@ -200,7 +193,7 @@ export const insertColumn =
|
|
|
200
193
|
};
|
|
201
194
|
|
|
202
195
|
export const insertRow =
|
|
203
|
-
(row: number, moveCursorToTheNewRow: boolean
|
|
196
|
+
(row: number, moveCursorToTheNewRow: boolean): Command =>
|
|
204
197
|
(state, dispatch) => {
|
|
205
198
|
// Don't clone the header row
|
|
206
199
|
const headerRowEnabled = checkIfHeaderRowEnabled(state.selection);
|
|
@@ -214,7 +207,7 @@ export const insertRow =
|
|
|
214
207
|
|
|
215
208
|
const tr = clonePreviousRow
|
|
216
209
|
? copyPreviousRow(state.schema)(row)(state.tr)
|
|
217
|
-
: addRowAt(row, undefined
|
|
210
|
+
: addRowAt(row, undefined)(state.tr);
|
|
218
211
|
|
|
219
212
|
const table = findTable(tr.selection);
|
|
220
213
|
if (!table) {
|
|
@@ -3,7 +3,11 @@ import type { IntlShape } from 'react-intl-next/src/types';
|
|
|
3
3
|
import type { TableLayout } from '@atlaskit/adf-schema';
|
|
4
4
|
import { tableBackgroundColorPalette } from '@atlaskit/adf-schema';
|
|
5
5
|
import type { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
6
|
-
import type {
|
|
6
|
+
import type {
|
|
7
|
+
AnalyticsEventPayload,
|
|
8
|
+
CHANGE_ALIGNMENT_REASON,
|
|
9
|
+
EditorAnalyticsAPI,
|
|
10
|
+
} from '@atlaskit/editor-common/analytics';
|
|
7
11
|
import {
|
|
8
12
|
ACTION_SUBJECT,
|
|
9
13
|
EVENT_TYPE,
|
|
@@ -11,7 +15,6 @@ import {
|
|
|
11
15
|
TABLE_ACTION,
|
|
12
16
|
TABLE_DISPLAY_MODE,
|
|
13
17
|
} from '@atlaskit/editor-common/analytics';
|
|
14
|
-
import { type CHANGE_ALIGNMENT_REASON } from '@atlaskit/editor-common/analytics';
|
|
15
18
|
import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
16
19
|
import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
17
20
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -199,7 +202,7 @@ export const addRowAroundSelection =
|
|
|
199
202
|
};
|
|
200
203
|
|
|
201
204
|
export const insertRowWithAnalytics =
|
|
202
|
-
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null
|
|
205
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
203
206
|
(inputMethod: InsertRowMethods, options: InsertRowOptions) =>
|
|
204
207
|
withEditorAnalyticsAPI((state) => {
|
|
205
208
|
const { totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
|
|
@@ -215,9 +218,7 @@ export const insertRowWithAnalytics =
|
|
|
215
218
|
},
|
|
216
219
|
eventType: EVENT_TYPE.TRACK,
|
|
217
220
|
};
|
|
218
|
-
})(editorAnalyticsAPI)(
|
|
219
|
-
insertRow(options.index, options.moveCursorToInsertedRow, isCellbackgroundDuplicated),
|
|
220
|
-
);
|
|
221
|
+
})(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow));
|
|
221
222
|
|
|
222
223
|
export const changeColumnWidthByStepWithAnalytics =
|
|
223
224
|
(
|
|
@@ -272,7 +273,6 @@ export const insertColumnWithAnalytics =
|
|
|
272
273
|
api: PluginInjectionAPI | undefined | null,
|
|
273
274
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
274
275
|
isTableScalingEnabled = false,
|
|
275
|
-
isCellbackgroundDuplicated = false,
|
|
276
276
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
277
277
|
shouldUseIncreasedScalingPercent = false,
|
|
278
278
|
isCommentEditor = false,
|
|
@@ -304,7 +304,6 @@ export const insertColumnWithAnalytics =
|
|
|
304
304
|
insertColumn(
|
|
305
305
|
api,
|
|
306
306
|
isTableScalingEnabled,
|
|
307
|
-
isCellbackgroundDuplicated,
|
|
308
307
|
isTableFixedColumnWidthsOptionEnabled,
|
|
309
308
|
shouldUseIncreasedScalingPercent,
|
|
310
309
|
isCommentEditor,
|
package/src/plugin.tsx
CHANGED
|
@@ -188,9 +188,6 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
188
188
|
// When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
|
|
189
189
|
options?.isCommentEditor);
|
|
190
190
|
|
|
191
|
-
const isCellBackgroundDuplicated =
|
|
192
|
-
options?.getEditorFeatureFlags?.().tableDuplicateCellColouring || false;
|
|
193
|
-
|
|
194
191
|
return {
|
|
195
192
|
name: 'table',
|
|
196
193
|
|
|
@@ -435,7 +432,6 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
435
432
|
fullWidthEnabled,
|
|
436
433
|
api,
|
|
437
434
|
getIntl,
|
|
438
|
-
isCellBackgroundDuplicated,
|
|
439
435
|
isTableFixedColumnWidthsOptionEnabled,
|
|
440
436
|
shouldUseIncreasedScalingPercent,
|
|
441
437
|
isCommentEditor,
|
package/src/pm-plugins/keymap.ts
CHANGED
|
@@ -68,7 +68,6 @@ export function keymapPlugin(
|
|
|
68
68
|
isFullWidthEnabled?: boolean,
|
|
69
69
|
pluginInjectionApi?: PluginInjectionAPIWithA11y,
|
|
70
70
|
getIntl?: () => IntlShape,
|
|
71
|
-
isCellBackgroundDuplicated = false,
|
|
72
71
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
73
72
|
shouldUseIncreasedScalingPercent?: boolean,
|
|
74
73
|
isCommentEditor?: boolean,
|
|
@@ -130,7 +129,6 @@ export function keymapPlugin(
|
|
|
130
129
|
addColumnBeforeCommand(
|
|
131
130
|
api,
|
|
132
131
|
isTableScalingEnabled,
|
|
133
|
-
isCellBackgroundDuplicated,
|
|
134
132
|
isTableFixedColumnWidthsOptionEnabled,
|
|
135
133
|
shouldUseIncreasedScalingPercent,
|
|
136
134
|
),
|
|
@@ -142,7 +140,6 @@ export function keymapPlugin(
|
|
|
142
140
|
addColumnAfterCommand(
|
|
143
141
|
api,
|
|
144
142
|
isTableScalingEnabled,
|
|
145
|
-
isCellBackgroundDuplicated,
|
|
146
143
|
isTableFixedColumnWidthsOptionEnabled,
|
|
147
144
|
shouldUseIncreasedScalingPercent,
|
|
148
145
|
),
|
|
@@ -166,7 +163,6 @@ export function keymapPlugin(
|
|
|
166
163
|
addColumnBeforeCommand(
|
|
167
164
|
api,
|
|
168
165
|
isTableScalingEnabled,
|
|
169
|
-
isCellBackgroundDuplicated,
|
|
170
166
|
isTableFixedColumnWidthsOptionEnabled,
|
|
171
167
|
shouldUseIncreasedScalingPercent,
|
|
172
168
|
),
|
|
@@ -178,7 +174,6 @@ export function keymapPlugin(
|
|
|
178
174
|
addColumnAfterCommand(
|
|
179
175
|
api,
|
|
180
176
|
isTableScalingEnabled,
|
|
181
|
-
isCellBackgroundDuplicated,
|
|
182
177
|
isTableFixedColumnWidthsOptionEnabled,
|
|
183
178
|
shouldUseIncreasedScalingPercent,
|
|
184
179
|
),
|
package/src/toolbar.tsx
CHANGED
|
@@ -206,7 +206,6 @@ export const getToolbarCellOptionsConfig = (
|
|
|
206
206
|
api: PluginInjectionAPI | undefined | null,
|
|
207
207
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
208
208
|
isTableScalingEnabled = false,
|
|
209
|
-
isCellBackgroundDuplicated = false,
|
|
210
209
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
211
210
|
shouldUseIncreasedScalingPercent = false,
|
|
212
211
|
isCommentEditor = false,
|
|
@@ -228,7 +227,6 @@ export const getToolbarCellOptionsConfig = (
|
|
|
228
227
|
api,
|
|
229
228
|
editorAnalyticsAPI,
|
|
230
229
|
isTableScalingEnabled,
|
|
231
|
-
isCellBackgroundDuplicated,
|
|
232
230
|
isTableFixedColumnWidthsOptionEnabled,
|
|
233
231
|
shouldUseIncreasedScalingPercent,
|
|
234
232
|
isCommentEditor,
|
|
@@ -553,9 +551,6 @@ export const getToolbarConfig =
|
|
|
553
551
|
)
|
|
554
552
|
: [];
|
|
555
553
|
|
|
556
|
-
const isCellBackgroundDuplicated =
|
|
557
|
-
getEditorFeatureFlags().tableDuplicateCellColouring || false;
|
|
558
|
-
|
|
559
554
|
const cellItems = pluginState.isDragAndDropEnabled
|
|
560
555
|
? []
|
|
561
556
|
: getCellItems(
|
|
@@ -566,7 +561,6 @@ export const getToolbarConfig =
|
|
|
566
561
|
api,
|
|
567
562
|
editorAnalyticsAPI,
|
|
568
563
|
isTableScalingEnabled,
|
|
569
|
-
isCellBackgroundDuplicated,
|
|
570
564
|
isTableFixedColumnWidthsOptionEnabled,
|
|
571
565
|
shouldUseIncreasedScalingPercent,
|
|
572
566
|
options?.isCommentEditor,
|
|
@@ -681,7 +675,6 @@ const getCellItems = (
|
|
|
681
675
|
api: PluginInjectionAPI | undefined | null,
|
|
682
676
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
683
677
|
isTableScalingEnabled = false,
|
|
684
|
-
isCellBackgroundDuplicated = false,
|
|
685
678
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
686
679
|
shouldUseIncreasedScalingPercent = false,
|
|
687
680
|
isCommentEditor = false,
|
|
@@ -697,7 +690,6 @@ const getCellItems = (
|
|
|
697
690
|
api,
|
|
698
691
|
editorAnalyticsAPI,
|
|
699
692
|
isTableScalingEnabled,
|
|
700
|
-
isCellBackgroundDuplicated,
|
|
701
693
|
isTableFixedColumnWidthsOptionEnabled,
|
|
702
694
|
shouldUseIncreasedScalingPercent,
|
|
703
695
|
isCommentEditor,
|
|
@@ -584,13 +584,11 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
584
584
|
|
|
585
585
|
private createOriginalContextMenuItems = () => {
|
|
586
586
|
let items: MenuItem[] = [];
|
|
587
|
-
const { getEditorFeatureFlags } = this.props;
|
|
588
|
-
const { tableSortColumnReorder = false } = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
589
587
|
const sortColumnItems = this.createSortColumnItems();
|
|
590
588
|
const backgroundColorItem = this.createBackgroundColorItem();
|
|
591
589
|
const distributeColumnsItem = this.createDistributeColumnsItem();
|
|
592
590
|
|
|
593
|
-
|
|
591
|
+
sortColumnItems && items.push(...sortColumnItems);
|
|
594
592
|
|
|
595
593
|
backgroundColorItem && items.push(backgroundColorItem);
|
|
596
594
|
|
|
@@ -606,8 +604,6 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
606
604
|
|
|
607
605
|
distributeColumnsItem && items.push(distributeColumnsItem);
|
|
608
606
|
|
|
609
|
-
!tableSortColumnReorder && sortColumnItems && items.push(...sortColumnItems);
|
|
610
|
-
|
|
611
607
|
items.push(this.createClearCellsItem());
|
|
612
608
|
|
|
613
609
|
return [{ items }];
|
|
@@ -657,8 +653,9 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
657
653
|
const { state, dispatch } = editorView;
|
|
658
654
|
const { targetCellPosition, isTableScalingEnabled = false } = getPluginState(state);
|
|
659
655
|
|
|
660
|
-
const {
|
|
661
|
-
|
|
656
|
+
const { tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags
|
|
657
|
+
? getEditorFeatureFlags()
|
|
658
|
+
: {};
|
|
662
659
|
// context menu opened by keyboard and any item except 'background' activated
|
|
663
660
|
// or color has been chosen from color palette
|
|
664
661
|
if (
|
|
@@ -739,7 +736,6 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
739
736
|
this.props.api,
|
|
740
737
|
editorAnalyticsAPI,
|
|
741
738
|
isTableScalingEnabled,
|
|
742
|
-
tableDuplicateCellColouring,
|
|
743
739
|
tableWithFixedColumnWidthsOption,
|
|
744
740
|
shouldUseIncreasedScalingPercent,
|
|
745
741
|
isCommentEditor,
|
|
@@ -747,13 +743,10 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
747
743
|
this.toggleOpen();
|
|
748
744
|
break;
|
|
749
745
|
case 'insert_row':
|
|
750
|
-
insertRowWithAnalytics(editorAnalyticsAPI,
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
moveCursorToInsertedRow: true,
|
|
755
|
-
},
|
|
756
|
-
)(state, dispatch);
|
|
746
|
+
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, {
|
|
747
|
+
index: selectionRect.bottom,
|
|
748
|
+
moveCursorToInsertedRow: true,
|
|
749
|
+
})(state, dispatch);
|
|
757
750
|
this.toggleOpen();
|
|
758
751
|
break;
|
|
759
752
|
case 'delete_column':
|
|
@@ -90,10 +90,8 @@ type DragMenuProps = {
|
|
|
90
90
|
boundariesElement?: HTMLElement;
|
|
91
91
|
scrollableElement?: HTMLElement;
|
|
92
92
|
isTableScalingEnabled?: boolean;
|
|
93
|
-
tableDuplicateCellColouring?: boolean;
|
|
94
93
|
shouldUseIncreasedScalingPercent?: boolean;
|
|
95
94
|
isTableFixedColumnWidthsOptionEnabled?: boolean;
|
|
96
|
-
tableSortColumnReorder?: boolean;
|
|
97
95
|
ariaNotifyPlugin?: (
|
|
98
96
|
message: string,
|
|
99
97
|
ariaLiveElementAttributes?: AriaLiveElementAttributes,
|
|
@@ -166,7 +164,7 @@ const MapDragMenuOptionIdToMessage: Record<DragMenuOptionIdType, MessageType> =
|
|
|
166
164
|
},
|
|
167
165
|
};
|
|
168
166
|
|
|
169
|
-
const getGroupedDragMenuConfig = (
|
|
167
|
+
const getGroupedDragMenuConfig = () => {
|
|
170
168
|
let groupedDragMenuConfig: DragMenuOptionIdType[][] = [
|
|
171
169
|
[
|
|
172
170
|
'add_row_above',
|
|
@@ -181,9 +179,7 @@ const getGroupedDragMenuConfig = (tableSortColumnReorder: boolean) => {
|
|
|
181
179
|
['move_column_left', 'move_column_right', 'move_row_up', 'move_row_down'],
|
|
182
180
|
];
|
|
183
181
|
const sortColumnItems: DragMenuOptionIdType[] = ['sort_column_asc', 'sort_column_desc'];
|
|
184
|
-
|
|
185
|
-
? groupedDragMenuConfig.unshift(sortColumnItems)
|
|
186
|
-
: groupedDragMenuConfig.push(sortColumnItems);
|
|
182
|
+
groupedDragMenuConfig.unshift(sortColumnItems);
|
|
187
183
|
|
|
188
184
|
return groupedDragMenuConfig;
|
|
189
185
|
};
|
|
@@ -196,10 +192,9 @@ const elementBeforeIconStyles = xcss({
|
|
|
196
192
|
const convertToDropdownItems = (
|
|
197
193
|
dragMenuConfig: DragMenuConfig[],
|
|
198
194
|
formatMessage: IntlShape['formatMessage'],
|
|
199
|
-
tableSortColumnReorder: boolean = false,
|
|
200
195
|
selectionRect?: Rect,
|
|
201
196
|
) => {
|
|
202
|
-
const groupedDragMenuConfig = getGroupedDragMenuConfig(
|
|
197
|
+
const groupedDragMenuConfig = getGroupedDragMenuConfig();
|
|
203
198
|
let menuItemsArr: MenuItem[][] = [...Array(groupedDragMenuConfig.length)].map(() => []);
|
|
204
199
|
let menuCallback: { [key: string]: Command } = {};
|
|
205
200
|
dragMenuConfig.forEach((item) => {
|
|
@@ -283,10 +278,8 @@ const DragMenu = React.memo(
|
|
|
283
278
|
scrollableElement,
|
|
284
279
|
boundariesElement,
|
|
285
280
|
isTableScalingEnabled,
|
|
286
|
-
tableDuplicateCellColouring,
|
|
287
281
|
shouldUseIncreasedScalingPercent,
|
|
288
282
|
isTableFixedColumnWidthsOptionEnabled,
|
|
289
|
-
tableSortColumnReorder,
|
|
290
283
|
ariaNotifyPlugin,
|
|
291
284
|
isCommentEditor,
|
|
292
285
|
}: DragMenuProps & WrappedComponentProps) => {
|
|
@@ -316,10 +309,8 @@ const DragMenu = React.memo(
|
|
|
316
309
|
editorAnalyticsAPI,
|
|
317
310
|
pluginConfig?.isHeaderRowRequired,
|
|
318
311
|
isTableScalingEnabled,
|
|
319
|
-
tableDuplicateCellColouring,
|
|
320
312
|
isTableFixedColumnWidthsOptionEnabled,
|
|
321
313
|
shouldUseIncreasedScalingPercent,
|
|
322
|
-
tableSortColumnReorder,
|
|
323
314
|
ariaNotifyPlugin,
|
|
324
315
|
isCommentEditor,
|
|
325
316
|
);
|
|
@@ -327,7 +318,6 @@ const DragMenu = React.memo(
|
|
|
327
318
|
const { menuItems, menuCallback } = convertToDropdownItems(
|
|
328
319
|
dragMenuConfig,
|
|
329
320
|
formatMessage,
|
|
330
|
-
tableSortColumnReorder,
|
|
331
321
|
selectionRect,
|
|
332
322
|
);
|
|
333
323
|
|
|
@@ -383,7 +373,7 @@ const DragMenu = React.memo(
|
|
|
383
373
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
384
374
|
className={DropdownMenuSharedCssClassName.SUBMENU}
|
|
385
375
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
386
|
-
css={dragMenuBackgroundColorStyles(
|
|
376
|
+
css={dragMenuBackgroundColorStyles()}
|
|
387
377
|
>
|
|
388
378
|
<div
|
|
389
379
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
@@ -610,9 +600,7 @@ const DragMenu = React.memo(
|
|
|
610
600
|
}
|
|
611
601
|
|
|
612
602
|
if (allowBackgroundColor) {
|
|
613
|
-
|
|
614
|
-
? menuItems[1].items.unshift(createBackgroundColorMenuItem())
|
|
615
|
-
: menuItems[0].items.unshift(createBackgroundColorMenuItem());
|
|
603
|
+
menuItems[1].items.unshift(createBackgroundColorMenuItem());
|
|
616
604
|
}
|
|
617
605
|
|
|
618
606
|
// If first row, add toggle for Header row, default is true
|
|
@@ -79,11 +79,7 @@ const FloatingDragMenu = ({
|
|
|
79
79
|
return null;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
const {
|
|
83
|
-
tableDuplicateCellColouring = false,
|
|
84
|
-
tableWithFixedColumnWidthsOption = false,
|
|
85
|
-
tableSortColumnReorder = false,
|
|
86
|
-
} = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
82
|
+
const { tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags?.() ?? {};
|
|
87
83
|
|
|
88
84
|
const shouldUseIncreasedScalingPercent =
|
|
89
85
|
isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
|
|
@@ -123,10 +119,8 @@ const FloatingDragMenu = ({
|
|
|
123
119
|
boundariesElement={boundariesElement}
|
|
124
120
|
scrollableElement={scrollableElement}
|
|
125
121
|
isTableScalingEnabled={isTableScalingEnabled}
|
|
126
|
-
tableDuplicateCellColouring={tableDuplicateCellColouring}
|
|
127
122
|
shouldUseIncreasedScalingPercent={shouldUseIncreasedScalingPercent}
|
|
128
123
|
isTableFixedColumnWidthsOptionEnabled={tableWithFixedColumnWidthsOption}
|
|
129
|
-
tableSortColumnReorder={tableSortColumnReorder}
|
|
130
124
|
ariaNotifyPlugin={ariaNotifyPlugin}
|
|
131
125
|
api={api}
|
|
132
126
|
isCommentEditor={isCommentEditor || false}
|
|
@@ -22,18 +22,16 @@ export const cellColourPreviewStyles = (selectedColor: string) =>
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
25
|
-
export const dragMenuBackgroundColorStyles = (
|
|
25
|
+
export const dragMenuBackgroundColorStyles = () => css`
|
|
26
26
|
.${ClassName.DRAG_SUBMENU} {
|
|
27
27
|
border-radius: ${token('border.radius', '3px')};
|
|
28
28
|
background: ${token('elevation.surface.overlay', 'white')};
|
|
29
29
|
box-shadow: ${token('elevation.shadow.overlay', `0 4px 8px -2px ${N60A}, 0 0 1px ${N60A}`)};
|
|
30
30
|
display: block;
|
|
31
31
|
position: absolute;
|
|
32
|
-
top: ${
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT
|
|
36
|
-
: 0}px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker
|
|
32
|
+
top: ${TABLE_DRAG_MENU_PADDING_TOP +
|
|
33
|
+
TABLE_DRAG_MENU_SORT_GROUP_HEIGHT +
|
|
34
|
+
TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT}px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker
|
|
37
35
|
left: ${dragMenuDropdownWidth}px;
|
|
38
36
|
padding: ${token('space.100', '8px')};
|
|
39
37
|
|
|
@@ -241,19 +241,14 @@ export class FloatingInsertButton extends React.Component<Props & WrappedCompone
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
private insertRow(event: React.SyntheticEvent) {
|
|
244
|
-
const { editorView, insertRowButtonIndex, editorAnalyticsAPI
|
|
245
|
-
this.props;
|
|
244
|
+
const { editorView, insertRowButtonIndex, editorAnalyticsAPI } = this.props;
|
|
246
245
|
|
|
247
246
|
if (typeof insertRowButtonIndex !== 'undefined') {
|
|
248
247
|
event.preventDefault();
|
|
249
248
|
|
|
250
249
|
const { state, dispatch } = editorView;
|
|
251
|
-
const featureFlags = !!getEditorFeatureFlags && getEditorFeatureFlags();
|
|
252
250
|
|
|
253
|
-
insertRowWithAnalytics(
|
|
254
|
-
editorAnalyticsAPI,
|
|
255
|
-
featureFlags && featureFlags.tableDuplicateCellColouring,
|
|
256
|
-
)(INPUT_METHOD.BUTTON, {
|
|
251
|
+
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.BUTTON, {
|
|
257
252
|
index: insertRowButtonIndex,
|
|
258
253
|
moveCursorToInsertedRow: true,
|
|
259
254
|
})(state, dispatch);
|
|
@@ -273,8 +268,9 @@ export class FloatingInsertButton extends React.Component<Props & WrappedCompone
|
|
|
273
268
|
if (typeof insertColumnButtonIndex !== 'undefined') {
|
|
274
269
|
event.preventDefault();
|
|
275
270
|
|
|
276
|
-
const {
|
|
277
|
-
|
|
271
|
+
const { tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags
|
|
272
|
+
? getEditorFeatureFlags()
|
|
273
|
+
: {};
|
|
278
274
|
|
|
279
275
|
const shouldUseIncreasedScalingPercent =
|
|
280
276
|
isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
|
|
@@ -284,7 +280,6 @@ export class FloatingInsertButton extends React.Component<Props & WrappedCompone
|
|
|
284
280
|
this.props.api,
|
|
285
281
|
editorAnalyticsAPI,
|
|
286
282
|
isTableScalingEnabled,
|
|
287
|
-
tableDuplicateCellColouring,
|
|
288
283
|
tableWithFixedColumnWidthsOption,
|
|
289
284
|
shouldUseIncreasedScalingPercent,
|
|
290
285
|
isCommentEditor,
|
package/src/utils/drag-menu.ts
CHANGED
|
@@ -162,10 +162,8 @@ export const getDragMenuConfig = (
|
|
|
162
162
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
163
163
|
isHeaderRowRequired?: boolean,
|
|
164
164
|
isTableScalingEnabled = false,
|
|
165
|
-
tableDuplicateCellColouring = false,
|
|
166
165
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
167
166
|
shouldUseIncreasedScalingPercent = false,
|
|
168
|
-
tableSortColumnReorder = false,
|
|
169
167
|
ariaNotifyPlugin?: (
|
|
170
168
|
message: string,
|
|
171
169
|
ariaLiveElementAttributes?: AriaLiveElementAttributes,
|
|
@@ -292,19 +290,15 @@ export const getDragMenuConfig = (
|
|
|
292
290
|
iconFallback: iconFallback,
|
|
293
291
|
onClick: (state: EditorState, dispatch?: CommandDispatch) => {
|
|
294
292
|
if (direction === 'row') {
|
|
295
|
-
insertRowWithAnalytics(editorAnalyticsAPI,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
moveCursorToInsertedRow: true,
|
|
300
|
-
},
|
|
301
|
-
)(state, dispatch);
|
|
293
|
+
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
|
|
294
|
+
index: (index ?? 0) + offset,
|
|
295
|
+
moveCursorToInsertedRow: true,
|
|
296
|
+
})(state, dispatch);
|
|
302
297
|
} else {
|
|
303
298
|
insertColumnWithAnalytics(
|
|
304
299
|
api,
|
|
305
300
|
editorAnalyticsAPI,
|
|
306
301
|
isTableScalingEnabled,
|
|
307
|
-
tableDuplicateCellColouring,
|
|
308
302
|
isTableFixedColumnWidthsOptionEnabled,
|
|
309
303
|
shouldUseIncreasedScalingPercent,
|
|
310
304
|
)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index ?? 0) + offset)(state, dispatch, editorView);
|
|
@@ -417,7 +411,7 @@ export const getDragMenuConfig = (
|
|
|
417
411
|
];
|
|
418
412
|
|
|
419
413
|
let allConfigs = [...restConfigs];
|
|
420
|
-
|
|
414
|
+
allConfigs.unshift(...sortConfigs);
|
|
421
415
|
|
|
422
416
|
return allConfigs.filter(Boolean) as DragMenuConfig[];
|
|
423
417
|
};
|