@atlaskit/editor-plugin-table 23.3.3 → 23.3.5
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 +27 -0
- package/dist/cjs/pm-plugins/commands/active-table-menu.js +19 -8
- package/dist/cjs/pm-plugins/commands/commands-with-analytics.js +9 -49
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +1 -1
- package/dist/cjs/pm-plugins/handlers.js +1 -1
- package/dist/cjs/pm-plugins/main.js +4 -1
- package/dist/cjs/ui/ContentComponent.js +11 -1
- package/dist/cjs/ui/FloatingContextualButton/index.js +2 -2
- package/dist/cjs/ui/FloatingContextualMenu/CellMenuPopup.js +2 -2
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +6 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +10 -38
- package/dist/cjs/ui/FloatingTableMenu/index.js +175 -0
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +43 -11
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +57 -26
- package/dist/cjs/ui/TableMenu/cell/items/MergeCellsItem.js +1 -1
- package/dist/cjs/ui/TableMenu/cell/items/SplitCellItem.js +1 -1
- package/dist/cjs/ui/TableMenu/cell/items/VerticalAlignDropdownItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/AddColumnLeftItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/AddColumnRightItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/DeleteColumnItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/DistributeColumnsItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnLeftItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnRightItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/SortDecreasingItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/SortIncreasingItem.js +1 -1
- package/dist/cjs/ui/TableMenu/row/items/AddRowAboveItem.js +1 -1
- package/dist/cjs/ui/TableMenu/row/items/AddRowBelowItem.js +1 -1
- package/dist/cjs/ui/TableMenu/row/items/DeleteRowItem.js +1 -1
- package/dist/cjs/ui/TableMenu/row/items/MoveRowDownItem.js +1 -1
- package/dist/cjs/ui/TableMenu/row/items/MoveRowUpItem.js +1 -1
- package/dist/cjs/ui/TableMenu/shared/TableMenu.js +8 -8
- package/dist/cjs/ui/TableMenu/shared/consts.js +1 -1
- package/dist/cjs/ui/TableMenu/shared/items/BackgroundColorItem.js +1 -1
- package/dist/cjs/ui/TableMenu/shared/items/ClearCellsItem.js +1 -1
- package/dist/es2019/pm-plugins/commands/active-table-menu.js +19 -8
- package/dist/es2019/pm-plugins/commands/commands-with-analytics.js +0 -39
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +1 -1
- package/dist/es2019/pm-plugins/handlers.js +1 -1
- package/dist/es2019/pm-plugins/main.js +3 -0
- package/dist/es2019/ui/ContentComponent.js +11 -1
- package/dist/es2019/ui/FloatingContextualButton/index.js +2 -2
- package/dist/es2019/ui/FloatingContextualMenu/CellMenuPopup.js +2 -2
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +6 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +11 -40
- package/dist/es2019/ui/FloatingTableMenu/index.js +165 -0
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +41 -7
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +40 -7
- package/dist/es2019/ui/TableMenu/cell/items/MergeCellsItem.js +1 -1
- package/dist/es2019/ui/TableMenu/cell/items/SplitCellItem.js +1 -1
- package/dist/es2019/ui/TableMenu/cell/items/VerticalAlignDropdownItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/AddColumnLeftItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/AddColumnRightItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/DeleteColumnItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/DistributeColumnsItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnLeftItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnRightItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/SortDecreasingItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/SortIncreasingItem.js +1 -1
- package/dist/es2019/ui/TableMenu/row/items/AddRowAboveItem.js +1 -1
- package/dist/es2019/ui/TableMenu/row/items/AddRowBelowItem.js +1 -1
- package/dist/es2019/ui/TableMenu/row/items/DeleteRowItem.js +1 -1
- package/dist/es2019/ui/TableMenu/row/items/MoveRowDownItem.js +1 -1
- package/dist/es2019/ui/TableMenu/row/items/MoveRowUpItem.js +1 -1
- package/dist/es2019/ui/TableMenu/shared/TableMenu.js +8 -8
- package/dist/es2019/ui/TableMenu/shared/consts.js +1 -1
- package/dist/es2019/ui/TableMenu/shared/items/BackgroundColorItem.js +1 -1
- package/dist/es2019/ui/TableMenu/shared/items/ClearCellsItem.js +1 -1
- package/dist/esm/pm-plugins/commands/active-table-menu.js +19 -8
- package/dist/esm/pm-plugins/commands/commands-with-analytics.js +8 -48
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +1 -1
- package/dist/esm/pm-plugins/handlers.js +1 -1
- package/dist/esm/pm-plugins/main.js +4 -1
- package/dist/esm/ui/ContentComponent.js +11 -1
- package/dist/esm/ui/FloatingContextualButton/index.js +2 -2
- package/dist/esm/ui/FloatingContextualMenu/CellMenuPopup.js +2 -2
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +8 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +11 -39
- package/dist/esm/ui/FloatingTableMenu/index.js +167 -0
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +42 -10
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +56 -25
- package/dist/esm/ui/TableMenu/cell/items/MergeCellsItem.js +1 -1
- package/dist/esm/ui/TableMenu/cell/items/SplitCellItem.js +1 -1
- package/dist/esm/ui/TableMenu/cell/items/VerticalAlignDropdownItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/AddColumnLeftItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/AddColumnRightItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/DeleteColumnItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/DistributeColumnsItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/MoveColumnLeftItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/MoveColumnRightItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/SortDecreasingItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/SortIncreasingItem.js +1 -1
- package/dist/esm/ui/TableMenu/row/items/AddRowAboveItem.js +1 -1
- package/dist/esm/ui/TableMenu/row/items/AddRowBelowItem.js +1 -1
- package/dist/esm/ui/TableMenu/row/items/DeleteRowItem.js +1 -1
- package/dist/esm/ui/TableMenu/row/items/MoveRowDownItem.js +1 -1
- package/dist/esm/ui/TableMenu/row/items/MoveRowUpItem.js +1 -1
- package/dist/esm/ui/TableMenu/shared/TableMenu.js +8 -8
- package/dist/esm/ui/TableMenu/shared/consts.js +1 -1
- package/dist/esm/ui/TableMenu/shared/items/BackgroundColorItem.js +1 -1
- package/dist/esm/ui/TableMenu/shared/items/ClearCellsItem.js +1 -1
- package/dist/types/pm-plugins/commands/active-table-menu.d.ts +3 -3
- package/dist/types/pm-plugins/commands/commands-with-analytics.d.ts +1 -3
- package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +0 -4
- package/dist/types/ui/FloatingTableMenu/index.d.ts +23 -0
- package/dist/types/ui/TableMenu/shared/consts.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/commands/active-table-menu.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/commands/commands-with-analytics.d.ts +1 -3
- package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +0 -4
- package/dist/types-ts4.5/ui/FloatingTableMenu/index.d.ts +23 -0
- package/dist/types-ts4.5/ui/TableMenu/shared/consts.d.ts +1 -1
- package/package.json +3 -3
|
@@ -5,6 +5,7 @@ import { getDomRefFromSelection } from '@atlaskit/editor-common/get-dom-ref-from
|
|
|
5
5
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
6
6
|
import { ResizerBreakoutModeLabel } from '@atlaskit/editor-common/resizer';
|
|
7
7
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
8
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
9
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
10
|
import FloatingContextualButton from './FloatingContextualButton';
|
|
10
11
|
import FloatingContextualMenu from './FloatingContextualMenu';
|
|
@@ -12,6 +13,7 @@ import FloatingDragMenu from './FloatingDragMenu';
|
|
|
12
13
|
// Ignored via go/ees005
|
|
13
14
|
// eslint-disable-next-line import/no-named-as-default
|
|
14
15
|
import FloatingInsertButton from './FloatingInsertButton';
|
|
16
|
+
import FloatingTableMenu from './FloatingTableMenu';
|
|
15
17
|
import { FloatingToolbarLabel } from './FloatingToolbarLabel/FloatingToolbarLabel';
|
|
16
18
|
import { GlobalStylesWrapper } from './global-styles';
|
|
17
19
|
import { SizeSelector } from './SizeSelector';
|
|
@@ -138,7 +140,15 @@ const ContentComponentInternal = ({
|
|
|
138
140
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
139
141
|
api: api,
|
|
140
142
|
isDragMenuOpen: isDragMenuOpen
|
|
141
|
-
}), /*#__PURE__*/React.createElement(
|
|
143
|
+
}), expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) ? /*#__PURE__*/React.createElement(FloatingTableMenu, {
|
|
144
|
+
api: api,
|
|
145
|
+
boundariesElement: popupsBoundariesElement,
|
|
146
|
+
editorView: editorView,
|
|
147
|
+
mountPoint: popupsMountPoint,
|
|
148
|
+
stickyHeaders: stickyHeader,
|
|
149
|
+
tableWrapper: tableWrapperTarget,
|
|
150
|
+
targetCellPosition: targetCellPosition
|
|
151
|
+
}) : /*#__PURE__*/React.createElement(FloatingDragMenu, {
|
|
142
152
|
editorView: editorView,
|
|
143
153
|
mountPoint: popupsMountPoint,
|
|
144
154
|
boundariesElement: popupsBoundariesElement,
|
|
@@ -76,7 +76,7 @@ const FloatingContextualButtonInner = /*#__PURE__*/React.memo(props => {
|
|
|
76
76
|
toggleActiveTableMenu({
|
|
77
77
|
type: 'cell',
|
|
78
78
|
openedBy: 'mouse'
|
|
79
|
-
}, currentActiveTableMenu)({
|
|
79
|
+
}, currentActiveTableMenu, api)({
|
|
80
80
|
tr
|
|
81
81
|
});
|
|
82
82
|
return tr;
|
|
@@ -115,7 +115,7 @@ const FloatingContextualButtonInner = /*#__PURE__*/React.memo(props => {
|
|
|
115
115
|
toggleActiveTableMenu({
|
|
116
116
|
type: 'cell',
|
|
117
117
|
openedBy: 'keyboard'
|
|
118
|
-
}, currentActiveTableMenu)({
|
|
118
|
+
}, currentActiveTableMenu, api)({
|
|
119
119
|
tr
|
|
120
120
|
});
|
|
121
121
|
return tr;
|
|
@@ -32,11 +32,11 @@ export const CellMenuPopup = ({
|
|
|
32
32
|
const {
|
|
33
33
|
isCellMenuOpenByKeyboard
|
|
34
34
|
} = getPluginState(editorView.state);
|
|
35
|
-
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
|
|
35
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu(api));
|
|
36
36
|
if (isCellMenuOpenByKeyboard) {
|
|
37
37
|
setFocusToCellMenu(false)(editorView.state, editorView.dispatch);
|
|
38
38
|
}
|
|
39
|
-
}, [api
|
|
39
|
+
}, [api, editorView]);
|
|
40
40
|
const isEventInsideCellMenu = useCallback(event => {
|
|
41
41
|
var _popupContentRef$curr;
|
|
42
42
|
const target = event.target;
|
|
@@ -4,9 +4,12 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
* @jsxRuntime classic
|
|
5
5
|
* @jsx jsx
|
|
6
6
|
*/
|
|
7
|
+
|
|
7
8
|
import React, { Component } from 'react';
|
|
9
|
+
|
|
8
10
|
/* eslint-disable @typescript-eslint/consistent-type-imports, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic */
|
|
9
11
|
import { jsx } from '@emotion/react';
|
|
12
|
+
import memoizeOne from 'memoize-one';
|
|
10
13
|
import { injectIntl } from 'react-intl';
|
|
11
14
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
12
15
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -44,7 +47,6 @@ import { getMergedCellsPositions } from '../../pm-plugins/utils/table';
|
|
|
44
47
|
import { TableCssClassName as ClassName } from '../../types';
|
|
45
48
|
import { colorPalletteColumns, contextualMenuDropdownWidthDnD } from '../consts';
|
|
46
49
|
import { cellColourPreviewStyles } from './styles';
|
|
47
|
-
const arrowsList = new Set(!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true) ? ['ArrowRight', 'ArrowLeft'] : ['ArrowRight']);
|
|
48
50
|
const dropdownMenuSection = {
|
|
49
51
|
hasSeparator: true
|
|
50
52
|
};
|
|
@@ -52,6 +54,8 @@ const elementBeforeIconStyles = xcss({
|
|
|
52
54
|
marginRight: 'space.negative.075',
|
|
53
55
|
display: 'flex'
|
|
54
56
|
});
|
|
57
|
+
const getArrowsList = memoizeOne(() => new Set(!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true) ? ['ArrowRight', 'ArrowLeft'] : ['ArrowRight']));
|
|
58
|
+
|
|
55
59
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
56
60
|
export class ContextualMenu extends Component {
|
|
57
61
|
constructor(...args) {
|
|
@@ -605,7 +609,7 @@ export class ContextualMenu extends Component {
|
|
|
605
609
|
} = payload;
|
|
606
610
|
if (event && event instanceof KeyboardEvent) {
|
|
607
611
|
if (!this.state.isSubmenuOpen) {
|
|
608
|
-
if (
|
|
612
|
+
if (getArrowsList().has(event.key)) {
|
|
609
613
|
// preventing default behavior for avoiding cursor jump to next/previous table column
|
|
610
614
|
// when left/right arrow pressed.
|
|
611
615
|
event.preventDefault();
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
2
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
4
|
-
import { UserIntentPopupWrapper } from '@atlaskit/editor-common/user-intent';
|
|
5
3
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
6
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
7
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
6
|
import { TableCssClassName as ClassName } from '../../types';
|
|
10
|
-
import { dragMenuDropdownWidth,
|
|
11
|
-
import { COLUMN_MENU } from '../TableMenu/column/keys';
|
|
12
|
-
import { ROW_MENU } from '../TableMenu/row/keys';
|
|
13
|
-
import { TABLE_MENU_WIDTH } from '../TableMenu/shared/consts';
|
|
14
|
-
import { TableMenu } from '../TableMenu/shared/TableMenu';
|
|
7
|
+
import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
|
|
15
8
|
import DragMenu from './DragMenu';
|
|
16
|
-
const TABLE_MENU_OFFSET = dragTableInsertColumnButtonSize + 4;
|
|
17
9
|
const FloatingDragMenu = ({
|
|
18
10
|
mountPoint,
|
|
19
11
|
boundariesElement,
|
|
@@ -36,24 +28,11 @@ const FloatingDragMenu = ({
|
|
|
36
28
|
tableWrapper
|
|
37
29
|
}) => {
|
|
38
30
|
var _getEditorFeatureFlag;
|
|
39
|
-
|
|
40
|
-
activeTableMenu
|
|
41
|
-
} = useSharedPluginStateWithSelector(api, ['table'], states => {
|
|
42
|
-
var _states$tableState;
|
|
43
|
-
return {
|
|
44
|
-
activeTableMenu: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.activeTableMenu
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
const isActiveTableMenuDragMenu = (activeTableMenu === null || activeTableMenu === void 0 ? void 0 : activeTableMenu.type) === 'row' || (activeTableMenu === null || activeTableMenu === void 0 ? void 0 : activeTableMenu.type) === 'column';
|
|
48
|
-
const hasActiveTableMenuState = activeTableMenu !== undefined;
|
|
49
|
-
const isDragMenuOpen = expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) && hasActiveTableMenuState ? isActiveTableMenuDragMenu : isOpen;
|
|
50
|
-
const dragMenuDirection = expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) && hasActiveTableMenuState ? isActiveTableMenuDragMenu ? activeTableMenu.type : undefined : direction;
|
|
51
|
-
const dragMenuIndex = expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) && hasActiveTableMenuState ? isActiveTableMenuDragMenu ? activeTableMenu.index : undefined : index;
|
|
52
|
-
if (!isDragMenuOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
31
|
+
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
53
32
|
return null;
|
|
54
33
|
}
|
|
55
34
|
const inStickyMode = (stickyHeaders === null || stickyHeaders === void 0 ? void 0 : stickyHeaders.sticky) || (tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.classList.contains(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW)) && fg('platform_editor_table_sticky_header_patch_7');
|
|
56
|
-
const targetHandleRef =
|
|
35
|
+
const targetHandleRef = direction === 'row' ? document.querySelector('#drag-handle-button-row') : document.querySelector('#drag-handle-button-column');
|
|
57
36
|
if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
|
|
58
37
|
return null;
|
|
59
38
|
}
|
|
@@ -62,8 +41,8 @@ const FloatingDragMenu = ({
|
|
|
62
41
|
} = (_getEditorFeatureFlag = getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags()) !== null && _getEditorFeatureFlag !== void 0 ? _getEditorFeatureFlag : {};
|
|
63
42
|
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
|
|
64
43
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
65
|
-
alignX:
|
|
66
|
-
alignY:
|
|
44
|
+
alignX: direction === 'row' ? 'right' : undefined,
|
|
45
|
+
alignY: direction === 'row' ? 'start' : undefined
|
|
67
46
|
// Ignored via go/ees005
|
|
68
47
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
69
48
|
,
|
|
@@ -71,7 +50,7 @@ const FloatingDragMenu = ({
|
|
|
71
50
|
mountTo: mountPoint,
|
|
72
51
|
boundariesElement: boundariesElement,
|
|
73
52
|
scrollableElement: scrollableElement,
|
|
74
|
-
fitWidth:
|
|
53
|
+
fitWidth: dragMenuDropdownWidth,
|
|
75
54
|
fitHeight: tablePopupMenuFitHeight
|
|
76
55
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
77
56
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
@@ -79,22 +58,14 @@ const FloatingDragMenu = ({
|
|
|
79
58
|
,
|
|
80
59
|
zIndex: inStickyMode ? akEditorFloatingDialogZIndex : akEditorFloatingOverlapPanelZIndex,
|
|
81
60
|
forcePlacement: true,
|
|
82
|
-
|
|
83
|
-
offset: expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) ? [TABLE_MENU_OFFSET, 0] : direction === 'row' ? [-9, 0] : [0, -7],
|
|
61
|
+
offset: direction === 'row' ? [-9, 0] : [0, -7],
|
|
84
62
|
stick: true
|
|
85
|
-
},
|
|
86
|
-
api: api,
|
|
87
|
-
userIntent: "tableDragMenuPopupOpen"
|
|
88
|
-
}, /*#__PURE__*/React.createElement(TableMenu, {
|
|
89
|
-
api: api,
|
|
90
|
-
editorView: editorView,
|
|
91
|
-
surface: dragMenuDirection === 'row' ? ROW_MENU : COLUMN_MENU
|
|
92
|
-
})) : /*#__PURE__*/React.createElement(DragMenu, {
|
|
63
|
+
}, /*#__PURE__*/React.createElement(DragMenu, {
|
|
93
64
|
editorView: editorView,
|
|
94
|
-
isOpen:
|
|
65
|
+
isOpen: isOpen,
|
|
95
66
|
tableNode: tableNode,
|
|
96
|
-
direction:
|
|
97
|
-
index:
|
|
67
|
+
direction: direction,
|
|
68
|
+
index: index,
|
|
98
69
|
target: targetHandleRef || undefined,
|
|
99
70
|
targetCellPosition: targetCellPosition,
|
|
100
71
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import React, { useCallback, useContext, useMemo, useRef } from 'react';
|
|
2
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { Popup } from '@atlaskit/editor-common/ui';
|
|
4
|
+
import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
5
|
+
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
6
|
+
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
7
|
+
import { ToolbarKeyboardNavigationProvider } from '@atlaskit/editor-toolbar/toolbar-keyboard-navigation-provider';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { closeActiveTableMenu } from '../../pm-plugins/commands';
|
|
10
|
+
import { TableCssClassName as ClassName } from '../../types';
|
|
11
|
+
import { dragTableInsertColumnButtonSize, tablePopupMenuFitHeight } from '../consts';
|
|
12
|
+
import { COLUMN_MENU } from '../TableMenu/column/keys';
|
|
13
|
+
import { ROW_MENU } from '../TableMenu/row/keys';
|
|
14
|
+
import { TABLE_MENU_WIDTH } from '../TableMenu/shared/consts';
|
|
15
|
+
import { TableMenu } from '../TableMenu/shared/TableMenu';
|
|
16
|
+
const PopupWithListeners = withReactEditorViewOuterListeners(Popup);
|
|
17
|
+
|
|
18
|
+
// Defer drag-handle clicks to the drag handle's own toggle/select handlers — those own
|
|
19
|
+
// the open/switch/close semantics for moving between rows/columns.
|
|
20
|
+
const DRAG_HANDLE_CONTROLS_SELECTOR = `.${ClassName.DRAG_ROW_CONTROLS}, .${ClassName.DRAG_COLUMN_CONTROLS}`;
|
|
21
|
+
const NESTED_DROPDOWN_SELECTOR = '[data-toolbar-nested-dropdown-menu]';
|
|
22
|
+
|
|
23
|
+
// Marks the menu subtree that ToolbarKeyboardNavigationProvider scopes its
|
|
24
|
+
// keyboard handling to. The provider only reacts to events whose target sits
|
|
25
|
+
// inside this selector.
|
|
26
|
+
const TABLE_MENU_NAV_SELECTOR = '[data-table-drag-menu-nav="true"]';
|
|
27
|
+
const TABLE_MENU_OFFSET = dragTableInsertColumnButtonSize + 4;
|
|
28
|
+
const POPUP_OFFSET = [TABLE_MENU_OFFSET, 0];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Row and column menu for table.
|
|
32
|
+
*/
|
|
33
|
+
const FloatingTableMenu = ({
|
|
34
|
+
api,
|
|
35
|
+
boundariesElement,
|
|
36
|
+
editorView,
|
|
37
|
+
mountPoint,
|
|
38
|
+
scrollableElement,
|
|
39
|
+
stickyHeaders,
|
|
40
|
+
tableWrapper,
|
|
41
|
+
targetCellPosition
|
|
42
|
+
}) => {
|
|
43
|
+
const {
|
|
44
|
+
activeTableMenu
|
|
45
|
+
} = useSharedPluginStateWithSelector(api, ['table'], states => {
|
|
46
|
+
var _states$tableState;
|
|
47
|
+
return {
|
|
48
|
+
activeTableMenu: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.activeTableMenu
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
const isDragMenuOpen = (activeTableMenu === null || activeTableMenu === void 0 ? void 0 : activeTableMenu.type) === 'row' || (activeTableMenu === null || activeTableMenu === void 0 ? void 0 : activeTableMenu.type) === 'column';
|
|
52
|
+
const dragMenuDirection = isDragMenuOpen ? activeTableMenu.type : undefined;
|
|
53
|
+
const isOpenedByKeyboard = isDragMenuOpen && activeTableMenu.openedBy === 'keyboard';
|
|
54
|
+
const popupContentRef = useRef(null);
|
|
55
|
+
const setOutsideClickTargetRef = useContext(OutsideClickTargetRefContext);
|
|
56
|
+
const navWrapperRef = useRef(null);
|
|
57
|
+
const handlePopupRef = useCallback(el => {
|
|
58
|
+
popupContentRef.current = el;
|
|
59
|
+
setOutsideClickTargetRef === null || setOutsideClickTargetRef === void 0 ? void 0 : setOutsideClickTargetRef(el);
|
|
60
|
+
}, [setOutsideClickTargetRef]);
|
|
61
|
+
const dismiss = useCallback(() => {
|
|
62
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu(api));
|
|
63
|
+
}, [api]);
|
|
64
|
+
const returnFocusToDragHandle = useCallback(() => {
|
|
65
|
+
// Match legacy DragMenu's closeMenu('handle') behaviour.
|
|
66
|
+
const handleId = dragMenuDirection === 'row' ? '#drag-handle-button-row' : '#drag-handle-button-column';
|
|
67
|
+
const handle = document.querySelector(handleId);
|
|
68
|
+
handle === null || handle === void 0 ? void 0 : handle.focus();
|
|
69
|
+
}, [dragMenuDirection]);
|
|
70
|
+
const focusFirstMenuItem = useCallback(() => {
|
|
71
|
+
const root = navWrapperRef.current;
|
|
72
|
+
if (!root) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const firstItem = root.querySelector('[role="menuitem"]:not([disabled]), [role="menuitemcheckbox"]:not([disabled]), [role="menuitemradio"]:not([disabled]), button:not([disabled])');
|
|
76
|
+
firstItem === null || firstItem === void 0 ? void 0 : firstItem.focus();
|
|
77
|
+
}, []);
|
|
78
|
+
|
|
79
|
+
// Focus the first menu item when the menu opens via keyboard (Enter/Space on
|
|
80
|
+
// the drag handle). Mouse-opened menus leave focus where the user clicked.
|
|
81
|
+
const setNavWrapperRef = useCallback(el => {
|
|
82
|
+
navWrapperRef.current = el;
|
|
83
|
+
if (el && isOpenedByKeyboard) {
|
|
84
|
+
// rAF allows the popup to finish positioning before focusing.
|
|
85
|
+
requestAnimationFrame(() => {
|
|
86
|
+
focusFirstMenuItem();
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}, [focusFirstMenuItem, isOpenedByKeyboard]);
|
|
90
|
+
const handleKeyboardFocus = useCallback(_event => {
|
|
91
|
+
focusFirstMenuItem();
|
|
92
|
+
}, [focusFirstMenuItem]);
|
|
93
|
+
const handleEscape = useCallback(event => {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
event.stopPropagation();
|
|
96
|
+
dismiss();
|
|
97
|
+
returnFocusToDragHandle();
|
|
98
|
+
}, [dismiss, returnFocusToDragHandle]);
|
|
99
|
+
|
|
100
|
+
// Memoize the editor DOM reference so the provider doesn't re-bind listeners
|
|
101
|
+
// on every render (the provider depends on `dom` in its effect's deps).
|
|
102
|
+
const editorDom = useMemo(() => editorView.dom instanceof HTMLElement ? editorView.dom : undefined, [editorView.dom]);
|
|
103
|
+
|
|
104
|
+
// The drag menu is opened by interacting with the drag handle directly, not
|
|
105
|
+
// by a global page-level shortcut.
|
|
106
|
+
const isShortcutToFocusToolbar = useCallback(() => false, []);
|
|
107
|
+
const handleClickOutside = useCallback(event => {
|
|
108
|
+
var _popupContentRef$curr;
|
|
109
|
+
const target = event.target;
|
|
110
|
+
// Ignore clicks handled by this popup, drag handles, or nested portalled
|
|
111
|
+
// dropdowns so those controls can manage their own open/close behavior.
|
|
112
|
+
if (target instanceof Node && (_popupContentRef$curr = popupContentRef.current) !== null && _popupContentRef$curr !== void 0 && _popupContentRef$curr.contains(target) || target instanceof Element && (target.closest(DRAG_HANDLE_CONTROLS_SELECTOR) || target.closest(NESTED_DROPDOWN_SELECTOR))) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
dismiss();
|
|
116
|
+
}, [dismiss]);
|
|
117
|
+
if (!isDragMenuOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
const inStickyMode = (stickyHeaders === null || stickyHeaders === void 0 ? void 0 : stickyHeaders.sticky) || (tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.classList.contains(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW)) && fg('platform_editor_table_sticky_header_patch_7');
|
|
121
|
+
const targetHandleRef = dragMenuDirection === 'row' ? document.querySelector('#drag-handle-button-row') : document.querySelector('#drag-handle-button-column');
|
|
122
|
+
if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
return /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
126
|
+
alignX: dragMenuDirection === 'row' ? 'right' : undefined,
|
|
127
|
+
alignY: dragMenuDirection === 'row' ? 'start' : undefined
|
|
128
|
+
// Ignored via go/ees005
|
|
129
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
130
|
+
,
|
|
131
|
+
target: targetHandleRef,
|
|
132
|
+
mountTo: mountPoint,
|
|
133
|
+
boundariesElement: boundariesElement,
|
|
134
|
+
scrollableElement: scrollableElement,
|
|
135
|
+
fitWidth: TABLE_MENU_WIDTH,
|
|
136
|
+
fitHeight: tablePopupMenuFitHeight
|
|
137
|
+
// z-index value below is to ensure that this menu is above other floating menu
|
|
138
|
+
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
139
|
+
// In sticky mode, we want to show the menu above the sticky header
|
|
140
|
+
,
|
|
141
|
+
zIndex: inStickyMode ? akEditorFloatingDialogZIndex : akEditorFloatingOverlapPanelZIndex,
|
|
142
|
+
forcePlacement: true,
|
|
143
|
+
preventOverflow: dragMenuDirection === 'row',
|
|
144
|
+
offset: POPUP_OFFSET,
|
|
145
|
+
stick: true,
|
|
146
|
+
handleClickOutside: handleClickOutside
|
|
147
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
148
|
+
ref: handlePopupRef
|
|
149
|
+
}, /*#__PURE__*/React.createElement(ToolbarKeyboardNavigationProvider, {
|
|
150
|
+
childComponentSelector: TABLE_MENU_NAV_SELECTOR,
|
|
151
|
+
dom: editorDom,
|
|
152
|
+
isShortcutToFocusToolbar: isShortcutToFocusToolbar,
|
|
153
|
+
handleFocus: handleKeyboardFocus,
|
|
154
|
+
handleEscape: handleEscape
|
|
155
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
156
|
+
"data-table-drag-menu-nav": "true",
|
|
157
|
+
ref: setNavWrapperRef
|
|
158
|
+
}, /*#__PURE__*/React.createElement(TableMenu, {
|
|
159
|
+
api: api,
|
|
160
|
+
editorView: editorView,
|
|
161
|
+
surface: dragMenuDirection === 'row' ? ROW_MENU : COLUMN_MENU
|
|
162
|
+
})))));
|
|
163
|
+
};
|
|
164
|
+
FloatingTableMenu.displayName = 'FloatingTableMenu';
|
|
165
|
+
export default FloatingTableMenu;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useMemo, useRef } from 'react';
|
|
4
|
+
import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
4
5
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
6
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
6
7
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
7
8
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
8
9
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
10
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
|
-
import { clearHoverSelection, hoverCell, hoverColumns, selectColumn, selectColumns } from '../../../pm-plugins/commands';
|
|
11
|
-
import { toggleActiveTableMenuWithAnalytics } from '../../../pm-plugins/commands/commands-with-analytics';
|
|
11
|
+
import { clearHoverSelection, closeActiveTableMenu, hoverCell, hoverColumns, selectColumn, selectColumns, toggleActiveTableMenu } from '../../../pm-plugins/commands';
|
|
12
12
|
import { toggleDragMenuWithAnalytics } from '../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
13
|
+
import { getPluginState as getTablePluginState } from '../../../pm-plugins/plugin-factory';
|
|
13
14
|
import { getRowsParams } from '../../../pm-plugins/utils/row-controls';
|
|
14
15
|
import { getSelectedColumnIndexes } from '../../../pm-plugins/utils/selection';
|
|
15
16
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
@@ -41,7 +42,7 @@ export const ColumnControls = ({
|
|
|
41
42
|
getScrollOffset,
|
|
42
43
|
api
|
|
43
44
|
}) => {
|
|
44
|
-
var _colWidths$map$join
|
|
45
|
+
var _colWidths$map$join;
|
|
45
46
|
const columnControlsRef = useRef(null);
|
|
46
47
|
const {
|
|
47
48
|
selection
|
|
@@ -131,17 +132,50 @@ export const ColumnControls = ({
|
|
|
131
132
|
dispatch
|
|
132
133
|
} = editorView;
|
|
133
134
|
if (event !== null && event !== void 0 && event.shiftKey) {
|
|
135
|
+
// Shift-click extends the selection rather than toggling the menu, but the
|
|
136
|
+
// open drag menu would otherwise stay anchored to a stale column. Close it here
|
|
137
|
+
// for the updated menu (legacy menu closes via outside-click on its dropdown).
|
|
138
|
+
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
139
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu(api));
|
|
140
|
+
}
|
|
134
141
|
return;
|
|
135
142
|
}
|
|
136
143
|
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
137
|
-
if (colIndex !== undefined) {
|
|
138
|
-
|
|
139
|
-
|
|
144
|
+
if (colIndex !== undefined && api) {
|
|
145
|
+
const {
|
|
146
|
+
activeTableMenu: currentActiveTableMenu
|
|
147
|
+
} = getTablePluginState(state);
|
|
148
|
+
const isSameActiveMenu = (currentActiveTableMenu === null || currentActiveTableMenu === void 0 ? void 0 : currentActiveTableMenu.type) === 'column' && currentActiveTableMenu.index === colIndex;
|
|
149
|
+
api.core.actions.execute(({
|
|
150
|
+
tr
|
|
151
|
+
}) => {
|
|
152
|
+
if (!isSameActiveMenu) {
|
|
153
|
+
var _api$analytics, _api$analytics$action;
|
|
154
|
+
(_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : _api$analytics$action.attachAnalyticsEvent({
|
|
155
|
+
action: TABLE_ACTION.DRAG_MENU_OPENED,
|
|
156
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
157
|
+
actionSubjectId: null,
|
|
158
|
+
eventType: EVENT_TYPE.TRACK,
|
|
159
|
+
attributes: {
|
|
160
|
+
inputMethod: trigger === 'keyboard' ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE,
|
|
161
|
+
direction: 'column'
|
|
162
|
+
}
|
|
163
|
+
})(tr);
|
|
164
|
+
}
|
|
165
|
+
toggleActiveTableMenu({
|
|
166
|
+
type: 'column',
|
|
167
|
+
index: colIndex,
|
|
168
|
+
openedBy: trigger
|
|
169
|
+
}, currentActiveTableMenu, api)({
|
|
170
|
+
tr
|
|
171
|
+
});
|
|
172
|
+
return tr;
|
|
173
|
+
});
|
|
140
174
|
}
|
|
141
175
|
return;
|
|
142
176
|
}
|
|
143
177
|
toggleDragMenuWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(undefined, 'column', colIndex, trigger)(state, dispatch);
|
|
144
|
-
}, [editorView, colIndex, api
|
|
178
|
+
}, [editorView, colIndex, api]);
|
|
145
179
|
const colIndexes = useMemo(() => {
|
|
146
180
|
// Ignored via go/ees005
|
|
147
181
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
2
2
|
|
|
3
3
|
import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
4
5
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
6
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
6
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
7
8
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
8
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
|
-
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
10
|
-
import { toggleActiveTableMenuWithAnalytics } from '../../../pm-plugins/commands/commands-with-analytics';
|
|
10
|
+
import { clearHoverSelection, closeActiveTableMenu, toggleActiveTableMenu } from '../../../pm-plugins/commands';
|
|
11
11
|
import { toggleDragMenuWithAnalytics } from '../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
12
12
|
import { getPluginState as getTablePluginState } from '../../../pm-plugins/plugin-factory';
|
|
13
13
|
import { getRowHeights, getRowsParams } from '../../../pm-plugins/utils/row-controls';
|
|
@@ -43,7 +43,7 @@ export const DragControls = ({
|
|
|
43
43
|
api,
|
|
44
44
|
selection
|
|
45
45
|
}) => {
|
|
46
|
-
var _tableNode$attrs$loca, _tableNode$attrs
|
|
46
|
+
var _tableNode$attrs$loca, _tableNode$attrs;
|
|
47
47
|
const [isDragging, setIsDragging] = useState(false);
|
|
48
48
|
const rowHeights = getRowHeights(tableRef);
|
|
49
49
|
const rowsParams = getRowsParams(rowHeights);
|
|
@@ -81,18 +81,51 @@ export const DragControls = ({
|
|
|
81
81
|
const toggleDragMenuHandler = useCallback((trigger, event) => {
|
|
82
82
|
var _api$analytics2;
|
|
83
83
|
if (event !== null && event !== void 0 && event.shiftKey) {
|
|
84
|
+
// Shift-click extends the selection rather than toggling the menu, but the
|
|
85
|
+
// open drag menu would otherwise stay anchored to a stale row. Close it here
|
|
86
|
+
// for the updated menu (legacy menu closes via outside-click on its dropdown).
|
|
87
|
+
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
88
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu(api));
|
|
89
|
+
}
|
|
84
90
|
return;
|
|
85
91
|
}
|
|
86
92
|
const rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
|
|
87
93
|
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
88
|
-
if (rowIndex !== undefined) {
|
|
89
|
-
|
|
90
|
-
|
|
94
|
+
if (rowIndex !== undefined && api) {
|
|
95
|
+
const {
|
|
96
|
+
activeTableMenu: currentActiveTableMenu
|
|
97
|
+
} = getTablePluginState(editorView.state);
|
|
98
|
+
const isSameActiveMenu = (currentActiveTableMenu === null || currentActiveTableMenu === void 0 ? void 0 : currentActiveTableMenu.type) === 'row' && currentActiveTableMenu.index === rowIndex;
|
|
99
|
+
api.core.actions.execute(({
|
|
100
|
+
tr
|
|
101
|
+
}) => {
|
|
102
|
+
if (!isSameActiveMenu) {
|
|
103
|
+
var _api$analytics, _api$analytics$action;
|
|
104
|
+
(_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : _api$analytics$action.attachAnalyticsEvent({
|
|
105
|
+
action: TABLE_ACTION.DRAG_MENU_OPENED,
|
|
106
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
107
|
+
actionSubjectId: null,
|
|
108
|
+
eventType: EVENT_TYPE.TRACK,
|
|
109
|
+
attributes: {
|
|
110
|
+
inputMethod: trigger === 'keyboard' ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE,
|
|
111
|
+
direction: 'row'
|
|
112
|
+
}
|
|
113
|
+
})(tr);
|
|
114
|
+
}
|
|
115
|
+
toggleActiveTableMenu({
|
|
116
|
+
type: 'row',
|
|
117
|
+
index: rowIndex,
|
|
118
|
+
openedBy: trigger
|
|
119
|
+
}, currentActiveTableMenu, api)({
|
|
120
|
+
tr
|
|
121
|
+
});
|
|
122
|
+
return tr;
|
|
123
|
+
});
|
|
91
124
|
}
|
|
92
125
|
return;
|
|
93
126
|
}
|
|
94
127
|
toggleDragMenuWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(undefined, 'row', rowIndex, trigger)(editorView.state, editorView.dispatch);
|
|
95
|
-
}, [editorView, hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex, api
|
|
128
|
+
}, [editorView, hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex, api]);
|
|
96
129
|
const rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
|
|
97
130
|
const handleMouseOut = useCallback(() => {
|
|
98
131
|
if (tableActive) {
|
|
@@ -27,7 +27,7 @@ export const MergeCellsItem = ({
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
mergeCellsWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.CONTEXT_MENU)(editorView.state, editorView.dispatch);
|
|
30
|
-
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
|
|
30
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu(api));
|
|
31
31
|
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
32
32
|
};
|
|
33
33
|
if (!shouldShowMergeCells(tableMenuContext)) {
|
|
@@ -27,7 +27,7 @@ export const SplitCellItem = ({
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
splitCellWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.CONTEXT_MENU)(editorView.state, editorView.dispatch);
|
|
30
|
-
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
|
|
30
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu(api));
|
|
31
31
|
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
32
32
|
};
|
|
33
33
|
if (!shouldShowSplitCell(tableMenuContext)) {
|
|
@@ -43,7 +43,7 @@ export const AddColumnLeftItem = ({
|
|
|
43
43
|
}
|
|
44
44
|
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
45
45
|
insertColumnWithAnalytics(api, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.TABLE_CONTEXT_MENU, index)(editorView.state, editorView.dispatch, editorView);
|
|
46
|
-
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
|
|
46
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu(api));
|
|
47
47
|
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
48
48
|
};
|
|
49
49
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -43,7 +43,7 @@ export const AddColumnRightItem = ({
|
|
|
43
43
|
}
|
|
44
44
|
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
45
45
|
insertColumnWithAnalytics(api, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.TABLE_CONTEXT_MENU, index)(editorView.state, editorView.dispatch, editorView);
|
|
46
|
-
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
|
|
46
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu(api));
|
|
47
47
|
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
48
48
|
};
|
|
49
49
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -61,7 +61,7 @@ export const DeleteColumnItem = ({
|
|
|
61
61
|
}
|
|
62
62
|
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
63
63
|
deleteColumnsWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect)(editorView.state, editorView.dispatch, editorView);
|
|
64
|
-
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
|
|
64
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu(api));
|
|
65
65
|
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
66
66
|
};
|
|
67
67
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -48,7 +48,7 @@ export const DistributeColumnsItem = ({
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
distributeColumnsWidthsWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)(INPUT_METHOD.TABLE_CONTEXT_MENU, newResizeState)(editorView.state, editorView.dispatch);
|
|
51
|
-
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
|
|
51
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu(api));
|
|
52
52
|
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
53
53
|
};
|
|
54
54
|
if (!shouldShowDistributeColumns(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount)) {
|
|
@@ -45,7 +45,7 @@ export const MoveColumnLeftItem = props => {
|
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
moveSourceWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api === null || api === void 0 ? void 0 : (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify, getPluginState(editorView.state).getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, TABLE_COLUMN, getSelectedColumnIndexes(selectionRect), selectionRect.left - 1)(editorView.state, editorView.dispatch);
|
|
48
|
-
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
|
|
48
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu(api));
|
|
49
49
|
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
50
50
|
};
|
|
51
51
|
if (!tableNode || !shouldShowMoveColumnLeft(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstColumn)) {
|
|
@@ -44,7 +44,7 @@ export const MoveColumnRightItem = props => {
|
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
moveSourceWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api === null || api === void 0 ? void 0 : (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify, getPluginState(editorView.state).getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, TABLE_COLUMN, getSelectedColumnIndexes(selectionRect), selectionRect.right)(editorView.state, editorView.dispatch);
|
|
47
|
-
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
|
|
47
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu(api));
|
|
48
48
|
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
49
49
|
};
|
|
50
50
|
if (!tableNode || !shouldShowMoveColumnRight(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastColumn)) {
|
|
@@ -29,7 +29,7 @@ export const SortDecreasingItem = ({
|
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
sortColumnWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, columnIndex, SortOrder.DESC)(editorView.state, editorView.dispatch);
|
|
32
|
-
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
|
|
32
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu(api));
|
|
33
33
|
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
34
34
|
};
|
|
35
35
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|