@atlaskit/editor-plugin-block-controls 2.14.2 → 2.14.3

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,14 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 2.14.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#169746](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/169746)
8
+ [`5bfb485e85507`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5bfb485e85507) -
9
+ [ux] [ED-25925] After drag and drop to create a new layout or update an existing layout,
10
+ placecursor at the end of last node in the newly created column
11
+
3
12
  ## 2.14.2
4
13
 
5
14
  ### Patch Changes
@@ -7,6 +7,7 @@ exports.moveToLayout = void 0;
7
7
  var _analytics = require("@atlaskit/editor-common/analytics");
8
8
  var _model = require("@atlaskit/editor-prosemirror/model");
9
9
  var _state = require("@atlaskit/editor-prosemirror/state");
10
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
11
  var _consts = require("../pm-plugins/utils/consts");
11
12
  var _fireAnalytics = require("../pm-plugins/utils/fire-analytics");
12
13
  var _removeFromSource = require("../pm-plugins/utils/remove-from-source");
@@ -44,13 +45,21 @@ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos,
44
45
  // reorder columns
45
46
  tr.delete(from, from + sourceNode.nodeSize);
46
47
  var mappedTo = tr.mapping.map(to);
47
- tr.insert(mappedTo, sourceNode).setSelection(new _state.NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
48
+ tr.insert(mappedTo, sourceNode);
49
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
50
+ tr.setSelection(new _state.NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
51
+ }
48
52
  (0, _fireAnalytics.fireMoveNodeAnalytics)(tr, _analytics.INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf === void 0 ? void 0 : _$originalFrom$nodeAf.type.name) || '', 1, 'layoutSection', true, api);
49
53
  } else if (toLayout.childCount < (0, _consts.maxLayoutColumnSupported)()) {
50
54
  var _$originalFrom$nodeAf2;
51
- insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos);
52
- var mappedFrom = tr.mapping.map(from);
53
- (0, _removeFromSource.removeFromSource)(tr, tr.doc.resolve(mappedFrom));
55
+ if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
56
+ (0, _removeFromSource.removeFromSource)(tr, tr.doc.resolve(from));
57
+ insertToDestination(tr, tr.mapping.map(to), sourceNode, toLayout, tr.mapping.map(toLayoutPos));
58
+ } else {
59
+ insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos);
60
+ var mappedFrom = tr.mapping.map(from);
61
+ (0, _removeFromSource.removeFromSource)(tr, tr.doc.resolve(mappedFrom));
62
+ }
54
63
  (0, _fireAnalytics.fireMoveNodeAnalytics)(tr, _analytics.INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf2 = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf2 === void 0 ? void 0 : _$originalFrom$nodeAf2.type.name) || '', 1, 'layoutSection', false, api);
55
64
  }
56
65
  return tr;
@@ -63,7 +72,10 @@ var insertToDestination = function insertToDestination(tr, to, sourceNode, toLay
63
72
  var content = layoutColumn.createChecked({
64
73
  width: newColumnWidth
65
74
  }, sourceNode.type.name === 'layoutColumn' ? sourceNode.content : sourceNode);
66
- tr.insert(to, content).setSelection(new _state.NodeSelection(tr.doc.resolve(to))).scrollIntoView();
75
+ tr.insert(to, content);
76
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
77
+ tr.setSelection(new _state.NodeSelection(tr.doc.resolve(to))).scrollIntoView();
78
+ }
67
79
  return tr;
68
80
  };
69
81
 
@@ -171,7 +183,10 @@ var moveToLayout = exports.moveToLayout = function moveToLayout(api) {
171
183
  if (newLayout) {
172
184
  tr = (0, _removeFromSource.removeFromSource)(tr, $from);
173
185
  var mappedTo = tr.mapping.map(to);
174
- tr.delete(mappedTo, mappedTo + toNodeWithoutBreakout.nodeSize).insert(mappedTo, newLayout).setSelection(new _state.NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
186
+ tr.delete(mappedTo, mappedTo + toNodeWithoutBreakout.nodeSize).insert(mappedTo, newLayout);
187
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
188
+ tr.setSelection(new _state.NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
189
+ }
175
190
  breakoutMode && tr.setNodeMarkup(mappedTo, newLayout.type, newLayout.attrs, [breakout.create({
176
191
  mode: breakoutMode
177
192
  })]);
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.updateSelection = exports.getInsertLayoutStep = void 0;
7
+ var _selection = require("@atlaskit/editor-common/selection");
8
+ var _state = require("@atlaskit/editor-prosemirror/state");
9
+ var _transform = require("@atlaskit/editor-prosemirror/transform");
10
+ var getInsertLayoutStep = exports.getInsertLayoutStep = function getInsertLayoutStep(tr) {
11
+ return tr.steps.find(function (step) {
12
+ var _step$slice$content$f;
13
+ return step instanceof _transform.ReplaceStep && ['layoutSection', 'layoutColumn'].includes(((_step$slice$content$f = step.slice.content.firstChild) === null || _step$slice$content$f === void 0 ? void 0 : _step$slice$content$f.type.name) || '');
14
+ });
15
+ };
16
+ var updateSelection = exports.updateSelection = function updateSelection(tr, to, insertAtRight) {
17
+ var _lastNode;
18
+ var $to = tr.doc.resolve(to);
19
+ var toNode = $to.nodeAfter;
20
+ var lastNode = toNode === null || toNode === void 0 ? void 0 : toNode.content.lastChild;
21
+ if (!toNode || !lastNode) {
22
+ return tr;
23
+ }
24
+ var offset = toNode.nodeSize;
25
+
26
+ // drop at the start of the layoutSection or to create a new layoutSection
27
+ if (toNode.type.name === 'layoutSection') {
28
+ if (insertAtRight) {
29
+ var _toNode$content$lastC;
30
+ lastNode = (_toNode$content$lastC = toNode.content.lastChild) === null || _toNode$content$lastC === void 0 ? void 0 : _toNode$content$lastC.lastChild;
31
+ offset = toNode.nodeSize - 1;
32
+ } else {
33
+ var _toNode$content$first, _toNode$content$first2;
34
+ lastNode = (_toNode$content$first = toNode.content.firstChild) === null || _toNode$content$first === void 0 ? void 0 : _toNode$content$first.lastChild;
35
+ offset = 1 + (((_toNode$content$first2 = toNode.content.firstChild) === null || _toNode$content$first2 === void 0 ? void 0 : _toNode$content$first2.nodeSize) || 0);
36
+ }
37
+ }
38
+ if (['paragraph', 'heading'].includes(((_lastNode = lastNode) === null || _lastNode === void 0 ? void 0 : _lastNode.type.name) || '')) {
39
+ tr.setSelection(_state.TextSelection.near(tr.doc.resolve(to + offset - 2)));
40
+ } else if (lastNode) {
41
+ tr.setSelection(new _selection.GapCursorSelection(tr.doc.resolve(to + offset - 1), _selection.Side.RIGHT));
42
+ }
43
+ return tr;
44
+ };
@@ -10,6 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
10
10
  var _react = require("react");
11
11
  var _react2 = require("@emotion/react");
12
12
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
14
15
  var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
15
16
  var _colors = require("@atlaskit/theme/colors");
@@ -17,6 +18,7 @@ var _decorationsCommon = require("../pm-plugins/decorations-common");
17
18
  var _activeAnchorTracker = require("../pm-plugins/utils/active-anchor-tracker");
18
19
  var _anchorUtils = require("../pm-plugins/utils/anchor-utils");
19
20
  var _dragTargetDebug = require("../pm-plugins/utils/drag-target-debug");
21
+ var _updateSelection = require("../pm-plugins/utils/update-selection");
20
22
  /**
21
23
  * @jsxRuntime classic
22
24
  * @jsx jsx
@@ -78,10 +80,32 @@ var DropTargetLayout = exports.DropTargetLayout = function DropTargetLayout(prop
78
80
  return;
79
81
  }
80
82
  var to = getPos();
83
+ var mappedTo;
81
84
  if (to !== undefined) {
82
- var _api$core, _api$blockControls2;
85
+ var _api$core;
83
86
  var from = activeNode.pos;
84
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.moveToLayout(from, to));
87
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
88
+ var _api$blockControls2;
89
+ var tr = _ref2.tr;
90
+ api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 || _api$blockControls2.moveToLayout(from, to)({
91
+ tr: tr
92
+ });
93
+ if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
94
+ var insertColumnStep = (0, _updateSelection.getInsertLayoutStep)(tr);
95
+ mappedTo = insertColumnStep === null || insertColumnStep === void 0 ? void 0 : insertColumnStep.from;
96
+ }
97
+ return tr;
98
+ });
99
+ if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
100
+ var _api$core2;
101
+ api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref3) {
102
+ var tr = _ref3.tr;
103
+ if (mappedTo !== undefined) {
104
+ (0, _updateSelection.updateSelection)(tr, mappedTo);
105
+ }
106
+ return tr;
107
+ });
108
+ }
85
109
  }
86
110
  }, [api, getPos, activeNode]);
87
111
  (0, _react.useEffect)(function () {
@@ -10,6 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
10
10
  var _react = require("react");
11
11
  var _react2 = require("@emotion/react");
12
12
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
14
15
  var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
15
16
  var _colors = require("@atlaskit/theme/colors");
@@ -17,6 +18,7 @@ var _decorationsCommon = require("../pm-plugins/decorations-common");
17
18
  var _activeAnchorTracker = require("../pm-plugins/utils/active-anchor-tracker");
18
19
  var _anchorUtils = require("../pm-plugins/utils/anchor-utils");
19
20
  var _dragTargetDebug = require("../pm-plugins/utils/drag-target-debug");
21
+ var _updateSelection = require("../pm-plugins/utils/update-selection");
20
22
  /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
21
23
  /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */
22
24
  /**
@@ -188,16 +190,39 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
188
190
  return;
189
191
  }
190
192
  var toPos = getPos();
193
+ var mappedTo;
191
194
  if (activeNode && toPos !== undefined) {
192
- var _api$core, _api$blockControls2;
195
+ var _api$core;
193
196
  var start = activeNode.pos;
194
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.moveToLayout(start, toPos, {
195
- moveToEnd: position === 'right'
196
- }));
197
+ var moveToEnd = position === 'right';
198
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref3) {
199
+ var _api$blockControls2;
200
+ var tr = _ref3.tr;
201
+ api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 || _api$blockControls2.moveToLayout(start, toPos, {
202
+ moveToEnd: moveToEnd
203
+ })({
204
+ tr: tr
205
+ });
206
+ if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
207
+ var insertLayoutStep = (0, _updateSelection.getInsertLayoutStep)(tr);
208
+ mappedTo = insertLayoutStep === null || insertLayoutStep === void 0 ? void 0 : insertLayoutStep.from;
209
+ }
210
+ return tr;
211
+ });
212
+ if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
213
+ var _api$core2;
214
+ api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref4) {
215
+ var tr = _ref4.tr;
216
+ if (mappedTo !== undefined) {
217
+ (0, _updateSelection.updateSelection)(tr, mappedTo, moveToEnd);
218
+ }
219
+ return tr;
220
+ });
221
+ }
197
222
  }
198
223
  }, [api, getPos, position]);
199
224
  var hoverZoneRectStyle = (0, _react.useMemo)(function () {
200
- var _ref3;
225
+ var _ref5;
201
226
  var isLayoutNode = (nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name) === 'layoutSection';
202
227
  var layoutAdjustment = isLayoutNode ? {
203
228
  width: 11,
@@ -205,7 +230,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
205
230
  top: 6,
206
231
  bottom: 2
207
232
  } : undefined;
208
- return _ref3 = {}, (0, _defineProperty2.default)(_ref3, HOVER_ZONE_WIDTH, nodeDimension.widthOffset ? "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px + ").concat(nodeDimension.widthOffset, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)") : "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)")), (0, _defineProperty2.default)(_ref3, HOVER_ZONE_HEIGHT, "calc(".concat(nodeDimension.height, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.height) || 0, "px)")), (0, _defineProperty2.default)(_ref3, HOVER_ZONE_TOP, "calc(".concat(nodeDimension.top, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.top) || 0, "px)")), (0, _defineProperty2.default)(_ref3, HOVER_ZONE_BOTTOM, "calc(".concat(nodeDimension.bottom, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.bottom) || 0, "px)")), (0, _defineProperty2.default)(_ref3, HOVER_ZONE_ANCHOR_NAME, anchorName), _ref3;
233
+ return _ref5 = {}, (0, _defineProperty2.default)(_ref5, HOVER_ZONE_WIDTH, nodeDimension.widthOffset ? "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px + ").concat(nodeDimension.widthOffset, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)") : "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)")), (0, _defineProperty2.default)(_ref5, HOVER_ZONE_HEIGHT, "calc(".concat(nodeDimension.height, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.height) || 0, "px)")), (0, _defineProperty2.default)(_ref5, HOVER_ZONE_TOP, "calc(".concat(nodeDimension.top, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.top) || 0, "px)")), (0, _defineProperty2.default)(_ref5, HOVER_ZONE_BOTTOM, "calc(".concat(nodeDimension.bottom, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.bottom) || 0, "px)")), (0, _defineProperty2.default)(_ref5, HOVER_ZONE_ANCHOR_NAME, anchorName), _ref5;
209
234
  }, [nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name, nodeDimension, anchorName]);
210
235
  var dropIndicatorPos = (0, _react.useMemo)(function () {
211
236
  return isLeftPosition ? 'right' : 'left';
@@ -1,6 +1,7 @@
1
1
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
3
3
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { maxLayoutColumnSupported } from '../pm-plugins/utils/consts';
5
6
  import { fireInsertLayoutAnalytics, fireMoveNodeAnalytics } from '../pm-plugins/utils/fire-analytics';
6
7
  import { removeFromSource } from '../pm-plugins/utils/remove-from-source';
@@ -39,13 +40,21 @@ const moveToExistingLayout = (toLayout, toLayoutPos, sourceNode, from, to, tr, $
39
40
  // reorder columns
40
41
  tr.delete(from, from + sourceNode.nodeSize);
41
42
  const mappedTo = tr.mapping.map(to);
42
- tr.insert(mappedTo, sourceNode).setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
43
+ tr.insert(mappedTo, sourceNode);
44
+ if (!fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
45
+ tr.setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
46
+ }
43
47
  fireMoveNodeAnalytics(tr, INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf === void 0 ? void 0 : _$originalFrom$nodeAf.type.name) || '', 1, 'layoutSection', true, api);
44
48
  } else if (toLayout.childCount < maxLayoutColumnSupported()) {
45
49
  var _$originalFrom$nodeAf2;
46
- insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos);
47
- const mappedFrom = tr.mapping.map(from);
48
- removeFromSource(tr, tr.doc.resolve(mappedFrom));
50
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
51
+ removeFromSource(tr, tr.doc.resolve(from));
52
+ insertToDestination(tr, tr.mapping.map(to), sourceNode, toLayout, tr.mapping.map(toLayoutPos));
53
+ } else {
54
+ insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos);
55
+ const mappedFrom = tr.mapping.map(from);
56
+ removeFromSource(tr, tr.doc.resolve(mappedFrom));
57
+ }
49
58
  fireMoveNodeAnalytics(tr, INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf2 = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf2 === void 0 ? void 0 : _$originalFrom$nodeAf2.type.name) || '', 1, 'layoutSection', false, api);
50
59
  }
51
60
  return tr;
@@ -60,7 +69,10 @@ const insertToDestination = (tr, to, sourceNode, toLayout, toLayoutPos) => {
60
69
  const content = layoutColumn.createChecked({
61
70
  width: newColumnWidth
62
71
  }, sourceNode.type.name === 'layoutColumn' ? sourceNode.content : sourceNode);
63
- tr.insert(to, content).setSelection(new NodeSelection(tr.doc.resolve(to))).scrollIntoView();
72
+ tr.insert(to, content);
73
+ if (!fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
74
+ tr.setSelection(new NodeSelection(tr.doc.resolve(to))).scrollIntoView();
75
+ }
64
76
  return tr;
65
77
  };
66
78
 
@@ -166,7 +178,10 @@ export const moveToLayout = api => (from, to, options) => ({
166
178
  if (newLayout) {
167
179
  tr = removeFromSource(tr, $from);
168
180
  const mappedTo = tr.mapping.map(to);
169
- tr.delete(mappedTo, mappedTo + toNodeWithoutBreakout.nodeSize).insert(mappedTo, newLayout).setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
181
+ tr.delete(mappedTo, mappedTo + toNodeWithoutBreakout.nodeSize).insert(mappedTo, newLayout);
182
+ if (!fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
183
+ tr.setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
184
+ }
170
185
  breakoutMode && tr.setNodeMarkup(mappedTo, newLayout.type, newLayout.attrs, [breakout.create({
171
186
  mode: breakoutMode
172
187
  })]);
@@ -0,0 +1,36 @@
1
+ import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
2
+ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
3
+ import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
4
+ export const getInsertLayoutStep = tr => tr.steps.find(step => {
5
+ var _step$slice$content$f;
6
+ return step instanceof ReplaceStep && ['layoutSection', 'layoutColumn'].includes(((_step$slice$content$f = step.slice.content.firstChild) === null || _step$slice$content$f === void 0 ? void 0 : _step$slice$content$f.type.name) || '');
7
+ });
8
+ export const updateSelection = (tr, to, insertAtRight) => {
9
+ var _lastNode;
10
+ const $to = tr.doc.resolve(to);
11
+ const toNode = $to.nodeAfter;
12
+ let lastNode = toNode === null || toNode === void 0 ? void 0 : toNode.content.lastChild;
13
+ if (!toNode || !lastNode) {
14
+ return tr;
15
+ }
16
+ let offset = toNode.nodeSize;
17
+
18
+ // drop at the start of the layoutSection or to create a new layoutSection
19
+ if (toNode.type.name === 'layoutSection') {
20
+ if (insertAtRight) {
21
+ var _toNode$content$lastC;
22
+ lastNode = (_toNode$content$lastC = toNode.content.lastChild) === null || _toNode$content$lastC === void 0 ? void 0 : _toNode$content$lastC.lastChild;
23
+ offset = toNode.nodeSize - 1;
24
+ } else {
25
+ var _toNode$content$first, _toNode$content$first2;
26
+ lastNode = (_toNode$content$first = toNode.content.firstChild) === null || _toNode$content$first === void 0 ? void 0 : _toNode$content$first.lastChild;
27
+ offset = 1 + (((_toNode$content$first2 = toNode.content.firstChild) === null || _toNode$content$first2 === void 0 ? void 0 : _toNode$content$first2.nodeSize) || 0);
28
+ }
29
+ }
30
+ if (['paragraph', 'heading'].includes(((_lastNode = lastNode) === null || _lastNode === void 0 ? void 0 : _lastNode.type.name) || '')) {
31
+ tr.setSelection(TextSelection.near(tr.doc.resolve(to + offset - 2)));
32
+ } else if (lastNode) {
33
+ tr.setSelection(new GapCursorSelection(tr.doc.resolve(to + offset - 1), Side.RIGHT));
34
+ }
35
+ return tr;
36
+ };
@@ -7,6 +7,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { layoutBreakpointWidth } from '@atlaskit/editor-shared-styles';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
11
12
  import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
12
13
  import { B200 } from '@atlaskit/theme/colors';
@@ -14,6 +15,7 @@ import { getNodeAnchor } from '../pm-plugins/decorations-common';
14
15
  import { useActiveAnchorTracker } from '../pm-plugins/utils/active-anchor-tracker';
15
16
  import { isAnchorSupported } from '../pm-plugins/utils/anchor-utils';
16
17
  import { isBlocksDragTargetDebug } from '../pm-plugins/utils/drag-target-debug';
18
+ import { getInsertLayoutStep, updateSelection } from '../pm-plugins/utils/update-selection';
17
19
 
18
20
  // 8px gap + 16px on left and right
19
21
  const DROP_TARGET_LAYOUT_DROP_ZONE_WIDTH = 40;
@@ -70,12 +72,36 @@ export const DropTargetLayout = props => {
70
72
  return;
71
73
  }
72
74
  const to = getPos();
75
+ let mappedTo;
73
76
  if (to !== undefined) {
74
- var _api$core, _api$blockControls2, _api$blockControls2$c;
77
+ var _api$core;
75
78
  const {
76
79
  pos: from
77
80
  } = activeNode;
78
- api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : (_api$blockControls2$c = _api$blockControls2.commands) === null || _api$blockControls2$c === void 0 ? void 0 : _api$blockControls2$c.moveToLayout(from, to));
81
+ api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(({
82
+ tr
83
+ }) => {
84
+ var _api$blockControls2, _api$blockControls2$c;
85
+ api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : (_api$blockControls2$c = _api$blockControls2.commands) === null || _api$blockControls2$c === void 0 ? void 0 : _api$blockControls2$c.moveToLayout(from, to)({
86
+ tr
87
+ });
88
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
89
+ const insertColumnStep = getInsertLayoutStep(tr);
90
+ mappedTo = insertColumnStep === null || insertColumnStep === void 0 ? void 0 : insertColumnStep.from;
91
+ }
92
+ return tr;
93
+ });
94
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
95
+ var _api$core2;
96
+ api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(({
97
+ tr
98
+ }) => {
99
+ if (mappedTo !== undefined) {
100
+ updateSelection(tr, mappedTo);
101
+ }
102
+ return tr;
103
+ });
104
+ }
79
105
  }
80
106
  }, [api, getPos, activeNode]);
81
107
  useEffect(() => {
@@ -9,6 +9,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
9
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
10
10
  import { css, jsx } from '@emotion/react';
11
11
  import { akEditorBreakoutPadding } from '@atlaskit/editor-shared-styles';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
13
14
  import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
14
15
  import { B200 } from '@atlaskit/theme/colors';
@@ -16,6 +17,7 @@ import { getNodeAnchor } from '../pm-plugins/decorations-common';
16
17
  import { useActiveAnchorTracker } from '../pm-plugins/utils/active-anchor-tracker';
17
18
  import { isAnchorSupported } from '../pm-plugins/utils/anchor-utils';
18
19
  import { isBlocksDragTargetDebug } from '../pm-plugins/utils/drag-target-debug';
20
+ import { getInsertLayoutStep, updateSelection } from '../pm-plugins/utils/update-selection';
19
21
  const HOVER_ZONE_WIDTH = '--editor-blocks-inline-hover-zone-width';
20
22
  const HOVER_ZONE_HEIGHT = '--editor-blocks-inline-hover-zone-height';
21
23
  const HOVER_ZONE_TOP = '--editor-blocks-inline-hover-zone-top';
@@ -175,14 +177,39 @@ export const InlineDropTarget = ({
175
177
  return;
176
178
  }
177
179
  const toPos = getPos();
180
+ let mappedTo;
178
181
  if (activeNode && toPos !== undefined) {
179
- var _api$core, _api$blockControls2, _api$blockControls2$c;
182
+ var _api$core;
180
183
  const {
181
184
  pos: start
182
185
  } = activeNode;
183
- api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : (_api$blockControls2$c = _api$blockControls2.commands) === null || _api$blockControls2$c === void 0 ? void 0 : _api$blockControls2$c.moveToLayout(start, toPos, {
184
- moveToEnd: position === 'right'
185
- }));
186
+ const moveToEnd = position === 'right';
187
+ api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(({
188
+ tr
189
+ }) => {
190
+ var _api$blockControls2, _api$blockControls2$c;
191
+ api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : (_api$blockControls2$c = _api$blockControls2.commands) === null || _api$blockControls2$c === void 0 ? void 0 : _api$blockControls2$c.moveToLayout(start, toPos, {
192
+ moveToEnd
193
+ })({
194
+ tr
195
+ });
196
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
197
+ const insertLayoutStep = getInsertLayoutStep(tr);
198
+ mappedTo = insertLayoutStep === null || insertLayoutStep === void 0 ? void 0 : insertLayoutStep.from;
199
+ }
200
+ return tr;
201
+ });
202
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
203
+ var _api$core2;
204
+ api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(({
205
+ tr
206
+ }) => {
207
+ if (mappedTo !== undefined) {
208
+ updateSelection(tr, mappedTo, moveToEnd);
209
+ }
210
+ return tr;
211
+ });
212
+ }
186
213
  }
187
214
  }, [api, getPos, position]);
188
215
  const hoverZoneRectStyle = useMemo(() => {
@@ -1,6 +1,7 @@
1
1
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
3
3
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { maxLayoutColumnSupported } from '../pm-plugins/utils/consts';
5
6
  import { fireInsertLayoutAnalytics, fireMoveNodeAnalytics } from '../pm-plugins/utils/fire-analytics';
6
7
  import { removeFromSource } from '../pm-plugins/utils/remove-from-source';
@@ -38,13 +39,21 @@ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos,
38
39
  // reorder columns
39
40
  tr.delete(from, from + sourceNode.nodeSize);
40
41
  var mappedTo = tr.mapping.map(to);
41
- tr.insert(mappedTo, sourceNode).setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
42
+ tr.insert(mappedTo, sourceNode);
43
+ if (!fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
44
+ tr.setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
45
+ }
42
46
  fireMoveNodeAnalytics(tr, INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf === void 0 ? void 0 : _$originalFrom$nodeAf.type.name) || '', 1, 'layoutSection', true, api);
43
47
  } else if (toLayout.childCount < maxLayoutColumnSupported()) {
44
48
  var _$originalFrom$nodeAf2;
45
- insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos);
46
- var mappedFrom = tr.mapping.map(from);
47
- removeFromSource(tr, tr.doc.resolve(mappedFrom));
49
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
50
+ removeFromSource(tr, tr.doc.resolve(from));
51
+ insertToDestination(tr, tr.mapping.map(to), sourceNode, toLayout, tr.mapping.map(toLayoutPos));
52
+ } else {
53
+ insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos);
54
+ var mappedFrom = tr.mapping.map(from);
55
+ removeFromSource(tr, tr.doc.resolve(mappedFrom));
56
+ }
48
57
  fireMoveNodeAnalytics(tr, INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf2 = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf2 === void 0 ? void 0 : _$originalFrom$nodeAf2.type.name) || '', 1, 'layoutSection', false, api);
49
58
  }
50
59
  return tr;
@@ -57,7 +66,10 @@ var insertToDestination = function insertToDestination(tr, to, sourceNode, toLay
57
66
  var content = layoutColumn.createChecked({
58
67
  width: newColumnWidth
59
68
  }, sourceNode.type.name === 'layoutColumn' ? sourceNode.content : sourceNode);
60
- tr.insert(to, content).setSelection(new NodeSelection(tr.doc.resolve(to))).scrollIntoView();
69
+ tr.insert(to, content);
70
+ if (!fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
71
+ tr.setSelection(new NodeSelection(tr.doc.resolve(to))).scrollIntoView();
72
+ }
61
73
  return tr;
62
74
  };
63
75
 
@@ -165,7 +177,10 @@ export var moveToLayout = function moveToLayout(api) {
165
177
  if (newLayout) {
166
178
  tr = removeFromSource(tr, $from);
167
179
  var mappedTo = tr.mapping.map(to);
168
- tr.delete(mappedTo, mappedTo + toNodeWithoutBreakout.nodeSize).insert(mappedTo, newLayout).setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
180
+ tr.delete(mappedTo, mappedTo + toNodeWithoutBreakout.nodeSize).insert(mappedTo, newLayout);
181
+ if (!fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
182
+ tr.setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
183
+ }
169
184
  breakoutMode && tr.setNodeMarkup(mappedTo, newLayout.type, newLayout.attrs, [breakout.create({
170
185
  mode: breakoutMode
171
186
  })]);
@@ -0,0 +1,38 @@
1
+ import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
2
+ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
3
+ import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
4
+ export var getInsertLayoutStep = function getInsertLayoutStep(tr) {
5
+ return tr.steps.find(function (step) {
6
+ var _step$slice$content$f;
7
+ return step instanceof ReplaceStep && ['layoutSection', 'layoutColumn'].includes(((_step$slice$content$f = step.slice.content.firstChild) === null || _step$slice$content$f === void 0 ? void 0 : _step$slice$content$f.type.name) || '');
8
+ });
9
+ };
10
+ export var updateSelection = function updateSelection(tr, to, insertAtRight) {
11
+ var _lastNode;
12
+ var $to = tr.doc.resolve(to);
13
+ var toNode = $to.nodeAfter;
14
+ var lastNode = toNode === null || toNode === void 0 ? void 0 : toNode.content.lastChild;
15
+ if (!toNode || !lastNode) {
16
+ return tr;
17
+ }
18
+ var offset = toNode.nodeSize;
19
+
20
+ // drop at the start of the layoutSection or to create a new layoutSection
21
+ if (toNode.type.name === 'layoutSection') {
22
+ if (insertAtRight) {
23
+ var _toNode$content$lastC;
24
+ lastNode = (_toNode$content$lastC = toNode.content.lastChild) === null || _toNode$content$lastC === void 0 ? void 0 : _toNode$content$lastC.lastChild;
25
+ offset = toNode.nodeSize - 1;
26
+ } else {
27
+ var _toNode$content$first, _toNode$content$first2;
28
+ lastNode = (_toNode$content$first = toNode.content.firstChild) === null || _toNode$content$first === void 0 ? void 0 : _toNode$content$first.lastChild;
29
+ offset = 1 + (((_toNode$content$first2 = toNode.content.firstChild) === null || _toNode$content$first2 === void 0 ? void 0 : _toNode$content$first2.nodeSize) || 0);
30
+ }
31
+ }
32
+ if (['paragraph', 'heading'].includes(((_lastNode = lastNode) === null || _lastNode === void 0 ? void 0 : _lastNode.type.name) || '')) {
33
+ tr.setSelection(TextSelection.near(tr.doc.resolve(to + offset - 2)));
34
+ } else if (lastNode) {
35
+ tr.setSelection(new GapCursorSelection(tr.doc.resolve(to + offset - 1), Side.RIGHT));
36
+ }
37
+ return tr;
38
+ };
@@ -9,6 +9,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
9
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
10
10
  import { css, jsx } from '@emotion/react';
11
11
  import { layoutBreakpointWidth } from '@atlaskit/editor-shared-styles';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
13
14
  import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
14
15
  import { B200 } from '@atlaskit/theme/colors';
@@ -16,6 +17,7 @@ import { getNodeAnchor } from '../pm-plugins/decorations-common';
16
17
  import { useActiveAnchorTracker } from '../pm-plugins/utils/active-anchor-tracker';
17
18
  import { isAnchorSupported } from '../pm-plugins/utils/anchor-utils';
18
19
  import { isBlocksDragTargetDebug } from '../pm-plugins/utils/drag-target-debug';
20
+ import { getInsertLayoutStep, updateSelection } from '../pm-plugins/utils/update-selection';
19
21
 
20
22
  // 8px gap + 16px on left and right
21
23
  var DROP_TARGET_LAYOUT_DROP_ZONE_WIDTH = 40;
@@ -71,10 +73,32 @@ export var DropTargetLayout = function DropTargetLayout(props) {
71
73
  return;
72
74
  }
73
75
  var to = getPos();
76
+ var mappedTo;
74
77
  if (to !== undefined) {
75
- var _api$core, _api$blockControls2;
78
+ var _api$core;
76
79
  var from = activeNode.pos;
77
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.moveToLayout(from, to));
80
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
81
+ var _api$blockControls2;
82
+ var tr = _ref2.tr;
83
+ api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 || _api$blockControls2.moveToLayout(from, to)({
84
+ tr: tr
85
+ });
86
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
87
+ var insertColumnStep = getInsertLayoutStep(tr);
88
+ mappedTo = insertColumnStep === null || insertColumnStep === void 0 ? void 0 : insertColumnStep.from;
89
+ }
90
+ return tr;
91
+ });
92
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
93
+ var _api$core2;
94
+ api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref3) {
95
+ var tr = _ref3.tr;
96
+ if (mappedTo !== undefined) {
97
+ updateSelection(tr, mappedTo);
98
+ }
99
+ return tr;
100
+ });
101
+ }
78
102
  }
79
103
  }, [api, getPos, activeNode]);
80
104
  useEffect(function () {
@@ -11,6 +11,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
11
11
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
12
12
  import { css, jsx } from '@emotion/react';
13
13
  import { akEditorBreakoutPadding } from '@atlaskit/editor-shared-styles';
14
+ import { fg } from '@atlaskit/platform-feature-flags';
14
15
  import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
15
16
  import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
16
17
  import { B200 } from '@atlaskit/theme/colors';
@@ -18,6 +19,7 @@ import { getNodeAnchor } from '../pm-plugins/decorations-common';
18
19
  import { useActiveAnchorTracker } from '../pm-plugins/utils/active-anchor-tracker';
19
20
  import { isAnchorSupported } from '../pm-plugins/utils/anchor-utils';
20
21
  import { isBlocksDragTargetDebug } from '../pm-plugins/utils/drag-target-debug';
22
+ import { getInsertLayoutStep, updateSelection } from '../pm-plugins/utils/update-selection';
21
23
  var HOVER_ZONE_WIDTH = '--editor-blocks-inline-hover-zone-width';
22
24
  var HOVER_ZONE_HEIGHT = '--editor-blocks-inline-hover-zone-height';
23
25
  var HOVER_ZONE_TOP = '--editor-blocks-inline-hover-zone-top';
@@ -180,16 +182,39 @@ export var InlineDropTarget = function InlineDropTarget(_ref) {
180
182
  return;
181
183
  }
182
184
  var toPos = getPos();
185
+ var mappedTo;
183
186
  if (activeNode && toPos !== undefined) {
184
- var _api$core, _api$blockControls2;
187
+ var _api$core;
185
188
  var start = activeNode.pos;
186
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.moveToLayout(start, toPos, {
187
- moveToEnd: position === 'right'
188
- }));
189
+ var moveToEnd = position === 'right';
190
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref3) {
191
+ var _api$blockControls2;
192
+ var tr = _ref3.tr;
193
+ api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 || _api$blockControls2.moveToLayout(start, toPos, {
194
+ moveToEnd: moveToEnd
195
+ })({
196
+ tr: tr
197
+ });
198
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
199
+ var insertLayoutStep = getInsertLayoutStep(tr);
200
+ mappedTo = insertLayoutStep === null || insertLayoutStep === void 0 ? void 0 : insertLayoutStep.from;
201
+ }
202
+ return tr;
203
+ });
204
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
205
+ var _api$core2;
206
+ api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref4) {
207
+ var tr = _ref4.tr;
208
+ if (mappedTo !== undefined) {
209
+ updateSelection(tr, mappedTo, moveToEnd);
210
+ }
211
+ return tr;
212
+ });
213
+ }
189
214
  }
190
215
  }, [api, getPos, position]);
191
216
  var hoverZoneRectStyle = useMemo(function () {
192
- var _ref3;
217
+ var _ref5;
193
218
  var isLayoutNode = (nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name) === 'layoutSection';
194
219
  var layoutAdjustment = isLayoutNode ? {
195
220
  width: 11,
@@ -197,7 +222,7 @@ export var InlineDropTarget = function InlineDropTarget(_ref) {
197
222
  top: 6,
198
223
  bottom: 2
199
224
  } : undefined;
200
- return _ref3 = {}, _defineProperty(_ref3, HOVER_ZONE_WIDTH, nodeDimension.widthOffset ? "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px + ").concat(nodeDimension.widthOffset, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)") : "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)")), _defineProperty(_ref3, HOVER_ZONE_HEIGHT, "calc(".concat(nodeDimension.height, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.height) || 0, "px)")), _defineProperty(_ref3, HOVER_ZONE_TOP, "calc(".concat(nodeDimension.top, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.top) || 0, "px)")), _defineProperty(_ref3, HOVER_ZONE_BOTTOM, "calc(".concat(nodeDimension.bottom, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.bottom) || 0, "px)")), _defineProperty(_ref3, HOVER_ZONE_ANCHOR_NAME, anchorName), _ref3;
225
+ return _ref5 = {}, _defineProperty(_ref5, HOVER_ZONE_WIDTH, nodeDimension.widthOffset ? "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px + ").concat(nodeDimension.widthOffset, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)") : "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)")), _defineProperty(_ref5, HOVER_ZONE_HEIGHT, "calc(".concat(nodeDimension.height, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.height) || 0, "px)")), _defineProperty(_ref5, HOVER_ZONE_TOP, "calc(".concat(nodeDimension.top, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.top) || 0, "px)")), _defineProperty(_ref5, HOVER_ZONE_BOTTOM, "calc(".concat(nodeDimension.bottom, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.bottom) || 0, "px)")), _defineProperty(_ref5, HOVER_ZONE_ANCHOR_NAME, anchorName), _ref5;
201
226
  }, [nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name, nodeDimension, anchorName]);
202
227
  var dropIndicatorPos = useMemo(function () {
203
228
  return isLeftPosition ? 'right' : 'left';
@@ -0,0 +1,3 @@
1
+ import { type Transaction } from '@atlaskit/editor-prosemirror/state';
2
+ export declare const getInsertLayoutStep: (tr: Transaction) => import("prosemirror-transform").Step | undefined;
3
+ export declare const updateSelection: (tr: Transaction, to: number, insertAtRight?: boolean) => Transaction;
@@ -0,0 +1,3 @@
1
+ import { type Transaction } from '@atlaskit/editor-prosemirror/state';
2
+ export declare const getInsertLayoutStep: (tr: Transaction) => import("prosemirror-transform").Step | undefined;
3
+ export declare const updateSelection: (tr: Transaction, to: number, insertAtRight?: boolean) => Transaction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "2.14.2",
3
+ "version": "2.14.3",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,12 +31,12 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@atlaskit/adf-schema": "^46.1.0",
34
- "@atlaskit/editor-common": "^96.0.0",
34
+ "@atlaskit/editor-common": "^96.2.0",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
37
  "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
38
38
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
39
- "@atlaskit/editor-plugin-quick-insert": "^1.7.0",
39
+ "@atlaskit/editor-plugin-quick-insert": "^1.8.0",
40
40
  "@atlaskit/editor-plugin-width": "^1.3.0",
41
41
  "@atlaskit/editor-prosemirror": "6.2.1",
42
42
  "@atlaskit/editor-shared-styles": "^3.2.0",
@@ -44,11 +44,11 @@
44
44
  "@atlaskit/icon": "^23.0.0",
45
45
  "@atlaskit/platform-feature-flags": "^0.3.0",
46
46
  "@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
47
- "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.0.0",
47
+ "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
48
48
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
49
49
  "@atlaskit/primitives": "^13.3.0",
50
50
  "@atlaskit/theme": "^14.0.0",
51
- "@atlaskit/tmp-editor-statsig": "^2.22.0",
51
+ "@atlaskit/tmp-editor-statsig": "^2.23.0",
52
52
  "@atlaskit/tokens": "^2.4.0",
53
53
  "@atlaskit/tooltip": "^18.9.0",
54
54
  "@babel/runtime": "^7.0.0",
@@ -165,6 +165,9 @@
165
165
  },
166
166
  "platform_editor_use_nested_table_pm_nodes": {
167
167
  "type": "boolean"
168
+ },
169
+ "platform_editor_advanced_layouts_post_fix_patch_1": {
170
+ "type": "boolean"
168
171
  }
169
172
  }
170
173
  }