@atlaskit/editor-plugin-block-controls 1.11.2 → 1.12.0

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/commands/move-node.js +22 -6
  3. package/dist/cjs/pm-plugins/decorations.js +10 -8
  4. package/dist/cjs/pm-plugins/main.js +3 -4
  5. package/dist/cjs/ui/consts.js +6 -2
  6. package/dist/cjs/ui/drag-handle.js +11 -3
  7. package/dist/cjs/ui/drop-target.js +3 -3
  8. package/dist/cjs/utils/drag-handle-positions.js +3 -3
  9. package/dist/cjs/utils/validation.js +74 -3
  10. package/dist/es2019/commands/move-node.js +25 -7
  11. package/dist/es2019/pm-plugins/decorations.js +11 -9
  12. package/dist/es2019/pm-plugins/main.js +3 -4
  13. package/dist/es2019/ui/consts.js +5 -1
  14. package/dist/es2019/ui/drag-handle.js +11 -3
  15. package/dist/es2019/ui/drop-target.js +3 -3
  16. package/dist/es2019/utils/drag-handle-positions.js +3 -3
  17. package/dist/es2019/utils/validation.js +73 -2
  18. package/dist/esm/commands/move-node.js +24 -7
  19. package/dist/esm/pm-plugins/decorations.js +11 -9
  20. package/dist/esm/pm-plugins/main.js +3 -4
  21. package/dist/esm/ui/consts.js +5 -1
  22. package/dist/esm/ui/drag-handle.js +11 -3
  23. package/dist/esm/ui/drop-target.js +3 -3
  24. package/dist/esm/utils/drag-handle-positions.js +3 -3
  25. package/dist/esm/utils/validation.js +71 -2
  26. package/dist/types/pm-plugins/decorations.d.ts +2 -2
  27. package/dist/types/types.d.ts +9 -15
  28. package/dist/types/ui/consts.d.ts +2 -1
  29. package/dist/types/utils/drag-handle-positions.d.ts +1 -1
  30. package/dist/types/utils/validation.d.ts +16 -1
  31. package/dist/types-ts4.5/pm-plugins/decorations.d.ts +2 -2
  32. package/dist/types-ts4.5/types.d.ts +9 -15
  33. package/dist/types-ts4.5/ui/consts.d.ts +2 -1
  34. package/dist/types-ts4.5/utils/drag-handle-positions.d.ts +1 -1
  35. package/dist/types-ts4.5/utils/validation.d.ts +16 -1
  36. package/package.json +4 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 1.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#130247](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/130247)
8
+ [`c331860f119e6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c331860f119e6) -
9
+ ED-24455 add suport for drag expand drop into table
10
+
11
+ ### Patch Changes
12
+
13
+ - [#130406](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/130406)
14
+ [`487b48abdae42`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/487b48abdae42) -
15
+ ED-24554 Don't show handle for indented tasks
16
+ - [#130260](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/130260)
17
+ [`d338ce6e4ff6e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d338ce6e4ff6e) -
18
+ Reduce drag handle gap for nested elements
19
+ - Updated dependencies
20
+
3
21
  ## 1.11.2
4
22
 
5
23
  ### Patch Changes
@@ -18,11 +18,24 @@ var _utils2 = require("../utils");
18
18
  var _validation = require("../utils/validation");
19
19
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
20
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
- function transformNested(nodeCopy, destType) {
21
+ /**
22
+ * This function transforms the slice to move
23
+ * @param nodeCopy The slice contains the node to be moved
24
+ * @param destType The type of the destiation node
25
+ * @returns transformed slice or null if unable to
26
+ */
27
+ function transformSourceSlice(nodeCopy, destType) {
22
28
  var srcNode = nodeCopy.content.firstChild;
23
29
  var schema = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.schema;
24
- if (srcNode && schema && srcNode.type === schema.nodes.nestedExpand && destType === schema.nodes.doc) {
25
- return (0, _transforms.transformSliceNestedExpandToExpand)(nodeCopy, schema);
30
+ if (srcNode && schema) {
31
+ var _schema$nodes = schema.nodes,
32
+ doc = _schema$nodes.doc,
33
+ layoutColumn = _schema$nodes.layoutColumn;
34
+ if (srcNode.type === schema.nodes.nestedExpand && [doc, layoutColumn].includes(destType)) {
35
+ return (0, _transforms.transformSliceNestedExpandToExpand)(nodeCopy, schema);
36
+ } else if (srcNode.type === schema.nodes.expand && (0, _validation.isInsideTable)(destType)) {
37
+ return (0, _validation.transformSliceExpandToNestedExpand)(nodeCopy);
38
+ }
26
39
  }
27
40
  return nodeCopy;
28
41
  }
@@ -120,16 +133,19 @@ var moveNode = exports.moveNode = function moveNode(api) {
120
133
  var end = start + size;
121
134
  var mappedTo;
122
135
  if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
136
+ var _transformSourceSlice;
123
137
  var nodeCopy = tr.doc.slice(start, end, false); // cut the content
124
138
  var $to = tr.doc.resolve(to);
125
139
  var $from = tr.doc.resolve(start);
126
140
  var destType = $to.node().type;
127
- var srcType = $from.node().child($from.index()).type;
128
141
  var destParent = $to.node($to.depth);
129
- if (!(0, _validation.canMoveToIndex)(destParent, $to.index(), srcType)) {
142
+ if (!(0, _validation.canMoveNodeToIndex)(destParent, $to.index(), $from.node().child($from.index()))) {
143
+ return tr;
144
+ }
145
+ var convertedNode = (_transformSourceSlice = transformSourceSlice(nodeCopy, destType)) === null || _transformSourceSlice === void 0 ? void 0 : _transformSourceSlice.content;
146
+ if (!convertedNode) {
130
147
  return tr;
131
148
  }
132
- var convertedNode = transformNested(nodeCopy, destType).content;
133
149
  tr.delete(start, end); // delete the content from the original position
134
150
  mappedTo = tr.mapping.map(to);
135
151
  tr.insert(mappedTo, convertedNode); // insert the content at the new position
@@ -16,8 +16,8 @@ var _dragHandle = require("../ui/drag-handle");
16
16
  var _dropTarget = require("../ui/drop-target");
17
17
  var _dragTargetDebug = require("../utils/drag-target-debug");
18
18
  var _validation = require("../utils/validation");
19
- var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem'];
20
- var IGNORE_NODES_AND_DESCENDANTS = ['listItem'];
19
+ var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
20
+ var IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList'];
21
21
  var PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand'];
22
22
  var getNestedDepth = function getNestedDepth() {
23
23
  return (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested') ? 100 : 0;
@@ -34,16 +34,17 @@ var createDropTargetDecoration = function createDropTargetDecoration(pos, dropTa
34
34
  side: -1
35
35
  });
36
36
  };
37
- var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetDecorations(oldState, newState, api, formatMessage, activeNodeType) {
37
+ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetDecorations(newState, api, formatMessage, activeNode) {
38
38
  var decs = [];
39
39
  unmountDecorations('data-blocks-drop-target-container');
40
40
  // Decoration state is used to keep track of the position of the drop targets
41
41
  // and allows us to easily map the updated position in the plugin apply method.
42
42
  var decorationState = [];
43
43
  var prevNode;
44
+ var activeNodePos = activeNode === null || activeNode === void 0 ? void 0 : activeNode.pos;
45
+ var activePMNode = typeof activeNodePos === 'number' && newState.doc.resolve(activeNodePos).nodeAfter;
44
46
  newState.doc.nodesBetween(0, newState.doc.nodeSize - 2, function (node, pos, parent, index) {
45
47
  var depth = 0;
46
- var nodeType = newState.doc.type.schema.nodes[activeNodeType];
47
48
  var endDec = null;
48
49
  if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
49
50
  depth = newState.doc.resolve(pos).depth;
@@ -55,7 +56,7 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
55
56
  prevNode = node;
56
57
  return true; //skip over, don't consider it a valid depth
57
58
  }
58
- var canDrop = activeNodeType && (0, _validation.canMoveToIndex)(parent, index, nodeType);
59
+ var canDrop = activePMNode && (0, _validation.canMoveNodeToIndex)(parent, index, activePMNode);
59
60
 
60
61
  //NOTE: This will block drop targets showing for nodes that are valid after transformation (i.e. expand -> nestedExpand)
61
62
  if (!canDrop && !(0, _dragTargetDebug.isBlocksDragTargetDebug)()) {
@@ -154,13 +155,14 @@ var nodeDecorations = exports.nodeDecorations = function nodeDecorations(newStat
154
155
  var _Decoration$node2;
155
156
  var depth = 0;
156
157
  var anchorName;
158
+ var shouldDescend = !IGNORE_NODE_DESCENDANTS.includes(node.type.name);
157
159
  if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
158
160
  // Doesn't descend into a node
159
- if (node.isInline || IGNORE_NODES_AND_DESCENDANTS.includes((parent === null || parent === void 0 ? void 0 : parent.type.name) || '')) {
161
+ if (node.isInline) {
160
162
  return false;
161
163
  }
162
164
  if (IGNORE_NODES.includes(node.type.name)) {
163
- return true; //skip over, don't consider it a valid depth
165
+ return shouldDescend; //skip over, don't consider it a valid depth
164
166
  }
165
167
  depth = newState.doc.resolve(pos).depth;
166
168
  anchorName = "--node-anchor-".concat(node.type.name, "-").concat(pos);
@@ -172,7 +174,7 @@ var nodeDecorations = exports.nodeDecorations = function nodeDecorations(newStat
172
174
  }, (0, _defineProperty2.default)(_Decoration$node2, 'data-drag-handler-anchor-name', anchorName), (0, _defineProperty2.default)(_Decoration$node2, 'data-drag-handler-node-type', node.type.name), (0, _defineProperty2.default)(_Decoration$node2, 'data-drag-handler-anchor-depth', "".concat(depth)), _Decoration$node2), {
173
175
  type: 'node-decoration'
174
176
  }));
175
- return depth < getNestedDepth();
177
+ return shouldDescend && depth < getNestedDepth();
176
178
  });
177
179
  return decs;
178
180
  };
@@ -92,7 +92,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
92
92
  return initialState;
93
93
  },
94
94
  apply: function apply(tr, currentState, oldState, newState) {
95
- var _meta$activeNode, _meta$activeNode$hand, _activeNodeWithNewNod, _meta$activeNode3, _meta$isDragging, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging;
95
+ var _meta$activeNode, _meta$activeNode$hand, _activeNodeWithNewNod, _meta$activeNode2, _meta$isDragging, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging;
96
96
  var activeNode = currentState.activeNode,
97
97
  decorations = currentState.decorations,
98
98
  isMenuOpen = currentState.isMenuOpen,
@@ -237,8 +237,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
237
237
  // Add drop targets when node is being dragged
238
238
  // if the transaction is only for analytics and user is dragging, continue to draw drop targets
239
239
  if (shouldUpdateDropTargets || (0, _dragTargetDebug.isBlocksDragTargetDebug)()) {
240
- var _meta$activeNode2;
241
- var _dropTargetDecoration = (0, _decorations.dropTargetDecorations)(oldState, newState, api, formatMessage, meta === null || meta === void 0 || (_meta$activeNode2 = meta.activeNode) === null || _meta$activeNode2 === void 0 ? void 0 : _meta$activeNode2.nodeType),
240
+ var _dropTargetDecoration = (0, _decorations.dropTargetDecorations)(newState, api, formatMessage, meta === null || meta === void 0 ? void 0 : meta.activeNode),
242
241
  _decs2 = _dropTargetDecoration.decs,
243
242
  updatedDecorationState = _dropTargetDecoration.decorationState;
244
243
  decorationState = updatedDecorationState;
@@ -280,7 +279,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
280
279
  return {
281
280
  decorations: decorations,
282
281
  decorationState: decorationState,
283
- activeNode: isEmptyDoc || isHandleMissing ? null : (_meta$activeNode3 = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode3 !== void 0 ? _meta$activeNode3 : mappedActiveNodePos,
282
+ activeNode: isEmptyDoc || isHandleMissing ? null : (_meta$activeNode2 = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode2 !== void 0 ? _meta$activeNode2 : mappedActiveNodePos,
284
283
  isDragging: (_meta$isDragging = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging !== void 0 ? _meta$isDragging : isDragging,
285
284
  isMenuOpen: meta !== null && meta !== void 0 && meta.toggleMenu ? !isMenuOpen : isMenuOpen,
286
285
  editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : currentState.editorHeight,
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.topPositionAdjustment = exports.spaceLookupMap = exports.nodeMargins = exports.dragHandleGap = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_BORDER_RADIUS = void 0;
7
+ exports.topPositionAdjustment = exports.spaceLookupMap = exports.nodeMargins = exports.dragHandleGap = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_BORDER_RADIUS = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
10
10
  var _dropTargetMarginMap;
@@ -13,12 +13,16 @@ var DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_WIDTH = 12;
13
13
  var DRAG_HANDLE_BORDER_RADIUS = exports.DRAG_HANDLE_BORDER_RADIUS = 4;
14
14
  var DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_ZINDEX = _editorSharedStyles.akRichMediaResizeZIndex + _editorSharedStyles.akEditorUnitZIndex; //place above legacy resizer
15
15
  var DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_DEFAULT_GAP = 8;
16
+ var DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_NARROW_GAP = 4;
16
17
  var DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_MAX_GAP = 12;
17
18
  var DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = DRAG_HANDLE_WIDTH + DRAG_HANDLE_MAX_GAP;
18
19
  var DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = 4 + 2; // 4px for the divider vertical padding and 2px for the divider height
19
20
 
20
21
  var nodeTypeExcludeList = ['embedCard', 'mediaSingle', 'table'];
21
- var dragHandleGap = exports.dragHandleGap = function dragHandleGap(nodeType) {
22
+ var dragHandleGap = exports.dragHandleGap = function dragHandleGap(nodeType, parentNodeType) {
23
+ if (parentNodeType && parentNodeType !== 'doc') {
24
+ return DRAG_HANDLE_NARROW_GAP;
25
+ }
22
26
  if (nodeTypeExcludeList.includes(nodeType)) {
23
27
  return DRAG_HANDLE_MAX_GAP;
24
28
  }
@@ -253,6 +253,14 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
253
253
  }, [anchorName, api, nodeType, view, start]);
254
254
  var macroInteractionUpdates = featureFlagsState === null || featureFlagsState === void 0 ? void 0 : featureFlagsState.macroInteractionUpdates;
255
255
  var calculatePosition = (0, _react.useCallback)(function () {
256
+ var parentNodeType;
257
+ if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
258
+ var pos = getPos();
259
+ var $pos = pos && view.state.doc.resolve(pos);
260
+ var parentPos = $pos && $pos.depth ? $pos.before() : undefined;
261
+ var node = parentPos !== undefined ? view.state.doc.nodeAt(parentPos) : undefined;
262
+ parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
263
+ }
256
264
  var supportsAnchor = CSS.supports('top', "anchor(".concat(anchorName, " start)")) && CSS.supports('left', "anchor(".concat(anchorName, " start)"));
257
265
  var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(anchorName, "\"]"));
258
266
  var hasResizer = nodeType === 'table' || nodeType === 'mediaSingle';
@@ -274,15 +282,15 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
274
282
  }
275
283
  if (supportsAnchor) {
276
284
  return {
277
- left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType), "px)"),
285
+ left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType, parentNodeType), "px)"),
278
286
  top: (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_ed_23674') ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _consts.topPositionAdjustment)(nodeType), "px)") : anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(_consts.DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
279
287
  };
280
288
  }
281
289
  return {
282
- left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates), ")") : (0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates),
290
+ left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : (0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType),
283
291
  top: (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_ed_23674') ? (0, _dragHandlePositions.getTopPosition)(dom, nodeType) : (0, _dragHandlePositions.getTopPosition)(dom)
284
292
  };
285
- }, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates]);
293
+ }, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates, getPos]);
286
294
  var _useState5 = (0, _react.useState)({
287
295
  display: 'none'
288
296
  }),
@@ -68,11 +68,11 @@ var getDropTargetOffsetStyle = function getDropTargetOffsetStyle(prevNode, nextN
68
68
  }
69
69
  var top = getNodeMargins(nextNode).top;
70
70
  var bottom = getNodeMargins(prevNode).bottom;
71
- var merginDiff = Math.round((top - bottom) / 2);
72
- if (merginDiff === 0) {
71
+ var marginDiff = Math.round((top - bottom) / 2);
72
+ if (marginDiff === 0) {
73
73
  return null;
74
74
  }
75
- var offset = Math.max(Math.min(merginDiff, 24), -24);
75
+ var offset = Math.max(Math.min(marginDiff, 24), -24);
76
76
  return marginLookupMap[offset];
77
77
  };
78
78
  var DropTarget = exports.DropTarget = function DropTarget(_ref3) {
@@ -18,17 +18,17 @@ var getTopPosition = exports.getTopPosition = function getTopPosition(dom, type)
18
18
  return "".concat(dom.offsetTop, "px");
19
19
  }
20
20
  };
21
- var getLeftPosition = exports.getLeftPosition = function getLeftPosition(dom, type, innerContainer, macroInteractionUpdates) {
21
+ var getLeftPosition = exports.getLeftPosition = function getLeftPosition(dom, type, innerContainer, macroInteractionUpdates, parentType) {
22
22
  if (!dom) {
23
23
  return 'auto';
24
24
  }
25
25
  if (!innerContainer) {
26
- return "".concat(dom.offsetLeft - (0, _consts.dragHandleGap)(type) - _consts.DRAG_HANDLE_WIDTH, "px");
26
+ return "".concat(dom.offsetLeft - (0, _consts.dragHandleGap)(type, parentType) - _consts.DRAG_HANDLE_WIDTH, "px");
27
27
  }
28
28
 
29
29
  // There is a showMacroInteractionDesignUpdates prop in extension node wrapper that can add a relative span under the top level div
30
30
  // We need to adjust the left offset position of the drag handle to account for the relative span
31
31
  var relativeSpan = macroInteractionUpdates ? dom.querySelector('span.relative') : null;
32
32
  var leftAdjustment = relativeSpan ? relativeSpan.offsetLeft : 0;
33
- return getComputedStyle(innerContainer).transform === 'none' ? "".concat(innerContainer.offsetLeft + leftAdjustment - (0, _consts.dragHandleGap)(type) - _consts.DRAG_HANDLE_WIDTH, "px") : "".concat(innerContainer.offsetLeft + leftAdjustment - innerContainer.offsetWidth / 2 - (0, _consts.dragHandleGap)(type) - _consts.DRAG_HANDLE_WIDTH, "px");
33
+ return getComputedStyle(innerContainer).transform === 'none' ? "".concat(innerContainer.offsetLeft + leftAdjustment - (0, _consts.dragHandleGap)(type, parentType) - _consts.DRAG_HANDLE_WIDTH, "px") : "".concat(innerContainer.offsetLeft + leftAdjustment - innerContainer.offsetWidth / 2 - (0, _consts.dragHandleGap)(type, parentType) - _consts.DRAG_HANDLE_WIDTH, "px");
34
34
  };
@@ -1,9 +1,80 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.canMoveToIndex = canMoveToIndex;
7
- function canMoveToIndex(destParent, indexIntoParent, srcType) {
8
- return destParent.canReplaceWith(indexIntoParent, indexIntoParent, srcType);
7
+ exports.canMoveNodeToIndex = canMoveNodeToIndex;
8
+ exports.transformSliceExpandToNestedExpand = exports.transformExpandToNestedExpand = exports.memoizedTransformExpandToNestedExpand = exports.isNestedExpand = exports.isInsideTable = exports.isExpand = exports.isDoc = void 0;
9
+ var _memoizeOne = _interopRequireDefault(require("memoize-one"));
10
+ var _model = require("@atlaskit/editor-prosemirror/model");
11
+ var isInsideTable = exports.isInsideTable = function isInsideTable(nodeType) {
12
+ var _nodeType$schema$node = nodeType.schema.nodes,
13
+ tableCell = _nodeType$schema$node.tableCell,
14
+ tableHeader = _nodeType$schema$node.tableHeader;
15
+ return [tableCell, tableHeader].indexOf(nodeType) >= 0;
16
+ };
17
+ var isDoc = exports.isDoc = function isDoc(nodeType) {
18
+ return nodeType === nodeType.schema.nodes.doc;
19
+ };
20
+ var isExpand = exports.isExpand = function isExpand(nodeType) {
21
+ return nodeType === nodeType.schema.nodes.expand;
22
+ };
23
+ var isNestedExpand = exports.isNestedExpand = function isNestedExpand(nodeType) {
24
+ return nodeType === nodeType.schema.nodes.nestedExpand;
25
+ };
26
+
27
+ /**
28
+ * This function converts an expand into a nested expand,
29
+ * although it may fail based on the expand's content.
30
+ * @param expandNode the node to transform.
31
+ * @returns an nested expand node
32
+ * @throws RangeError: Invalid content for node nestedExpand
33
+ */
34
+ var transformExpandToNestedExpand = exports.transformExpandToNestedExpand = function transformExpandToNestedExpand(expandNode) {
35
+ var _expandNode$type$sche = expandNode.type.schema.nodes,
36
+ expand = _expandNode$type$sche.expand,
37
+ nestedExpand = _expandNode$type$sche.nestedExpand;
38
+ if (expandNode.type === expand) {
39
+ return nestedExpand.createChecked(expandNode.attrs, expandNode.content, expandNode.marks);
40
+ }
41
+ return null;
42
+ };
43
+ var transformSliceExpandToNestedExpand = exports.transformSliceExpandToNestedExpand = function transformSliceExpandToNestedExpand(slice) {
44
+ var children = [];
45
+ try {
46
+ slice.content.forEach(function (node) {
47
+ if (isExpand(node.type)) {
48
+ var nestedExpandNode = transformExpandToNestedExpand(node);
49
+ if (nestedExpandNode) {
50
+ children.push(nestedExpandNode);
51
+ }
52
+ } else {
53
+ children.push(node);
54
+ }
55
+ });
56
+ } catch (e) {
57
+ return null;
58
+ }
59
+ return new _model.Slice(_model.Fragment.fromArray(children), slice.openStart, slice.openEnd);
60
+ };
61
+ var memoizedTransformExpandToNestedExpand = exports.memoizedTransformExpandToNestedExpand = (0, _memoizeOne.default)(function (node) {
62
+ try {
63
+ return transformExpandToNestedExpand(node);
64
+ } catch (e) {
65
+ return null;
66
+ }
67
+ });
68
+ function canMoveNodeToIndex(destParent, indexIntoParent, srcNode) {
69
+ var srcNodeType = srcNode.type;
70
+ if (isInsideTable(destParent.type) && isExpand(srcNodeType)) {
71
+ if (memoizedTransformExpandToNestedExpand(srcNode)) {
72
+ srcNodeType = srcNodeType.schema.nodes.nestedExpand;
73
+ } else {
74
+ return false;
75
+ }
76
+ } else if (isDoc(destParent.type) && isNestedExpand(srcNodeType)) {
77
+ srcNodeType = srcNodeType.schema.nodes.expand;
78
+ }
79
+ return destParent.canReplaceWith(indexIntoParent, indexIntoParent, srcNodeType);
9
80
  }
@@ -7,12 +7,27 @@ import { fg } from '@atlaskit/platform-feature-flags';
7
7
  import { DIRECTION } from '../consts';
8
8
  import { key } from '../pm-plugins/main';
9
9
  import { selectNode } from '../utils';
10
- import { canMoveToIndex } from '../utils/validation';
11
- function transformNested(nodeCopy, destType) {
10
+ import { canMoveNodeToIndex, isInsideTable, transformSliceExpandToNestedExpand } from '../utils/validation';
11
+
12
+ /**
13
+ * This function transforms the slice to move
14
+ * @param nodeCopy The slice contains the node to be moved
15
+ * @param destType The type of the destiation node
16
+ * @returns transformed slice or null if unable to
17
+ */
18
+ function transformSourceSlice(nodeCopy, destType) {
12
19
  const srcNode = nodeCopy.content.firstChild;
13
20
  const schema = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.schema;
14
- if (srcNode && schema && srcNode.type === schema.nodes.nestedExpand && destType === schema.nodes.doc) {
15
- return transformSliceNestedExpandToExpand(nodeCopy, schema);
21
+ if (srcNode && schema) {
22
+ const {
23
+ doc,
24
+ layoutColumn
25
+ } = schema.nodes;
26
+ if (srcNode.type === schema.nodes.nestedExpand && [doc, layoutColumn].includes(destType)) {
27
+ return transformSliceNestedExpandToExpand(nodeCopy, schema);
28
+ } else if (srcNode.type === schema.nodes.expand && isInsideTable(destType)) {
29
+ return transformSliceExpandToNestedExpand(nodeCopy);
30
+ }
16
31
  }
17
32
  return nodeCopy;
18
33
  }
@@ -112,16 +127,19 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
112
127
  const end = start + size;
113
128
  let mappedTo;
114
129
  if (fg('platform_editor_elements_dnd_nested')) {
130
+ var _transformSourceSlice;
115
131
  const nodeCopy = tr.doc.slice(start, end, false); // cut the content
116
132
  const $to = tr.doc.resolve(to);
117
133
  const $from = tr.doc.resolve(start);
118
134
  const destType = $to.node().type;
119
- const srcType = $from.node().child($from.index()).type;
120
135
  const destParent = $to.node($to.depth);
121
- if (!canMoveToIndex(destParent, $to.index(), srcType)) {
136
+ if (!canMoveNodeToIndex(destParent, $to.index(), $from.node().child($from.index()))) {
137
+ return tr;
138
+ }
139
+ const convertedNode = (_transformSourceSlice = transformSourceSlice(nodeCopy, destType)) === null || _transformSourceSlice === void 0 ? void 0 : _transformSourceSlice.content;
140
+ if (!convertedNode) {
122
141
  return tr;
123
142
  }
124
- const convertedNode = transformNested(nodeCopy, destType).content;
125
143
  tr.delete(start, end); // delete the content from the original position
126
144
  mappedTo = tr.mapping.map(to);
127
145
  tr.insert(mappedTo, convertedNode); // insert the content at the new position
@@ -7,9 +7,9 @@ import { fg } from '@atlaskit/platform-feature-flags';
7
7
  import { DragHandle } from '../ui/drag-handle';
8
8
  import { DropTarget } from '../ui/drop-target';
9
9
  import { isBlocksDragTargetDebug } from '../utils/drag-target-debug';
10
- import { canMoveToIndex } from '../utils/validation';
11
- const IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem'];
12
- const IGNORE_NODES_AND_DESCENDANTS = ['listItem'];
10
+ import { canMoveNodeToIndex } from '../utils/validation';
11
+ const IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
12
+ const IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList'];
13
13
  const PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand'];
14
14
  const getNestedDepth = () => fg('platform_editor_elements_dnd_nested') ? 100 : 0;
15
15
  const createDropTargetDecoration = (pos, dropTargetDec) => {
@@ -24,16 +24,17 @@ const createDropTargetDecoration = (pos, dropTargetDec) => {
24
24
  side: -1
25
25
  });
26
26
  };
27
- export const dropTargetDecorations = (oldState, newState, api, formatMessage, activeNodeType) => {
27
+ export const dropTargetDecorations = (newState, api, formatMessage, activeNode) => {
28
28
  const decs = [];
29
29
  unmountDecorations('data-blocks-drop-target-container');
30
30
  // Decoration state is used to keep track of the position of the drop targets
31
31
  // and allows us to easily map the updated position in the plugin apply method.
32
32
  const decorationState = [];
33
33
  let prevNode;
34
+ const activeNodePos = activeNode === null || activeNode === void 0 ? void 0 : activeNode.pos;
35
+ const activePMNode = typeof activeNodePos === 'number' && newState.doc.resolve(activeNodePos).nodeAfter;
34
36
  newState.doc.nodesBetween(0, newState.doc.nodeSize - 2, (node, pos, parent, index) => {
35
37
  let depth = 0;
36
- const nodeType = newState.doc.type.schema.nodes[activeNodeType];
37
38
  let endDec = null;
38
39
  if (fg('platform_editor_elements_dnd_nested')) {
39
40
  depth = newState.doc.resolve(pos).depth;
@@ -45,7 +46,7 @@ export const dropTargetDecorations = (oldState, newState, api, formatMessage, ac
45
46
  prevNode = node;
46
47
  return true; //skip over, don't consider it a valid depth
47
48
  }
48
- const canDrop = activeNodeType && canMoveToIndex(parent, index, nodeType);
49
+ const canDrop = activePMNode && canMoveNodeToIndex(parent, index, activePMNode);
49
50
 
50
51
  //NOTE: This will block drop targets showing for nodes that are valid after transformation (i.e. expand -> nestedExpand)
51
52
  if (!canDrop && !isBlocksDragTargetDebug()) {
@@ -144,13 +145,14 @@ export const nodeDecorations = newState => {
144
145
  newState.doc.descendants((node, pos, parent, index) => {
145
146
  let depth = 0;
146
147
  let anchorName;
148
+ const shouldDescend = !IGNORE_NODE_DESCENDANTS.includes(node.type.name);
147
149
  if (fg('platform_editor_elements_dnd_nested')) {
148
150
  // Doesn't descend into a node
149
- if (node.isInline || IGNORE_NODES_AND_DESCENDANTS.includes((parent === null || parent === void 0 ? void 0 : parent.type.name) || '')) {
151
+ if (node.isInline) {
150
152
  return false;
151
153
  }
152
154
  if (IGNORE_NODES.includes(node.type.name)) {
153
- return true; //skip over, don't consider it a valid depth
155
+ return shouldDescend; //skip over, don't consider it a valid depth
154
156
  }
155
157
  depth = newState.doc.resolve(pos).depth;
156
158
  anchorName = `--node-anchor-${node.type.name}-${pos}`;
@@ -165,7 +167,7 @@ export const nodeDecorations = newState => {
165
167
  }, {
166
168
  type: 'node-decoration'
167
169
  }));
168
- return depth < getNestedDepth();
170
+ return shouldDescend && depth < getNestedDepth();
169
171
  });
170
172
  return decs;
171
173
  };
@@ -86,7 +86,7 @@ export const createPlugin = (api, getIntl) => {
86
86
  return initialState;
87
87
  },
88
88
  apply(tr, currentState, oldState, newState) {
89
- var _meta$activeNode, _meta$activeNode$hand, _activeNodeWithNewNod, _meta$activeNode3, _meta$isDragging, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging;
89
+ var _meta$activeNode, _meta$activeNode$hand, _activeNodeWithNewNod, _meta$activeNode2, _meta$isDragging, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging;
90
90
  let {
91
91
  activeNode,
92
92
  decorations,
@@ -219,11 +219,10 @@ export const createPlugin = (api, getIntl) => {
219
219
  // Add drop targets when node is being dragged
220
220
  // if the transaction is only for analytics and user is dragging, continue to draw drop targets
221
221
  if (shouldUpdateDropTargets || isBlocksDragTargetDebug()) {
222
- var _meta$activeNode2;
223
222
  const {
224
223
  decs,
225
224
  decorationState: updatedDecorationState
226
- } = dropTargetDecorations(oldState, newState, api, formatMessage, meta === null || meta === void 0 ? void 0 : (_meta$activeNode2 = meta.activeNode) === null || _meta$activeNode2 === void 0 ? void 0 : _meta$activeNode2.nodeType);
225
+ } = dropTargetDecorations(newState, api, formatMessage, meta === null || meta === void 0 ? void 0 : meta.activeNode);
227
226
  decorationState = updatedDecorationState;
228
227
  decorations = decorations.add(newState.doc, decs);
229
228
  }
@@ -263,7 +262,7 @@ export const createPlugin = (api, getIntl) => {
263
262
  return {
264
263
  decorations,
265
264
  decorationState,
266
- activeNode: isEmptyDoc || isHandleMissing ? null : (_meta$activeNode3 = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode3 !== void 0 ? _meta$activeNode3 : mappedActiveNodePos,
265
+ activeNode: isEmptyDoc || isHandleMissing ? null : (_meta$activeNode2 = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode2 !== void 0 ? _meta$activeNode2 : mappedActiveNodePos,
267
266
  isDragging: (_meta$isDragging = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging !== void 0 ? _meta$isDragging : isDragging,
268
267
  isMenuOpen: meta !== null && meta !== void 0 && meta.toggleMenu ? !isMenuOpen : isMenuOpen,
269
268
  editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : currentState.editorHeight,
@@ -4,12 +4,16 @@ export const DRAG_HANDLE_WIDTH = 12;
4
4
  export const DRAG_HANDLE_BORDER_RADIUS = 4;
5
5
  export const DRAG_HANDLE_ZINDEX = akRichMediaResizeZIndex + akEditorUnitZIndex; //place above legacy resizer
6
6
  export const DRAG_HANDLE_DEFAULT_GAP = 8;
7
+ export const DRAG_HANDLE_NARROW_GAP = 4;
7
8
  export const DRAG_HANDLE_MAX_GAP = 12;
8
9
  export const DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = DRAG_HANDLE_WIDTH + DRAG_HANDLE_MAX_GAP;
9
10
  export const DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = 4 + 2; // 4px for the divider vertical padding and 2px for the divider height
10
11
 
11
12
  const nodeTypeExcludeList = ['embedCard', 'mediaSingle', 'table'];
12
- export const dragHandleGap = nodeType => {
13
+ export const dragHandleGap = (nodeType, parentNodeType) => {
14
+ if (parentNodeType && parentNodeType !== 'doc') {
15
+ return DRAG_HANDLE_NARROW_GAP;
16
+ }
13
17
  if (nodeTypeExcludeList.includes(nodeType)) {
14
18
  return DRAG_HANDLE_MAX_GAP;
15
19
  }
@@ -241,6 +241,14 @@ const DragHandleInternal = ({
241
241
  }, [anchorName, api, nodeType, view, start]);
242
242
  const macroInteractionUpdates = featureFlagsState === null || featureFlagsState === void 0 ? void 0 : featureFlagsState.macroInteractionUpdates;
243
243
  const calculatePosition = useCallback(() => {
244
+ let parentNodeType;
245
+ if (fg('platform_editor_elements_dnd_nested')) {
246
+ const pos = getPos();
247
+ const $pos = pos && view.state.doc.resolve(pos);
248
+ const parentPos = $pos && $pos.depth ? $pos.before() : undefined;
249
+ const node = parentPos !== undefined ? view.state.doc.nodeAt(parentPos) : undefined;
250
+ parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
251
+ }
244
252
  const supportsAnchor = CSS.supports('top', `anchor(${anchorName} start)`) && CSS.supports('left', `anchor(${anchorName} start)`);
245
253
  const dom = view.dom.querySelector(`[data-drag-handler-anchor-name="${anchorName}"]`);
246
254
  const hasResizer = nodeType === 'table' || nodeType === 'mediaSingle';
@@ -262,15 +270,15 @@ const DragHandleInternal = ({
262
270
  }
263
271
  if (supportsAnchor) {
264
272
  return {
265
- left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? `calc(anchor(${anchorName} start) + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates)})` : `calc(anchor(${anchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType)}px)`,
273
+ left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? `calc(anchor(${anchorName} start) + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType)})` : `calc(anchor(${anchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType, parentNodeType)}px)`,
266
274
  top: fg('platform_editor_elements_dnd_ed_23674') ? `calc(anchor(${anchorName} start) + ${topPositionAdjustment(nodeType)}px)` : anchorName.includes('table') ? `calc(anchor(${anchorName} start) + ${DRAG_HANDLE_HEIGHT}px)` : `anchor(${anchorName} start)`
267
275
  };
268
276
  }
269
277
  return {
270
- left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? `calc(${(dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0}px + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates)})` : getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates),
278
+ left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? `calc(${(dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0}px + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType)})` : getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType),
271
279
  top: fg('platform_editor_elements_dnd_ed_23674') ? getTopPosition(dom, nodeType) : getTopPosition(dom)
272
280
  };
273
- }, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates]);
281
+ }, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates, getPos]);
274
282
  const [positionStyles, setPositionStyles] = useState({
275
283
  display: 'none'
276
284
  });
@@ -53,11 +53,11 @@ const getDropTargetOffsetStyle = (prevNode, nextNode) => {
53
53
  }
54
54
  const top = getNodeMargins(nextNode).top;
55
55
  const bottom = getNodeMargins(prevNode).bottom;
56
- const merginDiff = Math.round((top - bottom) / 2);
57
- if (merginDiff === 0) {
56
+ const marginDiff = Math.round((top - bottom) / 2);
57
+ if (marginDiff === 0) {
58
58
  return null;
59
59
  }
60
- const offset = Math.max(Math.min(merginDiff, 24), -24);
60
+ const offset = Math.max(Math.min(marginDiff, 24), -24);
61
61
  return marginLookupMap[offset];
62
62
  };
63
63
  export const DropTarget = ({
@@ -12,17 +12,17 @@ export const getTopPosition = (dom, type) => {
12
12
  return `${dom.offsetTop}px`;
13
13
  }
14
14
  };
15
- export const getLeftPosition = (dom, type, innerContainer, macroInteractionUpdates) => {
15
+ export const getLeftPosition = (dom, type, innerContainer, macroInteractionUpdates, parentType) => {
16
16
  if (!dom) {
17
17
  return 'auto';
18
18
  }
19
19
  if (!innerContainer) {
20
- return `${dom.offsetLeft - dragHandleGap(type) - DRAG_HANDLE_WIDTH}px`;
20
+ return `${dom.offsetLeft - dragHandleGap(type, parentType) - DRAG_HANDLE_WIDTH}px`;
21
21
  }
22
22
 
23
23
  // There is a showMacroInteractionDesignUpdates prop in extension node wrapper that can add a relative span under the top level div
24
24
  // We need to adjust the left offset position of the drag handle to account for the relative span
25
25
  const relativeSpan = macroInteractionUpdates ? dom.querySelector('span.relative') : null;
26
26
  const leftAdjustment = relativeSpan ? relativeSpan.offsetLeft : 0;
27
- return getComputedStyle(innerContainer).transform === 'none' ? `${innerContainer.offsetLeft + leftAdjustment - dragHandleGap(type) - DRAG_HANDLE_WIDTH}px` : `${innerContainer.offsetLeft + leftAdjustment - innerContainer.offsetWidth / 2 - dragHandleGap(type) - DRAG_HANDLE_WIDTH}px`;
27
+ return getComputedStyle(innerContainer).transform === 'none' ? `${innerContainer.offsetLeft + leftAdjustment - dragHandleGap(type, parentType) - DRAG_HANDLE_WIDTH}px` : `${innerContainer.offsetLeft + leftAdjustment - innerContainer.offsetWidth / 2 - dragHandleGap(type, parentType) - DRAG_HANDLE_WIDTH}px`;
28
28
  };