@atlaskit/editor-plugin-table 7.29.6 → 7.29.7
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/plugin.js +1 -2
- package/dist/cjs/pm-plugins/keymap.js +1 -4
- package/dist/cjs/ui/FloatingContextualButton/index.js +7 -10
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +42 -72
- package/dist/es2019/plugin.js +1 -2
- package/dist/es2019/pm-plugins/keymap.js +1 -4
- package/dist/es2019/ui/FloatingContextualButton/index.js +9 -12
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +47 -77
- package/dist/esm/plugin.js +1 -2
- package/dist/esm/pm-plugins/keymap.js +1 -4
- package/dist/esm/ui/FloatingContextualButton/index.js +7 -10
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +42 -72
- package/package.json +1 -4
- package/src/plugin.tsx +1 -4
- package/src/pm-plugins/keymap.ts +2 -4
- package/src/ui/FloatingContextualButton/index.tsx +6 -13
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +81 -127
|
@@ -2,7 +2,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import { addColumnAfter, addColumnAfterVO, addColumnBefore, addColumnBeforeVO, addRowAfter, addRowAfterVO, addRowBefore, addRowBeforeVO, backspace, bindKeymapWithCommand, decreaseMediaSize, deleteColumn, deleteRow, escape, focusToContextMenuTrigger, increaseMediaSize, moveColumnLeft, moveColumnRight, moveLeft, moveRight, moveRowDown, moveRowUp, nextCell, previousCell, startColumnResizing, toggleTable } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
4
4
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { goToNextCell, moveCursorBackward, setFocusToCellMenu } from '../commands';
|
|
7
6
|
import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
|
|
8
7
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
@@ -76,9 +75,7 @@ export function keymapPlugin(getEditorContainerWidth, api, editorAnalyticsAPI, d
|
|
|
76
75
|
ariaNotify: ariaNotifyPlugin,
|
|
77
76
|
getIntl: getIntl
|
|
78
77
|
}), list);
|
|
79
|
-
|
|
80
|
-
bindKeymapWithCommand(focusToContextMenuTrigger.common, setFocusToCellMenu(), list);
|
|
81
|
-
}
|
|
78
|
+
bindKeymapWithCommand(focusToContextMenuTrigger.common, setFocusToCellMenu(), list);
|
|
82
79
|
return keymap(list);
|
|
83
80
|
}
|
|
84
81
|
export default keymapPlugin;
|
|
@@ -16,7 +16,6 @@ import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
|
16
16
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
17
17
|
import { akEditorSmallZIndex } from '@atlaskit/editor-shared-styles';
|
|
18
18
|
import ExpandIcon from '@atlaskit/icon/utility/migration/chevron-down';
|
|
19
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
19
|
import { toggleContextualMenu } from '../../commands';
|
|
21
20
|
import { TableCssClassName as ClassName } from '../../types';
|
|
22
21
|
import FixedButton from './FixedButton';
|
|
@@ -49,13 +48,11 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
49
48
|
var targetCellRef;
|
|
50
49
|
targetCellRef = findDomRefAtPos(targetCellPosition, domAtPos);
|
|
51
50
|
useEffect(function () {
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
toggleContextualMenu()(state, dispatch);
|
|
58
|
-
}
|
|
51
|
+
if (isCellMenuOpenByKeyboard && !isContextualMenuOpen) {
|
|
52
|
+
var state = editorView.state,
|
|
53
|
+
dispatch = editorView.dispatch;
|
|
54
|
+
// open the menu when the keyboard shortcut is pressed
|
|
55
|
+
toggleContextualMenu()(state, dispatch);
|
|
59
56
|
}
|
|
60
57
|
}, [isCellMenuOpenByKeyboard, isContextualMenuOpen, editorView]);
|
|
61
58
|
if (!targetCellRef || !(targetCellRef instanceof HTMLElement)) {
|
|
@@ -74,7 +71,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
74
71
|
className: ClassName.CONTEXTUAL_MENU_BUTTON,
|
|
75
72
|
selected: isContextualMenuOpen,
|
|
76
73
|
title: labelCellOptions,
|
|
77
|
-
keymap:
|
|
74
|
+
keymap: focusToContextMenuTrigger,
|
|
78
75
|
onClick: handleClick,
|
|
79
76
|
iconBefore: jsx(ExpandIcon, {
|
|
80
77
|
label: "",
|
|
@@ -82,7 +79,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
82
79
|
isFacadeDisabled: true
|
|
83
80
|
}),
|
|
84
81
|
"aria-label": labelCellOptions,
|
|
85
|
-
"aria-expanded":
|
|
82
|
+
"aria-expanded": isContextualMenuOpen
|
|
86
83
|
}));
|
|
87
84
|
var parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
|
|
88
85
|
if (stickyHeader && parentSticky && tableWrapper) {
|
|
@@ -41,7 +41,6 @@ import TableColumnAddRightIcon from '@atlaskit/icon/core/table-column-add-right'
|
|
|
41
41
|
import TableColumnDeleteIcon from '@atlaskit/icon/core/table-column-delete';
|
|
42
42
|
import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
|
|
43
43
|
import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
|
|
44
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
45
44
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
46
45
|
import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, setFocusToCellMenu, toggleContextualMenu } from '../../commands';
|
|
47
46
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics } from '../../commands-with-analytics';
|
|
@@ -99,16 +98,14 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
99
98
|
targetCellPosition = _getPluginState.targetCellPosition,
|
|
100
99
|
isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
|
|
101
100
|
if (allowBackgroundColor) {
|
|
102
|
-
var _node$attrs, _node$attrs2
|
|
101
|
+
var _node$attrs, _node$attrs2;
|
|
103
102
|
var node = isOpen && targetCellPosition ? state.doc.nodeAt(targetCellPosition) : null;
|
|
104
103
|
var background = hexToEditorBackgroundPaletteColor((node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff');
|
|
105
104
|
var selectedRowIndex;
|
|
106
105
|
var selectedColumnIndex;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
selectedColumnIndex = selectedRowAndColumnFromPalette.selectedColumnIndex;
|
|
111
|
-
}
|
|
106
|
+
var selectedRowAndColumnFromPalette = getSelectedRowAndColumnFromPalette(cellBackgroundColorPalette, background, colorPalletteColumns);
|
|
107
|
+
selectedRowIndex = selectedRowAndColumnFromPalette.selectedRowIndex;
|
|
108
|
+
selectedColumnIndex = selectedRowAndColumnFromPalette.selectedColumnIndex;
|
|
112
109
|
return {
|
|
113
110
|
content: isDragAndDropEnabled ? formatMessage(messages.backgroundColor) : formatMessage(messages.cellBackground),
|
|
114
111
|
value: {
|
|
@@ -132,7 +129,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
132
129
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
133
130
|
,
|
|
134
131
|
className: isDragAndDropEnabled ? ClassName.CONTEXTUAL_MENU_ICON_SMALL : ClassName.CONTEXTUAL_MENU_ICON
|
|
135
|
-
}),
|
|
132
|
+
}), isSubmenuOpen && jsx("div", {
|
|
136
133
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
137
134
|
className: ClassName.CONTEXTUAL_SUBMENU,
|
|
138
135
|
ref: _this.handleSubMenuRef
|
|
@@ -162,22 +159,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
162
159
|
paletteColorTooltipMessages: backgroundPaletteTooltipMessages,
|
|
163
160
|
hexToPaletteColor: hexToEditorBackgroundPaletteColor
|
|
164
161
|
}
|
|
165
|
-
})))
|
|
166
|
-
|
|
167
|
-
jsx("div", {
|
|
168
|
-
className: ClassName.CONTEXTUAL_SUBMENU,
|
|
169
|
-
ref: _this.handleSubMenuRef
|
|
170
|
-
}, jsx(ColorPalette, {
|
|
171
|
-
cols: 7,
|
|
172
|
-
onClick: _this.setColor,
|
|
173
|
-
selectedColor: (node === null || node === void 0 || (_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.background) || '#ffffff',
|
|
174
|
-
paletteOptions: {
|
|
175
|
-
palette: cellBackgroundColorPalette,
|
|
176
|
-
paletteColorTooltipMessages: backgroundPaletteTooltipMessages,
|
|
177
|
-
hexToPaletteColor: hexToEditorBackgroundPaletteColor
|
|
178
|
-
}
|
|
179
|
-
}))),
|
|
180
|
-
'aria-expanded': fg('platform_editor_a11y_table_context_menu') ? isSubmenuOpen : undefined
|
|
162
|
+
})))),
|
|
163
|
+
'aria-expanded': isSubmenuOpen
|
|
181
164
|
};
|
|
182
165
|
}
|
|
183
166
|
});
|
|
@@ -503,7 +486,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
503
486
|
tableWithFixedColumnWidthsOption = _ref4$tableWithFixedC === void 0 ? false : _ref4$tableWithFixedC;
|
|
504
487
|
// context menu opened by keyboard and any item except 'background' activated
|
|
505
488
|
// or color has been chosen from color palette
|
|
506
|
-
if (isCellMenuOpenByKeyboard && (item.value.name !== 'background' || item.value.name === 'background' && _this.state.isSubmenuOpen)
|
|
489
|
+
if (isCellMenuOpenByKeyboard && (item.value.name !== 'background' || item.value.name === 'background' && _this.state.isSubmenuOpen)) {
|
|
507
490
|
var tr = state.tr;
|
|
508
491
|
tr.setMeta(tablePluginKey, {
|
|
509
492
|
type: 'SET_CELL_MENU_OPEN',
|
|
@@ -572,7 +555,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
572
555
|
// 1st time when user chooses the background color item.
|
|
573
556
|
// 2nd when color has been chosen from color palette.
|
|
574
557
|
// here we are handling the 1st call relying on the isSubmenuOpen state value
|
|
575
|
-
if (isCellMenuOpenByKeyboard && !_this.state.isSubmenuOpen
|
|
558
|
+
if (isCellMenuOpenByKeyboard && !_this.state.isSubmenuOpen) {
|
|
576
559
|
_this.setState({
|
|
577
560
|
isSubmenuOpen: true
|
|
578
561
|
});
|
|
@@ -601,39 +584,32 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
601
584
|
dispatch = _this$props12$editorV.dispatch,
|
|
602
585
|
dom = _this$props12$editorV.dom,
|
|
603
586
|
isCellMenuOpenByKeyboard = _this$props12.isCellMenuOpenByKeyboard;
|
|
604
|
-
if (
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
if (
|
|
608
|
-
if (
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
event.preventDefault();
|
|
613
|
-
}
|
|
614
|
-
toggleContextualMenu()(state, dispatch);
|
|
615
|
-
_this.setState({
|
|
616
|
-
isSubmenuOpen: false
|
|
617
|
-
});
|
|
618
|
-
setFocusToCellMenu(false)(state, dispatch);
|
|
619
|
-
dom.focus();
|
|
587
|
+
if (payload) {
|
|
588
|
+
var event = payload.event;
|
|
589
|
+
if (event && event instanceof KeyboardEvent) {
|
|
590
|
+
if (!_this.state.isSubmenuOpen) {
|
|
591
|
+
if (arrowsList.has(event.key)) {
|
|
592
|
+
// preventing default behavior for avoiding cursor jump to next/previous table column
|
|
593
|
+
// when left/right arrow pressed.
|
|
594
|
+
event.preventDefault();
|
|
620
595
|
}
|
|
621
|
-
} else {
|
|
622
|
-
// mouse click outside
|
|
623
596
|
toggleContextualMenu()(state, dispatch);
|
|
624
597
|
_this.setState({
|
|
625
598
|
isSubmenuOpen: false
|
|
626
599
|
});
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
600
|
+
setFocusToCellMenu(false)(state, dispatch);
|
|
601
|
+
dom.focus();
|
|
602
|
+
}
|
|
603
|
+
} else {
|
|
604
|
+
// mouse click outside
|
|
605
|
+
toggleContextualMenu()(state, dispatch);
|
|
606
|
+
_this.setState({
|
|
607
|
+
isSubmenuOpen: false
|
|
608
|
+
});
|
|
609
|
+
if (isCellMenuOpenByKeyboard) {
|
|
610
|
+
setFocusToCellMenu(false)(state, dispatch);
|
|
630
611
|
}
|
|
631
612
|
}
|
|
632
|
-
} else {
|
|
633
|
-
toggleContextualMenu()(state, dispatch);
|
|
634
|
-
_this.setState({
|
|
635
|
-
isSubmenuOpen: false
|
|
636
|
-
});
|
|
637
613
|
}
|
|
638
614
|
});
|
|
639
615
|
_defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (_ref5) {
|
|
@@ -693,17 +669,15 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
693
669
|
_createClass(ContextualMenu, [{
|
|
694
670
|
key: "componentDidMount",
|
|
695
671
|
value: function componentDidMount() {
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
}));
|
|
706
|
-
}
|
|
672
|
+
// ArrowKeyNavigationProvider in DropdownMenu expects that menu handle will stay focused
|
|
673
|
+
// until user pressed ArrowDown.
|
|
674
|
+
// Behavior above fails the A11Y requirement about first item in menu should be focused immediately.
|
|
675
|
+
// so here is triggering componentDidUpdate inside dropdown to set focus on first element
|
|
676
|
+
var isCellMenuOpenByKeyboard = this.props.isCellMenuOpenByKeyboard;
|
|
677
|
+
if (isCellMenuOpenByKeyboard) {
|
|
678
|
+
this.setState(_objectSpread(_objectSpread({}, this.state), {}, {
|
|
679
|
+
isOpenAllowed: isCellMenuOpenByKeyboard
|
|
680
|
+
}));
|
|
707
681
|
}
|
|
708
682
|
}
|
|
709
683
|
}, {
|
|
@@ -720,11 +694,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
720
694
|
isDragAndDropEnabled = _getPluginState13.isDragAndDropEnabled;
|
|
721
695
|
var items = isDragAndDropEnabled ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
|
|
722
696
|
var isOpenAllowed = false;
|
|
723
|
-
|
|
724
|
-
isOpenAllowed = isCellMenuOpenByKeyboard ? this.state.isOpenAllowed : isOpen;
|
|
725
|
-
} else {
|
|
726
|
-
isOpenAllowed = isOpen;
|
|
727
|
-
}
|
|
697
|
+
isOpenAllowed = isCellMenuOpenByKeyboard ? this.state.isOpenAllowed : isOpen;
|
|
728
698
|
return jsx("div", {
|
|
729
699
|
"data-testid": "table-cell-contextual-menu",
|
|
730
700
|
onMouseLeave: this.closeSubmenu,
|
|
@@ -736,7 +706,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
736
706
|
,
|
|
737
707
|
arrowKeyNavigationProviderOptions: {
|
|
738
708
|
type: ArrowKeyNavigationType.MENU,
|
|
739
|
-
disableArrowKeyNavigation: isCellMenuOpenByKeyboard
|
|
709
|
+
disableArrowKeyNavigation: !isCellMenuOpenByKeyboard || this.state.isSubmenuOpen
|
|
740
710
|
},
|
|
741
711
|
items: items,
|
|
742
712
|
isOpen: isOpenAllowed,
|
|
@@ -746,15 +716,15 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
746
716
|
onMouseLeave: this.handleItemMouseLeave,
|
|
747
717
|
fitHeight: 188,
|
|
748
718
|
fitWidth: isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth,
|
|
749
|
-
shouldFocusFirstItem:
|
|
719
|
+
shouldFocusFirstItem: function shouldFocusFirstItem() {
|
|
750
720
|
return Boolean(isCellMenuOpenByKeyboard);
|
|
751
|
-
}
|
|
721
|
+
},
|
|
752
722
|
boundariesElement: boundariesElement,
|
|
753
723
|
offset: offset,
|
|
754
724
|
section: isDragAndDropEnabled ? {
|
|
755
725
|
hasSeparator: true
|
|
756
726
|
} : undefined,
|
|
757
|
-
allowEnterDefaultBehavior:
|
|
727
|
+
allowEnterDefaultBehavior: this.state.isSubmenuOpen
|
|
758
728
|
}));
|
|
759
729
|
}
|
|
760
730
|
}]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.29.
|
|
3
|
+
"version": "7.29.7",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -109,9 +109,6 @@
|
|
|
109
109
|
"platform_editor_dark_mode_cell_header_color_fix": {
|
|
110
110
|
"type": "boolean"
|
|
111
111
|
},
|
|
112
|
-
"platform_editor_a11y_table_context_menu": {
|
|
113
|
-
"type": "boolean"
|
|
114
|
-
},
|
|
115
112
|
"platform_editor_breakout_use_css": {
|
|
116
113
|
"type": "boolean"
|
|
117
114
|
},
|
package/src/plugin.tsx
CHANGED
|
@@ -39,7 +39,6 @@ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
|
39
39
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
40
40
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
41
41
|
import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
|
|
42
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
43
42
|
|
|
44
43
|
import { insertTableWithSize } from './commands/insert';
|
|
45
44
|
import { pluginConfig } from './create-plugin-config';
|
|
@@ -576,9 +575,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
576
575
|
return (
|
|
577
576
|
<>
|
|
578
577
|
{targetCellPosition &&
|
|
579
|
-
(tableRef ||
|
|
580
|
-
(isCellMenuOpenByKeyboard &&
|
|
581
|
-
fg('platform_editor_a11y_table_context_menu'))) &&
|
|
578
|
+
(tableRef || isCellMenuOpenByKeyboard) &&
|
|
582
579
|
!isResizing &&
|
|
583
580
|
options &&
|
|
584
581
|
options.allowContextualMenu && (
|
package/src/pm-plugins/keymap.ts
CHANGED
|
@@ -34,7 +34,6 @@ import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
34
34
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
35
35
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
36
36
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
37
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
38
37
|
|
|
39
38
|
import { goToNextCell, moveCursorBackward, setFocusToCellMenu } from '../commands';
|
|
40
39
|
import {
|
|
@@ -317,6 +316,7 @@ export function keymapPlugin(
|
|
|
317
316
|
),
|
|
318
317
|
list,
|
|
319
318
|
);
|
|
319
|
+
|
|
320
320
|
bindKeymapWithCommand(
|
|
321
321
|
escape.common!,
|
|
322
322
|
stopKeyboardColumnResizing({
|
|
@@ -326,9 +326,7 @@ export function keymapPlugin(
|
|
|
326
326
|
list,
|
|
327
327
|
);
|
|
328
328
|
|
|
329
|
-
|
|
330
|
-
bindKeymapWithCommand(focusToContextMenuTrigger.common!, setFocusToCellMenu(), list);
|
|
331
|
-
}
|
|
329
|
+
bindKeymapWithCommand(focusToContextMenuTrigger.common!, setFocusToCellMenu(), list);
|
|
332
330
|
|
|
333
331
|
return keymap(list) as SafePlugin;
|
|
334
332
|
}
|
|
@@ -21,7 +21,6 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
21
21
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
22
22
|
import { akEditorSmallZIndex } from '@atlaskit/editor-shared-styles';
|
|
23
23
|
import ExpandIcon from '@atlaskit/icon/utility/migration/chevron-down';
|
|
24
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
25
24
|
|
|
26
25
|
import { toggleContextualMenu } from '../../commands';
|
|
27
26
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
@@ -77,12 +76,10 @@ const FloatingContextualButtonInner = React.memo((props: Props & WrappedComponen
|
|
|
77
76
|
targetCellRef = findDomRefAtPos(targetCellPosition, domAtPos);
|
|
78
77
|
|
|
79
78
|
useEffect(() => {
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
toggleContextualMenu()(state, dispatch);
|
|
85
|
-
}
|
|
79
|
+
if (isCellMenuOpenByKeyboard && !isContextualMenuOpen) {
|
|
80
|
+
const { state, dispatch } = editorView;
|
|
81
|
+
// open the menu when the keyboard shortcut is pressed
|
|
82
|
+
toggleContextualMenu()(state, dispatch);
|
|
86
83
|
}
|
|
87
84
|
}, [isCellMenuOpenByKeyboard, isContextualMenuOpen, editorView]);
|
|
88
85
|
|
|
@@ -106,15 +103,11 @@ const FloatingContextualButtonInner = React.memo((props: Props & WrappedComponen
|
|
|
106
103
|
className={ClassName.CONTEXTUAL_MENU_BUTTON}
|
|
107
104
|
selected={isContextualMenuOpen}
|
|
108
105
|
title={labelCellOptions}
|
|
109
|
-
keymap={
|
|
110
|
-
fg('platform_editor_a11y_table_context_menu') ? focusToContextMenuTrigger : undefined
|
|
111
|
-
}
|
|
106
|
+
keymap={focusToContextMenuTrigger}
|
|
112
107
|
onClick={handleClick}
|
|
113
108
|
iconBefore={<ExpandIcon label="" color="currentColor" isFacadeDisabled={true} />}
|
|
114
109
|
aria-label={labelCellOptions}
|
|
115
|
-
aria-expanded={
|
|
116
|
-
fg('platform_editor_a11y_table_context_menu') ? isContextualMenuOpen : undefined
|
|
117
|
-
}
|
|
110
|
+
aria-expanded={isContextualMenuOpen}
|
|
118
111
|
/>
|
|
119
112
|
</div>
|
|
120
113
|
);
|