@atlaskit/editor-plugin-table 7.6.12 → 7.6.14

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.6.14
4
+
5
+ ### Patch Changes
6
+
7
+ - [#89135](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/89135) [`134b3db4945d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/134b3db4945d) - fix drag menu flicker issue
8
+
9
+ ## 7.6.13
10
+
11
+ ### Patch Changes
12
+
13
+ - [#88770](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88770) [`c86d9e7941f1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c86d9e7941f1) - [ux] fixing the numbered columns blue insert line indicator with correct length
14
+
3
15
  ## 7.6.12
4
16
 
5
17
  ### Patch Changes
@@ -13,6 +13,7 @@ var _uiMenu = require("@atlaskit/editor-common/ui-menu");
13
13
  var _uiReact = require("@atlaskit/editor-common/ui-react");
14
14
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
15
15
  var _menu = require("@atlaskit/menu");
16
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
17
  var _consts = require("../consts");
17
18
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
18
19
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -24,7 +25,7 @@ var DropdownMenu = exports.DropdownMenu = function DropdownMenu(_ref) {
24
25
  section = _ref.section,
25
26
  disableKeyboardHandling = _ref.disableKeyboardHandling,
26
27
  onItemActivated = _ref.onItemActivated,
27
- handleClose = _ref.handleClose,
28
+ _handleClose = _ref.handleClose,
28
29
  onMouseEnter = _ref.onMouseEnter,
29
30
  onMouseLeave = _ref.onMouseLeave,
30
31
  fitWidth = _ref.fitWidth,
@@ -44,17 +45,21 @@ var DropdownMenu = exports.DropdownMenu = function DropdownMenu(_ref) {
44
45
  var handleRef = function handleRef(ref) {
45
46
  setTargetRefDiv(ref);
46
47
  };
48
+
49
+ // more offsets calculation as offsets depend on the direction and updated placement here
50
+ var offsetY = direction === 'row' ? popupPlacement[0] === 'bottom' ? -8 : -34 : 0;
51
+ var offsetX = direction === 'column' ? popupPlacement[1] === 'left' ? 0 : -7 : 0;
47
52
  var innerMenu = function innerMenu() {
48
53
  return /*#__PURE__*/_react.default.createElement(DropListWithOutsideListeners, {
49
54
  isOpen: true,
50
55
  shouldFitContainer: true,
51
56
  position: popupPlacement.join(' '),
52
57
  handleClickOutside: function handleClickOutside() {
53
- return handleClose('editor');
58
+ return _handleClose('editor');
54
59
  },
55
60
  handleEscapeKeydown: function handleEscapeKeydown() {
56
61
  if (!disableKeyboardHandling) {
57
- handleClose('handle');
62
+ _handleClose('handle');
58
63
  }
59
64
  },
60
65
  handleEnterKeydown: function handleEnterKeydown(e) {
@@ -90,12 +95,31 @@ var DropdownMenu = exports.DropdownMenu = function DropdownMenu(_ref) {
90
95
  })));
91
96
  };
92
97
  if (disableKeyboardHandling) {
93
- return innerMenu();
98
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.background-color-flicker-in-drag-menu')) {
99
+ // This part need be refactor when clean up the ff, to reuse the wrapper
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
+ }, innerMenu()));
119
+ } else {
120
+ return innerMenu();
121
+ }
94
122
  }
95
-
96
- // more offsets calculation as offsets depend on the direction and updated placement here
97
- var offsetY = direction === 'row' ? popupPlacement[0] === 'bottom' ? -8 : -34 : 0;
98
- var offsetX = direction === 'column' ? popupPlacement[1] === 'left' ? 0 : -7 : 0;
99
123
  return /*#__PURE__*/_react.default.createElement("div", {
100
124
  className: "drag-dropdown-menu-wrapper"
101
125
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -117,6 +141,9 @@ var DropdownMenu = exports.DropdownMenu = function DropdownMenu(_ref) {
117
141
  }, /*#__PURE__*/_react.default.createElement(_uiMenu.ArrowKeyNavigationProvider, {
118
142
  closeOnTab: true,
119
143
  type: _uiMenu.ArrowKeyNavigationType.MENU,
144
+ handleClose: function handleClose() {
145
+ return _handleClose('handle');
146
+ },
120
147
  onSelection: function onSelection(index) {
121
148
  var results = items.flatMap(function (item) {
122
149
  return 'items' in item ? item.items : item;
@@ -34,6 +34,13 @@ var getToolbarSize = function getToolbarSize(tableRef) {
34
34
  }
35
35
  return _consts.tableToolbarSize;
36
36
  };
37
+ var getNumberColumnWidth = function getNumberColumnWidth(tableRef, isDragAndDropEnabled) {
38
+ var parent = (0, _utils.closestElement)(tableRef, ".".concat(_types.TableCssClassName.TABLE_CONTAINER));
39
+ if (parent && isDragAndDropEnabled) {
40
+ return parent.querySelector(".".concat(_types.TableCssClassName.NUMBERED_COLUMN)) ? _editorSharedStyles.akEditorTableNumberColumnWidth - 1 : 0;
41
+ }
42
+ return 0;
43
+ };
37
44
  var getInsertLineWidth = function getInsertLineWidth(tableRef, isDragAndDropEnabled) {
38
45
  // The line gets width 100% from the table,
39
46
  // but since we have an overflow on the left,
@@ -48,7 +55,7 @@ var getInsertLineWidth = function getInsertLineWidth(tableRef, isDragAndDropEnab
48
55
  var diff = offsetWidth - parentOffsetWidth;
49
56
  var toolbarSize = isDragAndDropEnabled ? 0 : getToolbarSize(tableRef);
50
57
  var lineOffset = isDragAndDropEnabled ? DRAG_LINE_OFFSET : LINE_OFFSET;
51
- return Math.min(offsetWidth + toolbarSize, parentOffsetWidth + toolbarSize - Math.max(scrollLeft - diff, 0)) + lineOffset;
58
+ return Math.min(offsetWidth + toolbarSize, parentOffsetWidth + toolbarSize - Math.max(scrollLeft - diff, 0)) + lineOffset + getNumberColumnWidth(tableRef, isDragAndDropEnabled);
52
59
  };
53
60
  var tooltipMessageByType = function tooltipMessageByType(type) {
54
61
  return type === 'row' ? _messages.tableMessages.insertRow : _messages.tableMessages.insertColumn;
@@ -5,6 +5,7 @@ import { ArrowKeyNavigationProvider, ArrowKeyNavigationType, DropdownMenuItem }
5
5
  import { withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
6
6
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
7
7
  import { MenuGroup, Section } from '@atlaskit/menu';
8
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
9
  import { dragMenuDropdownWidth } from '../consts';
9
10
  const DropListWithOutsideListeners = withReactEditorViewOuterListeners(DropList);
10
11
  export const DropdownMenu = ({
@@ -27,6 +28,10 @@ export const DropdownMenu = ({
27
28
  const handleRef = ref => {
28
29
  setTargetRefDiv(ref);
29
30
  };
31
+
32
+ // more offsets calculation as offsets depend on the direction and updated placement here
33
+ let offsetY = direction === 'row' ? popupPlacement[0] === 'bottom' ? -8 : -34 : 0;
34
+ let offsetX = direction === 'column' ? popupPlacement[1] === 'left' ? 0 : -7 : 0;
30
35
  const innerMenu = () => {
31
36
  return /*#__PURE__*/React.createElement(DropListWithOutsideListeners, {
32
37
  isOpen: true,
@@ -69,12 +74,31 @@ export const DropdownMenu = ({
69
74
  })))));
70
75
  };
71
76
  if (disableKeyboardHandling) {
72
- return innerMenu();
77
+ if (getBooleanFF('platform.editor.table.background-color-flicker-in-drag-menu')) {
78
+ // This part need be refactor when clean up the ff, to reuse the wrapper
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
+ }, innerMenu()));
98
+ } else {
99
+ return innerMenu();
100
+ }
73
101
  }
74
-
75
- // more offsets calculation as offsets depend on the direction and updated placement here
76
- let offsetY = direction === 'row' ? popupPlacement[0] === 'bottom' ? -8 : -34 : 0;
77
- let offsetX = direction === 'column' ? popupPlacement[1] === 'left' ? 0 : -7 : 0;
78
102
  return /*#__PURE__*/React.createElement("div", {
79
103
  className: "drag-dropdown-menu-wrapper"
80
104
  }, /*#__PURE__*/React.createElement("div", {
@@ -96,6 +120,7 @@ export const DropdownMenu = ({
96
120
  }, /*#__PURE__*/React.createElement(ArrowKeyNavigationProvider, {
97
121
  closeOnTab: true,
98
122
  type: ArrowKeyNavigationType.MENU,
123
+ handleClose: () => handleClose('handle'),
99
124
  onSelection: index => {
100
125
  const results = items.flatMap(item => 'items' in item ? item.items : item);
101
126
 
@@ -26,6 +26,13 @@ const getToolbarSize = tableRef => {
26
26
  }
27
27
  return tableToolbarSize;
28
28
  };
29
+ const getNumberColumnWidth = (tableRef, isDragAndDropEnabled) => {
30
+ const parent = closestElement(tableRef, `.${ClassName.TABLE_CONTAINER}`);
31
+ if (parent && isDragAndDropEnabled) {
32
+ return parent.querySelector(`.${ClassName.NUMBERED_COLUMN}`) ? akEditorTableNumberColumnWidth - 1 : 0;
33
+ }
34
+ return 0;
35
+ };
29
36
  const getInsertLineWidth = (tableRef, isDragAndDropEnabled) => {
30
37
  // The line gets width 100% from the table,
31
38
  // but since we have an overflow on the left,
@@ -43,7 +50,7 @@ const getInsertLineWidth = (tableRef, isDragAndDropEnabled) => {
43
50
  const diff = offsetWidth - parentOffsetWidth;
44
51
  const toolbarSize = isDragAndDropEnabled ? 0 : getToolbarSize(tableRef);
45
52
  const lineOffset = isDragAndDropEnabled ? DRAG_LINE_OFFSET : LINE_OFFSET;
46
- return Math.min(offsetWidth + toolbarSize, parentOffsetWidth + toolbarSize - Math.max(scrollLeft - diff, 0)) + lineOffset;
53
+ return Math.min(offsetWidth + toolbarSize, parentOffsetWidth + toolbarSize - Math.max(scrollLeft - diff, 0)) + lineOffset + getNumberColumnWidth(tableRef, isDragAndDropEnabled);
47
54
  };
48
55
  const tooltipMessageByType = type => {
49
56
  return type === 'row' ? messages.insertRow : messages.insertColumn;
@@ -6,6 +6,7 @@ import { ArrowKeyNavigationProvider, ArrowKeyNavigationType, DropdownMenuItem }
6
6
  import { withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
7
7
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
8
8
  import { MenuGroup, Section } from '@atlaskit/menu';
9
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
10
  import { dragMenuDropdownWidth } from '../consts';
10
11
  var DropListWithOutsideListeners = withReactEditorViewOuterListeners(DropList);
11
12
  export var DropdownMenu = function DropdownMenu(_ref) {
@@ -13,7 +14,7 @@ export var DropdownMenu = function DropdownMenu(_ref) {
13
14
  section = _ref.section,
14
15
  disableKeyboardHandling = _ref.disableKeyboardHandling,
15
16
  onItemActivated = _ref.onItemActivated,
16
- handleClose = _ref.handleClose,
17
+ _handleClose = _ref.handleClose,
17
18
  onMouseEnter = _ref.onMouseEnter,
18
19
  onMouseLeave = _ref.onMouseLeave,
19
20
  fitWidth = _ref.fitWidth,
@@ -33,17 +34,21 @@ export var DropdownMenu = function DropdownMenu(_ref) {
33
34
  var handleRef = function handleRef(ref) {
34
35
  setTargetRefDiv(ref);
35
36
  };
37
+
38
+ // more offsets calculation as offsets depend on the direction and updated placement here
39
+ var offsetY = direction === 'row' ? popupPlacement[0] === 'bottom' ? -8 : -34 : 0;
40
+ var offsetX = direction === 'column' ? popupPlacement[1] === 'left' ? 0 : -7 : 0;
36
41
  var innerMenu = function innerMenu() {
37
42
  return /*#__PURE__*/React.createElement(DropListWithOutsideListeners, {
38
43
  isOpen: true,
39
44
  shouldFitContainer: true,
40
45
  position: popupPlacement.join(' '),
41
46
  handleClickOutside: function handleClickOutside() {
42
- return handleClose('editor');
47
+ return _handleClose('editor');
43
48
  },
44
49
  handleEscapeKeydown: function handleEscapeKeydown() {
45
50
  if (!disableKeyboardHandling) {
46
- handleClose('handle');
51
+ _handleClose('handle');
47
52
  }
48
53
  },
49
54
  handleEnterKeydown: function handleEnterKeydown(e) {
@@ -79,12 +84,31 @@ export var DropdownMenu = function DropdownMenu(_ref) {
79
84
  })));
80
85
  };
81
86
  if (disableKeyboardHandling) {
82
- return innerMenu();
87
+ if (getBooleanFF('platform.editor.table.background-color-flicker-in-drag-menu')) {
88
+ // This part need be refactor when clean up the ff, to reuse the wrapper
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
+ }, innerMenu()));
108
+ } else {
109
+ return innerMenu();
110
+ }
83
111
  }
84
-
85
- // more offsets calculation as offsets depend on the direction and updated placement here
86
- var offsetY = direction === 'row' ? popupPlacement[0] === 'bottom' ? -8 : -34 : 0;
87
- var offsetX = direction === 'column' ? popupPlacement[1] === 'left' ? 0 : -7 : 0;
88
112
  return /*#__PURE__*/React.createElement("div", {
89
113
  className: "drag-dropdown-menu-wrapper"
90
114
  }, /*#__PURE__*/React.createElement("div", {
@@ -106,6 +130,9 @@ export var DropdownMenu = function DropdownMenu(_ref) {
106
130
  }, /*#__PURE__*/React.createElement(ArrowKeyNavigationProvider, {
107
131
  closeOnTab: true,
108
132
  type: ArrowKeyNavigationType.MENU,
133
+ handleClose: function handleClose() {
134
+ return _handleClose('handle');
135
+ },
109
136
  onSelection: function onSelection(index) {
110
137
  var results = items.flatMap(function (item) {
111
138
  return 'items' in item ? item.items : item;
@@ -27,6 +27,13 @@ var getToolbarSize = function getToolbarSize(tableRef) {
27
27
  }
28
28
  return tableToolbarSize;
29
29
  };
30
+ var getNumberColumnWidth = function getNumberColumnWidth(tableRef, isDragAndDropEnabled) {
31
+ var parent = closestElement(tableRef, ".".concat(ClassName.TABLE_CONTAINER));
32
+ if (parent && isDragAndDropEnabled) {
33
+ return parent.querySelector(".".concat(ClassName.NUMBERED_COLUMN)) ? akEditorTableNumberColumnWidth - 1 : 0;
34
+ }
35
+ return 0;
36
+ };
30
37
  var getInsertLineWidth = function getInsertLineWidth(tableRef, isDragAndDropEnabled) {
31
38
  // The line gets width 100% from the table,
32
39
  // but since we have an overflow on the left,
@@ -41,7 +48,7 @@ var getInsertLineWidth = function getInsertLineWidth(tableRef, isDragAndDropEnab
41
48
  var diff = offsetWidth - parentOffsetWidth;
42
49
  var toolbarSize = isDragAndDropEnabled ? 0 : getToolbarSize(tableRef);
43
50
  var lineOffset = isDragAndDropEnabled ? DRAG_LINE_OFFSET : LINE_OFFSET;
44
- return Math.min(offsetWidth + toolbarSize, parentOffsetWidth + toolbarSize - Math.max(scrollLeft - diff, 0)) + lineOffset;
51
+ return Math.min(offsetWidth + toolbarSize, parentOffsetWidth + toolbarSize - Math.max(scrollLeft - diff, 0)) + lineOffset + getNumberColumnWidth(tableRef, isDragAndDropEnabled);
45
52
  };
46
53
  var tooltipMessageByType = function tooltipMessageByType(type) {
47
54
  return type === 'row' ? messages.insertRow : messages.insertColumn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.6.12",
3
+ "version": "7.6.14",
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.8.0",
32
32
  "@atlaskit/custom-steps": "^0.0.17",
33
- "@atlaskit/editor-common": "^78.24.0",
33
+ "@atlaskit/editor-common": "^78.25.0",
34
34
  "@atlaskit/editor-palette": "1.5.3",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^1.0.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.0.0",
@@ -52,7 +52,7 @@
52
52
  "@atlaskit/theme": "^12.7.0",
53
53
  "@atlaskit/toggle": "^13.0.0",
54
54
  "@atlaskit/tokens": "^1.43.0",
55
- "@atlaskit/tooltip": "^18.1.0",
55
+ "@atlaskit/tooltip": "^18.2.0",
56
56
  "@babel/runtime": "^7.0.0",
57
57
  "@emotion/react": "^11.7.1",
58
58
  "classnames": "^2.2.5",
@@ -136,6 +136,9 @@
136
136
  "platform.editor.transform-slice-for-nested-expand": {
137
137
  "type": "boolean"
138
138
  },
139
+ "platform.editor.table.background-color-flicker-in-drag-menu": {
140
+ "type": "boolean"
141
+ },
139
142
  "platform.editor.table.cmd-a-select-table": {
140
143
  "type": "boolean"
141
144
  },
@@ -11,6 +11,7 @@ import {
11
11
  import { withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
12
12
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
13
13
  import { MenuGroup, Section } from '@atlaskit/menu';
14
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
15
 
15
16
  import { dragMenuDropdownWidth } from '../consts';
16
17
 
@@ -63,6 +64,13 @@ export const DropdownMenu = ({
63
64
  const handleRef = (ref: HTMLDivElement | null) => {
64
65
  setTargetRefDiv(ref);
65
66
  };
67
+
68
+ // more offsets calculation as offsets depend on the direction and updated placement here
69
+ let offsetY =
70
+ direction === 'row' ? (popupPlacement[0] === 'bottom' ? -8 : -34) : 0;
71
+ let offsetX =
72
+ direction === 'column' ? (popupPlacement[1] === 'left' ? 0 : -7) : 0;
73
+
66
74
  const innerMenu = () => {
67
75
  return (
68
76
  <DropListWithOutsideListeners
@@ -109,15 +117,38 @@ export const DropdownMenu = ({
109
117
  };
110
118
 
111
119
  if (disableKeyboardHandling) {
112
- return innerMenu();
120
+ if (
121
+ getBooleanFF(
122
+ 'platform.editor.table.background-color-flicker-in-drag-menu',
123
+ )
124
+ ) {
125
+ // This part need be refactor when clean up the ff, to reuse the wrapper
126
+ return (
127
+ <div className="drag-dropdown-menu-wrapper">
128
+ <div className="drag-dropdown-menu-popup-ref" ref={handleRef}></div>
129
+ <Popup
130
+ target={targetRefDiv as HTMLElement}
131
+ mountTo={mountPoint}
132
+ boundariesElement={boundariesElement}
133
+ scrollableElement={scrollableElement}
134
+ onPlacementChanged={(placement: [string, string]) => {
135
+ setPopupPlacement(placement);
136
+ }}
137
+ fitHeight={fitHeight}
138
+ fitWidth={fitWidth}
139
+ zIndex={akEditorFloatingPanelZIndex}
140
+ offset={[offsetX, offsetY]}
141
+ 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
142
+ >
143
+ {innerMenu()}
144
+ </Popup>
145
+ </div>
146
+ );
147
+ } else {
148
+ return innerMenu();
149
+ }
113
150
  }
114
151
 
115
- // more offsets calculation as offsets depend on the direction and updated placement here
116
- let offsetY =
117
- direction === 'row' ? (popupPlacement[0] === 'bottom' ? -8 : -34) : 0;
118
- let offsetX =
119
- direction === 'column' ? (popupPlacement[1] === 'left' ? 0 : -7) : 0;
120
-
121
152
  return (
122
153
  <div className="drag-dropdown-menu-wrapper">
123
154
  <div className="drag-dropdown-menu-popup-ref" ref={handleRef}></div>
@@ -138,6 +169,7 @@ export const DropdownMenu = ({
138
169
  <ArrowKeyNavigationProvider
139
170
  closeOnTab
140
171
  type={ArrowKeyNavigationType.MENU}
172
+ handleClose={() => handleClose('handle')}
141
173
  onSelection={(index) => {
142
174
  const results = items.flatMap((item) =>
143
175
  'items' in item ? item.items : item,
@@ -58,6 +58,19 @@ const getToolbarSize = (tableRef: HTMLElement): number => {
58
58
  return tableToolbarSize;
59
59
  };
60
60
 
61
+ const getNumberColumnWidth = (
62
+ tableRef: HTMLElement,
63
+ isDragAndDropEnabled?: boolean,
64
+ ): number => {
65
+ const parent = closestElement(tableRef, `.${ClassName.TABLE_CONTAINER}`);
66
+ if (parent && isDragAndDropEnabled) {
67
+ return parent.querySelector(`.${ClassName.NUMBERED_COLUMN}`)
68
+ ? akEditorTableNumberColumnWidth - 1
69
+ : 0;
70
+ }
71
+ return 0;
72
+ };
73
+
61
74
  const getInsertLineWidth = (
62
75
  tableRef: HTMLElement,
63
76
  isDragAndDropEnabled?: boolean,
@@ -78,7 +91,9 @@ const getInsertLineWidth = (
78
91
  Math.min(
79
92
  offsetWidth + toolbarSize,
80
93
  parentOffsetWidth + toolbarSize - Math.max(scrollLeft - diff, 0),
81
- ) + lineOffset
94
+ ) +
95
+ lineOffset +
96
+ getNumberColumnWidth(tableRef, isDragAndDropEnabled)
82
97
  );
83
98
  };
84
99