@atlaskit/editor-plugin-table 7.18.3 → 7.18.4
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 +8 -0
- package/dist/cjs/commands/column-resize.js +0 -12
- package/dist/cjs/commands/go-to-next-cell.js +8 -11
- package/dist/cjs/commands/selection.js +4 -11
- package/dist/cjs/event-handlers.js +7 -11
- package/dist/cjs/pm-plugins/keymap.js +20 -22
- package/dist/cjs/pm-plugins/main.js +26 -30
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +13 -21
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +8 -11
- package/dist/es2019/commands/column-resize.js +0 -12
- package/dist/es2019/commands/go-to-next-cell.js +8 -11
- package/dist/es2019/commands/selection.js +4 -11
- package/dist/es2019/event-handlers.js +8 -12
- package/dist/es2019/pm-plugins/keymap.js +20 -22
- package/dist/es2019/pm-plugins/main.js +27 -31
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +13 -21
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +9 -12
- package/dist/esm/commands/column-resize.js +0 -12
- package/dist/esm/commands/go-to-next-cell.js +8 -11
- package/dist/esm/commands/selection.js +4 -11
- package/dist/esm/event-handlers.js +7 -11
- package/dist/esm/pm-plugins/keymap.js +20 -22
- package/dist/esm/pm-plugins/main.js +26 -30
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +13 -21
- package/dist/esm/pm-plugins/table-resizing/plugin.js +8 -11
- package/package.json +1 -4
- package/src/commands/column-resize.ts +0 -14
- package/src/commands/go-to-next-cell.ts +7 -10
- package/src/commands/selection.ts +4 -11
- package/src/event-handlers.ts +6 -12
- package/src/pm-plugins/keymap.ts +60 -62
- package/src/pm-plugins/main.ts +27 -31
- package/src/pm-plugins/table-resizing/event-handlers.ts +11 -19
- package/src/pm-plugins/table-resizing/plugin.ts +7 -10
- package/src/types.ts +20 -20
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +5 -7
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
isTableSelected,
|
|
19
19
|
selectedRect,
|
|
20
20
|
} from '@atlaskit/editor-tables/utils';
|
|
21
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
22
21
|
|
|
23
22
|
import { selectColumn, selectRow } from '../commands/misc';
|
|
24
23
|
import type tablePlugin from '../plugin';
|
|
@@ -219,12 +218,9 @@ const arrowLeftFromText =
|
|
|
219
218
|
const table = findTable(selection);
|
|
220
219
|
if (table) {
|
|
221
220
|
const { $from } = selection;
|
|
222
|
-
let isColumnResizing = false;
|
|
223
221
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
isColumnResizing = Boolean(columResizePluginState?.isKeyboardResize);
|
|
227
|
-
}
|
|
222
|
+
const columResizePluginState = getPluginState(state) || {};
|
|
223
|
+
const isColumnResizing = Boolean(columResizePluginState?.isKeyboardResize);
|
|
228
224
|
|
|
229
225
|
if (
|
|
230
226
|
isSelectionAtStartOfTable($from, selection) &&
|
|
@@ -261,12 +257,9 @@ const arrowRightFromText =
|
|
|
261
257
|
const table = findTable(selection);
|
|
262
258
|
if (table) {
|
|
263
259
|
const { $to } = selection;
|
|
264
|
-
let isColumnResizing = false;
|
|
265
260
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
isColumnResizing = Boolean(columResizePluginState?.isKeyboardResize);
|
|
269
|
-
}
|
|
261
|
+
const columResizePluginState = getPluginState(state) || {};
|
|
262
|
+
const isColumnResizing = Boolean(columResizePluginState?.isKeyboardResize);
|
|
270
263
|
if (
|
|
271
264
|
isSelectionAtEndOfTable($to, selection) &&
|
|
272
265
|
$to.parent.type.name === 'paragraph' &&
|
package/src/event-handlers.ts
CHANGED
|
@@ -286,16 +286,12 @@ export const handleMouseOut = (view: EditorView, mouseEvent: Event): boolean =>
|
|
|
286
286
|
// we don't need to hide the resize handle decoration
|
|
287
287
|
if (isResizeHandleDecoration(target) && !isResizeHandleDecoration(relatedTarget)) {
|
|
288
288
|
const { state, dispatch } = view;
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
if
|
|
292
|
-
|
|
293
|
-
return false;
|
|
294
|
-
}
|
|
295
|
-
return hideResizeHandleLine()(state, dispatch);
|
|
296
|
-
} else {
|
|
297
|
-
return hideResizeHandleLine()(state, dispatch);
|
|
289
|
+
const { isKeyboardResize } = getPluginState(state);
|
|
290
|
+
if (isKeyboardResize) {
|
|
291
|
+
// no need to hide decoration if column resizing started by keyboard
|
|
292
|
+
return false;
|
|
298
293
|
}
|
|
294
|
+
return hideResizeHandleLine()(state, dispatch);
|
|
299
295
|
}
|
|
300
296
|
|
|
301
297
|
return false;
|
|
@@ -401,9 +397,7 @@ const handleMouseMoveDebounce = rafSchedule(
|
|
|
401
397
|
const { state, dispatch } = view;
|
|
402
398
|
const { resizeHandleColumnIndex, resizeHandleRowIndex } = getPluginState(state);
|
|
403
399
|
|
|
404
|
-
const isKeyboardResize =
|
|
405
|
-
? getPluginState(state).isKeyboardResize
|
|
406
|
-
: false;
|
|
400
|
+
const isKeyboardResize = getPluginState(state).isKeyboardResize;
|
|
407
401
|
const tableCell = closestElement(element, 'td, th') as HTMLTableCellElement;
|
|
408
402
|
const cellStartPosition = view.posAtDOM(tableCell, 0);
|
|
409
403
|
const rect = findCellRectClosestToPos(state.doc.resolve(cellStartPosition));
|
package/src/pm-plugins/keymap.ts
CHANGED
|
@@ -232,72 +232,70 @@ export function keymapPlugin(
|
|
|
232
232
|
);
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
);
|
|
235
|
+
bindKeymapWithCommand(
|
|
236
|
+
startColumnResizing.common!,
|
|
237
|
+
initiateKeyboardColumnResizing({
|
|
238
|
+
ariaNotify: ariaNotifyPlugin,
|
|
239
|
+
getIntl: getIntl,
|
|
240
|
+
}),
|
|
241
|
+
list,
|
|
242
|
+
);
|
|
244
243
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
244
|
+
bindKeymapWithCommand(
|
|
245
|
+
moveRight.common!,
|
|
246
|
+
activateNextResizeArea({
|
|
247
|
+
direction: 1,
|
|
248
|
+
ariaNotify: ariaNotifyPlugin,
|
|
249
|
+
getIntl: getIntl,
|
|
250
|
+
}),
|
|
251
|
+
list,
|
|
252
|
+
);
|
|
254
253
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
254
|
+
bindKeymapWithCommand(
|
|
255
|
+
moveLeft.common!,
|
|
256
|
+
activateNextResizeArea({
|
|
257
|
+
direction: -1,
|
|
258
|
+
ariaNotify: ariaNotifyPlugin,
|
|
259
|
+
getIntl: getIntl,
|
|
260
|
+
}),
|
|
261
|
+
list,
|
|
262
|
+
);
|
|
264
263
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
264
|
+
bindKeymapWithCommand(
|
|
265
|
+
decreaseMediaSize.common!,
|
|
266
|
+
changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(
|
|
267
|
+
-10,
|
|
268
|
+
getEditorContainerWidth,
|
|
269
|
+
isTableScalingEnabled,
|
|
270
|
+
isTableFixedColumnWidthsOptionEnabled,
|
|
271
|
+
INPUT_METHOD.SHORTCUT,
|
|
272
|
+
ariaNotifyPlugin,
|
|
273
|
+
getIntl,
|
|
274
|
+
),
|
|
275
|
+
list,
|
|
276
|
+
);
|
|
278
277
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
278
|
+
bindKeymapWithCommand(
|
|
279
|
+
increaseMediaSize.common!,
|
|
280
|
+
changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(
|
|
281
|
+
10,
|
|
282
|
+
getEditorContainerWidth,
|
|
283
|
+
isTableScalingEnabled,
|
|
284
|
+
isTableFixedColumnWidthsOptionEnabled,
|
|
285
|
+
INPUT_METHOD.SHORTCUT,
|
|
286
|
+
ariaNotifyPlugin,
|
|
287
|
+
getIntl,
|
|
288
|
+
),
|
|
289
|
+
list,
|
|
290
|
+
);
|
|
291
|
+
bindKeymapWithCommand(
|
|
292
|
+
escape.common!,
|
|
293
|
+
stopKeyboardColumnResizing({
|
|
294
|
+
ariaNotify: ariaNotifyPlugin,
|
|
295
|
+
getIntl: getIntl,
|
|
296
|
+
}),
|
|
297
|
+
list,
|
|
298
|
+
);
|
|
301
299
|
|
|
302
300
|
if (getBooleanFF('platform.editor.a11y-table-context-menu_y4c9c')) {
|
|
303
301
|
bindKeymapWithCommand(focusToContextMenuTrigger.common!, setFocusToCellMenu(), list);
|
package/src/pm-plugins/main.ts
CHANGED
|
@@ -193,33 +193,31 @@ export const createPlugin = (
|
|
|
193
193
|
(parent as HTMLElement).querySelector<HTMLTableElement>('table') || undefined;
|
|
194
194
|
}
|
|
195
195
|
const tableNode = findTable(state.selection);
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
// Jump to another table
|
|
211
|
-
stopKeyboardColumnResizing({
|
|
212
|
-
ariaNotify: ariaNotifyPlugin,
|
|
213
|
-
getIntl: getIntl,
|
|
214
|
-
})(state, dispatch);
|
|
215
|
-
}
|
|
216
|
-
} else if (!tableNode) {
|
|
217
|
-
// selection outside of table
|
|
196
|
+
// when keyboard cursor leaves the table we need to stop column resizing
|
|
197
|
+
const pluginPrevState = getPluginState(prevState);
|
|
198
|
+
const isStopKeyboardColumResizing =
|
|
199
|
+
pluginPrevState.isResizeHandleWidgetAdded && pluginPrevState.isKeyboardResize;
|
|
200
|
+
if (isStopKeyboardColumResizing) {
|
|
201
|
+
const isTableNodesDifferent = pluginPrevState?.tableNode !== tableNode?.node;
|
|
202
|
+
if (pluginPrevState?.tableNode && tableNode && isTableNodesDifferent) {
|
|
203
|
+
const oldRowsNumber = TableMap.get(pluginPrevState.tableNode).height;
|
|
204
|
+
const newRowsNumber = TableMap.get(tableNode.node).height;
|
|
205
|
+
if (
|
|
206
|
+
oldRowsNumber !== newRowsNumber || // Add/delete row
|
|
207
|
+
tableNode.node.attrs.localId !== pluginPrevState.tableNode.attrs.localId
|
|
208
|
+
) {
|
|
209
|
+
// Jump to another table
|
|
218
210
|
stopKeyboardColumnResizing({
|
|
219
211
|
ariaNotify: ariaNotifyPlugin,
|
|
220
212
|
getIntl: getIntl,
|
|
221
213
|
})(state, dispatch);
|
|
222
214
|
}
|
|
215
|
+
} else if (!tableNode) {
|
|
216
|
+
// selection outside of table
|
|
217
|
+
stopKeyboardColumnResizing({
|
|
218
|
+
ariaNotify: ariaNotifyPlugin,
|
|
219
|
+
getIntl: getIntl,
|
|
220
|
+
})(state, dispatch);
|
|
223
221
|
}
|
|
224
222
|
}
|
|
225
223
|
}
|
|
@@ -337,15 +335,13 @@ export const createPlugin = (
|
|
|
337
335
|
},
|
|
338
336
|
handleTextInput: (view, _from, _to, text) => {
|
|
339
337
|
const { state, dispatch } = view;
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
return false;
|
|
348
|
-
}
|
|
338
|
+
const { isKeyboardResize } = getPluginState(state);
|
|
339
|
+
if (isKeyboardResize) {
|
|
340
|
+
stopKeyboardColumnResizing({
|
|
341
|
+
ariaNotify: ariaNotifyPlugin,
|
|
342
|
+
getIntl: getIntl,
|
|
343
|
+
})(state, dispatch);
|
|
344
|
+
return false;
|
|
349
345
|
}
|
|
350
346
|
const tr = replaceSelectedTable(state, text, INPUT_METHOD.KEYBOARD, editorAnalyticsAPI);
|
|
351
347
|
if (tr.selectionSet) {
|
|
@@ -152,15 +152,11 @@ export const handleMouseDown = (
|
|
|
152
152
|
|
|
153
153
|
// If we let go in the same place we started, don't need to do anything.
|
|
154
154
|
if (dragging && clientX === dragging.startX) {
|
|
155
|
-
if (
|
|
156
|
-
if
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return stopKeyboardColumnResizing({})(state, dispatch, view);
|
|
161
|
-
} else {
|
|
162
|
-
return stopResizing()(state, dispatch);
|
|
163
|
-
}
|
|
155
|
+
if (isKeyboardResize || !isTableHovered) {
|
|
156
|
+
/** if column resize had started via keyboard but continued by mouse
|
|
157
|
+
* or mouse pointer leaves the table but mouse button still pressed
|
|
158
|
+
*/
|
|
159
|
+
return stopKeyboardColumnResizing({})(state, dispatch, view);
|
|
164
160
|
} else {
|
|
165
161
|
return stopResizing()(state, dispatch);
|
|
166
162
|
}
|
|
@@ -255,15 +251,11 @@ export const handleMouseDown = (
|
|
|
255
251
|
},
|
|
256
252
|
})(tr);
|
|
257
253
|
}
|
|
258
|
-
if (
|
|
259
|
-
if
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
return stopKeyboardColumnResizing({ originalTr: tr })(state, dispatch, view);
|
|
264
|
-
} else {
|
|
265
|
-
return stopResizing(tr)(state, dispatch);
|
|
266
|
-
}
|
|
254
|
+
if (isKeyboardResize || !isTableHovered) {
|
|
255
|
+
/** if column resize had started via keyboard but continued by mouse
|
|
256
|
+
* or mouse pointer leaves the table but mouse button still pressed
|
|
257
|
+
*/
|
|
258
|
+
return stopKeyboardColumnResizing({ originalTr: tr })(state, dispatch, view);
|
|
267
259
|
} else {
|
|
268
260
|
return stopResizing(tr)(state, dispatch);
|
|
269
261
|
}
|
|
@@ -280,7 +272,7 @@ export const handleMouseDown = (
|
|
|
280
272
|
!dragging ||
|
|
281
273
|
resizeHandlePos === null ||
|
|
282
274
|
!pointsAtCell(state.doc.resolve(resizeHandlePos)) ||
|
|
283
|
-
|
|
275
|
+
!isTableHovered
|
|
284
276
|
) {
|
|
285
277
|
return finish(event);
|
|
286
278
|
}
|
|
@@ -4,7 +4,6 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
6
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
|
|
9
8
|
import { TableCssClassName as ClassName } from '../../types';
|
|
10
9
|
import type { ColumnResizingPluginState } from '../../types';
|
|
@@ -55,15 +54,13 @@ export function createPlugin(
|
|
|
55
54
|
|
|
56
55
|
const { dragging } = getPluginState(state);
|
|
57
56
|
let isColumnKeyboardResizeStarted = false;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
isColumnKeyboardResizeStarted = isKeyboardResize;
|
|
66
|
-
}
|
|
57
|
+
/*
|
|
58
|
+
We need to start listening mouse events if column resize started from keyboard.
|
|
59
|
+
This will allow continue resizing via mouse
|
|
60
|
+
*/
|
|
61
|
+
const { isKeyboardResize } = getTablePluginState(state);
|
|
62
|
+
if (isKeyboardResize) {
|
|
63
|
+
isColumnKeyboardResizeStarted = isKeyboardResize;
|
|
67
64
|
}
|
|
68
65
|
|
|
69
66
|
if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
|
package/src/types.ts
CHANGED
|
@@ -195,7 +195,7 @@ export type TablePluginAction =
|
|
|
195
195
|
isHeaderRowEnabled: boolean;
|
|
196
196
|
isHeaderColumnEnabled: boolean;
|
|
197
197
|
};
|
|
198
|
-
|
|
198
|
+
}
|
|
199
199
|
| {
|
|
200
200
|
type: 'HOVER_ROWS';
|
|
201
201
|
data: {
|
|
@@ -203,13 +203,13 @@ export type TablePluginAction =
|
|
|
203
203
|
hoveredRows: number[];
|
|
204
204
|
isInDanger?: boolean;
|
|
205
205
|
};
|
|
206
|
-
|
|
206
|
+
}
|
|
207
207
|
| {
|
|
208
208
|
type: 'HOVER_MERGED_CELLS';
|
|
209
209
|
data: {
|
|
210
210
|
decorationSet: DecorationSet;
|
|
211
211
|
};
|
|
212
|
-
|
|
212
|
+
}
|
|
213
213
|
| {
|
|
214
214
|
type: 'HOVER_COLUMNS';
|
|
215
215
|
data: {
|
|
@@ -217,7 +217,7 @@ export type TablePluginAction =
|
|
|
217
217
|
hoveredColumns: number[];
|
|
218
218
|
isInDanger?: boolean;
|
|
219
219
|
};
|
|
220
|
-
|
|
220
|
+
}
|
|
221
221
|
| {
|
|
222
222
|
type: 'HOVER_TABLE';
|
|
223
223
|
data: {
|
|
@@ -226,7 +226,7 @@ export type TablePluginAction =
|
|
|
226
226
|
hoveredColumns: number[];
|
|
227
227
|
isInDanger?: boolean;
|
|
228
228
|
};
|
|
229
|
-
|
|
229
|
+
}
|
|
230
230
|
| {
|
|
231
231
|
type: 'START_KEYBOARD_COLUMN_RESIZE';
|
|
232
232
|
data: {
|
|
@@ -236,7 +236,7 @@ export type TablePluginAction =
|
|
|
236
236
|
resizeHandleIncludeTooltip: boolean;
|
|
237
237
|
isKeyboardResize?: boolean;
|
|
238
238
|
};
|
|
239
|
-
|
|
239
|
+
}
|
|
240
240
|
| {
|
|
241
241
|
type: 'ADD_RESIZE_HANDLE_DECORATIONS';
|
|
242
242
|
data: {
|
|
@@ -246,7 +246,7 @@ export type TablePluginAction =
|
|
|
246
246
|
resizeHandleIncludeTooltip: boolean;
|
|
247
247
|
isKeyboardResize?: boolean;
|
|
248
248
|
};
|
|
249
|
-
|
|
249
|
+
}
|
|
250
250
|
| {
|
|
251
251
|
type: 'UPDATE_RESIZE_HANDLE_DECORATIONS';
|
|
252
252
|
data: {
|
|
@@ -255,21 +255,21 @@ export type TablePluginAction =
|
|
|
255
255
|
resizeHandleColumnIndex: number | undefined;
|
|
256
256
|
resizeHandleIncludeTooltip: boolean | undefined;
|
|
257
257
|
};
|
|
258
|
-
|
|
258
|
+
}
|
|
259
259
|
| {
|
|
260
260
|
type: 'UPDATE_TABLE_WIDTH_TO_WIDEST';
|
|
261
261
|
data: {
|
|
262
262
|
widthToWidest: WidthToWidest | undefined;
|
|
263
263
|
};
|
|
264
|
-
|
|
264
|
+
}
|
|
265
265
|
| {
|
|
266
266
|
type: 'REMOVE_RESIZE_HANDLE_DECORATIONS';
|
|
267
267
|
data: { decorationSet: DecorationSet };
|
|
268
|
-
|
|
268
|
+
}
|
|
269
269
|
| {
|
|
270
270
|
type: 'STOP_KEYBOARD_COLUMN_RESIZE';
|
|
271
271
|
data: { decorationSet: DecorationSet };
|
|
272
|
-
|
|
272
|
+
}
|
|
273
273
|
| { type: 'CLEAR_HOVER_SELECTION'; data: { decorationSet: DecorationSet } }
|
|
274
274
|
| { type: 'SHOW_RESIZE_HANDLE_LINE'; data: { decorationSet: DecorationSet } }
|
|
275
275
|
| { type: 'HIDE_RESIZE_HANDLE_LINE'; data: { decorationSet: DecorationSet } }
|
|
@@ -278,48 +278,48 @@ export type TablePluginAction =
|
|
|
278
278
|
data: {
|
|
279
279
|
hoveredCell: CellHoverMeta;
|
|
280
280
|
};
|
|
281
|
-
|
|
281
|
+
}
|
|
282
282
|
| {
|
|
283
283
|
type: 'TABLE_HOVERED';
|
|
284
284
|
data: {
|
|
285
285
|
isTableHovered: boolean;
|
|
286
286
|
};
|
|
287
|
-
|
|
287
|
+
}
|
|
288
288
|
| { type: 'SET_TARGET_CELL_POSITION'; data: { targetCellPosition?: number } }
|
|
289
289
|
| {
|
|
290
290
|
type: 'SELECT_COLUMN';
|
|
291
291
|
data: { targetCellPosition: number; decorationSet: DecorationSet };
|
|
292
|
-
|
|
292
|
+
}
|
|
293
293
|
| { type: 'SHOW_INSERT_ROW_BUTTON'; data: { insertRowButtonIndex: number } }
|
|
294
294
|
| {
|
|
295
295
|
type: 'SHOW_INSERT_COLUMN_BUTTON';
|
|
296
296
|
data: { insertColumnButtonIndex: number };
|
|
297
|
-
|
|
297
|
+
}
|
|
298
298
|
| {
|
|
299
299
|
type: 'HIDE_INSERT_COLUMN_OR_ROW_BUTTON';
|
|
300
|
-
|
|
300
|
+
}
|
|
301
301
|
| { type: 'TOGGLE_CONTEXTUAL_MENU' }
|
|
302
302
|
| {
|
|
303
303
|
type: 'SET_CELL_MENU_OPEN';
|
|
304
304
|
data: {
|
|
305
305
|
isCellMenuOpenByKeyboard: boolean;
|
|
306
306
|
};
|
|
307
|
-
|
|
307
|
+
};
|
|
308
308
|
|
|
309
309
|
export type ColumnResizingPluginAction =
|
|
310
310
|
| {
|
|
311
311
|
type: 'SET_RESIZE_HANDLE_POSITION';
|
|
312
312
|
data: { resizeHandlePos: number | null };
|
|
313
|
-
|
|
313
|
+
}
|
|
314
314
|
| { type: 'STOP_RESIZING' }
|
|
315
315
|
| {
|
|
316
316
|
type: 'SET_DRAGGING';
|
|
317
317
|
data: { dragging: { startX: number; startWidth: number } | null };
|
|
318
|
-
|
|
318
|
+
}
|
|
319
319
|
| {
|
|
320
320
|
type: 'SET_LAST_CLICK';
|
|
321
321
|
data: { lastClick: { x: number; y: number; time: number } | null };
|
|
322
|
-
|
|
322
|
+
};
|
|
323
323
|
|
|
324
324
|
export enum TableDecorations {
|
|
325
325
|
/** Classic controls */
|
|
@@ -116,7 +116,6 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
116
116
|
};
|
|
117
117
|
private dropdownMenuRef = React.createRef<HTMLDivElement>();
|
|
118
118
|
|
|
119
|
-
|
|
120
119
|
componentDidMount() {
|
|
121
120
|
if (getBooleanFF('platform.editor.a11y-table-context-menu_y4c9c')) {
|
|
122
121
|
// ArrowKeyNavigationProvider in DropdownMenu expects that menu handle will stay focused
|
|
@@ -127,8 +126,8 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
127
126
|
if (isCellMenuOpenByKeyboard) {
|
|
128
127
|
this.setState({
|
|
129
128
|
...this.state,
|
|
130
|
-
isOpenAllowed: isCellMenuOpenByKeyboard
|
|
131
|
-
})
|
|
129
|
+
isOpenAllowed: isCellMenuOpenByKeyboard,
|
|
130
|
+
});
|
|
132
131
|
}
|
|
133
132
|
}
|
|
134
133
|
}
|
|
@@ -179,10 +178,9 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
179
178
|
}
|
|
180
179
|
shouldFocusFirstItem={
|
|
181
180
|
getBooleanFF('platform.editor.a11y-table-context-menu_y4c9c')
|
|
182
|
-
?
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
181
|
+
? () => {
|
|
182
|
+
return Boolean(isCellMenuOpenByKeyboard);
|
|
183
|
+
}
|
|
186
184
|
: undefined
|
|
187
185
|
}
|
|
188
186
|
boundariesElement={boundariesElement}
|