@atlaskit/editor-plugin-table 7.4.8 → 7.4.9
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 +6 -0
- package/dist/cjs/ui/FloatingContextualMenu/index.js +1 -1
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +13 -3
- package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +53 -8
- package/dist/cjs/ui/FloatingDragMenu/index.js +9 -5
- package/dist/cjs/ui/consts.js +2 -1
- package/dist/es2019/ui/FloatingContextualMenu/index.js +2 -2
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +13 -3
- package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +42 -8
- package/dist/es2019/ui/FloatingDragMenu/index.js +10 -6
- package/dist/es2019/ui/consts.js +1 -0
- package/dist/esm/ui/FloatingContextualMenu/index.js +2 -2
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +13 -3
- package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +50 -9
- package/dist/esm/ui/FloatingDragMenu/index.js +10 -6
- package/dist/esm/ui/consts.js +1 -0
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +6 -1
- package/dist/types/ui/FloatingDragMenu/DropdownMenu.d.ts +8 -2
- package/dist/types/ui/consts.d.ts +1 -0
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +6 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DropdownMenu.d.ts +8 -2
- package/dist/types-ts4.5/ui/consts.d.ts +1 -0
- package/package.json +2 -2
- package/src/ui/FloatingContextualMenu/index.tsx +2 -1
- package/src/ui/FloatingDragMenu/DragMenu.tsx +16 -1
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +94 -50
- package/src/ui/FloatingDragMenu/index.tsx +8 -3
- package/src/ui/consts.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.4.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#78202](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78202) [`287432cbca17`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/287432cbca17) - [ux] ED-22099: Fixed drag menu position when close to edge of view port.
|
|
8
|
+
|
|
3
9
|
## 7.4.8
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -50,7 +50,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
50
50
|
mountTo: mountPoint,
|
|
51
51
|
boundariesElement: boundariesElement,
|
|
52
52
|
scrollableElement: scrollableElement,
|
|
53
|
-
fitHeight:
|
|
53
|
+
fitHeight: _consts.tablePopupMenuFitHeight,
|
|
54
54
|
fitWidth: isDragAndDropEnabled ? _consts.contextualMenuDropdownWidthDnD : _consts.contextualMenuDropdownWidth
|
|
55
55
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
56
56
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
@@ -185,7 +185,12 @@ var DragMenu = exports.DragMenu = /*#__PURE__*/_react.default.memo(function (_re
|
|
|
185
185
|
getEditorContainerWidth = _ref.getEditorContainerWidth,
|
|
186
186
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
187
187
|
pluginConfig = _ref.pluginConfig,
|
|
188
|
-
formatMessage = _ref.intl.formatMessage
|
|
188
|
+
formatMessage = _ref.intl.formatMessage,
|
|
189
|
+
fitHeight = _ref.fitHeight,
|
|
190
|
+
fitWidth = _ref.fitWidth,
|
|
191
|
+
mountPoint = _ref.mountPoint,
|
|
192
|
+
scrollableElement = _ref.scrollableElement,
|
|
193
|
+
boundariesElement = _ref.boundariesElement;
|
|
189
194
|
var state = editorView.state,
|
|
190
195
|
dispatch = editorView.dispatch;
|
|
191
196
|
var selection = state.selection;
|
|
@@ -457,12 +462,17 @@ var DragMenu = exports.DragMenu = /*#__PURE__*/_react.default.memo(function (_re
|
|
|
457
462
|
section: {
|
|
458
463
|
hasSeparator: true
|
|
459
464
|
},
|
|
460
|
-
target: target,
|
|
461
465
|
items: menuItems,
|
|
462
466
|
onItemActivated: handleMenuItemActivated,
|
|
463
467
|
onMouseEnter: handleItemMouseEnter,
|
|
464
468
|
onMouseLeave: handleItemMouseLeave,
|
|
465
|
-
handleClose: closeMenu
|
|
469
|
+
handleClose: closeMenu,
|
|
470
|
+
fitHeight: fitHeight,
|
|
471
|
+
fitWidth: fitWidth,
|
|
472
|
+
direction: direction,
|
|
473
|
+
mountPoint: mountPoint,
|
|
474
|
+
boundariesElement: boundariesElement,
|
|
475
|
+
scrollableElement: scrollableElement
|
|
466
476
|
});
|
|
467
477
|
});
|
|
468
478
|
var _default = exports.default = (0, _reactIntlNext.injectIntl)(DragMenu);
|
|
@@ -1,32 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.DropdownMenu = void 0;
|
|
8
|
-
var
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
11
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
10
12
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
11
13
|
var _uiReact = require("@atlaskit/editor-common/ui-react");
|
|
14
|
+
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
12
15
|
var _menu = require("@atlaskit/menu");
|
|
13
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
17
|
var _consts = require("../consts");
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
+
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
21
|
+
|
|
15
22
|
var DropListWithOutsideListeners = (0, _uiReact.withReactEditorViewOuterListeners)(_ui.DropList);
|
|
16
23
|
var DropdownMenu = exports.DropdownMenu = function DropdownMenu(_ref) {
|
|
17
|
-
var
|
|
18
|
-
items = _ref.items,
|
|
24
|
+
var items = _ref.items,
|
|
19
25
|
section = _ref.section,
|
|
20
26
|
disableKeyboardHandling = _ref.disableKeyboardHandling,
|
|
21
27
|
onItemActivated = _ref.onItemActivated,
|
|
22
28
|
handleClose = _ref.handleClose,
|
|
23
29
|
onMouseEnter = _ref.onMouseEnter,
|
|
24
|
-
onMouseLeave = _ref.onMouseLeave
|
|
30
|
+
onMouseLeave = _ref.onMouseLeave,
|
|
31
|
+
fitWidth = _ref.fitWidth,
|
|
32
|
+
fitHeight = _ref.fitHeight,
|
|
33
|
+
direction = _ref.direction,
|
|
34
|
+
mountPoint = _ref.mountPoint,
|
|
35
|
+
boundariesElement = _ref.boundariesElement,
|
|
36
|
+
scrollableElement = _ref.scrollableElement;
|
|
37
|
+
var _useState = (0, _react.useState)(['bottom', 'left']),
|
|
38
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
39
|
+
popupPlacement = _useState2[0],
|
|
40
|
+
setPopupPlacement = _useState2[1];
|
|
41
|
+
var _useState3 = (0, _react.useState)(null),
|
|
42
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
43
|
+
targetRefDiv = _useState4[0],
|
|
44
|
+
setTargetRefDiv = _useState4[1];
|
|
45
|
+
var handleRef = function handleRef(ref) {
|
|
46
|
+
setTargetRefDiv(ref);
|
|
47
|
+
};
|
|
25
48
|
var innerMenu = function innerMenu() {
|
|
26
49
|
return /*#__PURE__*/_react.default.createElement(DropListWithOutsideListeners, {
|
|
27
50
|
isOpen: true,
|
|
28
51
|
shouldFitContainer: true,
|
|
29
|
-
position:
|
|
52
|
+
position: popupPlacement.join(' '),
|
|
30
53
|
handleClickOutside: function handleClickOutside() {
|
|
31
54
|
return handleClose('editor');
|
|
32
55
|
},
|
|
@@ -41,7 +64,7 @@ var DropdownMenu = exports.DropdownMenu = function DropdownMenu(_ref) {
|
|
|
41
64
|
e.stopPropagation();
|
|
42
65
|
}
|
|
43
66
|
},
|
|
44
|
-
targetRef:
|
|
67
|
+
targetRef: targetRefDiv
|
|
45
68
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
46
69
|
style: {
|
|
47
70
|
height: 0,
|
|
@@ -70,7 +93,29 @@ var DropdownMenu = exports.DropdownMenu = function DropdownMenu(_ref) {
|
|
|
70
93
|
if (disableKeyboardHandling) {
|
|
71
94
|
return innerMenu();
|
|
72
95
|
}
|
|
73
|
-
|
|
96
|
+
|
|
97
|
+
// more offsets calculation as offsets depend on the direction and updated placement here
|
|
98
|
+
var offsetY = direction === 'row' ? popupPlacement[0] === 'bottom' ? -8 : -34 : 0;
|
|
99
|
+
var offsetX = direction === 'column' ? popupPlacement[1] === 'left' ? 0 : -7 : 0;
|
|
100
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
101
|
+
className: "drag-dropdown-menu-wrapper"
|
|
102
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
103
|
+
className: "drag-dropdown-menu-popup-ref",
|
|
104
|
+
ref: handleRef
|
|
105
|
+
}), /*#__PURE__*/_react.default.createElement(_ui.Popup, {
|
|
106
|
+
target: targetRefDiv,
|
|
107
|
+
mountTo: mountPoint,
|
|
108
|
+
boundariesElement: boundariesElement,
|
|
109
|
+
scrollableElement: scrollableElement,
|
|
110
|
+
onPlacementChanged: function onPlacementChanged(placement) {
|
|
111
|
+
setPopupPlacement(placement);
|
|
112
|
+
},
|
|
113
|
+
fitHeight: fitHeight,
|
|
114
|
+
fitWidth: fitWidth,
|
|
115
|
+
zIndex: _editorSharedStyles.akEditorFloatingPanelZIndex,
|
|
116
|
+
offset: [offsetX, offsetY],
|
|
117
|
+
allowOutOfBounds: true // required as this popup is child of a parent popup, should be allowed to be out of bound of the parent popup, otherwise horizontal offset is not right
|
|
118
|
+
}, /*#__PURE__*/_react.default.createElement(_uiMenu.ArrowKeyNavigationProvider, {
|
|
74
119
|
closeOnTab: true,
|
|
75
120
|
type: _uiMenu.ArrowKeyNavigationType.MENU,
|
|
76
121
|
onSelection: function onSelection(index) {
|
|
@@ -119,5 +164,5 @@ var DropdownMenu = exports.DropdownMenu = function DropdownMenu(_ref) {
|
|
|
119
164
|
});
|
|
120
165
|
}
|
|
121
166
|
}
|
|
122
|
-
}, innerMenu());
|
|
167
|
+
}, innerMenu())));
|
|
123
168
|
};
|
|
@@ -30,12 +30,10 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
30
30
|
}
|
|
31
31
|
var inStickyMode = stickyHeaders === null || stickyHeaders === void 0 ? void 0 : stickyHeaders.sticky;
|
|
32
32
|
var targetHandleRef = direction === 'row' ? document.querySelector('#drag-handle-button-row') : document.querySelector('#drag-handle-button-column');
|
|
33
|
-
var offset = direction === 'row' ? [-9,
|
|
33
|
+
var offset = direction === 'row' ? [-9, 0] : [0, -7];
|
|
34
34
|
if (!targetHandleRef || !(editorView.state.selection instanceof _cellSelection.CellSelection)) {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
// TODO: we will need to adjust the alignment and offset values depending on whether this is a row or column menu.
|
|
39
37
|
return /*#__PURE__*/_react.default.createElement(_ui.Popup, {
|
|
40
38
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
41
39
|
alignY: direction === 'row' ? 'start' : undefined,
|
|
@@ -43,7 +41,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
43
41
|
mountTo: mountPoint,
|
|
44
42
|
boundariesElement: boundariesElement,
|
|
45
43
|
scrollableElement: scrollableElement,
|
|
46
|
-
fitWidth: _consts.dragMenuDropdownWidth
|
|
44
|
+
fitWidth: _consts.dragMenuDropdownWidth,
|
|
45
|
+
fitHeight: _consts.tablePopupMenuFitHeight
|
|
47
46
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
48
47
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
49
48
|
// In sticky mode, we want to show the menu above the sticky header
|
|
@@ -62,7 +61,12 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
62
61
|
targetCellPosition: targetCellPosition,
|
|
63
62
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
64
63
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
65
|
-
pluginConfig: pluginConfig
|
|
64
|
+
pluginConfig: pluginConfig,
|
|
65
|
+
fitWidth: _consts.dragMenuDropdownWidth,
|
|
66
|
+
fitHeight: _consts.tablePopupMenuFitHeight,
|
|
67
|
+
mountPoint: mountPoint,
|
|
68
|
+
boundariesElement: boundariesElement,
|
|
69
|
+
scrollableElement: scrollableElement
|
|
66
70
|
}));
|
|
67
71
|
};
|
|
68
72
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
package/dist/cjs/ui/consts.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.tableToolbarSize = exports.tableToolbarSelectedColor = exports.tableToolbarDeleteColor = exports.tableToolbarColor = exports.tableTextColor = exports.tableScrollbarOffset = exports.tablePadding = exports.tableOverflowShadowWidthWide = exports.tableOverflowShadowWidth = exports.tableMarginFullWidthMode = exports.tableInsertColumnButtonSize = exports.tableInsertColumnButtonOffset = exports.tableHeaderCellBackgroundColor = exports.tableFloatingControlsColor = exports.tableDeleteButtonSize = exports.tableDeleteButtonOffset = exports.tableControlsSpacing = exports.tableCellSelectedDeleteIconColor = exports.tableCellSelectedDeleteIconBackground = exports.tableCellSelectedColor = exports.tableCellHoverDeleteIconColor = exports.tableCellHoverDeleteIconBackground = exports.tableCellDeleteColor = exports.tableCellBackgroundColor = exports.tableBorderSelectedColor = exports.tableBorderRadiusSize = exports.tableBorderDeleteColor = exports.tableBorderColor = exports.stickyRowZIndex = exports.stickyRowOffsetTop = exports.stickyHeaderBorderBottomWidth = exports.rowControlsZIndex = exports.resizeLineWidth = exports.resizeHandlerZIndex = exports.resizeHandlerAreaWidth = exports.lineMarkerSize = exports.lineMarkerOffsetFromColumnControls = exports.layoutButtonSize = exports.insertLineWidth = exports.dropTargetsZIndex = exports.dropTargetExtendedWidth = exports.dragTableInsertColumnButtonSize = exports.dragMenuDropdownWidth = exports.contextualMenuTriggerSize = exports.contextualMenuDropdownWidthDnD = exports.contextualMenuDropdownWidth = exports.columnResizeHandleZIndex = exports.columnControlsZIndex = exports.columnControlsSelectedZIndex = exports.columnControlsDecorationHeight = exports.colorPalletteColumns = exports.TABLE_SNAP_GAP = exports.TABLE_HIGHLIGHT_TOLERANCE = exports.TABLE_HIGHLIGHT_GAP = exports.TABLE_GUIDELINE_VISIBLE_ADJUSTMENT = exports.STICKY_HEADER_TOGGLE_TOLERANCE_MS = void 0;
|
|
6
|
+
exports.tableToolbarSize = exports.tableToolbarSelectedColor = exports.tableToolbarDeleteColor = exports.tableToolbarColor = exports.tableTextColor = exports.tableScrollbarOffset = exports.tablePopupMenuFitHeight = exports.tablePadding = exports.tableOverflowShadowWidthWide = exports.tableOverflowShadowWidth = exports.tableMarginFullWidthMode = exports.tableInsertColumnButtonSize = exports.tableInsertColumnButtonOffset = exports.tableHeaderCellBackgroundColor = exports.tableFloatingControlsColor = exports.tableDeleteButtonSize = exports.tableDeleteButtonOffset = exports.tableControlsSpacing = exports.tableCellSelectedDeleteIconColor = exports.tableCellSelectedDeleteIconBackground = exports.tableCellSelectedColor = exports.tableCellHoverDeleteIconColor = exports.tableCellHoverDeleteIconBackground = exports.tableCellDeleteColor = exports.tableCellBackgroundColor = exports.tableBorderSelectedColor = exports.tableBorderRadiusSize = exports.tableBorderDeleteColor = exports.tableBorderColor = exports.stickyRowZIndex = exports.stickyRowOffsetTop = exports.stickyHeaderBorderBottomWidth = exports.rowControlsZIndex = exports.resizeLineWidth = exports.resizeHandlerZIndex = exports.resizeHandlerAreaWidth = exports.lineMarkerSize = exports.lineMarkerOffsetFromColumnControls = exports.layoutButtonSize = exports.insertLineWidth = exports.dropTargetsZIndex = exports.dropTargetExtendedWidth = exports.dragTableInsertColumnButtonSize = exports.dragMenuDropdownWidth = exports.contextualMenuTriggerSize = exports.contextualMenuDropdownWidthDnD = exports.contextualMenuDropdownWidth = exports.columnResizeHandleZIndex = exports.columnControlsZIndex = exports.columnControlsSelectedZIndex = exports.columnControlsDecorationHeight = exports.colorPalletteColumns = exports.TABLE_SNAP_GAP = exports.TABLE_HIGHLIGHT_TOLERANCE = exports.TABLE_HIGHLIGHT_GAP = exports.TABLE_GUIDELINE_VISIBLE_ADJUSTMENT = exports.STICKY_HEADER_TOGGLE_TOLERANCE_MS = void 0;
|
|
7
7
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
8
8
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
9
9
|
var _colors = require("@atlaskit/theme/colors");
|
|
@@ -61,6 +61,7 @@ var stickyRowOffsetTop = exports.stickyRowOffsetTop = 8;
|
|
|
61
61
|
var stickyHeaderBorderBottomWidth = exports.stickyHeaderBorderBottomWidth = 1;
|
|
62
62
|
var tableOverflowShadowWidth = exports.tableOverflowShadowWidth = 8;
|
|
63
63
|
var tableOverflowShadowWidthWide = exports.tableOverflowShadowWidthWide = 32;
|
|
64
|
+
var tablePopupMenuFitHeight = exports.tablePopupMenuFitHeight = 188;
|
|
64
65
|
var dropTargetsZIndex = exports.dropTargetsZIndex = 14;
|
|
65
66
|
var TABLE_SNAP_GAP = exports.TABLE_SNAP_GAP = 9;
|
|
66
67
|
var TABLE_HIGHLIGHT_GAP = exports.TABLE_HIGHLIGHT_GAP = 10;
|
|
@@ -5,7 +5,7 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
5
5
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
8
|
-
import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize } from '../consts';
|
|
8
|
+
import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize, tablePopupMenuFitHeight } from '../consts';
|
|
9
9
|
import ContextualMenu from './ContextualMenu';
|
|
10
10
|
import { tablePopupStyles } from './styles';
|
|
11
11
|
const FloatingContextualMenu = ({
|
|
@@ -46,7 +46,7 @@ const FloatingContextualMenu = ({
|
|
|
46
46
|
mountTo: mountPoint,
|
|
47
47
|
boundariesElement: boundariesElement,
|
|
48
48
|
scrollableElement: scrollableElement,
|
|
49
|
-
fitHeight:
|
|
49
|
+
fitHeight: tablePopupMenuFitHeight,
|
|
50
50
|
fitWidth: isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth
|
|
51
51
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
52
52
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
@@ -170,7 +170,12 @@ export const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
170
170
|
pluginConfig,
|
|
171
171
|
intl: {
|
|
172
172
|
formatMessage
|
|
173
|
-
}
|
|
173
|
+
},
|
|
174
|
+
fitHeight,
|
|
175
|
+
fitWidth,
|
|
176
|
+
mountPoint,
|
|
177
|
+
scrollableElement,
|
|
178
|
+
boundariesElement
|
|
174
179
|
}) => {
|
|
175
180
|
var _pluginConfig$allowBa;
|
|
176
181
|
const {
|
|
@@ -457,12 +462,17 @@ export const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
457
462
|
section: {
|
|
458
463
|
hasSeparator: true
|
|
459
464
|
},
|
|
460
|
-
target: target,
|
|
461
465
|
items: menuItems,
|
|
462
466
|
onItemActivated: handleMenuItemActivated,
|
|
463
467
|
onMouseEnter: handleItemMouseEnter,
|
|
464
468
|
onMouseLeave: handleItemMouseLeave,
|
|
465
|
-
handleClose: closeMenu
|
|
469
|
+
handleClose: closeMenu,
|
|
470
|
+
fitHeight: fitHeight,
|
|
471
|
+
fitWidth: fitWidth,
|
|
472
|
+
direction: direction,
|
|
473
|
+
mountPoint: mountPoint,
|
|
474
|
+
boundariesElement: boundariesElement,
|
|
475
|
+
scrollableElement: scrollableElement
|
|
466
476
|
});
|
|
467
477
|
});
|
|
468
478
|
export default injectIntl(DragMenu);
|
|
@@ -1,26 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { DropList, Popup } from '@atlaskit/editor-common/ui';
|
|
3
4
|
import { ArrowKeyNavigationProvider, ArrowKeyNavigationType, DropdownMenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
4
5
|
import { withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
6
|
+
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
5
7
|
import { MenuGroup, Section } from '@atlaskit/menu';
|
|
6
8
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
9
|
import { dragMenuDropdownWidth } from '../consts';
|
|
8
10
|
const DropListWithOutsideListeners = withReactEditorViewOuterListeners(DropList);
|
|
9
11
|
export const DropdownMenu = ({
|
|
10
|
-
target,
|
|
11
12
|
items,
|
|
12
13
|
section,
|
|
13
14
|
disableKeyboardHandling,
|
|
14
15
|
onItemActivated,
|
|
15
16
|
handleClose,
|
|
16
17
|
onMouseEnter,
|
|
17
|
-
onMouseLeave
|
|
18
|
+
onMouseLeave,
|
|
19
|
+
fitWidth,
|
|
20
|
+
fitHeight,
|
|
21
|
+
direction,
|
|
22
|
+
mountPoint,
|
|
23
|
+
boundariesElement,
|
|
24
|
+
scrollableElement
|
|
18
25
|
}) => {
|
|
26
|
+
const [popupPlacement, setPopupPlacement] = useState(['bottom', 'left']);
|
|
27
|
+
const [targetRefDiv, setTargetRefDiv] = useState(null);
|
|
28
|
+
const handleRef = ref => {
|
|
29
|
+
setTargetRefDiv(ref);
|
|
30
|
+
};
|
|
19
31
|
const innerMenu = () => {
|
|
20
32
|
return /*#__PURE__*/React.createElement(DropListWithOutsideListeners, {
|
|
21
33
|
isOpen: true,
|
|
22
34
|
shouldFitContainer: true,
|
|
23
|
-
position:
|
|
35
|
+
position: popupPlacement.join(' '),
|
|
24
36
|
handleClickOutside: () => handleClose('editor'),
|
|
25
37
|
handleEscapeKeydown: () => {
|
|
26
38
|
if (!disableKeyboardHandling) {
|
|
@@ -33,7 +45,7 @@ export const DropdownMenu = ({
|
|
|
33
45
|
e.stopPropagation();
|
|
34
46
|
}
|
|
35
47
|
},
|
|
36
|
-
targetRef:
|
|
48
|
+
targetRef: targetRefDiv
|
|
37
49
|
}, /*#__PURE__*/React.createElement("div", {
|
|
38
50
|
style: {
|
|
39
51
|
height: 0,
|
|
@@ -60,7 +72,29 @@ export const DropdownMenu = ({
|
|
|
60
72
|
if (disableKeyboardHandling) {
|
|
61
73
|
return innerMenu();
|
|
62
74
|
}
|
|
63
|
-
|
|
75
|
+
|
|
76
|
+
// more offsets calculation as offsets depend on the direction and updated placement here
|
|
77
|
+
let offsetY = direction === 'row' ? popupPlacement[0] === 'bottom' ? -8 : -34 : 0;
|
|
78
|
+
let offsetX = direction === 'column' ? popupPlacement[1] === 'left' ? 0 : -7 : 0;
|
|
79
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
className: "drag-dropdown-menu-wrapper"
|
|
81
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
className: "drag-dropdown-menu-popup-ref",
|
|
83
|
+
ref: handleRef
|
|
84
|
+
}), /*#__PURE__*/React.createElement(Popup, {
|
|
85
|
+
target: targetRefDiv,
|
|
86
|
+
mountTo: mountPoint,
|
|
87
|
+
boundariesElement: boundariesElement,
|
|
88
|
+
scrollableElement: scrollableElement,
|
|
89
|
+
onPlacementChanged: placement => {
|
|
90
|
+
setPopupPlacement(placement);
|
|
91
|
+
},
|
|
92
|
+
fitHeight: fitHeight,
|
|
93
|
+
fitWidth: fitWidth,
|
|
94
|
+
zIndex: akEditorFloatingPanelZIndex,
|
|
95
|
+
offset: [offsetX, offsetY],
|
|
96
|
+
allowOutOfBounds: true // required as this popup is child of a parent popup, should be allowed to be out of bound of the parent popup, otherwise horizontal offset is not right
|
|
97
|
+
}, /*#__PURE__*/React.createElement(ArrowKeyNavigationProvider, {
|
|
64
98
|
closeOnTab: true,
|
|
65
99
|
type: ArrowKeyNavigationType.MENU,
|
|
66
100
|
onSelection: index => {
|
|
@@ -105,5 +139,5 @@ export const DropdownMenu = ({
|
|
|
105
139
|
});
|
|
106
140
|
}
|
|
107
141
|
}
|
|
108
|
-
}, innerMenu());
|
|
142
|
+
}, innerMenu())));
|
|
109
143
|
};
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
3
3
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
|
-
import { dragMenuDropdownWidth } from '../consts';
|
|
5
|
+
import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
|
|
6
6
|
import DragMenu from './DragMenu';
|
|
7
7
|
const FloatingDragMenu = ({
|
|
8
8
|
mountPoint,
|
|
@@ -24,12 +24,10 @@ const FloatingDragMenu = ({
|
|
|
24
24
|
}
|
|
25
25
|
const inStickyMode = stickyHeaders === null || stickyHeaders === void 0 ? void 0 : stickyHeaders.sticky;
|
|
26
26
|
const targetHandleRef = direction === 'row' ? document.querySelector('#drag-handle-button-row') : document.querySelector('#drag-handle-button-column');
|
|
27
|
-
const offset = direction === 'row' ? [-9,
|
|
27
|
+
const offset = direction === 'row' ? [-9, 0] : [0, -7];
|
|
28
28
|
if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
// TODO: we will need to adjust the alignment and offset values depending on whether this is a row or column menu.
|
|
33
31
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
34
32
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
35
33
|
alignY: direction === 'row' ? 'start' : undefined,
|
|
@@ -37,7 +35,8 @@ const FloatingDragMenu = ({
|
|
|
37
35
|
mountTo: mountPoint,
|
|
38
36
|
boundariesElement: boundariesElement,
|
|
39
37
|
scrollableElement: scrollableElement,
|
|
40
|
-
fitWidth: dragMenuDropdownWidth
|
|
38
|
+
fitWidth: dragMenuDropdownWidth,
|
|
39
|
+
fitHeight: tablePopupMenuFitHeight
|
|
41
40
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
42
41
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
43
42
|
// In sticky mode, we want to show the menu above the sticky header
|
|
@@ -56,7 +55,12 @@ const FloatingDragMenu = ({
|
|
|
56
55
|
targetCellPosition: targetCellPosition,
|
|
57
56
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
58
57
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
59
|
-
pluginConfig: pluginConfig
|
|
58
|
+
pluginConfig: pluginConfig,
|
|
59
|
+
fitWidth: dragMenuDropdownWidth,
|
|
60
|
+
fitHeight: tablePopupMenuFitHeight,
|
|
61
|
+
mountPoint: mountPoint,
|
|
62
|
+
boundariesElement: boundariesElement,
|
|
63
|
+
scrollableElement: scrollableElement
|
|
60
64
|
}));
|
|
61
65
|
};
|
|
62
66
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
package/dist/es2019/ui/consts.js
CHANGED
|
@@ -56,6 +56,7 @@ export const stickyRowOffsetTop = 8;
|
|
|
56
56
|
export const stickyHeaderBorderBottomWidth = 1;
|
|
57
57
|
export const tableOverflowShadowWidth = 8;
|
|
58
58
|
export const tableOverflowShadowWidthWide = 32;
|
|
59
|
+
export const tablePopupMenuFitHeight = 188;
|
|
59
60
|
export const dropTargetsZIndex = 14;
|
|
60
61
|
export const TABLE_SNAP_GAP = 9;
|
|
61
62
|
export const TABLE_HIGHLIGHT_GAP = 10;
|
|
@@ -5,7 +5,7 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
5
5
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
8
|
-
import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize } from '../consts';
|
|
8
|
+
import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize, tablePopupMenuFitHeight } from '../consts';
|
|
9
9
|
import ContextualMenu from './ContextualMenu';
|
|
10
10
|
import { tablePopupStyles } from './styles';
|
|
11
11
|
var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
@@ -42,7 +42,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
42
42
|
mountTo: mountPoint,
|
|
43
43
|
boundariesElement: boundariesElement,
|
|
44
44
|
scrollableElement: scrollableElement,
|
|
45
|
-
fitHeight:
|
|
45
|
+
fitHeight: tablePopupMenuFitHeight,
|
|
46
46
|
fitWidth: isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth
|
|
47
47
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
48
48
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
@@ -174,7 +174,12 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
174
174
|
getEditorContainerWidth = _ref.getEditorContainerWidth,
|
|
175
175
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
176
176
|
pluginConfig = _ref.pluginConfig,
|
|
177
|
-
formatMessage = _ref.intl.formatMessage
|
|
177
|
+
formatMessage = _ref.intl.formatMessage,
|
|
178
|
+
fitHeight = _ref.fitHeight,
|
|
179
|
+
fitWidth = _ref.fitWidth,
|
|
180
|
+
mountPoint = _ref.mountPoint,
|
|
181
|
+
scrollableElement = _ref.scrollableElement,
|
|
182
|
+
boundariesElement = _ref.boundariesElement;
|
|
178
183
|
var state = editorView.state,
|
|
179
184
|
dispatch = editorView.dispatch;
|
|
180
185
|
var selection = state.selection;
|
|
@@ -446,12 +451,17 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
446
451
|
section: {
|
|
447
452
|
hasSeparator: true
|
|
448
453
|
},
|
|
449
|
-
target: target,
|
|
450
454
|
items: menuItems,
|
|
451
455
|
onItemActivated: handleMenuItemActivated,
|
|
452
456
|
onMouseEnter: handleItemMouseEnter,
|
|
453
457
|
onMouseLeave: handleItemMouseLeave,
|
|
454
|
-
handleClose: closeMenu
|
|
458
|
+
handleClose: closeMenu,
|
|
459
|
+
fitHeight: fitHeight,
|
|
460
|
+
fitWidth: fitWidth,
|
|
461
|
+
direction: direction,
|
|
462
|
+
mountPoint: mountPoint,
|
|
463
|
+
boundariesElement: boundariesElement,
|
|
464
|
+
scrollableElement: scrollableElement
|
|
455
465
|
});
|
|
456
466
|
});
|
|
457
467
|
export default injectIntl(DragMenu);
|
|
@@ -1,25 +1,44 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import { DropList, Popup } from '@atlaskit/editor-common/ui';
|
|
3
5
|
import { ArrowKeyNavigationProvider, ArrowKeyNavigationType, DropdownMenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
4
6
|
import { withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
7
|
+
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
5
8
|
import { MenuGroup, Section } from '@atlaskit/menu';
|
|
6
9
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
10
|
import { dragMenuDropdownWidth } from '../consts';
|
|
8
11
|
var DropListWithOutsideListeners = withReactEditorViewOuterListeners(DropList);
|
|
9
12
|
export var DropdownMenu = function DropdownMenu(_ref) {
|
|
10
|
-
var
|
|
11
|
-
items = _ref.items,
|
|
13
|
+
var items = _ref.items,
|
|
12
14
|
section = _ref.section,
|
|
13
15
|
disableKeyboardHandling = _ref.disableKeyboardHandling,
|
|
14
16
|
onItemActivated = _ref.onItemActivated,
|
|
15
17
|
handleClose = _ref.handleClose,
|
|
16
18
|
onMouseEnter = _ref.onMouseEnter,
|
|
17
|
-
onMouseLeave = _ref.onMouseLeave
|
|
19
|
+
onMouseLeave = _ref.onMouseLeave,
|
|
20
|
+
fitWidth = _ref.fitWidth,
|
|
21
|
+
fitHeight = _ref.fitHeight,
|
|
22
|
+
direction = _ref.direction,
|
|
23
|
+
mountPoint = _ref.mountPoint,
|
|
24
|
+
boundariesElement = _ref.boundariesElement,
|
|
25
|
+
scrollableElement = _ref.scrollableElement;
|
|
26
|
+
var _useState = useState(['bottom', 'left']),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
popupPlacement = _useState2[0],
|
|
29
|
+
setPopupPlacement = _useState2[1];
|
|
30
|
+
var _useState3 = useState(null),
|
|
31
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
|
+
targetRefDiv = _useState4[0],
|
|
33
|
+
setTargetRefDiv = _useState4[1];
|
|
34
|
+
var handleRef = function handleRef(ref) {
|
|
35
|
+
setTargetRefDiv(ref);
|
|
36
|
+
};
|
|
18
37
|
var innerMenu = function innerMenu() {
|
|
19
38
|
return /*#__PURE__*/React.createElement(DropListWithOutsideListeners, {
|
|
20
39
|
isOpen: true,
|
|
21
40
|
shouldFitContainer: true,
|
|
22
|
-
position:
|
|
41
|
+
position: popupPlacement.join(' '),
|
|
23
42
|
handleClickOutside: function handleClickOutside() {
|
|
24
43
|
return handleClose('editor');
|
|
25
44
|
},
|
|
@@ -34,7 +53,7 @@ export var DropdownMenu = function DropdownMenu(_ref) {
|
|
|
34
53
|
e.stopPropagation();
|
|
35
54
|
}
|
|
36
55
|
},
|
|
37
|
-
targetRef:
|
|
56
|
+
targetRef: targetRefDiv
|
|
38
57
|
}, /*#__PURE__*/React.createElement("div", {
|
|
39
58
|
style: {
|
|
40
59
|
height: 0,
|
|
@@ -63,7 +82,29 @@ export var DropdownMenu = function DropdownMenu(_ref) {
|
|
|
63
82
|
if (disableKeyboardHandling) {
|
|
64
83
|
return innerMenu();
|
|
65
84
|
}
|
|
66
|
-
|
|
85
|
+
|
|
86
|
+
// more offsets calculation as offsets depend on the direction and updated placement here
|
|
87
|
+
var offsetY = direction === 'row' ? popupPlacement[0] === 'bottom' ? -8 : -34 : 0;
|
|
88
|
+
var offsetX = direction === 'column' ? popupPlacement[1] === 'left' ? 0 : -7 : 0;
|
|
89
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "drag-dropdown-menu-wrapper"
|
|
91
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: "drag-dropdown-menu-popup-ref",
|
|
93
|
+
ref: handleRef
|
|
94
|
+
}), /*#__PURE__*/React.createElement(Popup, {
|
|
95
|
+
target: targetRefDiv,
|
|
96
|
+
mountTo: mountPoint,
|
|
97
|
+
boundariesElement: boundariesElement,
|
|
98
|
+
scrollableElement: scrollableElement,
|
|
99
|
+
onPlacementChanged: function onPlacementChanged(placement) {
|
|
100
|
+
setPopupPlacement(placement);
|
|
101
|
+
},
|
|
102
|
+
fitHeight: fitHeight,
|
|
103
|
+
fitWidth: fitWidth,
|
|
104
|
+
zIndex: akEditorFloatingPanelZIndex,
|
|
105
|
+
offset: [offsetX, offsetY],
|
|
106
|
+
allowOutOfBounds: true // required as this popup is child of a parent popup, should be allowed to be out of bound of the parent popup, otherwise horizontal offset is not right
|
|
107
|
+
}, /*#__PURE__*/React.createElement(ArrowKeyNavigationProvider, {
|
|
67
108
|
closeOnTab: true,
|
|
68
109
|
type: ArrowKeyNavigationType.MENU,
|
|
69
110
|
onSelection: function onSelection(index) {
|
|
@@ -112,5 +153,5 @@ export var DropdownMenu = function DropdownMenu(_ref) {
|
|
|
112
153
|
});
|
|
113
154
|
}
|
|
114
155
|
}
|
|
115
|
-
}, innerMenu());
|
|
156
|
+
}, innerMenu())));
|
|
116
157
|
};
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
3
3
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
|
-
import { dragMenuDropdownWidth } from '../consts';
|
|
5
|
+
import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
|
|
6
6
|
import DragMenu from './DragMenu';
|
|
7
7
|
var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
8
8
|
var mountPoint = _ref.mountPoint,
|
|
@@ -23,12 +23,10 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
23
23
|
}
|
|
24
24
|
var inStickyMode = stickyHeaders === null || stickyHeaders === void 0 ? void 0 : stickyHeaders.sticky;
|
|
25
25
|
var targetHandleRef = direction === 'row' ? document.querySelector('#drag-handle-button-row') : document.querySelector('#drag-handle-button-column');
|
|
26
|
-
var offset = direction === 'row' ? [-9,
|
|
26
|
+
var offset = direction === 'row' ? [-9, 0] : [0, -7];
|
|
27
27
|
if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
// TODO: we will need to adjust the alignment and offset values depending on whether this is a row or column menu.
|
|
32
30
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
33
31
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
34
32
|
alignY: direction === 'row' ? 'start' : undefined,
|
|
@@ -36,7 +34,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
36
34
|
mountTo: mountPoint,
|
|
37
35
|
boundariesElement: boundariesElement,
|
|
38
36
|
scrollableElement: scrollableElement,
|
|
39
|
-
fitWidth: dragMenuDropdownWidth
|
|
37
|
+
fitWidth: dragMenuDropdownWidth,
|
|
38
|
+
fitHeight: tablePopupMenuFitHeight
|
|
40
39
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
41
40
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
42
41
|
// In sticky mode, we want to show the menu above the sticky header
|
|
@@ -55,7 +54,12 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
55
54
|
targetCellPosition: targetCellPosition,
|
|
56
55
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
57
56
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
58
|
-
pluginConfig: pluginConfig
|
|
57
|
+
pluginConfig: pluginConfig,
|
|
58
|
+
fitWidth: dragMenuDropdownWidth,
|
|
59
|
+
fitHeight: tablePopupMenuFitHeight,
|
|
60
|
+
mountPoint: mountPoint,
|
|
61
|
+
boundariesElement: boundariesElement,
|
|
62
|
+
scrollableElement: scrollableElement
|
|
59
63
|
}));
|
|
60
64
|
};
|
|
61
65
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
package/dist/esm/ui/consts.js
CHANGED
|
@@ -56,6 +56,7 @@ export var stickyRowOffsetTop = 8;
|
|
|
56
56
|
export var stickyHeaderBorderBottomWidth = 1;
|
|
57
57
|
export var tableOverflowShadowWidth = 8;
|
|
58
58
|
export var tableOverflowShadowWidthWide = 32;
|
|
59
|
+
export var tablePopupMenuFitHeight = 188;
|
|
59
60
|
export var dropTargetsZIndex = 14;
|
|
60
61
|
export var TABLE_SNAP_GAP = 9;
|
|
61
62
|
export var TABLE_HIGHLIGHT_GAP = 10;
|
|
@@ -19,8 +19,13 @@ type DragMenuProps = {
|
|
|
19
19
|
pluginConfig?: PluginConfig;
|
|
20
20
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
21
21
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
22
|
+
fitWidth?: number;
|
|
23
|
+
fitHeight?: number;
|
|
24
|
+
mountPoint?: HTMLElement;
|
|
25
|
+
boundariesElement?: HTMLElement;
|
|
26
|
+
scrollableElement?: HTMLElement;
|
|
22
27
|
};
|
|
23
|
-
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
28
|
+
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
24
29
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps<"intl">>> & {
|
|
25
30
|
WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps<"intl">>;
|
|
26
31
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
3
3
|
type DropdownMenuProps = {
|
|
4
|
-
target?: HTMLElement;
|
|
5
4
|
items: Array<{
|
|
6
5
|
items: MenuItem[];
|
|
7
6
|
}>;
|
|
@@ -25,6 +24,13 @@ type DropdownMenuProps = {
|
|
|
25
24
|
onMouseLeave: (attrs: {
|
|
26
25
|
item: MenuItem;
|
|
27
26
|
}) => void;
|
|
27
|
+
fitWidth?: number;
|
|
28
|
+
fitHeight?: number;
|
|
29
|
+
direction?: string;
|
|
30
|
+
offset?: Array<number>;
|
|
31
|
+
mountPoint?: HTMLElement;
|
|
32
|
+
boundariesElement?: HTMLElement;
|
|
33
|
+
scrollableElement?: HTMLElement;
|
|
28
34
|
};
|
|
29
|
-
export declare const DropdownMenu: ({
|
|
35
|
+
export declare const DropdownMenu: ({ items, section, disableKeyboardHandling, onItemActivated, handleClose, onMouseEnter, onMouseLeave, fitWidth, fitHeight, direction, mountPoint, boundariesElement, scrollableElement, }: DropdownMenuProps) => JSX.Element;
|
|
30
36
|
export {};
|
|
@@ -47,6 +47,7 @@ export declare const stickyRowOffsetTop = 8;
|
|
|
47
47
|
export declare const stickyHeaderBorderBottomWidth = 1;
|
|
48
48
|
export declare const tableOverflowShadowWidth = 8;
|
|
49
49
|
export declare const tableOverflowShadowWidthWide = 32;
|
|
50
|
+
export declare const tablePopupMenuFitHeight = 188;
|
|
50
51
|
export declare const dropTargetsZIndex = 14;
|
|
51
52
|
export declare const TABLE_SNAP_GAP = 9;
|
|
52
53
|
export declare const TABLE_HIGHLIGHT_GAP = 10;
|
|
@@ -19,8 +19,13 @@ type DragMenuProps = {
|
|
|
19
19
|
pluginConfig?: PluginConfig;
|
|
20
20
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
21
21
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
22
|
+
fitWidth?: number;
|
|
23
|
+
fitHeight?: number;
|
|
24
|
+
mountPoint?: HTMLElement;
|
|
25
|
+
boundariesElement?: HTMLElement;
|
|
26
|
+
scrollableElement?: HTMLElement;
|
|
22
27
|
};
|
|
23
|
-
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
28
|
+
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
24
29
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps<"intl">>> & {
|
|
25
30
|
WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps<"intl">>;
|
|
26
31
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
3
3
|
type DropdownMenuProps = {
|
|
4
|
-
target?: HTMLElement;
|
|
5
4
|
items: Array<{
|
|
6
5
|
items: MenuItem[];
|
|
7
6
|
}>;
|
|
@@ -25,6 +24,13 @@ type DropdownMenuProps = {
|
|
|
25
24
|
onMouseLeave: (attrs: {
|
|
26
25
|
item: MenuItem;
|
|
27
26
|
}) => void;
|
|
27
|
+
fitWidth?: number;
|
|
28
|
+
fitHeight?: number;
|
|
29
|
+
direction?: string;
|
|
30
|
+
offset?: Array<number>;
|
|
31
|
+
mountPoint?: HTMLElement;
|
|
32
|
+
boundariesElement?: HTMLElement;
|
|
33
|
+
scrollableElement?: HTMLElement;
|
|
28
34
|
};
|
|
29
|
-
export declare const DropdownMenu: ({
|
|
35
|
+
export declare const DropdownMenu: ({ items, section, disableKeyboardHandling, onItemActivated, handleClose, onMouseEnter, onMouseLeave, fitWidth, fitHeight, direction, mountPoint, boundariesElement, scrollableElement, }: DropdownMenuProps) => JSX.Element;
|
|
30
36
|
export {};
|
|
@@ -47,6 +47,7 @@ export declare const stickyRowOffsetTop = 8;
|
|
|
47
47
|
export declare const stickyHeaderBorderBottomWidth = 1;
|
|
48
48
|
export declare const tableOverflowShadowWidth = 8;
|
|
49
49
|
export declare const tableOverflowShadowWidthWide = 32;
|
|
50
|
+
export declare const tablePopupMenuFitHeight = 188;
|
|
50
51
|
export declare const dropTargetsZIndex = 14;
|
|
51
52
|
export declare const TABLE_SNAP_GAP = 9;
|
|
52
53
|
export declare const TABLE_HIGHLIGHT_GAP = 10;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.9",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^35.5.2",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.0.14",
|
|
33
|
-
"@atlaskit/editor-common": "^78.
|
|
33
|
+
"@atlaskit/editor-common": "^78.11.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.5.2",
|
|
35
35
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-content-insertion": "^1.0.0",
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
contextualMenuDropdownWidth,
|
|
26
26
|
contextualMenuDropdownWidthDnD,
|
|
27
27
|
contextualMenuTriggerSize,
|
|
28
|
+
tablePopupMenuFitHeight,
|
|
28
29
|
} from '../consts';
|
|
29
30
|
|
|
30
31
|
import ContextualMenu from './ContextualMenu';
|
|
@@ -91,7 +92,7 @@ const FloatingContextualMenu = ({
|
|
|
91
92
|
mountTo={mountPoint}
|
|
92
93
|
boundariesElement={boundariesElement}
|
|
93
94
|
scrollableElement={scrollableElement}
|
|
94
|
-
fitHeight={
|
|
95
|
+
fitHeight={tablePopupMenuFitHeight}
|
|
95
96
|
fitWidth={
|
|
96
97
|
isDragAndDropEnabled
|
|
97
98
|
? contextualMenuDropdownWidthDnD
|
|
@@ -96,6 +96,11 @@ type DragMenuProps = {
|
|
|
96
96
|
pluginConfig?: PluginConfig;
|
|
97
97
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
98
98
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
99
|
+
fitWidth?: number;
|
|
100
|
+
fitHeight?: number;
|
|
101
|
+
mountPoint?: HTMLElement;
|
|
102
|
+
boundariesElement?: HTMLElement;
|
|
103
|
+
scrollableElement?: HTMLElement;
|
|
99
104
|
};
|
|
100
105
|
|
|
101
106
|
type PluralOptionType = 'noOfCols' | 'noOfRows' | 'noOfCells' | null;
|
|
@@ -269,6 +274,11 @@ export const DragMenu = React.memo(
|
|
|
269
274
|
editorAnalyticsAPI,
|
|
270
275
|
pluginConfig,
|
|
271
276
|
intl: { formatMessage },
|
|
277
|
+
fitHeight,
|
|
278
|
+
fitWidth,
|
|
279
|
+
mountPoint,
|
|
280
|
+
scrollableElement,
|
|
281
|
+
boundariesElement,
|
|
272
282
|
}: DragMenuProps & WrappedComponentProps) => {
|
|
273
283
|
const { state, dispatch } = editorView;
|
|
274
284
|
const { selection } = state;
|
|
@@ -627,12 +637,17 @@ export const DragMenu = React.memo(
|
|
|
627
637
|
<DropdownMenu
|
|
628
638
|
disableKeyboardHandling={isSubmenuOpen}
|
|
629
639
|
section={{ hasSeparator: true }}
|
|
630
|
-
target={target as HTMLElement | undefined}
|
|
631
640
|
items={menuItems}
|
|
632
641
|
onItemActivated={handleMenuItemActivated}
|
|
633
642
|
onMouseEnter={handleItemMouseEnter}
|
|
634
643
|
onMouseLeave={handleItemMouseLeave}
|
|
635
644
|
handleClose={closeMenu}
|
|
645
|
+
fitHeight={fitHeight}
|
|
646
|
+
fitWidth={fitWidth}
|
|
647
|
+
direction={direction}
|
|
648
|
+
mountPoint={mountPoint}
|
|
649
|
+
boundariesElement={boundariesElement}
|
|
650
|
+
scrollableElement={scrollableElement}
|
|
636
651
|
/>
|
|
637
652
|
);
|
|
638
653
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
2
|
+
import React, { useState } from 'react';
|
|
2
3
|
|
|
3
|
-
import { DropList } from '@atlaskit/editor-common/ui';
|
|
4
|
+
import { DropList, Popup } from '@atlaskit/editor-common/ui';
|
|
4
5
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
5
6
|
import {
|
|
6
7
|
ArrowKeyNavigationProvider,
|
|
@@ -8,6 +9,7 @@ import {
|
|
|
8
9
|
DropdownMenuItem,
|
|
9
10
|
} from '@atlaskit/editor-common/ui-menu';
|
|
10
11
|
import { withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
12
|
+
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
11
13
|
import { MenuGroup, Section } from '@atlaskit/menu';
|
|
12
14
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
15
|
|
|
@@ -17,7 +19,6 @@ const DropListWithOutsideListeners =
|
|
|
17
19
|
withReactEditorViewOuterListeners(DropList);
|
|
18
20
|
|
|
19
21
|
type DropdownMenuProps = {
|
|
20
|
-
target?: HTMLElement;
|
|
21
22
|
items: Array<{
|
|
22
23
|
items: MenuItem[];
|
|
23
24
|
}>;
|
|
@@ -34,10 +35,16 @@ type DropdownMenuProps = {
|
|
|
34
35
|
handleClose: (focusTarget: 'editor' | 'handle') => void;
|
|
35
36
|
onMouseEnter: (attrs: { item: MenuItem }) => void;
|
|
36
37
|
onMouseLeave: (attrs: { item: MenuItem }) => void;
|
|
38
|
+
fitWidth?: number;
|
|
39
|
+
fitHeight?: number;
|
|
40
|
+
direction?: string;
|
|
41
|
+
offset?: Array<number>;
|
|
42
|
+
mountPoint?: HTMLElement;
|
|
43
|
+
boundariesElement?: HTMLElement;
|
|
44
|
+
scrollableElement?: HTMLElement;
|
|
37
45
|
};
|
|
38
46
|
|
|
39
47
|
export const DropdownMenu = ({
|
|
40
|
-
target,
|
|
41
48
|
items,
|
|
42
49
|
section,
|
|
43
50
|
disableKeyboardHandling,
|
|
@@ -45,13 +52,24 @@ export const DropdownMenu = ({
|
|
|
45
52
|
handleClose,
|
|
46
53
|
onMouseEnter,
|
|
47
54
|
onMouseLeave,
|
|
55
|
+
fitWidth,
|
|
56
|
+
fitHeight,
|
|
57
|
+
direction,
|
|
58
|
+
mountPoint,
|
|
59
|
+
boundariesElement,
|
|
60
|
+
scrollableElement,
|
|
48
61
|
}: DropdownMenuProps) => {
|
|
62
|
+
const [popupPlacement, setPopupPlacement] = useState(['bottom', 'left']);
|
|
63
|
+
const [targetRefDiv, setTargetRefDiv] = useState<HTMLDivElement | null>(null);
|
|
64
|
+
const handleRef = (ref: HTMLDivElement | null) => {
|
|
65
|
+
setTargetRefDiv(ref);
|
|
66
|
+
};
|
|
49
67
|
const innerMenu = () => {
|
|
50
68
|
return (
|
|
51
69
|
<DropListWithOutsideListeners
|
|
52
70
|
isOpen
|
|
53
71
|
shouldFitContainer
|
|
54
|
-
position={
|
|
72
|
+
position={popupPlacement.join(' ')}
|
|
55
73
|
handleClickOutside={() => handleClose('editor')}
|
|
56
74
|
handleEscapeKeydown={() => {
|
|
57
75
|
if (!disableKeyboardHandling) {
|
|
@@ -64,7 +82,7 @@ export const DropdownMenu = ({
|
|
|
64
82
|
e.stopPropagation();
|
|
65
83
|
}
|
|
66
84
|
}}
|
|
67
|
-
targetRef={
|
|
85
|
+
targetRef={targetRefDiv}
|
|
68
86
|
>
|
|
69
87
|
<div style={{ height: 0, minWidth: dragMenuDropdownWidth }} />
|
|
70
88
|
<MenuGroup role="menu">
|
|
@@ -95,56 +113,82 @@ export const DropdownMenu = ({
|
|
|
95
113
|
return innerMenu();
|
|
96
114
|
}
|
|
97
115
|
|
|
116
|
+
// more offsets calculation as offsets depend on the direction and updated placement here
|
|
117
|
+
let offsetY =
|
|
118
|
+
direction === 'row' ? (popupPlacement[0] === 'bottom' ? -8 : -34) : 0;
|
|
119
|
+
let offsetX =
|
|
120
|
+
direction === 'column' ? (popupPlacement[1] === 'left' ? 0 : -7) : 0;
|
|
121
|
+
|
|
98
122
|
return (
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
123
|
+
<div className="drag-dropdown-menu-wrapper">
|
|
124
|
+
<div className="drag-dropdown-menu-popup-ref" ref={handleRef}></div>
|
|
125
|
+
<Popup
|
|
126
|
+
target={targetRefDiv as HTMLElement}
|
|
127
|
+
mountTo={mountPoint}
|
|
128
|
+
boundariesElement={boundariesElement}
|
|
129
|
+
scrollableElement={scrollableElement}
|
|
130
|
+
onPlacementChanged={(placement: [string, string]) => {
|
|
131
|
+
setPopupPlacement(placement);
|
|
132
|
+
}}
|
|
133
|
+
fitHeight={fitHeight}
|
|
134
|
+
fitWidth={fitWidth}
|
|
135
|
+
zIndex={akEditorFloatingPanelZIndex}
|
|
136
|
+
offset={[offsetX, offsetY]}
|
|
137
|
+
allowOutOfBounds // required as this popup is child of a parent popup, should be allowed to be out of bound of the parent popup, otherwise horizontal offset is not right
|
|
138
|
+
>
|
|
139
|
+
<ArrowKeyNavigationProvider
|
|
140
|
+
closeOnTab
|
|
141
|
+
type={ArrowKeyNavigationType.MENU}
|
|
142
|
+
onSelection={(index) => {
|
|
143
|
+
const results = items.flatMap((item) =>
|
|
144
|
+
'items' in item ? item.items : item,
|
|
145
|
+
);
|
|
106
146
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
147
|
+
// onSelection is called when any focusable element is 'activated'
|
|
148
|
+
// this is an issue as some menu items have toggles, which cause the index value
|
|
149
|
+
// in the callback to be outside of array length.
|
|
150
|
+
// The logic below normalises the index value based on the number
|
|
151
|
+
// of menu items with 2 focusable elements, and adjusts the index to ensure
|
|
152
|
+
// the correct menu item is sent in onItemActivated callback
|
|
153
|
+
if (
|
|
154
|
+
getBooleanFF(
|
|
155
|
+
'platform.editor.table.new-cell-context-menu-styling',
|
|
156
|
+
)
|
|
157
|
+
) {
|
|
158
|
+
const keys = ['row_numbers', 'header_row', 'header_column'];
|
|
159
|
+
let doubleItemCount = 0;
|
|
118
160
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
161
|
+
const firstIndex = results.findIndex((value) =>
|
|
162
|
+
keys.includes(value.key!),
|
|
163
|
+
);
|
|
122
164
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
165
|
+
if (firstIndex === -1 || index <= firstIndex) {
|
|
166
|
+
onItemActivated && onItemActivated({ item: results[index] });
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
127
169
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
170
|
+
for (let i = firstIndex; i < results.length; i += 1) {
|
|
171
|
+
if (keys.includes(results[i].key!)) {
|
|
172
|
+
doubleItemCount += 1;
|
|
173
|
+
}
|
|
174
|
+
if (firstIndex % 2 === 0 && index - doubleItemCount === i) {
|
|
175
|
+
onItemActivated && onItemActivated({ item: results[i] });
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
136
178
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
179
|
+
if (firstIndex % 2 === 1 && index - doubleItemCount === i) {
|
|
180
|
+
onItemActivated && onItemActivated({ item: results[i] });
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
185
|
+
onItemActivated && onItemActivated({ item: results[index] });
|
|
140
186
|
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
>
|
|
147
|
-
{innerMenu()}
|
|
148
|
-
</ArrowKeyNavigationProvider>
|
|
187
|
+
}}
|
|
188
|
+
>
|
|
189
|
+
{innerMenu()}
|
|
190
|
+
</ArrowKeyNavigationProvider>
|
|
191
|
+
</Popup>
|
|
192
|
+
</div>
|
|
149
193
|
);
|
|
150
194
|
};
|
|
@@ -13,7 +13,7 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
|
13
13
|
|
|
14
14
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
15
15
|
import type { PluginConfig, TableDirection } from '../../types';
|
|
16
|
-
import { dragMenuDropdownWidth } from '../consts';
|
|
16
|
+
import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
|
|
17
17
|
|
|
18
18
|
import DragMenu from './DragMenu';
|
|
19
19
|
|
|
@@ -63,7 +63,7 @@ const FloatingDragMenu = ({
|
|
|
63
63
|
? document.querySelector('#drag-handle-button-row')
|
|
64
64
|
: document.querySelector('#drag-handle-button-column');
|
|
65
65
|
|
|
66
|
-
const offset = direction === 'row' ? [-9,
|
|
66
|
+
const offset = direction === 'row' ? [-9, 0] : [0, -7];
|
|
67
67
|
|
|
68
68
|
if (
|
|
69
69
|
!targetHandleRef ||
|
|
@@ -72,7 +72,6 @@ const FloatingDragMenu = ({
|
|
|
72
72
|
return null;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
// TODO: we will need to adjust the alignment and offset values depending on whether this is a row or column menu.
|
|
76
75
|
return (
|
|
77
76
|
<Popup
|
|
78
77
|
alignX={direction === 'row' ? 'right' : undefined}
|
|
@@ -82,6 +81,7 @@ const FloatingDragMenu = ({
|
|
|
82
81
|
boundariesElement={boundariesElement}
|
|
83
82
|
scrollableElement={scrollableElement}
|
|
84
83
|
fitWidth={dragMenuDropdownWidth}
|
|
84
|
+
fitHeight={tablePopupMenuFitHeight}
|
|
85
85
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
86
86
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
87
87
|
// In sticky mode, we want to show the menu above the sticky header
|
|
@@ -105,6 +105,11 @@ const FloatingDragMenu = ({
|
|
|
105
105
|
getEditorContainerWidth={getEditorContainerWidth}
|
|
106
106
|
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
107
107
|
pluginConfig={pluginConfig}
|
|
108
|
+
fitWidth={dragMenuDropdownWidth}
|
|
109
|
+
fitHeight={tablePopupMenuFitHeight}
|
|
110
|
+
mountPoint={mountPoint}
|
|
111
|
+
boundariesElement={boundariesElement}
|
|
112
|
+
scrollableElement={scrollableElement}
|
|
108
113
|
/>
|
|
109
114
|
</Popup>
|
|
110
115
|
);
|
package/src/ui/consts.ts
CHANGED
|
@@ -125,6 +125,7 @@ export const stickyRowOffsetTop = 8;
|
|
|
125
125
|
export const stickyHeaderBorderBottomWidth = 1;
|
|
126
126
|
export const tableOverflowShadowWidth = 8;
|
|
127
127
|
export const tableOverflowShadowWidthWide = 32;
|
|
128
|
+
export const tablePopupMenuFitHeight = 188;
|
|
128
129
|
|
|
129
130
|
export const dropTargetsZIndex = 14;
|
|
130
131
|
|