@atlaskit/editor-plugin-table 22.4.15 → 22.4.16
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 +9 -0
- package/dist/cjs/pm-plugins/commands/active-table-menu.js +51 -0
- package/dist/cjs/pm-plugins/commands/commands-with-analytics.js +42 -10
- package/dist/cjs/pm-plugins/commands/index.js +13 -0
- package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +2 -0
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +4 -0
- package/dist/cjs/pm-plugins/handlers.js +8 -1
- package/dist/cjs/pm-plugins/reducer.js +2 -0
- package/dist/cjs/tablePlugin.js +1 -0
- package/dist/cjs/ui/ContentComponent.js +1 -1
- package/dist/cjs/ui/FloatingContextualButton/index.js +28 -9
- package/dist/cjs/ui/FloatingContextualMenu/CellMenuPopup.js +58 -73
- package/dist/cjs/ui/FloatingContextualMenu/index.js +26 -12
- package/dist/cjs/ui/FloatingDragMenu/index.js +21 -8
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +13 -5
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +14 -5
- package/dist/cjs/ui/TableMenu/cell/getCellMenuComponents.js +8 -3
- package/dist/cjs/ui/TableMenu/cell/items/MergeCellsItem.js +16 -1
- package/dist/cjs/ui/TableMenu/cell/items/SplitCellItem.js +16 -1
- package/dist/cjs/ui/TableMenu/column/items/AddColumnLeftItem.js +4 -4
- package/dist/cjs/ui/TableMenu/column/items/AddColumnRightItem.js +4 -4
- package/dist/cjs/ui/TableMenu/column/items/DeleteColumnItem.js +2 -3
- package/dist/cjs/ui/TableMenu/column/items/DistributeColumnsItem.js +2 -3
- package/dist/cjs/ui/TableMenu/column/items/HeaderColumnToggleItem.js +2 -3
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnLeftItem.js +2 -3
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnRightItem.js +2 -3
- package/dist/cjs/ui/TableMenu/column/items/SortDecreasingItem.js +2 -3
- package/dist/cjs/ui/TableMenu/column/items/SortIncreasingItem.js +2 -3
- package/dist/cjs/ui/TableMenu/row/items/AddRowAboveItem.js +4 -4
- package/dist/cjs/ui/TableMenu/row/items/AddRowBelowItem.js +4 -4
- package/dist/cjs/ui/TableMenu/row/items/DeleteRowItem.js +2 -3
- package/dist/cjs/ui/TableMenu/row/items/HeaderRowToggleItem.js +2 -3
- package/dist/cjs/ui/TableMenu/row/items/MoveRowDownItem.js +2 -3
- package/dist/cjs/ui/TableMenu/row/items/MoveRowUpItem.js +2 -3
- package/dist/cjs/ui/TableMenu/row/items/NumberedRowsToggleItem.js +4 -3
- package/dist/cjs/ui/TableMenu/shared/TableMenu.compiled.css +0 -2
- package/dist/cjs/ui/TableMenu/shared/TableMenu.js +8 -9
- package/dist/cjs/ui/TableMenu/shared/getSharedItems.js +3 -1
- package/dist/cjs/ui/TableMenu/shared/getTableMenuComponents.js +1 -1
- package/dist/cjs/ui/TableMenu/shared/items/BackgroundColorItem.js +30 -4
- package/dist/cjs/ui/TableMenu/shared/items/ClearCellsItem.js +4 -3
- package/dist/es2019/pm-plugins/commands/active-table-menu.js +39 -0
- package/dist/es2019/pm-plugins/commands/commands-with-analytics.js +31 -2
- package/dist/es2019/pm-plugins/commands/index.js +1 -0
- package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +2 -0
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +4 -0
- package/dist/es2019/pm-plugins/handlers.js +8 -1
- package/dist/es2019/pm-plugins/reducer.js +5 -0
- package/dist/es2019/tablePlugin.js +1 -0
- package/dist/es2019/ui/ContentComponent.js +1 -1
- package/dist/es2019/ui/FloatingContextualButton/index.js +29 -9
- package/dist/es2019/ui/FloatingContextualMenu/CellMenuPopup.js +60 -77
- package/dist/es2019/ui/FloatingContextualMenu/index.js +27 -12
- package/dist/es2019/ui/FloatingDragMenu/index.js +22 -8
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +12 -4
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +13 -4
- package/dist/es2019/ui/TableMenu/cell/getCellMenuComponents.js +9 -3
- package/dist/es2019/ui/TableMenu/cell/items/MergeCellsItem.js +18 -2
- package/dist/es2019/ui/TableMenu/cell/items/SplitCellItem.js +18 -2
- package/dist/es2019/ui/TableMenu/column/items/AddColumnLeftItem.js +3 -3
- package/dist/es2019/ui/TableMenu/column/items/AddColumnRightItem.js +3 -3
- package/dist/es2019/ui/TableMenu/column/items/DeleteColumnItem.js +2 -3
- package/dist/es2019/ui/TableMenu/column/items/DistributeColumnsItem.js +2 -3
- package/dist/es2019/ui/TableMenu/column/items/HeaderColumnToggleItem.js +2 -3
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnLeftItem.js +2 -3
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnRightItem.js +2 -3
- package/dist/es2019/ui/TableMenu/column/items/SortDecreasingItem.js +2 -3
- package/dist/es2019/ui/TableMenu/column/items/SortIncreasingItem.js +2 -3
- package/dist/es2019/ui/TableMenu/row/items/AddRowAboveItem.js +3 -3
- package/dist/es2019/ui/TableMenu/row/items/AddRowBelowItem.js +3 -3
- package/dist/es2019/ui/TableMenu/row/items/DeleteRowItem.js +2 -3
- package/dist/es2019/ui/TableMenu/row/items/HeaderRowToggleItem.js +2 -3
- package/dist/es2019/ui/TableMenu/row/items/MoveRowDownItem.js +2 -3
- package/dist/es2019/ui/TableMenu/row/items/MoveRowUpItem.js +2 -3
- package/dist/es2019/ui/TableMenu/row/items/NumberedRowsToggleItem.js +3 -2
- package/dist/es2019/ui/TableMenu/shared/TableMenu.compiled.css +0 -2
- package/dist/es2019/ui/TableMenu/shared/TableMenu.js +8 -9
- package/dist/es2019/ui/TableMenu/shared/getSharedItems.js +3 -1
- package/dist/es2019/ui/TableMenu/shared/getTableMenuComponents.js +1 -1
- package/dist/es2019/ui/TableMenu/shared/items/BackgroundColorItem.js +33 -4
- package/dist/es2019/ui/TableMenu/shared/items/ClearCellsItem.js +4 -3
- package/dist/esm/pm-plugins/commands/active-table-menu.js +45 -0
- package/dist/esm/pm-plugins/commands/commands-with-analytics.js +41 -10
- package/dist/esm/pm-plugins/commands/index.js +1 -0
- package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +2 -0
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +4 -0
- package/dist/esm/pm-plugins/handlers.js +8 -1
- package/dist/esm/pm-plugins/reducer.js +2 -0
- package/dist/esm/tablePlugin.js +1 -0
- package/dist/esm/ui/ContentComponent.js +1 -1
- package/dist/esm/ui/FloatingContextualButton/index.js +29 -10
- package/dist/esm/ui/FloatingContextualMenu/CellMenuPopup.js +60 -75
- package/dist/esm/ui/FloatingContextualMenu/index.js +26 -12
- package/dist/esm/ui/FloatingDragMenu/index.js +21 -8
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +12 -4
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +13 -4
- package/dist/esm/ui/TableMenu/cell/getCellMenuComponents.js +8 -3
- package/dist/esm/ui/TableMenu/cell/items/MergeCellsItem.js +16 -2
- package/dist/esm/ui/TableMenu/cell/items/SplitCellItem.js +16 -2
- package/dist/esm/ui/TableMenu/column/items/AddColumnLeftItem.js +4 -4
- package/dist/esm/ui/TableMenu/column/items/AddColumnRightItem.js +4 -4
- package/dist/esm/ui/TableMenu/column/items/DeleteColumnItem.js +2 -3
- package/dist/esm/ui/TableMenu/column/items/DistributeColumnsItem.js +2 -3
- package/dist/esm/ui/TableMenu/column/items/HeaderColumnToggleItem.js +2 -3
- package/dist/esm/ui/TableMenu/column/items/MoveColumnLeftItem.js +2 -3
- package/dist/esm/ui/TableMenu/column/items/MoveColumnRightItem.js +2 -3
- package/dist/esm/ui/TableMenu/column/items/SortDecreasingItem.js +2 -3
- package/dist/esm/ui/TableMenu/column/items/SortIncreasingItem.js +2 -3
- package/dist/esm/ui/TableMenu/row/items/AddRowAboveItem.js +4 -4
- package/dist/esm/ui/TableMenu/row/items/AddRowBelowItem.js +4 -4
- package/dist/esm/ui/TableMenu/row/items/DeleteRowItem.js +2 -3
- package/dist/esm/ui/TableMenu/row/items/HeaderRowToggleItem.js +2 -3
- package/dist/esm/ui/TableMenu/row/items/MoveRowDownItem.js +2 -3
- package/dist/esm/ui/TableMenu/row/items/MoveRowUpItem.js +2 -3
- package/dist/esm/ui/TableMenu/row/items/NumberedRowsToggleItem.js +4 -3
- package/dist/esm/ui/TableMenu/shared/TableMenu.compiled.css +0 -2
- package/dist/esm/ui/TableMenu/shared/TableMenu.js +8 -9
- package/dist/esm/ui/TableMenu/shared/getSharedItems.js +3 -1
- package/dist/esm/ui/TableMenu/shared/getTableMenuComponents.js +1 -1
- package/dist/esm/ui/TableMenu/shared/items/BackgroundColorItem.js +30 -4
- package/dist/esm/ui/TableMenu/shared/items/ClearCellsItem.js +4 -3
- package/dist/types/entry-points/types.d.ts +1 -1
- package/dist/types/pm-plugins/commands/active-table-menu.d.ts +6 -0
- package/dist/types/pm-plugins/commands/commands-with-analytics.d.ts +3 -1
- package/dist/types/pm-plugins/commands/index.d.ts +1 -0
- package/dist/types/types/index.d.ts +21 -1
- package/dist/types/ui/FloatingContextualButton/index.d.ts +2 -0
- package/dist/types/ui/FloatingContextualMenu/CellMenuPopup.d.ts +7 -5
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +0 -1
- package/dist/types/ui/TableMenu/cell/getCellMenuComponents.d.ts +2 -1
- package/dist/types/ui/TableMenu/cell/items/MergeCellsItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/cell/items/SplitCellItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/column/items/DistributeColumnsItem.d.ts +1 -1
- package/dist/types/ui/TableMenu/shared/TableMenuContext.d.ts +2 -0
- package/dist/types/ui/TableMenu/shared/items/BackgroundColorItem.d.ts +2 -1
- package/dist/types-ts4.5/entry-points/types.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/commands/active-table-menu.d.ts +6 -0
- package/dist/types-ts4.5/pm-plugins/commands/commands-with-analytics.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/commands/index.d.ts +1 -0
- package/dist/types-ts4.5/types/index.d.ts +21 -1
- package/dist/types-ts4.5/ui/FloatingContextualButton/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/FloatingContextualMenu/CellMenuPopup.d.ts +7 -5
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/TableMenu/cell/getCellMenuComponents.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/cell/items/MergeCellsItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/cell/items/SplitCellItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/column/items/DistributeColumnsItem.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableMenu/shared/TableMenuContext.d.ts +2 -0
- package/dist/types-ts4.5/ui/TableMenu/shared/items/BackgroundColorItem.d.ts +2 -1
- package/package.json +2 -2
|
@@ -1,96 +1,81 @@
|
|
|
1
|
-
import React, { useCallback,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import React, { useCallback, useContext, useRef } from 'react';
|
|
2
|
+
import { Popup } from '@atlaskit/editor-common/ui';
|
|
3
|
+
import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
4
4
|
import { UserIntentPopupWrapper } from '@atlaskit/editor-common/user-intent';
|
|
5
|
-
import {
|
|
5
|
+
import { closeActiveTableMenu, setFocusToCellMenu } from '../../pm-plugins/commands';
|
|
6
|
+
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
6
7
|
import { TableCssClassName as ClassName } from '../../types';
|
|
8
|
+
import { tablePopupMenuFitHeight } from '../consts';
|
|
7
9
|
import { CELL_MENU } from '../TableMenu/cell/keys';
|
|
10
|
+
import { TABLE_MENU_WIDTH } from '../TableMenu/shared/consts';
|
|
8
11
|
import { TableMenu } from '../TableMenu/shared/TableMenu';
|
|
12
|
+
var PopupWithListeners = withReactEditorViewOuterListeners(Popup);
|
|
13
|
+
var NESTED_DROPDOWN_SELECTOR = '[data-toolbar-nested-dropdown-menu]';
|
|
14
|
+
var CELL_MENU_TRIGGER_SELECTOR = ".".concat(ClassName.CONTEXTUAL_MENU_BUTTON);
|
|
9
15
|
export var CellMenuPopup = function CellMenuPopup(_ref) {
|
|
10
16
|
var api = _ref.api,
|
|
17
|
+
boundariesElement = _ref.boundariesElement,
|
|
11
18
|
editorView = _ref.editorView,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
targetCellRef = _ref.targetCellRef
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
currentUserIntent = _useSharedPluginState.currentUserIntent;
|
|
19
|
+
mountPoint = _ref.mountPoint,
|
|
20
|
+
scrollableElement = _ref.scrollableElement,
|
|
21
|
+
targetCellRef = _ref.targetCellRef,
|
|
22
|
+
zIndex = _ref.zIndex;
|
|
23
|
+
var popupContentRef = useRef(null);
|
|
24
|
+
var setOutsideClickTargetRef = useContext(OutsideClickTargetRefContext);
|
|
25
|
+
var handlePopupRef = useCallback(function (el) {
|
|
26
|
+
popupContentRef.current = el;
|
|
27
|
+
setOutsideClickTargetRef === null || setOutsideClickTargetRef === void 0 || setOutsideClickTargetRef(el);
|
|
28
|
+
}, [setOutsideClickTargetRef]);
|
|
23
29
|
var closeCellMenu = useCallback(function () {
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
toggleContextualMenu()(state, dispatch);
|
|
30
|
+
var _getPluginState = getPluginState(editorView.state),
|
|
31
|
+
isCellMenuOpenByKeyboard = _getPluginState.isCellMenuOpenByKeyboard;
|
|
32
|
+
closeActiveTableMenu()(editorView.state, editorView.dispatch);
|
|
28
33
|
if (isCellMenuOpenByKeyboard) {
|
|
29
|
-
setFocusToCellMenu(false)(state, dispatch);
|
|
30
|
-
dom.focus();
|
|
34
|
+
setFocusToCellMenu(false)(editorView.state, editorView.dispatch);
|
|
31
35
|
}
|
|
32
|
-
}, [editorView
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
}, [editorView]);
|
|
37
|
+
var isEventInsideCellMenu = useCallback(function (event) {
|
|
38
|
+
var _popupContentRef$curr;
|
|
39
|
+
var target = event.target;
|
|
40
|
+
if (!(target instanceof Node)) {
|
|
41
|
+
return false;
|
|
36
42
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
useEffect(function () {
|
|
40
|
-
if (!isOpen) {
|
|
41
|
-
return;
|
|
43
|
+
if ((_popupContentRef$curr = popupContentRef.current) !== null && _popupContentRef$curr !== void 0 && _popupContentRef$curr.contains(target)) {
|
|
44
|
+
return true;
|
|
42
45
|
}
|
|
43
|
-
|
|
46
|
+
return target instanceof Element && Boolean(target.closest(NESTED_DROPDOWN_SELECTOR) || target.closest(CELL_MENU_TRIGGER_SELECTOR));
|
|
47
|
+
}, []);
|
|
48
|
+
var handleCellMenuClickOutside = useCallback(function (event) {
|
|
49
|
+
if (isEventInsideCellMenu(event)) {
|
|
44
50
|
return;
|
|
45
51
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
type: 'pointerdown',
|
|
69
|
-
listener: handlePointerDown,
|
|
70
|
-
options: {
|
|
71
|
-
capture: true
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
var unbindKeyDown = bind(ownerDocument, {
|
|
75
|
-
type: 'keydown',
|
|
76
|
-
listener: handleKeyDown,
|
|
77
|
-
options: {
|
|
78
|
-
capture: true
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
return function () {
|
|
82
|
-
unbindPointerDown();
|
|
83
|
-
unbindKeyDown();
|
|
84
|
-
};
|
|
85
|
-
}, [closeCellMenu, isOpen, targetCellRef]);
|
|
86
|
-
return /*#__PURE__*/React.createElement(UserIntentPopupWrapper, {
|
|
52
|
+
closeCellMenu();
|
|
53
|
+
}, [closeCellMenu, isEventInsideCellMenu]);
|
|
54
|
+
return /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
55
|
+
alignX: "right",
|
|
56
|
+
alignY: "top",
|
|
57
|
+
target: targetCellRef,
|
|
58
|
+
mountTo: mountPoint,
|
|
59
|
+
boundariesElement: boundariesElement,
|
|
60
|
+
scrollableElement: scrollableElement,
|
|
61
|
+
fitHeight: tablePopupMenuFitHeight,
|
|
62
|
+
fitWidth: TABLE_MENU_WIDTH,
|
|
63
|
+
zIndex: zIndex,
|
|
64
|
+
forcePlacement: true
|
|
65
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
66
|
+
,
|
|
67
|
+
offset: [-7, 0],
|
|
68
|
+
stick: true,
|
|
69
|
+
handleClickOutside: handleCellMenuClickOutside,
|
|
70
|
+
handleEscapeKeydown: closeCellMenu
|
|
71
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
ref: handlePopupRef
|
|
73
|
+
}, /*#__PURE__*/React.createElement(UserIntentPopupWrapper, {
|
|
87
74
|
api: api,
|
|
88
75
|
userIntent: "tableContextualMenuPopupOpen"
|
|
89
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
90
|
-
ref: tableMenuRef
|
|
91
76
|
}, /*#__PURE__*/React.createElement(TableMenu, {
|
|
92
77
|
api: api,
|
|
93
78
|
editorView: editorView,
|
|
94
79
|
surface: CELL_MENU
|
|
95
|
-
})));
|
|
80
|
+
}))));
|
|
96
81
|
};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
7
8
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
8
9
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
9
10
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -11,7 +12,6 @@ import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@at
|
|
|
11
12
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
13
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
13
14
|
import { contextualMenuDropdownWidthDnD, contextualMenuTriggerSize, tablePopupMenuFitHeight } from '../consts';
|
|
14
|
-
import { TABLE_MENU_WIDTH } from '../TableMenu/shared/consts';
|
|
15
15
|
import { CellMenuPopup } from './CellMenuPopup';
|
|
16
16
|
// Ignored via go/ees005
|
|
17
17
|
// eslint-disable-next-line import/no-named-as-default
|
|
@@ -31,6 +31,14 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
31
31
|
isCommentEditor = _ref.isCommentEditor,
|
|
32
32
|
api = _ref.api,
|
|
33
33
|
isDragMenuOpen = _ref.isDragMenuOpen;
|
|
34
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['table'], function (states) {
|
|
35
|
+
var _states$tableState;
|
|
36
|
+
return {
|
|
37
|
+
activeTableMenu: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.activeTableMenu
|
|
38
|
+
};
|
|
39
|
+
}),
|
|
40
|
+
activeTableMenu = _useSharedPluginState.activeTableMenu;
|
|
41
|
+
var isCellMenuOpen = expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) ? (activeTableMenu === null || activeTableMenu === void 0 ? void 0 : activeTableMenu.type) === 'cell' : isOpen;
|
|
34
42
|
if (!editorView) {
|
|
35
43
|
return null;
|
|
36
44
|
}
|
|
@@ -38,7 +46,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
38
46
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
39
47
|
var _getPluginState = getPluginState(editorView.state),
|
|
40
48
|
targetCellPosition = _getPluginState.targetCellPosition;
|
|
41
|
-
if (!
|
|
49
|
+
if (!isCellMenuOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
42
50
|
return null;
|
|
43
51
|
}
|
|
44
52
|
var selection = editorView.state.selection;
|
|
@@ -55,6 +63,20 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
55
63
|
return null;
|
|
56
64
|
}
|
|
57
65
|
var parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
|
|
66
|
+
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
67
|
+
return jsx(CellMenuPopup, {
|
|
68
|
+
api: api,
|
|
69
|
+
boundariesElement: boundariesElement,
|
|
70
|
+
editorView: editorView,
|
|
71
|
+
mountPoint: mountPoint,
|
|
72
|
+
scrollableElement: scrollableElement
|
|
73
|
+
// Ignored via go/ees005
|
|
74
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
75
|
+
,
|
|
76
|
+
targetCellRef: targetCellRef,
|
|
77
|
+
zIndex: parentSticky ? akEditorFloatingDialogZIndex : akEditorFloatingOverlapPanelZIndex
|
|
78
|
+
});
|
|
79
|
+
}
|
|
58
80
|
return jsx(Popup, {
|
|
59
81
|
alignX: "right",
|
|
60
82
|
alignY: "top"
|
|
@@ -66,7 +88,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
66
88
|
boundariesElement: boundariesElement,
|
|
67
89
|
scrollableElement: scrollableElement,
|
|
68
90
|
fitHeight: tablePopupMenuFitHeight,
|
|
69
|
-
fitWidth:
|
|
91
|
+
fitWidth: contextualMenuDropdownWidthDnD
|
|
70
92
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
71
93
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
72
94
|
,
|
|
@@ -76,15 +98,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
76
98
|
,
|
|
77
99
|
offset: [-7, 0],
|
|
78
100
|
stick: true
|
|
79
|
-
},
|
|
80
|
-
api: api,
|
|
81
|
-
editorView: editorView,
|
|
82
|
-
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
|
|
83
|
-
isOpen: isOpen,
|
|
84
|
-
targetCellRef: targetCellRef
|
|
85
|
-
}) :
|
|
86
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
87
|
-
jsx("div", {
|
|
101
|
+
}, jsx("div", {
|
|
88
102
|
css: tablePopupStyles()
|
|
89
103
|
}, jsx(ContextualMenu, {
|
|
90
104
|
editorView: editorView
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
2
3
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
3
4
|
import { UserIntentPopupWrapper } from '@atlaskit/editor-common/user-intent';
|
|
4
5
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -34,11 +35,23 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
34
35
|
api = _ref.api,
|
|
35
36
|
isCommentEditor = _ref.isCommentEditor,
|
|
36
37
|
tableWrapper = _ref.tableWrapper;
|
|
37
|
-
|
|
38
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['table'], function (states) {
|
|
39
|
+
var _states$tableState;
|
|
40
|
+
return {
|
|
41
|
+
activeTableMenu: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.activeTableMenu
|
|
42
|
+
};
|
|
43
|
+
}),
|
|
44
|
+
activeTableMenu = _useSharedPluginState.activeTableMenu;
|
|
45
|
+
var isActiveTableMenuDragMenu = (activeTableMenu === null || activeTableMenu === void 0 ? void 0 : activeTableMenu.type) === 'row' || (activeTableMenu === null || activeTableMenu === void 0 ? void 0 : activeTableMenu.type) === 'column';
|
|
46
|
+
var hasActiveTableMenuState = activeTableMenu !== undefined;
|
|
47
|
+
var isDragMenuOpen = expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) && hasActiveTableMenuState ? isActiveTableMenuDragMenu : isOpen;
|
|
48
|
+
var dragMenuDirection = expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) && hasActiveTableMenuState ? isActiveTableMenuDragMenu ? activeTableMenu.type : undefined : direction;
|
|
49
|
+
var dragMenuIndex = expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) && hasActiveTableMenuState ? isActiveTableMenuDragMenu ? activeTableMenu.index : undefined : index;
|
|
50
|
+
if (!isDragMenuOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
38
51
|
return null;
|
|
39
52
|
}
|
|
40
53
|
var 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');
|
|
41
|
-
var targetHandleRef =
|
|
54
|
+
var targetHandleRef = dragMenuDirection === 'row' ? document.querySelector('#drag-handle-button-row') : document.querySelector('#drag-handle-button-column');
|
|
42
55
|
if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
|
|
43
56
|
return null;
|
|
44
57
|
}
|
|
@@ -47,8 +60,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
47
60
|
tableWithFixedColumnWidthsOption = _ref2$tableWithFixedC === void 0 ? false : _ref2$tableWithFixedC;
|
|
48
61
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
|
|
49
62
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
50
|
-
alignX:
|
|
51
|
-
alignY:
|
|
63
|
+
alignX: dragMenuDirection === 'row' ? 'right' : undefined,
|
|
64
|
+
alignY: dragMenuDirection === 'row' ? 'start' : undefined
|
|
52
65
|
// Ignored via go/ees005
|
|
53
66
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
54
67
|
,
|
|
@@ -72,13 +85,13 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
72
85
|
}, /*#__PURE__*/React.createElement(TableMenu, {
|
|
73
86
|
api: api,
|
|
74
87
|
editorView: editorView,
|
|
75
|
-
surface:
|
|
88
|
+
surface: dragMenuDirection === 'row' ? ROW_MENU : COLUMN_MENU
|
|
76
89
|
})) : /*#__PURE__*/React.createElement(DragMenu, {
|
|
77
90
|
editorView: editorView,
|
|
78
|
-
isOpen:
|
|
91
|
+
isOpen: isDragMenuOpen,
|
|
79
92
|
tableNode: tableNode,
|
|
80
|
-
direction:
|
|
81
|
-
index:
|
|
93
|
+
direction: dragMenuDirection,
|
|
94
|
+
index: dragMenuIndex,
|
|
82
95
|
target: targetHandleRef || undefined,
|
|
83
96
|
targetCellPosition: targetCellPosition,
|
|
84
97
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
@@ -8,6 +8,7 @@ import { CellSelection } from '@atlaskit/editor-tables';
|
|
|
8
8
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
10
|
import { clearHoverSelection, hoverCell, hoverColumns, selectColumn, selectColumns } from '../../../pm-plugins/commands';
|
|
11
|
+
import { toggleActiveTableMenuWithAnalytics } from '../../../pm-plugins/commands/commands-with-analytics';
|
|
11
12
|
import { toggleDragMenuWithAnalytics } from '../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
12
13
|
import { getRowsParams } from '../../../pm-plugins/utils/row-controls';
|
|
13
14
|
import { getSelectedColumnIndexes } from '../../../pm-plugins/utils/selection';
|
|
@@ -24,7 +25,7 @@ var getSelectedColumns = function getSelectedColumns(selection) {
|
|
|
24
25
|
return [];
|
|
25
26
|
};
|
|
26
27
|
export var ColumnControls = function ColumnControls(_ref) {
|
|
27
|
-
var _colWidths$map$join, _api$
|
|
28
|
+
var _colWidths$map$join, _api$analytics3;
|
|
28
29
|
var editorView = _ref.editorView,
|
|
29
30
|
tableActive = _ref.tableActive,
|
|
30
31
|
tableRef = _ref.tableRef,
|
|
@@ -117,14 +118,21 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
117
118
|
}
|
|
118
119
|
}, [editorView, tableActive]);
|
|
119
120
|
var toggleDragMenuHandler = useCallback(function (trigger, event) {
|
|
120
|
-
var _api$
|
|
121
|
+
var _api$analytics2;
|
|
121
122
|
var state = editorView.state,
|
|
122
123
|
dispatch = editorView.dispatch;
|
|
123
124
|
if (event !== null && event !== void 0 && event.shiftKey) {
|
|
124
125
|
return;
|
|
125
126
|
}
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
128
|
+
if (colIndex !== undefined) {
|
|
129
|
+
var _api$analytics;
|
|
130
|
+
toggleActiveTableMenuWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)('column', colIndex, trigger)(state, dispatch);
|
|
131
|
+
}
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
toggleDragMenuWithAnalytics(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(undefined, 'column', colIndex, trigger)(state, dispatch);
|
|
135
|
+
}, [editorView, colIndex, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions]);
|
|
128
136
|
var colIndexes = useMemo(function () {
|
|
129
137
|
// Ignored via go/ees005
|
|
130
138
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -8,6 +8,7 @@ import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
|
8
8
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
9
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
10
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
11
|
+
import { toggleActiveTableMenuWithAnalytics } from '../../../pm-plugins/commands/commands-with-analytics';
|
|
11
12
|
import { toggleDragMenuWithAnalytics } from '../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
12
13
|
import { getPluginState as getTablePluginState } from '../../../pm-plugins/plugin-factory';
|
|
13
14
|
import { getRowHeights, getRowsParams } from '../../../pm-plugins/utils/row-controls';
|
|
@@ -27,7 +28,7 @@ var getSelectedRows = function getSelectedRows(selection) {
|
|
|
27
28
|
return [];
|
|
28
29
|
};
|
|
29
30
|
export var DragControls = function DragControls(_ref) {
|
|
30
|
-
var _tableNode$attrs$loca, _tableNode$attrs, _api$
|
|
31
|
+
var _tableNode$attrs$loca, _tableNode$attrs, _api$analytics3;
|
|
31
32
|
var tableRef = _ref.tableRef,
|
|
32
33
|
tableNode = _ref.tableNode,
|
|
33
34
|
tableWidth = _ref.tableWidth,
|
|
@@ -80,12 +81,20 @@ export var DragControls = function DragControls(_ref) {
|
|
|
80
81
|
});
|
|
81
82
|
}, [editorView]);
|
|
82
83
|
var toggleDragMenuHandler = useCallback(function (trigger, event) {
|
|
83
|
-
var _api$
|
|
84
|
+
var _api$analytics2;
|
|
84
85
|
if (event !== null && event !== void 0 && event.shiftKey) {
|
|
85
86
|
return;
|
|
86
87
|
}
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
var rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
|
|
89
|
+
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
90
|
+
if (rowIndex !== undefined) {
|
|
91
|
+
var _api$analytics;
|
|
92
|
+
toggleActiveTableMenuWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)('row', rowIndex, trigger)(editorView.state, editorView.dispatch);
|
|
93
|
+
}
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
toggleDragMenuWithAnalytics(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(undefined, 'row', rowIndex, trigger)(editorView.state, editorView.dispatch);
|
|
97
|
+
}, [editorView, hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions]);
|
|
89
98
|
var rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
|
|
90
99
|
var handleMouseOut = useCallback(function () {
|
|
91
100
|
if (tableActive) {
|
|
@@ -3,7 +3,8 @@ import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
|
3
3
|
import { MergeCellsItem } from './items/MergeCellsItem';
|
|
4
4
|
import { SplitCellItem } from './items/SplitCellItem';
|
|
5
5
|
import { CELL_MENU, CELL_ACTION_SECTION, CELL_DANGER_SECTION, CELL_MENU_RANK, MERGE_CELLS_ITEM, SPLIT_CELL_ITEM, CELL_ACTION_SECTION_RANK } from './keys';
|
|
6
|
-
export var getCellMenuComponents = function getCellMenuComponents() {
|
|
6
|
+
export var getCellMenuComponents = function getCellMenuComponents(_ref) {
|
|
7
|
+
var api = _ref.api;
|
|
7
8
|
return [
|
|
8
9
|
// --- Menu surface ---
|
|
9
10
|
{
|
|
@@ -31,7 +32,9 @@ export var getCellMenuComponents = function getCellMenuComponents() {
|
|
|
31
32
|
rank: CELL_ACTION_SECTION_RANK[MERGE_CELLS_ITEM.key]
|
|
32
33
|
}],
|
|
33
34
|
component: function component() {
|
|
34
|
-
return /*#__PURE__*/React.createElement(MergeCellsItem,
|
|
35
|
+
return /*#__PURE__*/React.createElement(MergeCellsItem, {
|
|
36
|
+
api: api
|
|
37
|
+
});
|
|
35
38
|
}
|
|
36
39
|
}, {
|
|
37
40
|
type: SPLIT_CELL_ITEM.type,
|
|
@@ -42,7 +45,9 @@ export var getCellMenuComponents = function getCellMenuComponents() {
|
|
|
42
45
|
rank: CELL_ACTION_SECTION_RANK[SPLIT_CELL_ITEM.key]
|
|
43
46
|
}],
|
|
44
47
|
component: function component() {
|
|
45
|
-
return /*#__PURE__*/React.createElement(SplitCellItem,
|
|
48
|
+
return /*#__PURE__*/React.createElement(SplitCellItem, {
|
|
49
|
+
api: api
|
|
50
|
+
});
|
|
46
51
|
}
|
|
47
52
|
},
|
|
48
53
|
// --- Danger section (Clear cell) ---
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
5
|
import { TableCellMergeIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
6
|
+
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
7
|
+
import { mergeCellsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
5
8
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
6
|
-
|
|
7
9
|
/**
|
|
8
10
|
* Merge cells is only visible when the active selection can actually be merged
|
|
9
11
|
* (multi-cell, non-overlapping).
|
|
@@ -11,14 +13,26 @@ import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
|
11
13
|
var shouldShowMergeCells = function shouldShowMergeCells(tableMenuContext) {
|
|
12
14
|
return (tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMergeCells) === true;
|
|
13
15
|
};
|
|
14
|
-
export var MergeCellsItem = function MergeCellsItem() {
|
|
16
|
+
export var MergeCellsItem = function MergeCellsItem(_ref) {
|
|
17
|
+
var api = _ref.api;
|
|
15
18
|
var tableMenuContext = useTableMenuContext();
|
|
19
|
+
var _ref2 = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {},
|
|
20
|
+
editorView = _ref2.editorView;
|
|
16
21
|
var _useIntl = useIntl(),
|
|
17
22
|
formatMessage = _useIntl.formatMessage;
|
|
23
|
+
var handleClick = function handleClick() {
|
|
24
|
+
var _api$analytics;
|
|
25
|
+
if (!editorView) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
mergeCellsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.CONTEXT_MENU)(editorView.state, editorView.dispatch);
|
|
29
|
+
closeActiveTableMenu()(editorView.state, editorView.dispatch);
|
|
30
|
+
};
|
|
18
31
|
if (!shouldShowMergeCells(tableMenuContext)) {
|
|
19
32
|
return null;
|
|
20
33
|
}
|
|
21
34
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
35
|
+
onClick: handleClick,
|
|
22
36
|
elemBefore: /*#__PURE__*/React.createElement(TableCellMergeIcon, {
|
|
23
37
|
label: "",
|
|
24
38
|
size: "small"
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
5
|
import { TableCellSplitIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
6
|
+
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
7
|
+
import { splitCellWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
5
8
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
6
|
-
|
|
7
9
|
/**
|
|
8
10
|
* Split cell is only visible when the active selection sits in a cell whose
|
|
9
11
|
* `rowspan` or `colspan` is greater than one.
|
|
@@ -11,14 +13,26 @@ import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
|
11
13
|
var shouldShowSplitCell = function shouldShowSplitCell(tableMenuContext) {
|
|
12
14
|
return (tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canSplitCell) === true;
|
|
13
15
|
};
|
|
14
|
-
export var SplitCellItem = function SplitCellItem() {
|
|
16
|
+
export var SplitCellItem = function SplitCellItem(_ref) {
|
|
17
|
+
var api = _ref.api;
|
|
15
18
|
var tableMenuContext = useTableMenuContext();
|
|
19
|
+
var _ref2 = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {},
|
|
20
|
+
editorView = _ref2.editorView;
|
|
16
21
|
var _useIntl = useIntl(),
|
|
17
22
|
formatMessage = _useIntl.formatMessage;
|
|
23
|
+
var handleClick = function handleClick() {
|
|
24
|
+
var _api$analytics;
|
|
25
|
+
if (!editorView) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
splitCellWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.CONTEXT_MENU)(editorView.state, editorView.dispatch);
|
|
29
|
+
closeActiveTableMenu()(editorView.state, editorView.dispatch);
|
|
30
|
+
};
|
|
18
31
|
if (!shouldShowSplitCell(tableMenuContext)) {
|
|
19
32
|
return null;
|
|
20
33
|
}
|
|
21
34
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
35
|
+
onClick: handleClick,
|
|
22
36
|
elemBefore: /*#__PURE__*/React.createElement(TableCellSplitIcon, {
|
|
23
37
|
label: "",
|
|
24
38
|
size: "small"
|
|
@@ -4,15 +4,15 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { addColumnBefore, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { TableColumnAddLeftIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
10
9
|
import { insertColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
10
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
11
11
|
export var AddColumnLeftItem = function AddColumnLeftItem(_ref) {
|
|
12
|
-
var _tooltip;
|
|
12
|
+
var _useTableMenuContext, _tooltip;
|
|
13
13
|
var api = _ref.api;
|
|
14
|
-
var
|
|
15
|
-
editorView =
|
|
14
|
+
var _ref2 = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {},
|
|
15
|
+
editorView = _ref2.editorView;
|
|
16
16
|
var _useIntl = useIntl(),
|
|
17
17
|
formatMessage = _useIntl.formatMessage;
|
|
18
18
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], function (states) {
|
|
@@ -4,15 +4,15 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { addColumnAfter, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { TableColumnAddRightIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
10
9
|
import { insertColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
10
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
11
11
|
export var AddColumnRightItem = function AddColumnRightItem(_ref) {
|
|
12
|
-
var _tooltip;
|
|
12
|
+
var _useTableMenuContext, _tooltip;
|
|
13
13
|
var api = _ref.api;
|
|
14
|
-
var
|
|
15
|
-
editorView =
|
|
14
|
+
var _ref2 = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {},
|
|
15
|
+
editorView = _ref2.editorView;
|
|
16
16
|
var _useIntl = useIntl(),
|
|
17
17
|
formatMessage = _useIntl.formatMessage;
|
|
18
18
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], function (states) {
|
|
@@ -4,7 +4,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { deleteColumn, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { DeleteIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
10
9
|
import { clearHoverSelection, hoverColumns } from '../../../../pm-plugins/commands';
|
|
@@ -14,9 +13,9 @@ import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
|
14
13
|
export var DeleteColumnItem = function DeleteColumnItem(_ref) {
|
|
15
14
|
var _tableMenuContext$sel, _tooltip;
|
|
16
15
|
var api = _ref.api;
|
|
17
|
-
var _useEditorToolbar = useEditorToolbar(),
|
|
18
|
-
editorView = _useEditorToolbar.editorView;
|
|
19
16
|
var tableMenuContext = useTableMenuContext();
|
|
17
|
+
var _ref2 = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {},
|
|
18
|
+
editorView = _ref2.editorView;
|
|
20
19
|
var selectedColumnCount = (_tableMenuContext$sel = tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount) !== null && _tableMenuContext$sel !== void 0 ? _tableMenuContext$sel : 1;
|
|
21
20
|
var _useIntl = useIntl(),
|
|
22
21
|
formatMessage = _useIntl.formatMessage;
|
|
@@ -3,7 +3,6 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
7
6
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
7
|
import { TableColumnsDistributeIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
9
8
|
import { distributeColumnsWidthsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -15,9 +14,9 @@ var shouldShowDistributeColumns = function shouldShowDistributeColumns(selectedC
|
|
|
15
14
|
};
|
|
16
15
|
export var DistributeColumnsItem = function DistributeColumnsItem(_ref) {
|
|
17
16
|
var api = _ref.api;
|
|
18
|
-
var _useEditorToolbar = useEditorToolbar(),
|
|
19
|
-
editorView = _useEditorToolbar.editorView;
|
|
20
17
|
var tableMenuContext = useTableMenuContext();
|
|
18
|
+
var _ref2 = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {},
|
|
19
|
+
editorView = _ref2.editorView;
|
|
21
20
|
var _useIntl = useIntl(),
|
|
22
21
|
formatMessage = _useIntl.formatMessage;
|
|
23
22
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], function (states) {
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
6
5
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
7
6
|
import Toggle from '@atlaskit/toggle';
|
|
8
7
|
import { toggleHeaderColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -23,9 +22,9 @@ export var shouldShowHeaderColumnToggle = function shouldShowHeaderColumnToggle(
|
|
|
23
22
|
};
|
|
24
23
|
export var HeaderColumnToggleItem = function HeaderColumnToggleItem(props) {
|
|
25
24
|
var api = props.api;
|
|
26
|
-
var _useEditorToolbar = useEditorToolbar(),
|
|
27
|
-
editorView = _useEditorToolbar.editorView;
|
|
28
25
|
var tableMenuContext = useTableMenuContext();
|
|
26
|
+
var _ref2 = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {},
|
|
27
|
+
editorView = _ref2.editorView;
|
|
29
28
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], function (states) {
|
|
30
29
|
var _states$tableState, _states$tableState2;
|
|
31
30
|
return {
|
|
@@ -4,7 +4,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { moveColumnLeft, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
10
9
|
import TableColumnMoveLeftIcon from '@atlaskit/icon/core/table-column-move-left';
|
|
@@ -19,9 +18,9 @@ var shouldShowMoveColumnLeft = function shouldShowMoveColumnLeft(isFirstColumn)
|
|
|
19
18
|
export var MoveColumnLeftItem = function MoveColumnLeftItem(props) {
|
|
20
19
|
var _tableMenuContext$sel, _tooltip;
|
|
21
20
|
var api = props.api;
|
|
22
|
-
var _useEditorToolbar = useEditorToolbar(),
|
|
23
|
-
editorView = _useEditorToolbar.editorView;
|
|
24
21
|
var tableMenuContext = useTableMenuContext();
|
|
22
|
+
var _ref = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {},
|
|
23
|
+
editorView = _ref.editorView;
|
|
25
24
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], function (states) {
|
|
26
25
|
var _states$tableState;
|
|
27
26
|
return {
|