@atlaskit/editor-plugin-block-controls 2.21.1 → 2.21.2

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,13 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 2.21.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#103365](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103365)
8
+ [`fb69e4b7a2f59`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fb69e4b7a2f59) -
9
+ ED-26243 Removed unused drop-target v1
10
+
3
11
  ## 2.21.1
4
12
 
5
13
  ### Patch Changes
@@ -14,8 +14,8 @@ var _view = require("@atlaskit/editor-prosemirror/view");
14
14
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
15
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
16
16
  var _consts = require("../ui/consts");
17
+ var _dropTarget = require("../ui/drop-target");
17
18
  var _dropTargetLayout = require("../ui/drop-target-layout");
18
- var _dropTargetV = require("../ui/drop-target-v2");
19
19
  var _decorationsCommon = require("./decorations-common");
20
20
  var _consts2 = require("./utils/consts");
21
21
  var _dragTargetDebug = require("./utils/drag-target-debug");
@@ -104,19 +104,19 @@ var createDropTargetDecoration = exports.createDropTargetDecoration = function c
104
104
  var _getGapAndOffset = getGapAndOffset(props.prevNode, props.nextNode, props.parentNode),
105
105
  gap = _getGapAndOffset.gap,
106
106
  offset = _getGapAndOffset.offset;
107
- element.style.setProperty(_dropTargetV.EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET, "".concat(offset, "px"));
108
- element.style.setProperty(_dropTargetV.EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP, "".concat(gap, "px"));
107
+ element.style.setProperty(_dropTarget.EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET, "".concat(offset, "px"));
108
+ element.style.setProperty(_dropTarget.EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP, "".concat(gap, "px"));
109
109
  element.style.setProperty('display', 'block');
110
110
  if ((0, _platformFeatureFlags.fg)('platform_editor_react18_plugin_portalprovider')) {
111
111
  nodeViewPortalProviderAPI.render(function () {
112
- return /*#__PURE__*/(0, _react.createElement)(_dropTargetV.DropTargetV2, _objectSpread(_objectSpread({}, props), {}, {
112
+ return /*#__PURE__*/(0, _react.createElement)(_dropTarget.DropTarget, _objectSpread(_objectSpread({}, props), {}, {
113
113
  getPos: getPos,
114
114
  anchorRectCache: anchorRectCache,
115
115
  isSameLayout: isSameLayout
116
116
  }));
117
117
  }, element, key);
118
118
  } else {
119
- _reactDom.default.render( /*#__PURE__*/(0, _react.createElement)(_dropTargetV.DropTargetV2, _objectSpread(_objectSpread({}, props), {}, {
119
+ _reactDom.default.render( /*#__PURE__*/(0, _react.createElement)(_dropTarget.DropTarget, _objectSpread(_objectSpread({}, props), {}, {
120
120
  getPos: getPos,
121
121
  anchorRectCache: anchorRectCache,
122
122
  isSameLayout: isSameLayout
@@ -4,7 +4,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.DropTarget = void 0;
7
+ exports.EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET = exports.EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP = exports.DropTarget = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
11
  var _react = require("react");
@@ -14,8 +15,13 @@ 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 _constants = require("@atlaskit/theme/constants");
16
17
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
18
+ var _decorationsCommon = require("../pm-plugins/decorations-common");
19
+ var _activeAnchorTracker = require("../pm-plugins/utils/active-anchor-tracker");
20
+ var _anchorUtils = require("../pm-plugins/utils/anchor-utils");
17
21
  var _dragTargetDebug = require("../pm-plugins/utils/drag-target-debug");
22
+ var _inlineDropTarget = require("../pm-plugins/utils/inline-drop-target");
18
23
  var _consts = require("./consts");
24
+ var _inlineDropTarget2 = require("./inline-drop-target");
19
25
  /**
20
26
  * @jsxRuntime classic
21
27
  * @jsx jsx
@@ -27,15 +33,16 @@ var DEFAULT_DROP_INDICATOR_WIDTH = 760;
27
33
  var EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_WIDTH = '--editor-block-controls-drop-indicator-width';
28
34
  var EDITOR_BLOCK_CONTROLS_DROP_TARGET_LEFT_MARGIN = '--editor-block-controls-drop-target-leftMargin';
29
35
  var EDITOR_BLOCK_CONTROLS_DROP_TARGET_ZINDEX = '--editor-block-controls-drop-target-zindex';
36
+ var EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET = exports.EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET = '--editor-block-controls-drop-indicator-offset';
37
+ var EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP = exports.EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP = '--editor-block-controls-drop-indicator-gap';
30
38
  var styleDropTarget = (0, _react2.css)({
31
- height: "var(--ds-space-100, 8px)",
32
- marginTop: "var(--ds-space-negative-100, -8px)",
33
39
  marginLeft: "calc(-1 * var(".concat(EDITOR_BLOCK_CONTROLS_DROP_TARGET_LEFT_MARGIN, ", 0))"),
34
40
  paddingLeft: "var(".concat(EDITOR_BLOCK_CONTROLS_DROP_TARGET_LEFT_MARGIN, ", 0)"),
35
41
  position: 'absolute',
36
42
  left: '0',
37
43
  display: 'block',
38
- zIndex: "var(".concat(EDITOR_BLOCK_CONTROLS_DROP_TARGET_ZINDEX, ", 110)")
44
+ zIndex: "var(".concat(EDITOR_BLOCK_CONTROLS_DROP_TARGET_ZINDEX, ", 110)"),
45
+ transform: "translateY(var(".concat(EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET, ", 0))")
39
46
  });
40
47
  var styleDropIndicator = (0, _react2.css)({
41
48
  height: '100%',
@@ -46,65 +53,141 @@ var styleDropIndicator = (0, _react2.css)({
46
53
  var nestedDropIndicatorStyle = (0, _react2.css)({
47
54
  position: 'relative'
48
55
  });
49
- var marginLookupMap = Object.fromEntries(Object.entries(_consts.spaceLookupMap).map(function (_ref, i) {
50
- var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
51
- key = _ref2[0],
52
- value = _ref2[1];
53
- return [key,
54
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
55
- (0, _react2.css)({
56
- transform: "translateY(".concat(value, ")")
57
- })];
58
- }));
59
- var getNodeMargins = function getNodeMargins(node) {
60
- if (!node) {
61
- return _consts.nodeMargins['default'];
62
- }
63
- var nodeTypeName = node.type.name;
64
- if (nodeTypeName === 'heading') {
65
- return _consts.nodeMargins["heading".concat(node.attrs.level)] || _consts.nodeMargins['default'];
66
- }
67
- return _consts.nodeMargins[nodeTypeName] || _consts.nodeMargins['default'];
68
- };
69
- var getNestedDropTargetMarginTop = function getNestedDropTargetMarginTop(prevNode, nextNode, isNestedDropTarget) {
70
- if (!prevNode || !nextNode) {
71
- return (0, _react2.css)({
72
- marginTop: "var(--ds-space-negative-100, -8px)"
73
- });
74
- }
75
- var top = getNodeMargins(nextNode).top;
76
- var bottom = getNodeMargins(prevNode).bottom;
77
- if (['rule', 'media', 'mediaSingle'].includes(prevNode.type.name) && isNestedDropTarget && top > 0 && bottom > 0) {
78
- var collapsedMarginOffset = top === bottom ? top : Math.abs(top - bottom);
79
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
80
- var marginTop = _consts.dropTargetMarginMap[-collapsedMarginOffset - 8] || "-".concat(collapsedMarginOffset + 8, "px");
81
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
56
+ var dropZoneStyles = (0, _react2.css)({
57
+ margin: 0,
58
+ position: 'absolute',
59
+ width: '100%',
60
+ zIndex: 110,
61
+ minHeight: '4px'
62
+ });
63
+ var nestedDropZoneStyle = (0, _react2.css)({
64
+ left: '4px',
65
+ right: '4px',
66
+ width: 'unset'
67
+ });
68
+ var enableDropZone = ['paragraph', 'mediaSingle', 'heading', 'codeBlock', 'decisionList', 'bulletList', 'orderedList', 'taskList', 'extension', 'blockCard'];
69
+
70
+ // This z index is used in container like layout
71
+ var fullHeightStyleAdjustZIndexStyle = (0, _react2.css)({
72
+ zIndex: 0
73
+ });
74
+ var HoverZone = function HoverZone(_ref) {
75
+ var _onDragEnter = _ref.onDragEnter,
76
+ onDragLeave = _ref.onDragLeave,
77
+ onDrop = _ref.onDrop,
78
+ node = _ref.node,
79
+ parent = _ref.parent,
80
+ editorWidth = _ref.editorWidth,
81
+ anchorRectCache = _ref.anchorRectCache,
82
+ position = _ref.position,
83
+ isNestedDropTarget = _ref.isNestedDropTarget,
84
+ dropTargetStyle = _ref.dropTargetStyle;
85
+ var ref = (0, _react.useRef)(null);
86
+ var isRemainingheight = dropTargetStyle === 'remainingHeight';
87
+ var anchorName = (0, _react.useMemo)(function () {
88
+ return node ? (0, _decorationsCommon.getNodeAnchor)(node) : '';
89
+ }, [node]);
90
+ var _useActiveAnchorTrack = (0, _activeAnchorTracker.useActiveAnchorTracker)(anchorName),
91
+ _useActiveAnchorTrack2 = (0, _slicedToArray2.default)(_useActiveAnchorTrack, 2),
92
+ _isActive = _useActiveAnchorTrack2[0],
93
+ setActiveAnchor = _useActiveAnchorTrack2[1];
94
+ (0, _react.useEffect)(function () {
95
+ if (ref.current) {
96
+ return (0, _adapter.dropTargetForElements)({
97
+ element: ref.current,
98
+ onDragEnter: function onDragEnter() {
99
+ if (!isNestedDropTarget && (0, _experiments.editorExperiment)('advanced_layouts', true)) {
100
+ setActiveAnchor();
101
+ }
102
+ _onDragEnter();
103
+ },
104
+ onDragLeave: onDragLeave,
105
+ onDrop: onDrop
106
+ });
107
+ }
108
+ }, [isNestedDropTarget, _onDragEnter, onDragLeave, onDrop, setActiveAnchor]);
109
+ var hoverZoneUpperStyle = (0, _react.useMemo)(function () {
110
+ var heightStyleOffset = "var(--editor-block-controls-drop-indicator-gap, 0)/2";
111
+ var transformOffset = "var(".concat(EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET, ", 0)");
112
+ var heightStyle = anchorName && enableDropZone.includes((node === null || node === void 0 ? void 0 : node.type.name) || '') ? (0, _anchorUtils.isAnchorSupported)() ? "calc(anchor-size(".concat(anchorName, " height)/2 + ").concat(heightStyleOffset, ")") : "calc(".concat(((anchorRectCache === null || anchorRectCache === void 0 ? void 0 : anchorRectCache.getHeight(anchorName)) || 0) / 2, "px + ").concat(heightStyleOffset, ")") : '4px';
113
+ var transform = position === 'upper' ? "translateY(calc(-100% + ".concat(transformOffset, "))") : "translateY(".concat(transformOffset, ")");
82
114
  return (0, _react2.css)({
83
- marginTop: marginTop
115
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
116
+ height: heightStyle,
117
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
118
+ transform: transform,
119
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
120
+ maxWidth: "".concat(editorWidth || 0, "px")
84
121
  });
85
- }
86
- };
87
- var getDropTargetOffsetStyle = function getDropTargetOffsetStyle(prevNode, nextNode) {
88
- if (!prevNode || !nextNode) {
89
- return null;
90
- }
91
- var top = getNodeMargins(nextNode).top;
92
- var bottom = getNodeMargins(prevNode).bottom;
93
- var marginDiff = Math.round((top - bottom) / 2);
94
- if (marginDiff === 0) {
122
+ }, [anchorName, anchorRectCache, editorWidth, node === null || node === void 0 ? void 0 : node.type.name, position]);
123
+
124
+ /**
125
+ * 1. Above the last empty line
126
+ * 2. Below the last element
127
+ *
128
+ * Both cases will take the remaining height of the the container
129
+ */
130
+ var heightStyle = (0, _react.useMemo)(function () {
131
+ // only apply upper drop zone
132
+ if (isRemainingheight && position === 'upper') {
133
+ // previous node
134
+ var _anchorName = node ? (0, _decorationsCommon.getNodeAnchor)(node) : '';
135
+ var top = 'unset';
136
+ if (_anchorName) {
137
+ var enabledDropZone = enableDropZone.includes((node === null || node === void 0 ? void 0 : node.type.name) || '');
138
+ if ((0, _anchorUtils.isAnchorSupported)()) {
139
+ top = enabledDropZone ? "calc(anchor(".concat(_anchorName, " 50%))") : "calc(anchor(".concat(_anchorName, " bottom) - 4px)");
140
+ } else if (anchorRectCache) {
141
+ var preNodeTopPos = anchorRectCache.getTop(_anchorName) || 0;
142
+ var prevNodeHeight = anchorRectCache.getHeight(_anchorName) || 0;
143
+ top = enabledDropZone ? "calc(".concat(preNodeTopPos, "px + ").concat(prevNodeHeight / 2, "px)") : "calc(".concat(preNodeTopPos, "px + ").concat(prevNodeHeight, "px - 4px)");
144
+ } else {
145
+ // Should not happen
146
+ return null;
147
+ }
148
+ } else {
149
+ // first empty paragraph
150
+ top = '4px';
151
+ }
152
+ return (0, _react2.css)({
153
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
154
+ top: top,
155
+ bottom: '4px',
156
+ height: 'unset',
157
+ zIndex: 10,
158
+ transform: 'none'
159
+ });
160
+ }
95
161
  return null;
96
- }
97
- var offset = Math.max(Math.min(marginDiff, 24), -24);
98
- return marginLookupMap[offset];
162
+ }, [anchorRectCache, isRemainingheight, node, position]);
163
+ var isFullHeightInLayout = isRemainingheight && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutColumn';
164
+ return (0, _react2.jsx)("div", {
165
+ ref: ref
166
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
167
+ ,
168
+ className: "drop-target-hover-zone-".concat(position),
169
+ "data-testid": "drop-target-zone-".concat(position)
170
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
171
+ ,
172
+ css: [dropZoneStyles, isNestedDropTarget && nestedDropZoneStyle,
173
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
174
+ hoverZoneUpperStyle,
175
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
176
+ heightStyle, isFullHeightInLayout && fullHeightStyleAdjustZIndexStyle]
177
+ });
99
178
  };
100
- var DropTarget = exports.DropTarget = function DropTarget(_ref3) {
101
- var api = _ref3.api,
102
- getPos = _ref3.getPos,
103
- prevNode = _ref3.prevNode,
104
- nextNode = _ref3.nextNode,
105
- parentNode = _ref3.parentNode,
106
- formatMessage = _ref3.formatMessage;
107
- var ref = (0, _react.useRef)(null);
179
+ var DropTarget = exports.DropTarget = function DropTarget(props) {
180
+ var _api$blockControls;
181
+ var api = props.api,
182
+ getPos = props.getPos,
183
+ prevNode = props.prevNode,
184
+ nextNode = props.nextNode,
185
+ parentNode = props.parentNode,
186
+ formatMessage = props.formatMessage,
187
+ anchorRectCache = props.anchorRectCache,
188
+ _props$dropTargetStyl = props.dropTargetStyle,
189
+ dropTargetStyle = _props$dropTargetStyl === void 0 ? 'default' : _props$dropTargetStyl,
190
+ isSameLayout = props.isSameLayout;
108
191
  var _useState = (0, _react.useState)(false),
109
192
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
110
193
  isDraggedOver = _useState2[0],
@@ -112,102 +195,73 @@ var DropTarget = exports.DropTarget = function DropTarget(_ref3) {
112
195
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width']),
113
196
  widthState = _useSharedPluginState.widthState;
114
197
  var isNestedDropTarget = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name) !== 'doc';
115
- (0, _react.useEffect)(function () {
116
- var element = ref.current;
117
- if (!element) {
198
+ var _ref2 = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
199
+ activeNode = _ref2.activeNode;
200
+ var onDrop = function onDrop() {
201
+ if (!activeNode) {
118
202
  return;
119
203
  }
120
-
121
- // This should be moved to platform/packages/editor/editor-plugin-block-controls/src/pm-plugins/utils/validation.ts
122
- // Since we are moved to drop-target-v2
123
- // Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
124
- if ((0, _experiments.editorExperiment)('nest-media-and-codeblock-in-quote', false)) {
125
- var _api$blockControls;
126
- var _ref4 = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
127
- activeNode = _ref4.activeNode;
128
- var parentNodeType = parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name;
129
- var activeNodeType = activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType;
130
- if (parentNodeType === 'blockquote' && (activeNodeType === 'mediaGroup' || activeNodeType === 'mediaSingle' || activeNodeType === 'codeBlock')) {
131
- return;
132
- }
133
- }
134
- if ((0, _experiments.editorExperiment)('nested-expand-in-expand', false)) {
135
- var _api$blockControls2;
136
- var _ref5 = (api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.sharedState.currentState()) || {},
137
- _activeNode = _ref5.activeNode;
138
- var _parentNodeType = parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name;
139
- var _activeNodeType = _activeNode === null || _activeNode === void 0 ? void 0 : _activeNode.nodeType;
140
- if (_parentNodeType === 'expand' && (_activeNodeType === 'expand' || _activeNodeType === 'nestedExpand')) {
141
- return;
142
- }
143
- }
144
- return (0, _adapter.dropTargetForElements)({
145
- element: element,
146
- getIsSticky: function getIsSticky() {
147
- return true;
148
- },
149
- onDragEnter: function onDragEnter() {
150
- setIsDraggedOver(true);
151
- },
152
- onDragLeave: function onDragLeave() {
153
- setIsDraggedOver(false);
154
- },
155
- onDrop: function onDrop() {
156
- var _api$blockControls3;
157
- var _ref6 = (api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.sharedState.currentState()) || {},
158
- activeNode = _ref6.activeNode;
159
- if (!activeNode) {
160
- return;
161
- }
162
- var pos = getPos();
163
- if (activeNode && pos !== undefined) {
164
- var _api$core, _api$blockControls4;
165
- var start = activeNode.pos;
166
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || (_api$blockControls4 = _api$blockControls4.commands) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.moveNode(start, pos, undefined, formatMessage));
167
- }
168
- }
169
- });
170
- }, [api, formatMessage, getPos, parentNode]);
171
- var dropTargetOffsetStyle = (0, _react.useMemo)(function () {
172
- /**
173
- * First child of a nested node.
174
- * Disable the position adjustment temporarily
175
- */
176
- if (parentNode === prevNode) {
177
- return null;
204
+ var pos = getPos();
205
+ if (activeNode && pos !== undefined) {
206
+ var _api$core, _api$blockControls2;
207
+ var start = activeNode.pos;
208
+ 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.moveNode(start, pos, undefined, formatMessage));
178
209
  }
179
- return getDropTargetOffsetStyle(prevNode, nextNode);
180
- }, [prevNode, nextNode, parentNode]);
181
- var dropTargetMarginTopStyles = (0, _react.useMemo)(function () {
182
- if (parentNode === prevNode) {
183
- return null;
184
- }
185
- return getNestedDropTargetMarginTop(prevNode, nextNode, isNestedDropTarget);
186
- }, [prevNode, nextNode, parentNode, isNestedDropTarget]);
210
+ };
187
211
  var dynamicStyle = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
188
212
  width: isNestedDropTarget ? 'unset' : '100%'
189
213
  }, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_WIDTH, isNestedDropTarget ? '100%' : "".concat((widthState === null || widthState === void 0 ? void 0 : widthState.lineLength) || DEFAULT_DROP_INDICATOR_WIDTH, "px")), EDITOR_BLOCK_CONTROLS_DROP_TARGET_LEFT_MARGIN, isNestedDropTarget ? (0, _consts.getNestedNodeLeftPaddingMargin)(parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name) : '0'), EDITOR_BLOCK_CONTROLS_DROP_TARGET_ZINDEX, (0, _experiments.editorExperiment)('nested-dnd', true) ? _constants.layers.navigation() : _constants.layers.card());
190
- return (
191
- // Note: Firefox has trouble with using a button element as the handle for drag and drop
192
- (0, _react2.jsx)("div", {
193
- css: [styleDropTarget,
194
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
195
- dropTargetOffsetStyle, isNestedDropTarget && nestedDropIndicatorStyle,
196
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
197
- dropTargetMarginTopStyles]
198
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
199
- ,
200
- style: dynamicStyle,
201
- ref: ref,
202
- "data-testid": "block-ctrl-drop-target"
214
+ return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(HoverZone, {
215
+ onDragEnter: function onDragEnter() {
216
+ return setIsDraggedOver(true);
217
+ },
218
+ onDragLeave: function onDragLeave() {
219
+ return setIsDraggedOver(false);
220
+ },
221
+ onDrop: onDrop,
222
+ node: prevNode,
223
+ editorWidth: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength,
224
+ anchorRectCache: anchorRectCache,
225
+ position: "upper",
226
+ isNestedDropTarget: isNestedDropTarget,
227
+ dropTargetStyle: dropTargetStyle
228
+ }), (0, _react2.jsx)("div", {
229
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
230
+ css: [styleDropTarget, isNestedDropTarget && nestedDropIndicatorStyle]
231
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
232
+ ,
233
+ style: dynamicStyle,
234
+ "data-testid": "block-ctrl-drop-target"
235
+ },
236
+ // 4px gap to clear expand node border
237
+ (isDraggedOver || (0, _dragTargetDebug.isBlocksDragTargetDebug)()) && (0, _react2.jsx)("div", {
238
+ css: styleDropIndicator,
239
+ "data-testid": "block-ctrl-drop-indicator"
240
+ }, (0, _react2.jsx)(_box.DropIndicator, {
241
+ edge: "bottom"
242
+ }))), dropTargetStyle !== 'remainingHeight' && (0, _react2.jsx)(HoverZone, {
243
+ onDragEnter: function onDragEnter() {
244
+ return setIsDraggedOver(true);
245
+ },
246
+ onDragLeave: function onDragLeave() {
247
+ return setIsDraggedOver(false);
203
248
  },
204
- // 4px gap to clear expand node border
205
- (isDraggedOver || (0, _dragTargetDebug.isBlocksDragTargetDebug)()) && (0, _react2.jsx)("div", {
206
- css: styleDropIndicator,
207
- "data-testid": "block-ctrl-drop-indicator"
208
- }, (0, _react2.jsx)(_box.DropIndicator, {
209
- edge: "bottom",
210
- gap: "4px"
211
- })))
212
- );
249
+ onDrop: onDrop,
250
+ node: nextNode,
251
+ parent: parentNode,
252
+ editorWidth: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength,
253
+ anchorRectCache: anchorRectCache,
254
+ position: "lower",
255
+ isNestedDropTarget: isNestedDropTarget
256
+ }), (0, _inlineDropTarget.shouldAllowInlineDropTarget)(isNestedDropTarget, nextNode, isSameLayout, activeNode) && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_inlineDropTarget2.InlineDropTarget
257
+ // Ignored via go/ees005
258
+ // eslint-disable-next-line react/jsx-props-no-spreading
259
+ , (0, _extends2.default)({}, props, {
260
+ position: "left"
261
+ })), (0, _react2.jsx)(_inlineDropTarget2.InlineDropTarget
262
+ // Ignored via go/ees005
263
+ // eslint-disable-next-line react/jsx-props-no-spreading
264
+ , (0, _extends2.default)({}, props, {
265
+ position: "right"
266
+ }))));
213
267
  };
@@ -6,8 +6,8 @@ import { Decoration } from '@atlaskit/editor-prosemirror/view';
6
6
  import { fg } from '@atlaskit/platform-feature-flags';
7
7
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
8
  import { nodeMargins } from '../ui/consts';
9
+ import { DropTarget, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET } from '../ui/drop-target';
9
10
  import { DropTargetLayout } from '../ui/drop-target-layout';
10
- import { DropTargetV2, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET } from '../ui/drop-target-v2';
11
11
  import { getNestedDepth, TYPE_DROP_TARGET_DEC, unmountDecorations } from './decorations-common';
12
12
  import { maxLayoutColumnSupported } from './utils/consts';
13
13
  import { isBlocksDragTargetDebug } from './utils/drag-target-debug';
@@ -97,14 +97,14 @@ export const createDropTargetDecoration = (pos, props, nodeViewPortalProviderAPI
97
97
  element.style.setProperty(EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP, `${gap}px`);
98
98
  element.style.setProperty('display', 'block');
99
99
  if (fg('platform_editor_react18_plugin_portalprovider')) {
100
- nodeViewPortalProviderAPI.render(() => /*#__PURE__*/createElement(DropTargetV2, {
100
+ nodeViewPortalProviderAPI.render(() => /*#__PURE__*/createElement(DropTarget, {
101
101
  ...props,
102
102
  getPos,
103
103
  anchorRectCache,
104
104
  isSameLayout
105
105
  }), element, key);
106
106
  } else {
107
- ReactDOM.render( /*#__PURE__*/createElement(DropTargetV2, {
107
+ ReactDOM.render( /*#__PURE__*/createElement(DropTarget, {
108
108
  ...props,
109
109
  getPos,
110
110
  anchorRectCache,