@atlaskit/editor-plugin-block-controls 2.13.10 → 2.13.11

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,12 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 2.13.11
4
+
5
+ ### Patch Changes
6
+
7
+ - [`dda502e353b44`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dda502e353b44) -
8
+ [ux] [ED-25317] Implement drag and drop a layout column within the same layout section
9
+
3
10
  ## 2.13.10
4
11
 
5
12
  ### Patch Changes
@@ -8,6 +8,7 @@ var _model = require("@atlaskit/editor-prosemirror/model");
8
8
  var _state = require("@atlaskit/editor-prosemirror/state");
9
9
  var _consts = require("../consts");
10
10
  var _consts2 = require("../ui/consts");
11
+ var _validation = require("../utils/validation");
11
12
  var createNewLayout = function createNewLayout(schema, layoutContents) {
12
13
  if (layoutContents.length === 0 || layoutContents.length > (0, _consts.maxLayoutColumnSupported)()) {
13
14
  return null;
@@ -53,8 +54,13 @@ var moveNode = function moveNode(from, to, newNode, sourceNodeSize, tr) {
53
54
  tr.delete(mappedFrom, mappedFromEnd);
54
55
  return tr;
55
56
  };
56
- var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos, sourceNode, from, to, tr) {
57
- if (toLayout.childCount < (0, _consts.maxLayoutColumnSupported)()) {
57
+ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos, sourceNode, from, to, tr, isSameLayout) {
58
+ if (isSameLayout) {
59
+ // reorder columns
60
+ tr.delete(from, from + sourceNode.nodeSize);
61
+ var mappedTo = tr.mapping.map(to);
62
+ tr.insert(mappedTo, sourceNode).setSelection(new _state.NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
63
+ } else if (toLayout.childCount < (0, _consts.maxLayoutColumnSupported)()) {
58
64
  var newColumnWidth = _consts2.DEFAULT_COLUMN_DISTRIBUTIONS[toLayout.childCount + 1];
59
65
  updateColumnWidths(tr, toLayout, toLayoutPos, newColumnWidth);
60
66
  var _ref2 = tr.doc.type.schema.nodes || {},
@@ -136,12 +142,12 @@ var moveToLayout = exports.moveToLayout = function moveToLayout(api) {
136
142
  }
137
143
  if (toNode.type === layoutSection) {
138
144
  var toPos = options !== null && options !== void 0 && options.moveToEnd ? to + toNode.nodeSize - 1 : to + 1;
139
- return moveToExistingLayout(toNode, to, fromNodeWithoutBreakout, from, toPos, tr);
145
+ return moveToExistingLayout(toNode, to, fromNodeWithoutBreakout, from, toPos, tr, (0, _validation.isInSameLayout)($from, $to));
140
146
  } else if (toNode.type === layoutColumn) {
141
147
  var toLayout = $to.parent;
142
148
  var toLayoutPos = to - $to.parentOffset - 1;
143
149
  var _toPos = options !== null && options !== void 0 && options.moveToEnd ? to + toNode.nodeSize : to;
144
- return moveToExistingLayout(toLayout, toLayoutPos, fromNodeWithoutBreakout, from, _toPos, tr);
150
+ return moveToExistingLayout(toLayout, toLayoutPos, fromNodeWithoutBreakout, from, _toPos, tr, (0, _validation.isInSameLayout)($from, $to));
145
151
  } else {
146
152
  var toNodeWithoutBreakout = toNode;
147
153
 
@@ -88,7 +88,7 @@ var findDropTargetDecs = exports.findDropTargetDecs = function findDropTargetDec
88
88
  return spec.type === _decorationsCommon.TYPE_DROP_TARGET_DEC;
89
89
  });
90
90
  };
91
- var createDropTargetDecoration = exports.createDropTargetDecoration = function createDropTargetDecoration(pos, props, side, anchorRectCache) {
91
+ var createDropTargetDecoration = exports.createDropTargetDecoration = function createDropTargetDecoration(pos, props, side, anchorRectCache, isSameLayout) {
92
92
  return _view.Decoration.widget(pos, function (_, getPos) {
93
93
  var element = document.createElement('div');
94
94
  element.setAttribute('data-blocks-drop-target-container', 'true');
@@ -102,7 +102,8 @@ var createDropTargetDecoration = exports.createDropTargetDecoration = function c
102
102
  element.style.setProperty('display', 'block');
103
103
  _reactDom.default.render( /*#__PURE__*/(0, _react.createElement)(_dropTargetV.DropTargetV2, _objectSpread(_objectSpread({}, props), {}, {
104
104
  getPos: getPos,
105
- anchorRectCache: anchorRectCache
105
+ anchorRectCache: anchorRectCache,
106
+ isSameLayout: isSameLayout
106
107
  })), element);
107
108
  } else {
108
109
  _reactDom.default.render( /*#__PURE__*/(0, _react.createElement)(_dropTarget.DropTarget, _objectSpread(_objectSpread({}, props), {}, {
@@ -136,7 +137,8 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
136
137
  var docTo = to === undefined || to > POS_END_OF_DOC ? POS_END_OF_DOC : to;
137
138
  var prevNode;
138
139
  var activeNodePos = activeNode === null || activeNode === void 0 ? void 0 : activeNode.pos;
139
- var activePMNode = typeof activeNodePos === 'number' && newState.doc.resolve(activeNodePos).nodeAfter;
140
+ var $activeNodePos = typeof activeNodePos === 'number' && newState.doc.resolve(activeNodePos);
141
+ var activePMNode = $activeNodePos && $activeNodePos.nodeAfter;
140
142
  anchorRectCache === null || anchorRectCache === void 0 || anchorRectCache.clear();
141
143
  var prevNodeStack = [];
142
144
  var popNodeStack = function popNodeStack(depth) {
@@ -156,12 +158,15 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
156
158
  var depth = 0;
157
159
  // drop target deco at the end position
158
160
  var endPos;
161
+ var $pos = newState.doc.resolve(pos);
162
+ var isSameLayout = $activeNodePos && (0, _validation.isInSameLayout)($activeNodePos, $pos);
159
163
  if ((0, _experiments.editorExperiment)('nested-dnd', true)) {
160
- depth = newState.doc.resolve(pos).depth;
164
+ depth = $pos.depth;
161
165
  if (isAdvancedLayoutsPreRelease2) {
162
- if (node.type.name === 'layoutColumn' && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutSection' && (parent === null || parent === void 0 ? void 0 : parent.firstChild) !== node &&
166
+ if (node.type.name === 'layoutColumn' && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutSection' && (parent === null || parent === void 0 ? void 0 : parent.firstChild) !== node && (
163
167
  // Not the first node
164
- (parent === null || parent === void 0 ? void 0 : parent.childCount) < (0, _consts.maxLayoutColumnSupported)()) {
168
+ (parent === null || parent === void 0 ? void 0 : parent.childCount) < (0, _consts.maxLayoutColumnSupported)() || isSameLayout)) {
169
+ // Add drop target for layout columns
165
170
  decs.push(createLayoutDropTargetDecoration(pos, {
166
171
  api: api,
167
172
  parent: parent,
@@ -185,7 +190,7 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
185
190
  }
186
191
  return shouldDescend(node); //skip over, don't consider it a valid depth
187
192
  }
188
- var canDrop = activePMNode && (0, _validation.canMoveNodeToIndex)(parent, index, activePMNode);
193
+ var canDrop = activePMNode && (0, _validation.canMoveNodeToIndex)(parent, index, activePMNode, node);
189
194
 
190
195
  //NOTE: This will block drop targets showing for nodes that are valid after transformation (i.e. expand -> nestedExpand)
191
196
  if (!canDrop && !(0, _dragTargetDebug.isBlocksDragTargetDebug)()) {
@@ -212,7 +217,7 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
212
217
  parentNode: parent || undefined,
213
218
  formatMessage: formatMessage,
214
219
  dropTargetStyle: shouldShowFullHeight ? 'remainingHeight' : 'default'
215
- }, -1, anchorRectCache));
220
+ }, -1, anchorRectCache, isSameLayout));
216
221
  if (endPos !== undefined) {
217
222
  decs.push(createDropTargetDecoration(endPos, {
218
223
  api: api,
@@ -187,7 +187,8 @@ var DropTargetV2 = exports.DropTargetV2 = function DropTargetV2(props) {
187
187
  formatMessage = props.formatMessage,
188
188
  anchorRectCache = props.anchorRectCache,
189
189
  _props$dropTargetStyl = props.dropTargetStyle,
190
- dropTargetStyle = _props$dropTargetStyl === void 0 ? 'default' : _props$dropTargetStyl;
190
+ dropTargetStyle = _props$dropTargetStyl === void 0 ? 'default' : _props$dropTargetStyl,
191
+ isSameLayout = props.isSameLayout;
191
192
  var _useState = (0, _react.useState)(false),
192
193
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
193
194
  isDraggedOver = _useState2[0],
@@ -254,7 +255,7 @@ var DropTargetV2 = exports.DropTargetV2 = function DropTargetV2(props) {
254
255
  anchorRectCache: anchorRectCache,
255
256
  position: "lower",
256
257
  isNestedDropTarget: isNestedDropTarget
257
- }), (0, _inlineDropTarget.shouldAllowInlineDropTarget)(isNestedDropTarget, nextNode) && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_inlineDropTarget2.InlineDropTarget, (0, _extends2.default)({}, props, {
258
+ }), (0, _inlineDropTarget.shouldAllowInlineDropTarget)(isNestedDropTarget, nextNode, isSameLayout) && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_inlineDropTarget2.InlineDropTarget, (0, _extends2.default)({}, props, {
258
259
  position: "left"
259
260
  })), (0, _react2.jsx)(_inlineDropTarget2.InlineDropTarget, (0, _extends2.default)({}, props, {
260
261
  position: "right"
@@ -172,7 +172,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
172
172
  }, [onDrop, setIsDraggedOver]);
173
173
  return (0, _react2.jsx)("div", {
174
174
  ref: ref,
175
- "data-test-id": "drop-target-hover-zone-".concat(position),
175
+ "data-testid": "drop-target-hover-zone-".concat(position),
176
176
  css: [hoverZoneCommonStyle, inlineHoverZoneRectStyle]
177
177
  }, isDraggedOver || (0, _dragTargetDebug.isBlocksDragTargetDebug)() ? (0, _react2.jsx)(_box.DropIndicator, {
178
178
  edge: dropIndicatorPos
@@ -9,6 +9,7 @@ var _consts = require("../consts");
9
9
  var _advancedLayoutsFlags = require("./advanced-layouts-flags");
10
10
  var _checkMediaLayout = require("./check-media-layout");
11
11
  var shouldAllowInlineDropTarget = exports.shouldAllowInlineDropTarget = function shouldAllowInlineDropTarget(isNested, node) {
12
+ var isSameLayout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
12
13
  if (!(0, _advancedLayoutsFlags.isPreRelease1)() || isNested) {
13
14
  return false;
14
15
  }
@@ -16,7 +17,7 @@ var shouldAllowInlineDropTarget = exports.shouldAllowInlineDropTarget = function
16
17
  return false;
17
18
  }
18
19
  if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutSection') {
19
- return node.childCount < (0, _consts.maxLayoutColumnSupported)();
20
+ return node.childCount < (0, _consts.maxLayoutColumnSupported)() || (0, _advancedLayoutsFlags.isPreRelease2)() && isSameLayout;
20
21
  }
21
22
  return !(0, _utils.isEmptyParagraph)(node);
22
23
  };
@@ -5,10 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.canMoveNodeToIndex = canMoveNodeToIndex;
8
- exports.transformSliceExpandToNestedExpand = exports.transformExpandToNestedExpand = exports.memoizedTransformExpandToNestedExpand = exports.isNestedExpand = exports.isLayoutColumn = exports.isInsideTable = exports.isExpand = exports.isDoc = void 0;
8
+ exports.transformSliceExpandToNestedExpand = exports.transformExpandToNestedExpand = exports.memoizedTransformExpandToNestedExpand = exports.isNestedExpand = exports.isLayoutColumn = exports.isInsideTable = exports.isInSameLayout = exports.isExpand = exports.isDoc = void 0;
9
9
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
10
10
  var _model = require("@atlaskit/editor-prosemirror/model");
11
11
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
12
+ var _advancedLayoutsFlags = require("../utils/advanced-layouts-flags");
12
13
  var isInsideTable = exports.isInsideTable = function isInsideTable(nodeType) {
13
14
  var _nodeType$schema$node = nodeType.schema.nodes,
14
15
  tableCell = _nodeType$schema$node.tableCell,
@@ -27,6 +28,13 @@ var isExpand = exports.isExpand = function isExpand(nodeType) {
27
28
  var isNestedExpand = exports.isNestedExpand = function isNestedExpand(nodeType) {
28
29
  return nodeType === nodeType.schema.nodes.nestedExpand;
29
30
  };
31
+ var isInSameLayout = exports.isInSameLayout = function isInSameLayout($from, $to) {
32
+ var fromNode = $from.nodeAfter;
33
+ var toNode = $to.nodeAfter;
34
+ return !!(fromNode && toNode && fromNode.type.name === 'layoutColumn' && ['layoutSection', 'layoutColumn'].includes(toNode.type.name) && (
35
+ // fromNode can either be in the same layoutSection as toNode or is a layoutColumn inside the toNode (type layoutSection)
36
+ $from.sameParent($to) || $from.parent === toNode));
37
+ };
30
38
 
31
39
  /**
32
40
  * This function converts an expand into a nested expand,
@@ -69,7 +77,12 @@ var memoizedTransformExpandToNestedExpand = exports.memoizedTransformExpandToNes
69
77
  return null;
70
78
  }
71
79
  });
72
- function canMoveNodeToIndex(destParent, indexIntoParent, srcNode) {
80
+ function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, destNode) {
81
+ if ((0, _advancedLayoutsFlags.isPreRelease2)() &&
82
+ // Allow drag layout column and drop into layout section
83
+ srcNode.type.name === 'layoutColumn' && (destNode === null || destNode === void 0 ? void 0 : destNode.type.name) === 'layoutSection') {
84
+ return true;
85
+ }
73
86
  var srcNodeType = srcNode.type;
74
87
  var parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
75
88
  var activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.name;
@@ -2,6 +2,7 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
2
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  import { maxLayoutColumnSupported } from '../consts';
4
4
  import { DEFAULT_COLUMN_DISTRIBUTIONS } from '../ui/consts';
5
+ import { isInSameLayout } from '../utils/validation';
5
6
  const createNewLayout = (schema, layoutContents) => {
6
7
  if (layoutContents.length === 0 || layoutContents.length > maxLayoutColumnSupported()) {
7
8
  return null;
@@ -48,8 +49,13 @@ const moveNode = (from, to, newNode, sourceNodeSize, tr) => {
48
49
  tr.delete(mappedFrom, mappedFromEnd);
49
50
  return tr;
50
51
  };
51
- const moveToExistingLayout = (toLayout, toLayoutPos, sourceNode, from, to, tr) => {
52
- if (toLayout.childCount < maxLayoutColumnSupported()) {
52
+ const moveToExistingLayout = (toLayout, toLayoutPos, sourceNode, from, to, tr, isSameLayout) => {
53
+ if (isSameLayout) {
54
+ // reorder columns
55
+ tr.delete(from, from + sourceNode.nodeSize);
56
+ const mappedTo = tr.mapping.map(to);
57
+ tr.insert(mappedTo, sourceNode).setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
58
+ } else if (toLayout.childCount < maxLayoutColumnSupported()) {
53
59
  const newColumnWidth = DEFAULT_COLUMN_DISTRIBUTIONS[toLayout.childCount + 1];
54
60
  updateColumnWidths(tr, toLayout, toLayoutPos, newColumnWidth);
55
61
  const {
@@ -134,12 +140,12 @@ export const moveToLayout = api => (from, to, options) => ({
134
140
  }
135
141
  if (toNode.type === layoutSection) {
136
142
  const toPos = options !== null && options !== void 0 && options.moveToEnd ? to + toNode.nodeSize - 1 : to + 1;
137
- return moveToExistingLayout(toNode, to, fromNodeWithoutBreakout, from, toPos, tr);
143
+ return moveToExistingLayout(toNode, to, fromNodeWithoutBreakout, from, toPos, tr, isInSameLayout($from, $to));
138
144
  } else if (toNode.type === layoutColumn) {
139
145
  const toLayout = $to.parent;
140
146
  const toLayoutPos = to - $to.parentOffset - 1;
141
147
  const toPos = options !== null && options !== void 0 && options.moveToEnd ? to + toNode.nodeSize : to;
142
- return moveToExistingLayout(toLayout, toLayoutPos, fromNodeWithoutBreakout, from, toPos, tr);
148
+ return moveToExistingLayout(toLayout, toLayoutPos, fromNodeWithoutBreakout, from, toPos, tr, isInSameLayout($from, $to));
143
149
  } else {
144
150
  let toNodeWithoutBreakout = toNode;
145
151
 
@@ -11,7 +11,7 @@ import { DropTargetLayout } from '../ui/drop-target-layout';
11
11
  import { DropTargetV2, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET } from '../ui/drop-target-v2';
12
12
  import { isPreRelease2 } from '../utils/advanced-layouts-flags';
13
13
  import { isBlocksDragTargetDebug } from '../utils/drag-target-debug';
14
- import { canMoveNodeToIndex } from '../utils/validation';
14
+ import { canMoveNodeToIndex, isInSameLayout } from '../utils/validation';
15
15
  import { getNestedDepth, TYPE_DROP_TARGET_DEC, unmountDecorations } from './decorations-common';
16
16
  const IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
17
17
  const PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension'];
@@ -76,7 +76,7 @@ const getGapAndOffset = (prevNode, nextNode, parentNode) => {
76
76
  export const findDropTargetDecs = (decorations, from, to) => {
77
77
  return decorations.find(from, to, spec => spec.type === TYPE_DROP_TARGET_DEC);
78
78
  };
79
- export const createDropTargetDecoration = (pos, props, side, anchorRectCache) => {
79
+ export const createDropTargetDecoration = (pos, props, side, anchorRectCache, isSameLayout) => {
80
80
  return Decoration.widget(pos, (_, getPos) => {
81
81
  const element = document.createElement('div');
82
82
  element.setAttribute('data-blocks-drop-target-container', 'true');
@@ -92,7 +92,8 @@ export const createDropTargetDecoration = (pos, props, side, anchorRectCache) =>
92
92
  ReactDOM.render( /*#__PURE__*/createElement(DropTargetV2, {
93
93
  ...props,
94
94
  getPos,
95
- anchorRectCache
95
+ anchorRectCache,
96
+ isSameLayout
96
97
  }), element);
97
98
  } else {
98
99
  ReactDOM.render( /*#__PURE__*/createElement(DropTarget, {
@@ -128,7 +129,8 @@ export const dropTargetDecorations = (newState, api, formatMessage, activeNode,
128
129
  const docTo = to === undefined || to > POS_END_OF_DOC ? POS_END_OF_DOC : to;
129
130
  let prevNode;
130
131
  const activeNodePos = activeNode === null || activeNode === void 0 ? void 0 : activeNode.pos;
131
- const activePMNode = typeof activeNodePos === 'number' && newState.doc.resolve(activeNodePos).nodeAfter;
132
+ const $activeNodePos = typeof activeNodePos === 'number' && newState.doc.resolve(activeNodePos);
133
+ const activePMNode = $activeNodePos && $activeNodePos.nodeAfter;
132
134
  anchorRectCache === null || anchorRectCache === void 0 ? void 0 : anchorRectCache.clear();
133
135
  const prevNodeStack = [];
134
136
  const popNodeStack = depth => {
@@ -148,12 +150,15 @@ export const dropTargetDecorations = (newState, api, formatMessage, activeNode,
148
150
  let depth = 0;
149
151
  // drop target deco at the end position
150
152
  let endPos;
153
+ const $pos = newState.doc.resolve(pos);
154
+ const isSameLayout = $activeNodePos && isInSameLayout($activeNodePos, $pos);
151
155
  if (editorExperiment('nested-dnd', true)) {
152
- depth = newState.doc.resolve(pos).depth;
156
+ depth = $pos.depth;
153
157
  if (isAdvancedLayoutsPreRelease2) {
154
- if (node.type.name === 'layoutColumn' && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutSection' && (parent === null || parent === void 0 ? void 0 : parent.firstChild) !== node &&
158
+ if (node.type.name === 'layoutColumn' && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutSection' && (parent === null || parent === void 0 ? void 0 : parent.firstChild) !== node && (
155
159
  // Not the first node
156
- (parent === null || parent === void 0 ? void 0 : parent.childCount) < maxLayoutColumnSupported()) {
160
+ (parent === null || parent === void 0 ? void 0 : parent.childCount) < maxLayoutColumnSupported() || isSameLayout)) {
161
+ // Add drop target for layout columns
157
162
  decs.push(createLayoutDropTargetDecoration(pos, {
158
163
  api,
159
164
  parent,
@@ -177,7 +182,7 @@ export const dropTargetDecorations = (newState, api, formatMessage, activeNode,
177
182
  }
178
183
  return shouldDescend(node); //skip over, don't consider it a valid depth
179
184
  }
180
- const canDrop = activePMNode && canMoveNodeToIndex(parent, index, activePMNode);
185
+ const canDrop = activePMNode && canMoveNodeToIndex(parent, index, activePMNode, node);
181
186
 
182
187
  //NOTE: This will block drop targets showing for nodes that are valid after transformation (i.e. expand -> nestedExpand)
183
188
  if (!canDrop && !isBlocksDragTargetDebug()) {
@@ -204,7 +209,7 @@ export const dropTargetDecorations = (newState, api, formatMessage, activeNode,
204
209
  parentNode: parent || undefined,
205
210
  formatMessage,
206
211
  dropTargetStyle: shouldShowFullHeight ? 'remainingHeight' : 'default'
207
- }, -1, anchorRectCache));
212
+ }, -1, anchorRectCache, isSameLayout));
208
213
  if (endPos !== undefined) {
209
214
  decs.push(createDropTargetDecoration(endPos, {
210
215
  api,
@@ -174,7 +174,8 @@ export const DropTargetV2 = props => {
174
174
  parentNode,
175
175
  formatMessage,
176
176
  anchorRectCache,
177
- dropTargetStyle = 'default'
177
+ dropTargetStyle = 'default',
178
+ isSameLayout
178
179
  } = props;
179
180
  const [isDraggedOver, setIsDraggedOver] = useState(false);
180
181
  const {
@@ -238,7 +239,7 @@ export const DropTargetV2 = props => {
238
239
  anchorRectCache: anchorRectCache,
239
240
  position: "lower",
240
241
  isNestedDropTarget: isNestedDropTarget
241
- }), shouldAllowInlineDropTarget(isNestedDropTarget, nextNode) && jsx(Fragment, null, jsx(InlineDropTarget, _extends({}, props, {
242
+ }), shouldAllowInlineDropTarget(isNestedDropTarget, nextNode, isSameLayout) && jsx(Fragment, null, jsx(InlineDropTarget, _extends({}, props, {
242
243
  position: "left"
243
244
  })), jsx(InlineDropTarget, _extends({}, props, {
244
245
  position: "right"
@@ -162,7 +162,7 @@ export const InlineDropTarget = ({
162
162
  }, [onDrop, setIsDraggedOver]);
163
163
  return jsx("div", {
164
164
  ref: ref,
165
- "data-test-id": `drop-target-hover-zone-${position}`,
165
+ "data-testid": `drop-target-hover-zone-${position}`,
166
166
  css: [hoverZoneCommonStyle, inlineHoverZoneRectStyle]
167
167
  }, isDraggedOver || isBlocksDragTargetDebug() ? jsx(DropIndicator, {
168
168
  edge: dropIndicatorPos
@@ -1,8 +1,12 @@
1
1
  import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
2
2
  import { maxLayoutColumnSupported } from '../consts';
3
- import { isPreRelease1 } from './advanced-layouts-flags';
3
+ import { isPreRelease1, isPreRelease2 } from './advanced-layouts-flags';
4
4
  import { isWrappedMedia } from './check-media-layout';
5
- export const shouldAllowInlineDropTarget = (isNested, node) => {
5
+ export const shouldAllowInlineDropTarget = (isNested, node,
6
+ /**
7
+ * Is the active node in the same layout as the target node
8
+ */
9
+ isSameLayout = false) => {
6
10
  if (!isPreRelease1() || isNested) {
7
11
  return false;
8
12
  }
@@ -10,7 +14,7 @@ export const shouldAllowInlineDropTarget = (isNested, node) => {
10
14
  return false;
11
15
  }
12
16
  if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutSection') {
13
- return node.childCount < maxLayoutColumnSupported();
17
+ return node.childCount < maxLayoutColumnSupported() || isPreRelease2() && isSameLayout;
14
18
  }
15
19
  return !isEmptyParagraph(node);
16
20
  };
@@ -1,6 +1,7 @@
1
1
  import memoizeOne from 'memoize-one';
2
2
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
3
3
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
+ import { isPreRelease2 } from '../utils/advanced-layouts-flags';
4
5
  export const isInsideTable = nodeType => {
5
6
  const {
6
7
  tableCell,
@@ -20,6 +21,13 @@ export const isExpand = nodeType => {
20
21
  export const isNestedExpand = nodeType => {
21
22
  return nodeType === nodeType.schema.nodes.nestedExpand;
22
23
  };
24
+ export const isInSameLayout = ($from, $to) => {
25
+ const fromNode = $from.nodeAfter;
26
+ const toNode = $to.nodeAfter;
27
+ return !!(fromNode && toNode && fromNode.type.name === 'layoutColumn' && ['layoutSection', 'layoutColumn'].includes(toNode.type.name) && (
28
+ // fromNode can either be in the same layoutSection as toNode or is a layoutColumn inside the toNode (type layoutSection)
29
+ $from.sameParent($to) || $from.parent === toNode));
30
+ };
23
31
 
24
32
  /**
25
33
  * This function converts an expand into a nested expand,
@@ -63,7 +71,12 @@ export const memoizedTransformExpandToNestedExpand = memoizeOne(node => {
63
71
  return null;
64
72
  }
65
73
  });
66
- export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode) {
74
+ export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, destNode) {
75
+ if (isPreRelease2() &&
76
+ // Allow drag layout column and drop into layout section
77
+ srcNode.type.name === 'layoutColumn' && (destNode === null || destNode === void 0 ? void 0 : destNode.type.name) === 'layoutSection') {
78
+ return true;
79
+ }
67
80
  let srcNodeType = srcNode.type;
68
81
  const parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
69
82
  const activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.name;
@@ -2,6 +2,7 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
2
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  import { maxLayoutColumnSupported } from '../consts';
4
4
  import { DEFAULT_COLUMN_DISTRIBUTIONS } from '../ui/consts';
5
+ import { isInSameLayout } from '../utils/validation';
5
6
  var createNewLayout = function createNewLayout(schema, layoutContents) {
6
7
  if (layoutContents.length === 0 || layoutContents.length > maxLayoutColumnSupported()) {
7
8
  return null;
@@ -47,8 +48,13 @@ var moveNode = function moveNode(from, to, newNode, sourceNodeSize, tr) {
47
48
  tr.delete(mappedFrom, mappedFromEnd);
48
49
  return tr;
49
50
  };
50
- var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos, sourceNode, from, to, tr) {
51
- if (toLayout.childCount < maxLayoutColumnSupported()) {
51
+ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos, sourceNode, from, to, tr, isSameLayout) {
52
+ if (isSameLayout) {
53
+ // reorder columns
54
+ tr.delete(from, from + sourceNode.nodeSize);
55
+ var mappedTo = tr.mapping.map(to);
56
+ tr.insert(mappedTo, sourceNode).setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
57
+ } else if (toLayout.childCount < maxLayoutColumnSupported()) {
52
58
  var newColumnWidth = DEFAULT_COLUMN_DISTRIBUTIONS[toLayout.childCount + 1];
53
59
  updateColumnWidths(tr, toLayout, toLayoutPos, newColumnWidth);
54
60
  var _ref2 = tr.doc.type.schema.nodes || {},
@@ -130,12 +136,12 @@ export var moveToLayout = function moveToLayout(api) {
130
136
  }
131
137
  if (toNode.type === layoutSection) {
132
138
  var toPos = options !== null && options !== void 0 && options.moveToEnd ? to + toNode.nodeSize - 1 : to + 1;
133
- return moveToExistingLayout(toNode, to, fromNodeWithoutBreakout, from, toPos, tr);
139
+ return moveToExistingLayout(toNode, to, fromNodeWithoutBreakout, from, toPos, tr, isInSameLayout($from, $to));
134
140
  } else if (toNode.type === layoutColumn) {
135
141
  var toLayout = $to.parent;
136
142
  var toLayoutPos = to - $to.parentOffset - 1;
137
143
  var _toPos = options !== null && options !== void 0 && options.moveToEnd ? to + toNode.nodeSize : to;
138
- return moveToExistingLayout(toLayout, toLayoutPos, fromNodeWithoutBreakout, from, _toPos, tr);
144
+ return moveToExistingLayout(toLayout, toLayoutPos, fromNodeWithoutBreakout, from, _toPos, tr, isInSameLayout($from, $to));
139
145
  } else {
140
146
  var toNodeWithoutBreakout = toNode;
141
147
 
@@ -14,7 +14,7 @@ import { DropTargetLayout } from '../ui/drop-target-layout';
14
14
  import { DropTargetV2, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET } from '../ui/drop-target-v2';
15
15
  import { isPreRelease2 } from '../utils/advanced-layouts-flags';
16
16
  import { isBlocksDragTargetDebug } from '../utils/drag-target-debug';
17
- import { canMoveNodeToIndex } from '../utils/validation';
17
+ import { canMoveNodeToIndex, isInSameLayout } from '../utils/validation';
18
18
  import { getNestedDepth, TYPE_DROP_TARGET_DEC, unmountDecorations } from './decorations-common';
19
19
  var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
20
20
  var PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension'];
@@ -81,7 +81,7 @@ export var findDropTargetDecs = function findDropTargetDecs(decorations, from, t
81
81
  return spec.type === TYPE_DROP_TARGET_DEC;
82
82
  });
83
83
  };
84
- export var createDropTargetDecoration = function createDropTargetDecoration(pos, props, side, anchorRectCache) {
84
+ export var createDropTargetDecoration = function createDropTargetDecoration(pos, props, side, anchorRectCache, isSameLayout) {
85
85
  return Decoration.widget(pos, function (_, getPos) {
86
86
  var element = document.createElement('div');
87
87
  element.setAttribute('data-blocks-drop-target-container', 'true');
@@ -95,7 +95,8 @@ export var createDropTargetDecoration = function createDropTargetDecoration(pos,
95
95
  element.style.setProperty('display', 'block');
96
96
  ReactDOM.render( /*#__PURE__*/createElement(DropTargetV2, _objectSpread(_objectSpread({}, props), {}, {
97
97
  getPos: getPos,
98
- anchorRectCache: anchorRectCache
98
+ anchorRectCache: anchorRectCache,
99
+ isSameLayout: isSameLayout
99
100
  })), element);
100
101
  } else {
101
102
  ReactDOM.render( /*#__PURE__*/createElement(DropTarget, _objectSpread(_objectSpread({}, props), {}, {
@@ -129,7 +130,8 @@ export var dropTargetDecorations = function dropTargetDecorations(newState, api,
129
130
  var docTo = to === undefined || to > POS_END_OF_DOC ? POS_END_OF_DOC : to;
130
131
  var prevNode;
131
132
  var activeNodePos = activeNode === null || activeNode === void 0 ? void 0 : activeNode.pos;
132
- var activePMNode = typeof activeNodePos === 'number' && newState.doc.resolve(activeNodePos).nodeAfter;
133
+ var $activeNodePos = typeof activeNodePos === 'number' && newState.doc.resolve(activeNodePos);
134
+ var activePMNode = $activeNodePos && $activeNodePos.nodeAfter;
133
135
  anchorRectCache === null || anchorRectCache === void 0 || anchorRectCache.clear();
134
136
  var prevNodeStack = [];
135
137
  var popNodeStack = function popNodeStack(depth) {
@@ -149,12 +151,15 @@ export var dropTargetDecorations = function dropTargetDecorations(newState, api,
149
151
  var depth = 0;
150
152
  // drop target deco at the end position
151
153
  var endPos;
154
+ var $pos = newState.doc.resolve(pos);
155
+ var isSameLayout = $activeNodePos && isInSameLayout($activeNodePos, $pos);
152
156
  if (editorExperiment('nested-dnd', true)) {
153
- depth = newState.doc.resolve(pos).depth;
157
+ depth = $pos.depth;
154
158
  if (isAdvancedLayoutsPreRelease2) {
155
- if (node.type.name === 'layoutColumn' && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutSection' && (parent === null || parent === void 0 ? void 0 : parent.firstChild) !== node &&
159
+ if (node.type.name === 'layoutColumn' && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutSection' && (parent === null || parent === void 0 ? void 0 : parent.firstChild) !== node && (
156
160
  // Not the first node
157
- (parent === null || parent === void 0 ? void 0 : parent.childCount) < maxLayoutColumnSupported()) {
161
+ (parent === null || parent === void 0 ? void 0 : parent.childCount) < maxLayoutColumnSupported() || isSameLayout)) {
162
+ // Add drop target for layout columns
158
163
  decs.push(createLayoutDropTargetDecoration(pos, {
159
164
  api: api,
160
165
  parent: parent,
@@ -178,7 +183,7 @@ export var dropTargetDecorations = function dropTargetDecorations(newState, api,
178
183
  }
179
184
  return shouldDescend(node); //skip over, don't consider it a valid depth
180
185
  }
181
- var canDrop = activePMNode && canMoveNodeToIndex(parent, index, activePMNode);
186
+ var canDrop = activePMNode && canMoveNodeToIndex(parent, index, activePMNode, node);
182
187
 
183
188
  //NOTE: This will block drop targets showing for nodes that are valid after transformation (i.e. expand -> nestedExpand)
184
189
  if (!canDrop && !isBlocksDragTargetDebug()) {
@@ -205,7 +210,7 @@ export var dropTargetDecorations = function dropTargetDecorations(newState, api,
205
210
  parentNode: parent || undefined,
206
211
  formatMessage: formatMessage,
207
212
  dropTargetStyle: shouldShowFullHeight ? 'remainingHeight' : 'default'
208
- }, -1, anchorRectCache));
213
+ }, -1, anchorRectCache, isSameLayout));
209
214
  if (endPos !== undefined) {
210
215
  decs.push(createDropTargetDecoration(endPos, {
211
216
  api: api,
@@ -179,7 +179,8 @@ export var DropTargetV2 = function DropTargetV2(props) {
179
179
  formatMessage = props.formatMessage,
180
180
  anchorRectCache = props.anchorRectCache,
181
181
  _props$dropTargetStyl = props.dropTargetStyle,
182
- dropTargetStyle = _props$dropTargetStyl === void 0 ? 'default' : _props$dropTargetStyl;
182
+ dropTargetStyle = _props$dropTargetStyl === void 0 ? 'default' : _props$dropTargetStyl,
183
+ isSameLayout = props.isSameLayout;
183
184
  var _useState = useState(false),
184
185
  _useState2 = _slicedToArray(_useState, 2),
185
186
  isDraggedOver = _useState2[0],
@@ -246,7 +247,7 @@ export var DropTargetV2 = function DropTargetV2(props) {
246
247
  anchorRectCache: anchorRectCache,
247
248
  position: "lower",
248
249
  isNestedDropTarget: isNestedDropTarget
249
- }), shouldAllowInlineDropTarget(isNestedDropTarget, nextNode) && jsx(Fragment, null, jsx(InlineDropTarget, _extends({}, props, {
250
+ }), shouldAllowInlineDropTarget(isNestedDropTarget, nextNode, isSameLayout) && jsx(Fragment, null, jsx(InlineDropTarget, _extends({}, props, {
250
251
  position: "left"
251
252
  })), jsx(InlineDropTarget, _extends({}, props, {
252
253
  position: "right"
@@ -164,7 +164,7 @@ export var InlineDropTarget = function InlineDropTarget(_ref) {
164
164
  }, [onDrop, setIsDraggedOver]);
165
165
  return jsx("div", {
166
166
  ref: ref,
167
- "data-test-id": "drop-target-hover-zone-".concat(position),
167
+ "data-testid": "drop-target-hover-zone-".concat(position),
168
168
  css: [hoverZoneCommonStyle, inlineHoverZoneRectStyle]
169
169
  }, isDraggedOver || isBlocksDragTargetDebug() ? jsx(DropIndicator, {
170
170
  edge: dropIndicatorPos
@@ -1,8 +1,9 @@
1
1
  import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
2
2
  import { maxLayoutColumnSupported } from '../consts';
3
- import { isPreRelease1 } from './advanced-layouts-flags';
3
+ import { isPreRelease1, isPreRelease2 } from './advanced-layouts-flags';
4
4
  import { isWrappedMedia } from './check-media-layout';
5
5
  export var shouldAllowInlineDropTarget = function shouldAllowInlineDropTarget(isNested, node) {
6
+ var isSameLayout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6
7
  if (!isPreRelease1() || isNested) {
7
8
  return false;
8
9
  }
@@ -10,7 +11,7 @@ export var shouldAllowInlineDropTarget = function shouldAllowInlineDropTarget(is
10
11
  return false;
11
12
  }
12
13
  if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutSection') {
13
- return node.childCount < maxLayoutColumnSupported();
14
+ return node.childCount < maxLayoutColumnSupported() || isPreRelease2() && isSameLayout;
14
15
  }
15
16
  return !isEmptyParagraph(node);
16
17
  };
@@ -1,6 +1,7 @@
1
1
  import memoizeOne from 'memoize-one';
2
2
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
3
3
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
+ import { isPreRelease2 } from '../utils/advanced-layouts-flags';
4
5
  export var isInsideTable = function isInsideTable(nodeType) {
5
6
  var _nodeType$schema$node = nodeType.schema.nodes,
6
7
  tableCell = _nodeType$schema$node.tableCell,
@@ -19,6 +20,13 @@ export var isExpand = function isExpand(nodeType) {
19
20
  export var isNestedExpand = function isNestedExpand(nodeType) {
20
21
  return nodeType === nodeType.schema.nodes.nestedExpand;
21
22
  };
23
+ export var isInSameLayout = function isInSameLayout($from, $to) {
24
+ var fromNode = $from.nodeAfter;
25
+ var toNode = $to.nodeAfter;
26
+ return !!(fromNode && toNode && fromNode.type.name === 'layoutColumn' && ['layoutSection', 'layoutColumn'].includes(toNode.type.name) && (
27
+ // fromNode can either be in the same layoutSection as toNode or is a layoutColumn inside the toNode (type layoutSection)
28
+ $from.sameParent($to) || $from.parent === toNode));
29
+ };
22
30
 
23
31
  /**
24
32
  * This function converts an expand into a nested expand,
@@ -61,7 +69,12 @@ export var memoizedTransformExpandToNestedExpand = memoizeOne(function (node) {
61
69
  return null;
62
70
  }
63
71
  });
64
- export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode) {
72
+ export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, destNode) {
73
+ if (isPreRelease2() &&
74
+ // Allow drag layout column and drop into layout section
75
+ srcNode.type.name === 'layoutColumn' && (destNode === null || destNode === void 0 ? void 0 : destNode.type.name) === 'layoutSection') {
76
+ return true;
77
+ }
65
78
  var srcNodeType = srcNode.type;
66
79
  var parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
67
80
  var activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.name;
@@ -14,6 +14,6 @@ import { type AnchorRectCache } from '../utils/anchor-utils';
14
14
  * @returns
15
15
  */
16
16
  export declare const findDropTargetDecs: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
17
- export declare const createDropTargetDecoration: (pos: number, props: Omit<DropTargetProps, 'getPos'>, side?: number, anchorRectCache?: AnchorRectCache) => Decoration;
17
+ export declare const createDropTargetDecoration: (pos: number, props: Omit<DropTargetProps, 'getPos'>, side?: number, anchorRectCache?: AnchorRectCache, isSameLayout?: boolean) => Decoration;
18
18
  export declare const createLayoutDropTargetDecoration: (pos: number, props: Omit<DropTargetLayoutProps, 'getPos'>) => Decoration;
19
19
  export declare const dropTargetDecorations: (newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache, from?: number, to?: number) => Decoration[];
@@ -5,4 +5,5 @@ export declare const EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET = "--editor-blo
5
5
  export declare const EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP = "--editor-block-controls-drop-indicator-gap";
6
6
  export declare const DropTargetV2: (props: DropTargetProps & {
7
7
  anchorRectCache?: AnchorRectCache | undefined;
8
+ isSameLayout?: boolean | undefined;
8
9
  }) => jsx.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
- export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode) => boolean;
2
+ export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode, isSameLayout?: boolean) => boolean;
@@ -1,10 +1,11 @@
1
1
  import { Slice } from '@atlaskit/editor-prosemirror/model';
2
- import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
+ import type { NodeType, Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
3
3
  export declare const isInsideTable: (nodeType: NodeType) => Boolean;
4
4
  export declare const isLayoutColumn: (nodeType: NodeType) => Boolean;
5
5
  export declare const isDoc: (nodeType: NodeType) => Boolean;
6
6
  export declare const isExpand: (nodeType: NodeType) => Boolean;
7
7
  export declare const isNestedExpand: (nodeType: NodeType) => Boolean;
8
+ export declare const isInSameLayout: ($from: ResolvedPos, $to: ResolvedPos) => boolean;
8
9
  /**
9
10
  * This function converts an expand into a nested expand,
10
11
  * although it may fail based on the expand's content.
@@ -15,4 +16,4 @@ export declare const isNestedExpand: (nodeType: NodeType) => Boolean;
15
16
  export declare const transformExpandToNestedExpand: (expandNode: PMNode) => PMNode | null;
16
17
  export declare const transformSliceExpandToNestedExpand: (slice: Slice) => Slice | null;
17
18
  export declare const memoizedTransformExpandToNestedExpand: import("memoize-one").MemoizedFn<(node: PMNode) => PMNode | null>;
18
- export declare function canMoveNodeToIndex(destParent: PMNode, indexIntoParent: number, srcNode: PMNode): boolean;
19
+ export declare function canMoveNodeToIndex(destParent: PMNode, indexIntoParent: number, srcNode: PMNode, destNode?: PMNode): boolean;
@@ -14,6 +14,6 @@ import { type AnchorRectCache } from '../utils/anchor-utils';
14
14
  * @returns
15
15
  */
16
16
  export declare const findDropTargetDecs: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
17
- export declare const createDropTargetDecoration: (pos: number, props: Omit<DropTargetProps, 'getPos'>, side?: number, anchorRectCache?: AnchorRectCache) => Decoration;
17
+ export declare const createDropTargetDecoration: (pos: number, props: Omit<DropTargetProps, 'getPos'>, side?: number, anchorRectCache?: AnchorRectCache, isSameLayout?: boolean) => Decoration;
18
18
  export declare const createLayoutDropTargetDecoration: (pos: number, props: Omit<DropTargetLayoutProps, 'getPos'>) => Decoration;
19
19
  export declare const dropTargetDecorations: (newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache, from?: number, to?: number) => Decoration[];
@@ -5,4 +5,5 @@ export declare const EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET = "--editor-blo
5
5
  export declare const EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP = "--editor-block-controls-drop-indicator-gap";
6
6
  export declare const DropTargetV2: (props: DropTargetProps & {
7
7
  anchorRectCache?: AnchorRectCache | undefined;
8
+ isSameLayout?: boolean | undefined;
8
9
  }) => jsx.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
- export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode) => boolean;
2
+ export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode, isSameLayout?: boolean) => boolean;
@@ -1,10 +1,11 @@
1
1
  import { Slice } from '@atlaskit/editor-prosemirror/model';
2
- import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
+ import type { NodeType, Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
3
3
  export declare const isInsideTable: (nodeType: NodeType) => Boolean;
4
4
  export declare const isLayoutColumn: (nodeType: NodeType) => Boolean;
5
5
  export declare const isDoc: (nodeType: NodeType) => Boolean;
6
6
  export declare const isExpand: (nodeType: NodeType) => Boolean;
7
7
  export declare const isNestedExpand: (nodeType: NodeType) => Boolean;
8
+ export declare const isInSameLayout: ($from: ResolvedPos, $to: ResolvedPos) => boolean;
8
9
  /**
9
10
  * This function converts an expand into a nested expand,
10
11
  * although it may fail based on the expand's content.
@@ -15,4 +16,4 @@ export declare const isNestedExpand: (nodeType: NodeType) => Boolean;
15
16
  export declare const transformExpandToNestedExpand: (expandNode: PMNode) => PMNode | null;
16
17
  export declare const transformSliceExpandToNestedExpand: (slice: Slice) => Slice | null;
17
18
  export declare const memoizedTransformExpandToNestedExpand: import("memoize-one").MemoizedFn<(node: PMNode) => PMNode | null>;
18
- export declare function canMoveNodeToIndex(destParent: PMNode, indexIntoParent: number, srcNode: PMNode): boolean;
19
+ export declare function canMoveNodeToIndex(destParent: PMNode, indexIntoParent: number, srcNode: PMNode, destNode?: PMNode): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "2.13.10",
3
+ "version": "2.13.11",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",