@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
|
@@ -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
|
|
@@ -32,6 +32,15 @@ const FloatingContextualMenu = ({
|
|
|
32
32
|
api,
|
|
33
33
|
isDragMenuOpen
|
|
34
34
|
}) => {
|
|
35
|
+
const {
|
|
36
|
+
activeTableMenu
|
|
37
|
+
} = useSharedPluginStateWithSelector(api, ['table'], states => {
|
|
38
|
+
var _states$tableState;
|
|
39
|
+
return {
|
|
40
|
+
activeTableMenu: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.activeTableMenu
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
const isCellMenuOpen = expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) ? (activeTableMenu === null || activeTableMenu === void 0 ? void 0 : activeTableMenu.type) === 'cell' : isOpen;
|
|
35
44
|
if (!editorView) {
|
|
36
45
|
return null;
|
|
37
46
|
}
|
|
@@ -40,7 +49,7 @@ const FloatingContextualMenu = ({
|
|
|
40
49
|
const {
|
|
41
50
|
targetCellPosition
|
|
42
51
|
} = getPluginState(editorView.state);
|
|
43
|
-
if (!
|
|
52
|
+
if (!isCellMenuOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
44
53
|
return null;
|
|
45
54
|
}
|
|
46
55
|
const {
|
|
@@ -59,6 +68,20 @@ const FloatingContextualMenu = ({
|
|
|
59
68
|
return null;
|
|
60
69
|
}
|
|
61
70
|
const parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
|
|
71
|
+
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
72
|
+
return jsx(CellMenuPopup, {
|
|
73
|
+
api: api,
|
|
74
|
+
boundariesElement: boundariesElement,
|
|
75
|
+
editorView: editorView,
|
|
76
|
+
mountPoint: mountPoint,
|
|
77
|
+
scrollableElement: scrollableElement
|
|
78
|
+
// Ignored via go/ees005
|
|
79
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
80
|
+
,
|
|
81
|
+
targetCellRef: targetCellRef,
|
|
82
|
+
zIndex: parentSticky ? akEditorFloatingDialogZIndex : akEditorFloatingOverlapPanelZIndex
|
|
83
|
+
});
|
|
84
|
+
}
|
|
62
85
|
return jsx(Popup, {
|
|
63
86
|
alignX: "right",
|
|
64
87
|
alignY: "top"
|
|
@@ -70,7 +93,7 @@ const FloatingContextualMenu = ({
|
|
|
70
93
|
boundariesElement: boundariesElement,
|
|
71
94
|
scrollableElement: scrollableElement,
|
|
72
95
|
fitHeight: tablePopupMenuFitHeight,
|
|
73
|
-
fitWidth:
|
|
96
|
+
fitWidth: contextualMenuDropdownWidthDnD
|
|
74
97
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
75
98
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
76
99
|
,
|
|
@@ -80,15 +103,7 @@ const FloatingContextualMenu = ({
|
|
|
80
103
|
,
|
|
81
104
|
offset: [-7, 0],
|
|
82
105
|
stick: true
|
|
83
|
-
},
|
|
84
|
-
api: api,
|
|
85
|
-
editorView: editorView,
|
|
86
|
-
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
|
|
87
|
-
isOpen: isOpen,
|
|
88
|
-
targetCellRef: targetCellRef
|
|
89
|
-
}) :
|
|
90
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
91
|
-
jsx("div", {
|
|
106
|
+
}, jsx("div", {
|
|
92
107
|
css: tablePopupStyles()
|
|
93
108
|
}, jsx(ContextualMenu, {
|
|
94
109
|
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';
|
|
@@ -35,11 +36,24 @@ const FloatingDragMenu = ({
|
|
|
35
36
|
tableWrapper
|
|
36
37
|
}) => {
|
|
37
38
|
var _getEditorFeatureFlag;
|
|
38
|
-
|
|
39
|
+
const {
|
|
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) {
|
|
39
53
|
return null;
|
|
40
54
|
}
|
|
41
55
|
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');
|
|
42
|
-
const targetHandleRef =
|
|
56
|
+
const targetHandleRef = dragMenuDirection === 'row' ? document.querySelector('#drag-handle-button-row') : document.querySelector('#drag-handle-button-column');
|
|
43
57
|
if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
|
|
44
58
|
return null;
|
|
45
59
|
}
|
|
@@ -48,8 +62,8 @@ const FloatingDragMenu = ({
|
|
|
48
62
|
} = (_getEditorFeatureFlag = getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags()) !== null && _getEditorFeatureFlag !== void 0 ? _getEditorFeatureFlag : {};
|
|
49
63
|
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
|
|
50
64
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
51
|
-
alignX:
|
|
52
|
-
alignY:
|
|
65
|
+
alignX: dragMenuDirection === 'row' ? 'right' : undefined,
|
|
66
|
+
alignY: dragMenuDirection === 'row' ? 'start' : undefined
|
|
53
67
|
// Ignored via go/ees005
|
|
54
68
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
55
69
|
,
|
|
@@ -73,13 +87,13 @@ const FloatingDragMenu = ({
|
|
|
73
87
|
}, /*#__PURE__*/React.createElement(TableMenu, {
|
|
74
88
|
api: api,
|
|
75
89
|
editorView: editorView,
|
|
76
|
-
surface:
|
|
90
|
+
surface: dragMenuDirection === 'row' ? ROW_MENU : COLUMN_MENU
|
|
77
91
|
})) : /*#__PURE__*/React.createElement(DragMenu, {
|
|
78
92
|
editorView: editorView,
|
|
79
|
-
isOpen:
|
|
93
|
+
isOpen: isDragMenuOpen,
|
|
80
94
|
tableNode: tableNode,
|
|
81
|
-
direction:
|
|
82
|
-
index:
|
|
95
|
+
direction: dragMenuDirection,
|
|
96
|
+
index: dragMenuIndex,
|
|
83
97
|
target: targetHandleRef || undefined,
|
|
84
98
|
targetCellPosition: targetCellPosition,
|
|
85
99
|
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';
|
|
@@ -40,7 +41,7 @@ export const ColumnControls = ({
|
|
|
40
41
|
getScrollOffset,
|
|
41
42
|
api
|
|
42
43
|
}) => {
|
|
43
|
-
var _colWidths$map$join, _api$
|
|
44
|
+
var _colWidths$map$join, _api$analytics3;
|
|
44
45
|
const columnControlsRef = useRef(null);
|
|
45
46
|
const {
|
|
46
47
|
selection
|
|
@@ -124,7 +125,7 @@ export const ColumnControls = ({
|
|
|
124
125
|
}
|
|
125
126
|
}, [editorView, tableActive]);
|
|
126
127
|
const toggleDragMenuHandler = useCallback((trigger, event) => {
|
|
127
|
-
var _api$
|
|
128
|
+
var _api$analytics2;
|
|
128
129
|
const {
|
|
129
130
|
state,
|
|
130
131
|
dispatch
|
|
@@ -132,8 +133,15 @@ export const ColumnControls = ({
|
|
|
132
133
|
if (event !== null && event !== void 0 && event.shiftKey) {
|
|
133
134
|
return;
|
|
134
135
|
}
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
137
|
+
if (colIndex !== undefined) {
|
|
138
|
+
var _api$analytics;
|
|
139
|
+
toggleActiveTableMenuWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)('column', colIndex, trigger)(state, dispatch);
|
|
140
|
+
}
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
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 === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions]);
|
|
137
145
|
const colIndexes = useMemo(() => {
|
|
138
146
|
// Ignored via go/ees005
|
|
139
147
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -7,6 +7,7 @@ import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
|
7
7
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
8
8
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
9
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
10
|
+
import { toggleActiveTableMenuWithAnalytics } from '../../../pm-plugins/commands/commands-with-analytics';
|
|
10
11
|
import { toggleDragMenuWithAnalytics } from '../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
12
|
import { getPluginState as getTablePluginState } from '../../../pm-plugins/plugin-factory';
|
|
12
13
|
import { getRowHeights, getRowsParams } from '../../../pm-plugins/utils/row-controls';
|
|
@@ -42,7 +43,7 @@ export const DragControls = ({
|
|
|
42
43
|
api,
|
|
43
44
|
selection
|
|
44
45
|
}) => {
|
|
45
|
-
var _tableNode$attrs$loca, _tableNode$attrs, _api$
|
|
46
|
+
var _tableNode$attrs$loca, _tableNode$attrs, _api$analytics3;
|
|
46
47
|
const [isDragging, setIsDragging] = useState(false);
|
|
47
48
|
const rowHeights = getRowHeights(tableRef);
|
|
48
49
|
const rowsParams = getRowsParams(rowHeights);
|
|
@@ -78,12 +79,20 @@ export const DragControls = ({
|
|
|
78
79
|
});
|
|
79
80
|
}, [editorView]);
|
|
80
81
|
const toggleDragMenuHandler = useCallback((trigger, event) => {
|
|
81
|
-
var _api$
|
|
82
|
+
var _api$analytics2;
|
|
82
83
|
if (event !== null && event !== void 0 && event.shiftKey) {
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
const rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
|
|
87
|
+
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
88
|
+
if (rowIndex !== undefined) {
|
|
89
|
+
var _api$analytics;
|
|
90
|
+
toggleActiveTableMenuWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)('row', rowIndex, trigger)(editorView.state, editorView.dispatch);
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
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 === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions]);
|
|
87
96
|
const rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
|
|
88
97
|
const handleMouseOut = useCallback(() => {
|
|
89
98
|
if (tableActive) {
|
|
@@ -3,7 +3,9 @@ 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 const getCellMenuComponents = (
|
|
6
|
+
export const getCellMenuComponents = ({
|
|
7
|
+
api
|
|
8
|
+
}) => [
|
|
7
9
|
// --- Menu surface ---
|
|
8
10
|
{
|
|
9
11
|
type: CELL_MENU.type,
|
|
@@ -27,7 +29,9 @@ export const getCellMenuComponents = () => [
|
|
|
27
29
|
key: CELL_ACTION_SECTION.key,
|
|
28
30
|
rank: CELL_ACTION_SECTION_RANK[MERGE_CELLS_ITEM.key]
|
|
29
31
|
}],
|
|
30
|
-
component: () => /*#__PURE__*/React.createElement(MergeCellsItem,
|
|
32
|
+
component: () => /*#__PURE__*/React.createElement(MergeCellsItem, {
|
|
33
|
+
api: api
|
|
34
|
+
})
|
|
31
35
|
}, {
|
|
32
36
|
type: SPLIT_CELL_ITEM.type,
|
|
33
37
|
key: SPLIT_CELL_ITEM.key,
|
|
@@ -36,7 +40,9 @@ export const getCellMenuComponents = () => [
|
|
|
36
40
|
key: CELL_ACTION_SECTION.key,
|
|
37
41
|
rank: CELL_ACTION_SECTION_RANK[SPLIT_CELL_ITEM.key]
|
|
38
42
|
}],
|
|
39
|
-
component: () => /*#__PURE__*/React.createElement(SplitCellItem,
|
|
43
|
+
component: () => /*#__PURE__*/React.createElement(SplitCellItem, {
|
|
44
|
+
api: api
|
|
45
|
+
})
|
|
40
46
|
},
|
|
41
47
|
// --- Danger section (Clear cell) ---
|
|
42
48
|
{
|
|
@@ -1,23 +1,39 @@
|
|
|
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).
|
|
10
12
|
*/
|
|
11
13
|
const shouldShowMergeCells = tableMenuContext => (tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMergeCells) === true;
|
|
12
|
-
export const MergeCellsItem = (
|
|
14
|
+
export const MergeCellsItem = ({
|
|
15
|
+
api
|
|
16
|
+
}) => {
|
|
13
17
|
const tableMenuContext = useTableMenuContext();
|
|
18
|
+
const {
|
|
19
|
+
editorView
|
|
20
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
14
21
|
const {
|
|
15
22
|
formatMessage
|
|
16
23
|
} = useIntl();
|
|
24
|
+
const handleClick = () => {
|
|
25
|
+
var _api$analytics;
|
|
26
|
+
if (!editorView) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
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
|
+
closeActiveTableMenu()(editorView.state, editorView.dispatch);
|
|
31
|
+
};
|
|
17
32
|
if (!shouldShowMergeCells(tableMenuContext)) {
|
|
18
33
|
return null;
|
|
19
34
|
}
|
|
20
35
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
36
|
+
onClick: handleClick,
|
|
21
37
|
elemBefore: /*#__PURE__*/React.createElement(TableCellMergeIcon, {
|
|
22
38
|
label: "",
|
|
23
39
|
size: "small"
|
|
@@ -1,23 +1,39 @@
|
|
|
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.
|
|
10
12
|
*/
|
|
11
13
|
const shouldShowSplitCell = tableMenuContext => (tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canSplitCell) === true;
|
|
12
|
-
export const SplitCellItem = (
|
|
14
|
+
export const SplitCellItem = ({
|
|
15
|
+
api
|
|
16
|
+
}) => {
|
|
13
17
|
const tableMenuContext = useTableMenuContext();
|
|
18
|
+
const {
|
|
19
|
+
editorView
|
|
20
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
14
21
|
const {
|
|
15
22
|
formatMessage
|
|
16
23
|
} = useIntl();
|
|
24
|
+
const handleClick = () => {
|
|
25
|
+
var _api$analytics;
|
|
26
|
+
if (!editorView) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
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
|
+
closeActiveTableMenu()(editorView.state, editorView.dispatch);
|
|
31
|
+
};
|
|
17
32
|
if (!shouldShowSplitCell(tableMenuContext)) {
|
|
18
33
|
return null;
|
|
19
34
|
}
|
|
20
35
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
36
|
+
onClick: handleClick,
|
|
21
37
|
elemBefore: /*#__PURE__*/React.createElement(TableCellSplitIcon, {
|
|
22
38
|
label: "",
|
|
23
39
|
size: "small"
|
|
@@ -4,17 +4,17 @@ 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 const AddColumnLeftItem = ({
|
|
12
12
|
api
|
|
13
13
|
}) => {
|
|
14
|
-
var _tooltip;
|
|
14
|
+
var _useTableMenuContext, _tooltip;
|
|
15
15
|
const {
|
|
16
16
|
editorView
|
|
17
|
-
} =
|
|
17
|
+
} = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {};
|
|
18
18
|
const {
|
|
19
19
|
formatMessage
|
|
20
20
|
} = useIntl();
|
|
@@ -4,17 +4,17 @@ 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 const AddColumnRightItem = ({
|
|
12
12
|
api
|
|
13
13
|
}) => {
|
|
14
|
-
var _tooltip;
|
|
14
|
+
var _useTableMenuContext, _tooltip;
|
|
15
15
|
const {
|
|
16
16
|
editorView
|
|
17
|
-
} =
|
|
17
|
+
} = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {};
|
|
18
18
|
const {
|
|
19
19
|
formatMessage
|
|
20
20
|
} = useIntl();
|
|
@@ -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';
|
|
@@ -15,10 +14,10 @@ export const DeleteColumnItem = ({
|
|
|
15
14
|
api
|
|
16
15
|
}) => {
|
|
17
16
|
var _tableMenuContext$sel, _tooltip;
|
|
17
|
+
const tableMenuContext = useTableMenuContext();
|
|
18
18
|
const {
|
|
19
19
|
editorView
|
|
20
|
-
} =
|
|
21
|
-
const tableMenuContext = useTableMenuContext();
|
|
20
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
22
21
|
const selectedColumnCount = (_tableMenuContext$sel = tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount) !== null && _tableMenuContext$sel !== void 0 ? _tableMenuContext$sel : 1;
|
|
23
22
|
const {
|
|
24
23
|
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';
|
|
@@ -14,10 +13,10 @@ const shouldShowDistributeColumns = selectedColumnCount => (selectedColumnCount
|
|
|
14
13
|
export const DistributeColumnsItem = ({
|
|
15
14
|
api
|
|
16
15
|
}) => {
|
|
16
|
+
const tableMenuContext = useTableMenuContext();
|
|
17
17
|
const {
|
|
18
18
|
editorView
|
|
19
|
-
} =
|
|
20
|
-
const tableMenuContext = useTableMenuContext();
|
|
19
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
21
20
|
const {
|
|
22
21
|
formatMessage
|
|
23
22
|
} = useIntl();
|
|
@@ -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';
|
|
@@ -24,10 +23,10 @@ export const HeaderColumnToggleItem = props => {
|
|
|
24
23
|
const {
|
|
25
24
|
api
|
|
26
25
|
} = props;
|
|
26
|
+
const tableMenuContext = useTableMenuContext();
|
|
27
27
|
const {
|
|
28
28
|
editorView
|
|
29
|
-
} =
|
|
30
|
-
const tableMenuContext = useTableMenuContext();
|
|
29
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
31
30
|
const {
|
|
32
31
|
isHeaderColumnAllowed,
|
|
33
32
|
isHeaderColumnEnabled
|
|
@@ -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,10 +18,10 @@ export const MoveColumnLeftItem = props => {
|
|
|
19
18
|
const {
|
|
20
19
|
api
|
|
21
20
|
} = props;
|
|
21
|
+
const tableMenuContext = useTableMenuContext();
|
|
22
22
|
const {
|
|
23
23
|
editorView
|
|
24
|
-
} =
|
|
25
|
-
const tableMenuContext = useTableMenuContext();
|
|
24
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
26
25
|
const {
|
|
27
26
|
tableNode
|
|
28
27
|
} = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], 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 { moveColumnRight, 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 { TableColumnMoveRightIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
10
9
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
@@ -18,10 +17,10 @@ export const MoveColumnRightItem = props => {
|
|
|
18
17
|
const {
|
|
19
18
|
api
|
|
20
19
|
} = props;
|
|
20
|
+
const tableMenuContext = useTableMenuContext();
|
|
21
21
|
const {
|
|
22
22
|
editorView
|
|
23
|
-
} =
|
|
24
|
-
const tableMenuContext = useTableMenuContext();
|
|
23
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
25
24
|
const {
|
|
26
25
|
tableNode
|
|
27
26
|
} = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], states => {
|
|
@@ -3,7 +3,6 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
4
4
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
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 { ArrowDownIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
9
8
|
import { sortColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -11,10 +10,10 @@ import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
|
11
10
|
export const SortDecreasingItem = ({
|
|
12
11
|
api
|
|
13
12
|
}) => {
|
|
13
|
+
const tableMenuContext = useTableMenuContext();
|
|
14
14
|
const {
|
|
15
15
|
editorView
|
|
16
|
-
} =
|
|
17
|
-
const tableMenuContext = useTableMenuContext();
|
|
16
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
18
17
|
const {
|
|
19
18
|
formatMessage
|
|
20
19
|
} = useIntl();
|
|
@@ -3,7 +3,6 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
4
4
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
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 { ArrowUpIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
9
8
|
import { sortColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -11,10 +10,10 @@ import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
|
11
10
|
export const SortIncreasingItem = ({
|
|
12
11
|
api
|
|
13
12
|
}) => {
|
|
13
|
+
const tableMenuContext = useTableMenuContext();
|
|
14
14
|
const {
|
|
15
15
|
editorView
|
|
16
|
-
} =
|
|
17
|
-
const tableMenuContext = useTableMenuContext();
|
|
16
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
18
17
|
const {
|
|
19
18
|
formatMessage
|
|
20
19
|
} = useIntl();
|
|
@@ -3,18 +3,18 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { addRowBefore, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
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 { TableRowAddAboveIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
8
|
import { insertRowWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
9
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
10
10
|
export const AddRowAboveItem = props => {
|
|
11
|
-
var _tooltip;
|
|
11
|
+
var _useTableMenuContext, _tooltip;
|
|
12
12
|
const {
|
|
13
13
|
api
|
|
14
14
|
} = props;
|
|
15
15
|
const {
|
|
16
16
|
editorView
|
|
17
|
-
} =
|
|
17
|
+
} = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {};
|
|
18
18
|
const {
|
|
19
19
|
formatMessage
|
|
20
20
|
} = useIntl();
|
|
@@ -3,18 +3,18 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { addRowAfter, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
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 { TableRowAddBelowIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
8
|
import { insertRowWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
9
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
10
10
|
export const AddRowBelowItem = props => {
|
|
11
|
-
var _tooltip;
|
|
11
|
+
var _useTableMenuContext, _tooltip;
|
|
12
12
|
const {
|
|
13
13
|
api
|
|
14
14
|
} = props;
|
|
15
15
|
const {
|
|
16
16
|
editorView
|
|
17
|
-
} =
|
|
17
|
+
} = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {};
|
|
18
18
|
const {
|
|
19
19
|
formatMessage
|
|
20
20
|
} = useIntl();
|
|
@@ -4,7 +4,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { deleteRow, 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, hoverRows } from '../../../../pm-plugins/commands';
|
|
@@ -16,10 +15,10 @@ export const DeleteRowItem = props => {
|
|
|
16
15
|
const {
|
|
17
16
|
api
|
|
18
17
|
} = props;
|
|
18
|
+
const tableMenuContext = useTableMenuContext();
|
|
19
19
|
const {
|
|
20
20
|
editorView
|
|
21
|
-
} =
|
|
22
|
-
const tableMenuContext = useTableMenuContext();
|
|
21
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
23
22
|
const {
|
|
24
23
|
isHeaderRowRequired
|
|
25
24
|
} = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], 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 { toggleHeaderRowWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -18,10 +17,10 @@ export const HeaderRowToggleItem = props => {
|
|
|
18
17
|
const {
|
|
19
18
|
api
|
|
20
19
|
} = props;
|
|
20
|
+
const tableMenuContext = useTableMenuContext();
|
|
21
21
|
const {
|
|
22
22
|
editorView
|
|
23
|
-
} =
|
|
24
|
-
const tableMenuContext = useTableMenuContext();
|
|
23
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
25
24
|
const {
|
|
26
25
|
isHeaderRowAllowed,
|
|
27
26
|
isHeaderRowEnabled
|