@atlaskit/editor-plugin-table 7.25.6 → 7.25.8
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 +16 -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 +1 -1
- package/dist/cjs/nodeviews/TableContainer.js +2 -9
- package/dist/cjs/nodeviews/TableResizer.js +1 -1
- package/dist/cjs/nodeviews/table-container-styles.js +18 -0
- package/dist/cjs/plugin.js +11 -7
- package/dist/cjs/pm-plugins/keymap.js +19 -19
- package/dist/cjs/pm-plugins/main.js +1 -1
- 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/toDOM.js +10 -1
- 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 +1 -1
- package/dist/es2019/nodeviews/TableContainer.js +2 -9
- package/dist/es2019/nodeviews/TableResizer.js +1 -1
- package/dist/es2019/nodeviews/table-container-styles.js +10 -0
- package/dist/es2019/plugin.js +11 -7
- package/dist/es2019/pm-plugins/keymap.js +9 -9
- package/dist/es2019/pm-plugins/main.js +1 -1
- 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/toDOM.js +4 -1
- 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 +1 -1
- package/dist/esm/nodeviews/TableContainer.js +2 -9
- package/dist/esm/nodeviews/TableResizer.js +1 -1
- package/dist/esm/nodeviews/table-container-styles.js +12 -0
- package/dist/esm/plugin.js +11 -7
- package/dist/esm/pm-plugins/keymap.js +19 -19
- package/dist/esm/pm-plugins/main.js +1 -1
- 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/toDOM.js +10 -1
- 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/nodeviews/table-container-styles.d.ts +5 -0
- 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/nodeviews/table-container-styles.d.ts +5 -0
- 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 +7 -7
- 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 +1 -0
- package/src/nodeviews/TableContainer.tsx +2 -5
- package/src/nodeviews/TableResizer.tsx +1 -0
- package/src/nodeviews/table-container-styles.ts +9 -0
- package/src/plugin.tsx +7 -0
- package/src/pm-plugins/keymap.ts +10 -3
- package/src/pm-plugins/main.ts +1 -0
- 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/toDOM.ts +8 -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.25.
|
|
3
|
+
"version": "7.25.8",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^40.8.1",
|
|
32
|
-
"@atlaskit/button": "^20.
|
|
32
|
+
"@atlaskit/button": "^20.1.0",
|
|
33
33
|
"@atlaskit/custom-steps": "^0.7.0",
|
|
34
|
-
"@atlaskit/editor-common": "^87.
|
|
34
|
+
"@atlaskit/editor-common": "^87.13.0",
|
|
35
35
|
"@atlaskit/editor-palette": "1.6.0",
|
|
36
36
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.7.0",
|
|
38
|
-
"@atlaskit/editor-plugin-content-insertion": "^1.
|
|
38
|
+
"@atlaskit/editor-plugin-content-insertion": "^1.8.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-guideline": "^1.2.0",
|
|
41
|
-
"@atlaskit/editor-plugin-selection": "^1.
|
|
42
|
-
"@atlaskit/editor-plugin-width": "^1.
|
|
41
|
+
"@atlaskit/editor-plugin-selection": "^1.4.0",
|
|
42
|
+
"@atlaskit/editor-plugin-width": "^1.3.0",
|
|
43
43
|
"@atlaskit/editor-prosemirror": "5.0.1",
|
|
44
44
|
"@atlaskit/editor-shared-styles": "^2.13.0",
|
|
45
45
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/primitives": "^12.0.0",
|
|
53
53
|
"@atlaskit/theme": "^13.0.0",
|
|
54
54
|
"@atlaskit/toggle": "^13.3.0",
|
|
55
|
-
"@atlaskit/tokens": "^1.
|
|
55
|
+
"@atlaskit/tokens": "^1.59.0",
|
|
56
56
|
"@atlaskit/tooltip": "^18.7.0",
|
|
57
57
|
"@babel/runtime": "^7.0.0",
|
|
58
58
|
"@emotion/react": "^11.7.1",
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
} from '../pm-plugins/table-resizing/utils';
|
|
38
38
|
import { updateColumnWidths } from '../transforms';
|
|
39
39
|
import { TableDecorations } from '../types';
|
|
40
|
-
import type { TablePluginAction } from '../types';
|
|
40
|
+
import type { PluginInjectionAPI, TablePluginAction } from '../types';
|
|
41
41
|
import { createColumnLineResize, getSelectedColumnIndexes, updateDecorations } from '../utils';
|
|
42
42
|
|
|
43
43
|
const getTablePluginCommand = (
|
|
@@ -252,6 +252,7 @@ export const changeColumnWidthByStep =
|
|
|
252
252
|
isTableFixedColumnWidthsOptionEnabled,
|
|
253
253
|
isCommentEditor,
|
|
254
254
|
ariaNotify,
|
|
255
|
+
api,
|
|
255
256
|
getIntl,
|
|
256
257
|
}: {
|
|
257
258
|
stepSize: number;
|
|
@@ -259,6 +260,7 @@ export const changeColumnWidthByStep =
|
|
|
259
260
|
isTableScalingEnabled: boolean;
|
|
260
261
|
isTableFixedColumnWidthsOptionEnabled: boolean;
|
|
261
262
|
isCommentEditor: boolean;
|
|
263
|
+
api: PluginInjectionAPI | undefined | null;
|
|
262
264
|
ariaNotify?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void;
|
|
263
265
|
getIntl?: () => IntlShape;
|
|
264
266
|
originalTr?: Transaction;
|
|
@@ -356,7 +358,7 @@ export const changeColumnWidthByStep =
|
|
|
356
358
|
shouldUseIncreasedScalingPercent,
|
|
357
359
|
);
|
|
358
360
|
|
|
359
|
-
customTr = updateColumnWidths(newResizeState, originalTable, tableStartPosition)(customTr);
|
|
361
|
+
customTr = updateColumnWidths(newResizeState, originalTable, tableStartPosition, api)(customTr);
|
|
360
362
|
|
|
361
363
|
if (dispatch) {
|
|
362
364
|
dispatch(customTr);
|
package/src/commands/delete.ts
CHANGED
|
@@ -2,11 +2,13 @@ import type { Command } from '@atlaskit/editor-common/types';
|
|
|
2
2
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
3
3
|
|
|
4
4
|
import { deleteColumns } from '../transforms/delete-columns';
|
|
5
|
+
import type { PluginInjectionAPI } from '../types';
|
|
5
6
|
import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step';
|
|
6
7
|
|
|
7
8
|
export const deleteColumnsCommand =
|
|
8
9
|
(
|
|
9
10
|
rect: Rect,
|
|
11
|
+
api: PluginInjectionAPI | undefined | null,
|
|
10
12
|
isTableScalingEnabled = false,
|
|
11
13
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
12
14
|
shouldUseIncreasedScalingPercent = false,
|
|
@@ -15,6 +17,7 @@ export const deleteColumnsCommand =
|
|
|
15
17
|
const tr = deleteColumns(
|
|
16
18
|
rect,
|
|
17
19
|
getAllowAddColumnCustomStep(state),
|
|
20
|
+
api,
|
|
18
21
|
view,
|
|
19
22
|
isTableScalingEnabled,
|
|
20
23
|
isTableFixedColumnWidthsOptionEnabled,
|
package/src/commands/insert.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
import { updateRowOrColumnMovedTransform } from '../pm-plugins/analytics/commands';
|
|
26
26
|
import { META_KEYS } from '../pm-plugins/table-analytics';
|
|
27
27
|
import { rescaleColumns } from '../transforms/column-width';
|
|
28
|
+
import type { PluginInjectionAPI } from '../types';
|
|
28
29
|
import { checkIfHeaderRowEnabled, copyPreviousRow, createTableWithWidth } from '../utils';
|
|
29
30
|
import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step';
|
|
30
31
|
|
|
@@ -39,6 +40,7 @@ function addColumnAtCustomStep(column: number) {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
export function addColumnAt(
|
|
43
|
+
api: PluginInjectionAPI | undefined | null,
|
|
42
44
|
isTableScalingEnabled = false,
|
|
43
45
|
isCellBackgroundDuplicated?: boolean,
|
|
44
46
|
isTableFixedColumnWidthsOptionEnabled?: boolean,
|
|
@@ -63,6 +65,7 @@ export function addColumnAt(
|
|
|
63
65
|
isTableScalingEnabled,
|
|
64
66
|
isTableFixedColumnWidthsOptionEnabled,
|
|
65
67
|
shouldUseIncreasedScalingPercent,
|
|
68
|
+
api,
|
|
66
69
|
)(
|
|
67
70
|
table,
|
|
68
71
|
view,
|
|
@@ -89,6 +92,7 @@ export function addColumnAt(
|
|
|
89
92
|
// Command to add a column before the column with the selection.
|
|
90
93
|
export const addColumnBefore =
|
|
91
94
|
(
|
|
95
|
+
api: PluginInjectionAPI | undefined | null,
|
|
92
96
|
isTableScalingEnabled = false,
|
|
93
97
|
isCellBackgroundDuplicated = false,
|
|
94
98
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
@@ -103,6 +107,7 @@ export const addColumnBefore =
|
|
|
103
107
|
let rect = selectedRect(state);
|
|
104
108
|
dispatch(
|
|
105
109
|
addColumnAt(
|
|
110
|
+
api,
|
|
106
111
|
isTableScalingEnabled,
|
|
107
112
|
isCellBackgroundDuplicated,
|
|
108
113
|
isTableFixedColumnWidthsOptionEnabled,
|
|
@@ -121,6 +126,7 @@ export const addColumnBefore =
|
|
|
121
126
|
// Command to add a column after the column with the selection.
|
|
122
127
|
export const addColumnAfter =
|
|
123
128
|
(
|
|
129
|
+
api: PluginInjectionAPI | undefined | null,
|
|
124
130
|
isTableScalingEnabled?: boolean,
|
|
125
131
|
isCellBackgroundDuplicated?: boolean,
|
|
126
132
|
isTableFixedColumnWidthsOptionEnabled?: boolean,
|
|
@@ -136,6 +142,7 @@ export const addColumnAfter =
|
|
|
136
142
|
let rect = selectedRect(state);
|
|
137
143
|
dispatch(
|
|
138
144
|
addColumnAt(
|
|
145
|
+
api,
|
|
139
146
|
isTableScalingEnabled,
|
|
140
147
|
isCellBackgroundDuplicated,
|
|
141
148
|
isTableFixedColumnWidthsOptionEnabled,
|
|
@@ -152,6 +159,7 @@ export const addColumnAfter =
|
|
|
152
159
|
|
|
153
160
|
export const insertColumn =
|
|
154
161
|
(
|
|
162
|
+
api: PluginInjectionAPI | undefined | null,
|
|
155
163
|
isTableScalingEnabled = false,
|
|
156
164
|
isCellBackgroundDuplicated?: boolean,
|
|
157
165
|
isTableFixedColumnWidthsOptionEnabled?: boolean,
|
|
@@ -160,6 +168,7 @@ export const insertColumn =
|
|
|
160
168
|
(column: number): Command =>
|
|
161
169
|
(state, dispatch, view) => {
|
|
162
170
|
let tr = addColumnAt(
|
|
171
|
+
api,
|
|
163
172
|
isTableScalingEnabled,
|
|
164
173
|
isCellBackgroundDuplicated,
|
|
165
174
|
isTableFixedColumnWidthsOptionEnabled,
|
|
@@ -57,6 +57,7 @@ import type {
|
|
|
57
57
|
AlignmentOptions,
|
|
58
58
|
InsertRowMethods,
|
|
59
59
|
InsertRowOptions,
|
|
60
|
+
PluginInjectionAPI,
|
|
60
61
|
RowInsertPosition,
|
|
61
62
|
} from './types';
|
|
62
63
|
import { checkIfNumberColumnEnabled, getSelectedCellInfo, getSelectedTableInfo } from './utils';
|
|
@@ -232,7 +233,10 @@ export const insertRowWithAnalytics =
|
|
|
232
233
|
);
|
|
233
234
|
|
|
234
235
|
export const changeColumnWidthByStepWithAnalytics =
|
|
235
|
-
(
|
|
236
|
+
(
|
|
237
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
238
|
+
api: PluginInjectionAPI | undefined | null,
|
|
239
|
+
) =>
|
|
236
240
|
(
|
|
237
241
|
stepSize: number,
|
|
238
242
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
@@ -272,11 +276,13 @@ export const changeColumnWidthByStepWithAnalytics =
|
|
|
272
276
|
isCommentEditor,
|
|
273
277
|
ariaNotify: ariaNotify,
|
|
274
278
|
getIntl: getIntl,
|
|
279
|
+
api,
|
|
275
280
|
}),
|
|
276
281
|
);
|
|
277
282
|
|
|
278
283
|
export const insertColumnWithAnalytics =
|
|
279
284
|
(
|
|
285
|
+
api: PluginInjectionAPI | undefined | null,
|
|
280
286
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
281
287
|
isTableScalingEnabled = false,
|
|
282
288
|
isCellbackgroundDuplicated = false,
|
|
@@ -308,6 +314,7 @@ export const insertColumnWithAnalytics =
|
|
|
308
314
|
};
|
|
309
315
|
})(editorAnalyticsAPI)(
|
|
310
316
|
insertColumn(
|
|
317
|
+
api,
|
|
311
318
|
isTableScalingEnabled,
|
|
312
319
|
isCellbackgroundDuplicated,
|
|
313
320
|
isTableFixedColumnWidthsOptionEnabled,
|
|
@@ -353,6 +360,7 @@ export const deleteRowsWithAnalytics =
|
|
|
353
360
|
export const deleteColumnsWithAnalytics =
|
|
354
361
|
(
|
|
355
362
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
363
|
+
api: PluginInjectionAPI | undefined | null,
|
|
356
364
|
isTableScalingEnabled = false,
|
|
357
365
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
358
366
|
shouldUseIncreasedScalingPercent = false,
|
|
@@ -385,6 +393,7 @@ export const deleteColumnsWithAnalytics =
|
|
|
385
393
|
})(editorAnalyticsAPI)(
|
|
386
394
|
deleteColumnsCommand(
|
|
387
395
|
rect,
|
|
396
|
+
api,
|
|
388
397
|
isTableScalingEnabled,
|
|
389
398
|
isTableFixedColumnWidthsOptionEnabled,
|
|
390
399
|
shouldUseIncreasedScalingPercent,
|
|
@@ -394,6 +403,7 @@ export const deleteColumnsWithAnalytics =
|
|
|
394
403
|
export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut =
|
|
395
404
|
(
|
|
396
405
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
406
|
+
api: PluginInjectionAPI | undefined | null,
|
|
397
407
|
isTableScalingEnabled?: boolean,
|
|
398
408
|
isTableFixedColumnWidthsOptionEnabled?: boolean,
|
|
399
409
|
shouldUseIncreasedScalingPercent?: boolean,
|
|
@@ -423,6 +433,7 @@ export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut =
|
|
|
423
433
|
} else if (selectionType === 'column') {
|
|
424
434
|
return deleteColumnsWithAnalytics(
|
|
425
435
|
editorAnalyticsAPI,
|
|
436
|
+
api,
|
|
426
437
|
isTableScalingEnabled,
|
|
427
438
|
isTableFixedColumnWidthsOptionEnabled,
|
|
428
439
|
shouldUseIncreasedScalingPercent,
|
|
@@ -575,7 +586,10 @@ export const sortColumnWithAnalytics =
|
|
|
575
586
|
})(editorAnalyticsAPI)(sortByColumn(columnIndex, sortOrder));
|
|
576
587
|
|
|
577
588
|
export const distributeColumnsWidthsWithAnalytics =
|
|
578
|
-
(
|
|
589
|
+
(
|
|
590
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
591
|
+
api: PluginInjectionAPI | undefined | null,
|
|
592
|
+
) =>
|
|
579
593
|
(
|
|
580
594
|
inputMethod:
|
|
581
595
|
| INPUT_METHOD.CONTEXT_MENU
|
|
@@ -596,7 +610,7 @@ export const distributeColumnsWidthsWithAnalytics =
|
|
|
596
610
|
};
|
|
597
611
|
})(editorAnalyticsAPI)((state, dispatch) => {
|
|
598
612
|
if (dispatch) {
|
|
599
|
-
distributeColumnsWidths(resizeState, table)(state, dispatch);
|
|
613
|
+
distributeColumnsWidths(resizeState, table, api)(state, dispatch);
|
|
600
614
|
}
|
|
601
615
|
return true;
|
|
602
616
|
});
|
package/src/event-handlers.ts
CHANGED
|
@@ -42,6 +42,7 @@ import { getPluginState } from './pm-plugins/plugin-factory';
|
|
|
42
42
|
import { getPluginState as getResizePluginState } from './pm-plugins/table-resizing/plugin-factory';
|
|
43
43
|
import { deleteColumns, deleteRows } from './transforms';
|
|
44
44
|
import { TableCssClassName as ClassName, RESIZE_HANDLE_AREA_DECORATION_GAP } from './types';
|
|
45
|
+
import type { PluginInjectionAPI } from './types';
|
|
45
46
|
import {
|
|
46
47
|
convertHTMLCellIndexToColumnIndex,
|
|
47
48
|
getColumnIndexMappedToColumnIndexInFirstRow,
|
|
@@ -463,6 +464,7 @@ export const handleCut = (
|
|
|
463
464
|
oldTr: Transaction,
|
|
464
465
|
oldState: EditorState,
|
|
465
466
|
newState: EditorState,
|
|
467
|
+
api: PluginInjectionAPI | undefined | null,
|
|
466
468
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
467
469
|
editorView?: EditorView,
|
|
468
470
|
isTableScalingEnabled = false,
|
|
@@ -513,6 +515,7 @@ export const handleCut = (
|
|
|
513
515
|
tr = deleteColumns(
|
|
514
516
|
rect,
|
|
515
517
|
getAllowAddColumnCustomStep(oldState),
|
|
518
|
+
api,
|
|
516
519
|
editorView,
|
|
517
520
|
isTableScalingEnabled,
|
|
518
521
|
isTableFixedColumnWidthsOptionEnabled,
|
|
@@ -1093,6 +1093,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
1093
1093
|
...options,
|
|
1094
1094
|
},
|
|
1095
1095
|
domAtPos,
|
|
1096
|
+
this.props.pluginInjectionApi,
|
|
1096
1097
|
false, // isTableScalingEnabled doesn't change the behavior of nested tables
|
|
1097
1098
|
false, // shouldUseIncreasedScalingPercent set to false for nested tables
|
|
1098
1099
|
)(state.tr);
|
|
@@ -30,6 +30,7 @@ import type { PluginInjectionAPI, TableSharedState } from '../types';
|
|
|
30
30
|
import { TableCssClassName as ClassName } from '../types';
|
|
31
31
|
import { ALIGN_CENTER, ALIGN_START } from '../utils/alignment';
|
|
32
32
|
|
|
33
|
+
import { getAlignmentStyle } from './table-container-styles';
|
|
33
34
|
import { TableResizer } from './TableResizer';
|
|
34
35
|
|
|
35
36
|
type InnerContainerProps = {
|
|
@@ -60,10 +61,6 @@ export const InnerContainer = forwardRef<HTMLDivElement, PropsWithChildren<Inner
|
|
|
60
61
|
},
|
|
61
62
|
);
|
|
62
63
|
|
|
63
|
-
const centerAlignStyle = { display: 'flex', justifyContent: 'center' };
|
|
64
|
-
|
|
65
|
-
const leftAlignStyle = { display: 'flex', justifyContent: 'flex-start' };
|
|
66
|
-
|
|
67
64
|
type AlignmentTableContainerProps = {
|
|
68
65
|
node: PMNode;
|
|
69
66
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
@@ -114,7 +111,7 @@ const AlignmentTableContainer = ({
|
|
|
114
111
|
}, [editorView, tableState, node]);
|
|
115
112
|
|
|
116
113
|
const style = useMemo(() => {
|
|
117
|
-
return alignment
|
|
114
|
+
return getAlignmentStyle(alignment);
|
|
118
115
|
}, [alignment]);
|
|
119
116
|
|
|
120
117
|
return (
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AlignmentOptions } from '../types';
|
|
2
|
+
import { ALIGN_START } from '../utils/alignment';
|
|
3
|
+
|
|
4
|
+
const centerAlignStyle = { display: 'flex', justifyContent: 'center' };
|
|
5
|
+
|
|
6
|
+
const leftAlignStyle = { display: 'flex', justifyContent: 'flex-start' };
|
|
7
|
+
|
|
8
|
+
export const getAlignmentStyle = (alignment: AlignmentOptions) =>
|
|
9
|
+
alignment === ALIGN_START ? leftAlignStyle : centerAlignStyle;
|
package/src/plugin.tsx
CHANGED
|
@@ -338,6 +338,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
338
338
|
} as ColumnResizingPluginState,
|
|
339
339
|
defaultGetEditorContainerWidth,
|
|
340
340
|
getEditorFeatureFlags || defaultGetEditorFeatureFlags,
|
|
341
|
+
api,
|
|
341
342
|
editorAnalyticsAPI,
|
|
342
343
|
isTableScalingEnabled || false,
|
|
343
344
|
isNewColumnResizingEnabled,
|
|
@@ -364,6 +365,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
364
365
|
|
|
365
366
|
return keymapPlugin(
|
|
366
367
|
defaultGetEditorContainerWidth,
|
|
368
|
+
api,
|
|
367
369
|
editorAnalyticsAPI,
|
|
368
370
|
dragAndDropEnabled,
|
|
369
371
|
isTableScalingEnabled,
|
|
@@ -598,6 +600,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
598
600
|
options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags
|
|
599
601
|
}
|
|
600
602
|
isChromelessEditor={options?.isChromelessEditor}
|
|
603
|
+
api={api}
|
|
601
604
|
/>
|
|
602
605
|
)}
|
|
603
606
|
{options?.allowContextualMenu && (
|
|
@@ -615,6 +618,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
615
618
|
}
|
|
616
619
|
isCellMenuOpenByKeyboard={isCellMenuOpenByKeyboard}
|
|
617
620
|
isCommentEditor={options?.isCommentEditor}
|
|
621
|
+
api={api}
|
|
618
622
|
/>
|
|
619
623
|
)}
|
|
620
624
|
{isDragAndDropEnabled && (
|
|
@@ -637,6 +641,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
637
641
|
options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags
|
|
638
642
|
}
|
|
639
643
|
ariaNotifyPlugin={ariaNotifyPlugin}
|
|
644
|
+
api={api}
|
|
640
645
|
/>
|
|
641
646
|
)}
|
|
642
647
|
{allowControls && !isDragAndDropEnabled && !isResizing && (
|
|
@@ -650,6 +655,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
650
655
|
stickyHeaders={stickyHeader}
|
|
651
656
|
isNumberColumnEnabled={tableNode && tableNode.attrs.isNumberColumnEnabled}
|
|
652
657
|
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
658
|
+
api={api}
|
|
653
659
|
/>
|
|
654
660
|
)}
|
|
655
661
|
{(options?.isTableScalingEnabled ||
|
|
@@ -718,6 +724,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
718
724
|
],
|
|
719
725
|
floatingToolbar: getToolbarConfig(
|
|
720
726
|
defaultGetEditorContainerWidth,
|
|
727
|
+
api,
|
|
721
728
|
editorAnalyticsAPI,
|
|
722
729
|
options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags,
|
|
723
730
|
() => editorViewRef.current,
|
package/src/pm-plugins/keymap.ts
CHANGED
|
@@ -55,10 +55,11 @@ import {
|
|
|
55
55
|
createTable,
|
|
56
56
|
} from '../commands/insert';
|
|
57
57
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
58
|
-
import type { PluginInjectionAPIWithA11y } from '../types';
|
|
58
|
+
import type { PluginInjectionAPI, PluginInjectionAPIWithA11y } from '../types';
|
|
59
59
|
|
|
60
60
|
export function keymapPlugin(
|
|
61
61
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
62
|
+
api: PluginInjectionAPI | undefined | null,
|
|
62
63
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
63
64
|
dragAndDropEnabled?: boolean,
|
|
64
65
|
isTableScalingEnabled = false,
|
|
@@ -124,6 +125,7 @@ export function keymapPlugin(
|
|
|
124
125
|
bindKeymapWithCommand(
|
|
125
126
|
addColumnBefore.common!,
|
|
126
127
|
addColumnBeforeCommand(
|
|
128
|
+
api,
|
|
127
129
|
isTableScalingEnabled,
|
|
128
130
|
isCellBackgroundDuplicated,
|
|
129
131
|
isTableFixedColumnWidthsOptionEnabled,
|
|
@@ -135,6 +137,7 @@ export function keymapPlugin(
|
|
|
135
137
|
bindKeymapWithCommand(
|
|
136
138
|
addColumnAfter.common!,
|
|
137
139
|
addColumnAfterCommand(
|
|
140
|
+
api,
|
|
138
141
|
isTableScalingEnabled,
|
|
139
142
|
isCellBackgroundDuplicated,
|
|
140
143
|
isTableFixedColumnWidthsOptionEnabled,
|
|
@@ -158,6 +161,7 @@ export function keymapPlugin(
|
|
|
158
161
|
bindKeymapWithCommand(
|
|
159
162
|
addColumnBeforeVO.common!,
|
|
160
163
|
addColumnBeforeCommand(
|
|
164
|
+
api,
|
|
161
165
|
isTableScalingEnabled,
|
|
162
166
|
isCellBackgroundDuplicated,
|
|
163
167
|
isTableFixedColumnWidthsOptionEnabled,
|
|
@@ -169,6 +173,7 @@ export function keymapPlugin(
|
|
|
169
173
|
bindKeymapWithCommand(
|
|
170
174
|
addColumnAfterVO.common!,
|
|
171
175
|
addColumnAfterCommand(
|
|
176
|
+
api,
|
|
172
177
|
isTableScalingEnabled,
|
|
173
178
|
isCellBackgroundDuplicated,
|
|
174
179
|
isTableFixedColumnWidthsOptionEnabled,
|
|
@@ -231,6 +236,7 @@ export function keymapPlugin(
|
|
|
231
236
|
deleteColumn.common!,
|
|
232
237
|
deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(
|
|
233
238
|
editorAnalyticsAPI,
|
|
239
|
+
api,
|
|
234
240
|
isTableScalingEnabled,
|
|
235
241
|
isTableFixedColumnWidthsOptionEnabled,
|
|
236
242
|
shouldUseIncreasedScalingPercent,
|
|
@@ -242,6 +248,7 @@ export function keymapPlugin(
|
|
|
242
248
|
deleteRow.common!,
|
|
243
249
|
deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(
|
|
244
250
|
editorAnalyticsAPI,
|
|
251
|
+
api,
|
|
245
252
|
isTableScalingEnabled,
|
|
246
253
|
isTableFixedColumnWidthsOptionEnabled,
|
|
247
254
|
shouldUseIncreasedScalingPercent,
|
|
@@ -281,7 +288,7 @@ export function keymapPlugin(
|
|
|
281
288
|
|
|
282
289
|
bindKeymapWithCommand(
|
|
283
290
|
decreaseMediaSize.common!,
|
|
284
|
-
changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(
|
|
291
|
+
changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI, api)(
|
|
285
292
|
-10,
|
|
286
293
|
getEditorContainerWidth,
|
|
287
294
|
isTableScalingEnabled,
|
|
@@ -296,7 +303,7 @@ export function keymapPlugin(
|
|
|
296
303
|
|
|
297
304
|
bindKeymapWithCommand(
|
|
298
305
|
increaseMediaSize.common!,
|
|
299
|
-
changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(
|
|
306
|
+
changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI, api)(
|
|
300
307
|
10,
|
|
301
308
|
getEditorContainerWidth,
|
|
302
309
|
isTableScalingEnabled,
|
package/src/pm-plugins/main.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
6
6
|
import { isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
|
|
8
8
|
import { updateColumnWidths } from '../../transforms';
|
|
9
|
+
import type { PluginInjectionAPI } from '../../types';
|
|
9
10
|
import { META_KEYS } from '../table-analytics';
|
|
10
11
|
|
|
11
12
|
import { createCommand, getPluginState } from './plugin-factory';
|
|
@@ -18,7 +19,9 @@ export const evenColumns =
|
|
|
18
19
|
table,
|
|
19
20
|
start,
|
|
20
21
|
event,
|
|
22
|
+
api,
|
|
21
23
|
}: {
|
|
24
|
+
api: PluginInjectionAPI | undefined | null;
|
|
22
25
|
resizeState: ResizeState;
|
|
23
26
|
table: PMNode;
|
|
24
27
|
start: number;
|
|
@@ -35,7 +38,10 @@ export const evenColumns =
|
|
|
35
38
|
const now = Date.now();
|
|
36
39
|
if (lastClick && now - lastClick.time < 500 && isClickNear(event, lastClick)) {
|
|
37
40
|
const newState = evenAllColumnsWidths(resizeState);
|
|
38
|
-
setLastClick(null, (tr) => updateColumnWidths(newState, table, start)(tr))(
|
|
41
|
+
setLastClick(null, (tr) => updateColumnWidths(newState, table, start, api)(tr))(
|
|
42
|
+
state,
|
|
43
|
+
dispatch,
|
|
44
|
+
);
|
|
39
45
|
|
|
40
46
|
return true;
|
|
41
47
|
}
|
|
@@ -46,10 +52,14 @@ export const evenColumns =
|
|
|
46
52
|
};
|
|
47
53
|
|
|
48
54
|
export const distributeColumnsWidths =
|
|
49
|
-
(
|
|
55
|
+
(
|
|
56
|
+
newResizeState: ResizeState,
|
|
57
|
+
table: ContentNodeWithPos,
|
|
58
|
+
api: PluginInjectionAPI | undefined | null,
|
|
59
|
+
): Command =>
|
|
50
60
|
(state, dispatch) => {
|
|
51
61
|
if (dispatch) {
|
|
52
|
-
const tr = updateColumnWidths(newResizeState, table.node, table.start)(state.tr);
|
|
62
|
+
const tr = updateColumnWidths(newResizeState, table.node, table.start, api)(state.tr);
|
|
53
63
|
tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
|
|
54
64
|
name: TABLE_OVERFLOW_CHANGE_TRIGGER.DISTRIBUTED_COLUMNS,
|
|
55
65
|
});
|
|
@@ -18,6 +18,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
18
18
|
import { stopKeyboardColumnResizing } from '../../commands/column-resize';
|
|
19
19
|
import { updateResizeHandleDecorations } from '../../commands/misc';
|
|
20
20
|
import { updateColumnWidths } from '../../transforms';
|
|
21
|
+
import type { PluginInjectionAPI } from '../../types';
|
|
21
22
|
import { getSelectedColumnIndexes, isTableNested } from '../../utils';
|
|
22
23
|
import {
|
|
23
24
|
ALIGN_CENTER,
|
|
@@ -47,6 +48,7 @@ export const handleMouseDown = (
|
|
|
47
48
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
48
49
|
getEditorFeatureFlags: GetEditorFeatureFlags,
|
|
49
50
|
isTableScalingEnabled: boolean,
|
|
51
|
+
api: PluginInjectionAPI | undefined | null,
|
|
50
52
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
51
53
|
isNewColumnResizingEnabled?: boolean,
|
|
52
54
|
isTableAlignmentEnabled?: boolean,
|
|
@@ -125,6 +127,7 @@ export const handleMouseDown = (
|
|
|
125
127
|
table: originalTable,
|
|
126
128
|
start,
|
|
127
129
|
event,
|
|
130
|
+
api,
|
|
128
131
|
})(state, dispatch)
|
|
129
132
|
) {
|
|
130
133
|
finish(event);
|
|
@@ -230,7 +233,7 @@ export const handleMouseDown = (
|
|
|
230
233
|
isTableAlignmentEnabled,
|
|
231
234
|
});
|
|
232
235
|
|
|
233
|
-
tr = updateColumnWidths(newResizeState, table, start)(tr);
|
|
236
|
+
tr = updateColumnWidths(newResizeState, table, start, api)(tr);
|
|
234
237
|
|
|
235
238
|
// If the table is aligned to the start and the table width is greater than the line length, we should change the alignment to center
|
|
236
239
|
const shouldChangeAlignment = shouldChangeAlignmentToCenterResized(
|
|
@@ -276,7 +279,7 @@ export const handleMouseDown = (
|
|
|
276
279
|
shouldScale,
|
|
277
280
|
shouldUseIncreasedScalingPercent,
|
|
278
281
|
);
|
|
279
|
-
tr = updateColumnWidths(newResizeState, table, start)(tr);
|
|
282
|
+
tr = updateColumnWidths(newResizeState, table, start, api)(tr);
|
|
280
283
|
}
|
|
281
284
|
|
|
282
285
|
if (colIndex === map.width - 1) {
|
|
@@ -6,7 +6,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
6
6
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
7
7
|
|
|
8
8
|
import { TableCssClassName as ClassName } from '../../types';
|
|
9
|
-
import type { ColumnResizingPluginState } from '../../types';
|
|
9
|
+
import type { ColumnResizingPluginState, PluginInjectionAPI } from '../../types';
|
|
10
10
|
import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
11
11
|
|
|
12
12
|
import { setResizeHandlePos } from './commands';
|
|
@@ -20,6 +20,7 @@ export function createPlugin(
|
|
|
20
20
|
{ lastColumnResizable = true }: ColumnResizingPluginState,
|
|
21
21
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
22
22
|
getEditorFeatureFlags: GetEditorFeatureFlags,
|
|
23
|
+
api: PluginInjectionAPI | undefined | null,
|
|
23
24
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
24
25
|
isTableScalingEnabled?: boolean,
|
|
25
26
|
isNewColumnResizingEnabled?: boolean,
|
|
@@ -74,6 +75,7 @@ export function createPlugin(
|
|
|
74
75
|
getEditorContainerWidth,
|
|
75
76
|
getEditorFeatureFlags,
|
|
76
77
|
isTableScalingEnabled || false,
|
|
78
|
+
api,
|
|
77
79
|
editorAnalyticsAPI,
|
|
78
80
|
isNewColumnResizingEnabled,
|
|
79
81
|
isTableAlignmentEnabled,
|
|
@@ -7,6 +7,7 @@ import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
|
|
9
9
|
import { updateColumnWidths } from '../../../transforms';
|
|
10
|
+
import type { PluginInjectionAPI } from '../../../types';
|
|
10
11
|
import { getTableWidth } from '../../../utils';
|
|
11
12
|
import { getLayoutSize } from '../utils/misc';
|
|
12
13
|
import { reduceSpace } from '../utils/resize-logic';
|
|
@@ -214,6 +215,7 @@ export const scaleTable =
|
|
|
214
215
|
tableRef: HTMLTableElement | null | undefined,
|
|
215
216
|
options: ScaleOptions,
|
|
216
217
|
domAtPos: DomAtPos,
|
|
218
|
+
api: PluginInjectionAPI | undefined | null,
|
|
217
219
|
isTableScalingEnabledOnCurrentTable = false,
|
|
218
220
|
shouldUseIncreasedScalingPercent = false,
|
|
219
221
|
) =>
|
|
@@ -256,7 +258,7 @@ export const scaleTable =
|
|
|
256
258
|
}
|
|
257
259
|
|
|
258
260
|
if (resizeState) {
|
|
259
|
-
tr = updateColumnWidths(resizeState, node, start)(tr);
|
|
261
|
+
tr = updateColumnWidths(resizeState, node, start, api)(tr);
|
|
260
262
|
|
|
261
263
|
if (tr.docChanged) {
|
|
262
264
|
tr.setMeta('scrollIntoView', false);
|
package/src/toDOM.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import kebabCase from 'lodash/kebabCase';
|
|
2
|
+
|
|
1
3
|
import { table } from '@atlaskit/adf-schema';
|
|
2
4
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/src/types';
|
|
3
5
|
import type { DOMOutputSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
6
|
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
5
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
8
|
|
|
9
|
+
import { getAlignmentStyle } from './nodeviews/table-container-styles';
|
|
7
10
|
import { generateColgroup } from './pm-plugins/table-resizing/utils/colgroup';
|
|
8
11
|
|
|
9
12
|
type Config = {
|
|
@@ -23,6 +26,10 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): typeof table => {
|
|
|
23
26
|
config.getEditorContainerWidth().width - akEditorGutterPaddingDynamic() * 2,
|
|
24
27
|
node.attrs.width,
|
|
25
28
|
);
|
|
29
|
+
const alignmentStyle = Object.entries(getAlignmentStyle(node.attrs.layout))
|
|
30
|
+
.map(([k, v]) => `${kebabCase(k)}: ${kebabCase(v)}`)
|
|
31
|
+
.join(';');
|
|
32
|
+
|
|
26
33
|
const attrs = {
|
|
27
34
|
'data-number-column': node.attrs.isNumberColumnEnabled,
|
|
28
35
|
'data-layout': node.attrs.layout,
|
|
@@ -111,7 +118,7 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): typeof table => {
|
|
|
111
118
|
'div',
|
|
112
119
|
{
|
|
113
120
|
'data-testid': 'table-alignment-container',
|
|
114
|
-
style:
|
|
121
|
+
style: alignmentStyle,
|
|
115
122
|
},
|
|
116
123
|
[
|
|
117
124
|
'div',
|