@atlaskit/editor-plugin-block-controls 1.10.5 → 1.10.7

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,23 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 1.10.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7c744eaad4fb6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7c744eaad4fb6) -
8
+ ED-24473 Clean up FF in drag-handle and drop-targets
9
+ - [#127997](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/127997)
10
+ [`3d47f12053750`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3d47f12053750) -
11
+ ED-24404 ignore list items in Element DnD
12
+
13
+ ## 1.10.6
14
+
15
+ ### Patch Changes
16
+
17
+ - [#127749](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/127749)
18
+ [`2709d717d9040`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2709d717d9040) -
19
+ [ux] Dismiss dnd tooltip when cursor exits handle
20
+
3
21
  ## 1.10.5
4
22
 
5
23
  ### Patch Changes
@@ -15,7 +15,8 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
15
  var _dragHandle = require("../ui/drag-handle");
16
16
  var _dropTarget = require("../ui/drop-target");
17
17
  var _validation = require("../utils/validation");
18
- var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn'];
18
+ var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem'];
19
+ var IGNORE_NODES_AND_DESCENDANTS = ['listItem'];
19
20
  var NESTED_DEPTH = (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested') ? 100 : 0;
20
21
  var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetDecorations(oldState, newState, api, formatMessage, activeNodeType) {
21
22
  var decs = [];
@@ -24,8 +25,7 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
24
25
  // and allows us to easily map the updated position in the plugin apply method.
25
26
  var decorationState = [];
26
27
  var prevNode;
27
- var state = (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24372') ? newState : oldState;
28
- state.doc.nodesBetween(0, newState.doc.nodeSize - 2, function (node, pos, parent, index) {
28
+ newState.doc.nodesBetween(0, newState.doc.nodeSize - 2, function (node, pos, parent, index) {
29
29
  var depth = 0;
30
30
  var nodeType = newState.doc.type.schema.nodes[activeNodeType];
31
31
  if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
@@ -121,12 +121,13 @@ var emptyParagraphNodeDecorations = exports.emptyParagraphNodeDecorations = func
121
121
  };
122
122
  var nodeDecorations = exports.nodeDecorations = function nodeDecorations(newState) {
123
123
  var decs = [];
124
- newState.doc.descendants(function (node, pos, _parent, index) {
124
+ newState.doc.descendants(function (node, pos, parent, index) {
125
125
  var _Decoration$node2;
126
126
  var depth = 0;
127
127
  var anchorName;
128
128
  if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
129
- if (node.isInline) {
129
+ // Doesn't descend into a node
130
+ if (node.isInline || IGNORE_NODES_AND_DESCENDANTS.includes((parent === null || parent === void 0 ? void 0 : parent.type.name) || '')) {
130
131
  return false;
131
132
  }
132
133
  if (IGNORE_NODES.includes(node.type.name)) {
@@ -148,9 +149,8 @@ var nodeDecorations = exports.nodeDecorations = function nodeDecorations(newStat
148
149
  };
149
150
  var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDecoration(api, getIntl, pos, anchorName, nodeType, handleOptions) {
150
151
  var unbind;
151
- var elementType = (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24150') ? 'span' : 'div';
152
152
  return _view.Decoration.widget(pos, function (view, getPos) {
153
- var element = document.createElement(elementType);
153
+ var element = document.createElement('span');
154
154
  // Need to set it to inline to avoid text being split when merging two paragraphs
155
155
  element.style.display = 'inline';
156
156
  element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
@@ -163,9 +163,7 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
163
163
  }
164
164
  });
165
165
  }
166
- if ((0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896')) {
167
- unmountDecorations('data-blocks-drag-handle-container');
168
- }
166
+ unmountDecorations('data-blocks-drag-handle-container');
169
167
 
170
168
  // There are times when global clear: "both" styles are applied to this decoration causing jumpiness
171
169
  // due to margins applied to other nodes eg. Headings
@@ -184,13 +182,10 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
184
182
  }, {
185
183
  side: -1,
186
184
  id: 'drag-handle',
187
- destroy: function destroy(node) {
185
+ destroy: function destroy() {
188
186
  if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
189
187
  unbind && unbind();
190
188
  }
191
- if (!(0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896')) {
192
- _reactDom.default.unmountComponentAtNode(node);
193
- }
194
189
  }
195
190
  });
196
191
  };
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.key = exports.createPlugin = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
10
- var _steps = require("@atlaskit/adf-schema/steps");
11
10
  var _analytics = require("@atlaskit/editor-common/analytics");
12
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
12
  var _utils = require("@atlaskit/editor-common/utils");
@@ -93,7 +92,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
93
92
  return initialState;
94
93
  },
95
94
  apply: function apply(tr, currentState, oldState, newState) {
96
- var _meta$activeNode, _meta$activeNode$hand, _meta$activeNode4, _meta$isDragging, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging;
95
+ var _meta$activeNode, _meta$activeNode$hand, _activeNodeWithNewNod, _meta$activeNode3, _meta$isDragging, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging;
97
96
  var activeNode = currentState.activeNode,
98
97
  decorations = currentState.decorations,
99
98
  isMenuOpen = currentState.isMenuOpen,
@@ -106,20 +105,12 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
106
105
  isPMDragging = currentState.isPMDragging;
107
106
  var activeNodeWithNewNodeType = null;
108
107
  var meta = tr.getMeta(key);
109
- // when creating analytics during drag/drop events, PM thinks the doc has changed
110
- // so tr.docChange is true and causes some decorations to not render
111
- var isAnalyticTr = tr.steps.every(function (step) {
112
- return step instanceof _steps.AnalyticsStep;
113
- });
114
108
 
115
109
  // If tables or media are being resized, we want to hide the drag handle
116
110
  var resizerMeta = tr.getMeta('is-resizer-resizing');
117
111
  isResizerResizing = resizerMeta !== null && resizerMeta !== void 0 ? resizerMeta : isResizerResizing;
118
112
  var nodeCountChanged = oldState.doc.childCount !== newState.doc.childCount;
119
- var shouldRemoveHandle = true;
120
- if ((0, _platformFeatureFlags.fg)('platform_editor_elements_drag_and_drop_ed_24000')) {
121
- shouldRemoveHandle = !tr.getMeta('isRemote');
122
- }
113
+ var shouldRemoveHandle = !tr.getMeta('isRemote');
123
114
 
124
115
  // During resize, remove the drag handle widget so its dom positioning doesn't need to be maintained
125
116
  // Also remove the handle when the node is moved or the node count changes. This helps prevent incorrect positioning
@@ -147,16 +138,14 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
147
138
  if (!(0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
148
139
  isDecsMissing = !(isDragging || meta !== null && meta !== void 0 && meta.isDragging) && decsLength !== newState.doc.childCount;
149
140
  }
150
- if ((0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24372')) {
151
- var dropTargetLen = decorations.find().filter(function (_ref8) {
152
- var spec = _ref8.spec;
153
- return spec.type === 'drop-target-decoration';
154
- }).length;
141
+ var dropTargetLen = decorations.find().filter(function (_ref8) {
142
+ var spec = _ref8.spec;
143
+ return spec.type === 'drop-target-decoration';
144
+ }).length;
155
145
 
156
- //TODO: Fix this logic for nested scenarios
157
- if (!(0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
158
- isDropTargetsMissing = isDragging && (meta === null || meta === void 0 ? void 0 : meta.isDragging) !== false && dropTargetLen !== newState.doc.childCount + 1;
159
- }
146
+ //TODO: Fix this logic for nested scenarios
147
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
148
+ isDropTargetsMissing = isDragging && (meta === null || meta === void 0 ? void 0 : meta.isDragging) !== false && dropTargetLen !== newState.doc.childCount + 1;
160
149
  }
161
150
 
162
151
  // This is not targeted enough - it's trying to catch events like expand being set to breakout
@@ -227,90 +216,50 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
227
216
  var decs = (0, _decorations.dragHandleDecoration)(api, getIntl, meta.activeNode.pos, meta.activeNode.anchorName, meta.activeNode.nodeType, meta.activeNode.handleOptions);
228
217
  decorations = decorations.add(newState.doc, [decs]);
229
218
  }
230
- if ((0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-ed-23816')) {
231
- var _activeNodeWithNewNod;
232
- // Remove previous drag handle widget and draw new drag handle widget when node type changes
233
- if (activeNodeWithNewNodeType && ((_activeNodeWithNewNod = activeNodeWithNewNodeType) === null || _activeNodeWithNewNod === void 0 ? void 0 : _activeNodeWithNewNod.nodeType) !== (activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) && api) {
234
- var _oldHandle2 = decorations.find().filter(function (_ref11) {
235
- var spec = _ref11.spec;
236
- return spec.id === 'drag-handle';
237
- });
238
- decorations = decorations.remove(_oldHandle2);
239
- var _decs = (0, _decorations.dragHandleDecoration)(api, getIntl, activeNodeWithNewNodeType.pos, activeNodeWithNewNodeType.anchorName, activeNodeWithNewNodeType.nodeType);
240
- decorations = decorations.add(newState.doc, [_decs]);
241
- }
219
+
220
+ // Remove previous drag handle widget and draw new drag handle widget when node type changes
221
+ if (activeNodeWithNewNodeType && ((_activeNodeWithNewNod = activeNodeWithNewNodeType) === null || _activeNodeWithNewNod === void 0 ? void 0 : _activeNodeWithNewNod.nodeType) !== (activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) && api) {
222
+ var _oldHandle2 = decorations.find().filter(function (_ref11) {
223
+ var spec = _ref11.spec;
224
+ return spec.id === 'drag-handle';
225
+ });
226
+ decorations = decorations.remove(_oldHandle2);
227
+ var _decs = (0, _decorations.dragHandleDecoration)(api, getIntl, activeNodeWithNewNodeType.pos, activeNodeWithNewNodeType.anchorName, activeNodeWithNewNodeType.nodeType);
228
+ decorations = decorations.add(newState.doc, [_decs]);
242
229
  }
243
230
  var shouldUpdateDropTargets = (meta === null || meta === void 0 ? void 0 : meta.isDragging) || isDropTargetsMissing;
244
- var shouldMapDropTargets = false;
245
- if ((0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24372')) {
246
- shouldMapDropTargets = !shouldUpdateDropTargets && tr.docChanged && isDragging && (meta === null || meta === void 0 ? void 0 : meta.isDragging) !== false && !(meta !== null && meta !== void 0 && meta.nodeMoved);
247
- if ((meta === null || meta === void 0 ? void 0 : meta.isDragging) === false || isDropTargetsMissing) {
248
- // Remove drop target decoration when dragging stops
249
- var dropTargetDecs = decorations.find().filter(function (_ref12) {
250
- var spec = _ref12.spec;
251
- return spec.type === 'drop-target-decoration';
252
- });
253
- decorations = decorations.remove(dropTargetDecs);
254
- }
255
- if (api) {
256
- // Add drop targets when node is being dragged
257
- // if the transaction is only for analytics and user is dragging, continue to draw drop targets
258
- if (shouldUpdateDropTargets || (0, _dragTargetDebug.isBlocksDragTargetDebug)()) {
259
- var _meta$activeNode2;
260
- var _dropTargetDecoration = (0, _decorations.dropTargetDecorations)(oldState, newState, api, formatMessage, meta === null || meta === void 0 || (_meta$activeNode2 = meta.activeNode) === null || _meta$activeNode2 === void 0 ? void 0 : _meta$activeNode2.nodeType),
261
- _decs2 = _dropTargetDecoration.decs,
262
- updatedDecorationState = _dropTargetDecoration.decorationState;
263
- decorationState = updatedDecorationState;
264
- decorations = decorations.add(newState.doc, _decs2);
265
- }
266
- }
267
-
268
- //Map drop target decoration positions when the document changes
269
- if (shouldMapDropTargets) {
270
- decorationState = decorationState.map(function (_ref13) {
271
- var id = _ref13.id,
272
- pos = _ref13.pos;
273
- return {
274
- id: id,
275
- pos: tr.mapping.map(pos)
276
- };
277
- });
278
- }
279
- } else {
280
- if (api) {
281
- // Add drop targets when node is being dragged
282
- // if the transaction is only for analytics and user is dragging, continue to draw drop targets
283
- var shouldShowDragTarget = (meta === null || meta === void 0 ? void 0 : meta.isDragging) && (!tr.docChanged || tr.docChanged && isAnalyticTr);
284
- if (shouldShowDragTarget || (0, _dragTargetDebug.isBlocksDragTargetDebug)()) {
285
- var _meta$activeNode3;
286
- var _dropTargetDecoration2 = (0, _decorations.dropTargetDecorations)(oldState, newState, api, formatMessage, meta === null || meta === void 0 || (_meta$activeNode3 = meta.activeNode) === null || _meta$activeNode3 === void 0 ? void 0 : _meta$activeNode3.nodeType),
287
- _decs3 = _dropTargetDecoration2.decs,
288
- _updatedDecorationState = _dropTargetDecoration2.decorationState;
289
- decorationState = _updatedDecorationState;
290
- decorations = decorations.add(newState.doc, _decs3);
291
- }
292
- }
293
-
231
+ var shouldMapDropTargets = !shouldUpdateDropTargets && tr.docChanged && isDragging && (meta === null || meta === void 0 ? void 0 : meta.isDragging) !== false && !(meta !== null && meta !== void 0 && meta.nodeMoved);
232
+ if ((meta === null || meta === void 0 ? void 0 : meta.isDragging) === false || isDropTargetsMissing) {
294
233
  // Remove drop target decoration when dragging stops
295
- if ((meta === null || meta === void 0 ? void 0 : meta.isDragging) === false && ((0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24330') ? true : !tr.docChanged)) {
296
- var _dropTargetDecs = decorations.find().filter(function (_ref14) {
297
- var spec = _ref14.spec;
298
- return spec.type === 'drop-target-decoration';
299
- });
300
- decorations = decorations.remove(_dropTargetDecs);
234
+ var dropTargetDecs = decorations.find().filter(function (_ref12) {
235
+ var spec = _ref12.spec;
236
+ return spec.type === 'drop-target-decoration';
237
+ });
238
+ decorations = decorations.remove(dropTargetDecs);
239
+ }
240
+ if (api) {
241
+ // Add drop targets when node is being dragged
242
+ // if the transaction is only for analytics and user is dragging, continue to draw drop targets
243
+ if (shouldUpdateDropTargets || (0, _dragTargetDebug.isBlocksDragTargetDebug)()) {
244
+ var _meta$activeNode2;
245
+ var _dropTargetDecoration = (0, _decorations.dropTargetDecorations)(oldState, newState, api, formatMessage, meta === null || meta === void 0 || (_meta$activeNode2 = meta.activeNode) === null || _meta$activeNode2 === void 0 ? void 0 : _meta$activeNode2.nodeType),
246
+ _decs2 = _dropTargetDecoration.decs,
247
+ updatedDecorationState = _dropTargetDecoration.decorationState;
248
+ decorationState = updatedDecorationState;
249
+ decorations = decorations.add(newState.doc, _decs2);
301
250
  }
251
+ }
302
252
 
303
- // Map drop target decoration positions when the document changes
304
- if (tr.docChanged && isDragging) {
305
- decorationState = decorationState.map(function (_ref15) {
306
- var id = _ref15.id,
307
- pos = _ref15.pos;
308
- return {
309
- id: id,
310
- pos: tr.mapping.map(pos)
311
- };
312
- });
313
- }
253
+ //Map drop target decoration positions when the document changes
254
+ if (shouldMapDropTargets) {
255
+ decorationState = decorationState.map(function (_ref13) {
256
+ var id = _ref13.id,
257
+ pos = _ref13.pos;
258
+ return {
259
+ id: id,
260
+ pos: tr.mapping.map(pos)
261
+ };
262
+ });
314
263
  }
315
264
 
316
265
  // Map decorations if document changes and node decorations do not need to be redrawn
@@ -318,8 +267,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
318
267
  decorations = decorations.map(tr.mapping, tr.doc);
319
268
  }
320
269
  var isEmptyDoc = newState.doc.childCount === 1 && newState.doc.nodeSize <= 4;
321
- var hasNodeDecoration = decorations.find().some(function (_ref16) {
322
- var spec = _ref16.spec;
270
+ var hasNodeDecoration = decorations.find().some(function (_ref14) {
271
+ var spec = _ref14.spec;
323
272
  return spec.type === 'node-decoration';
324
273
  });
325
274
  if (!hasNodeDecoration && isEmptyDoc) {
@@ -327,24 +276,15 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
327
276
  }
328
277
 
329
278
  // Map active node position when the document changes
330
- var mappedActiveNodePos;
331
- if ((0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-ed-23816')) {
332
- mappedActiveNodePos = tr.docChanged && activeNode ? activeNodeWithNewNodeType || {
333
- pos: tr.mapping.map(activeNode.pos),
334
- anchorName: activeNode.anchorName,
335
- nodeType: activeNode.nodeType
336
- } : activeNode;
337
- } else {
338
- mappedActiveNodePos = tr.docChanged && activeNode ? {
339
- pos: tr.mapping.map(activeNode.pos),
340
- anchorName: activeNode.anchorName,
341
- nodeType: activeNode.nodeType
342
- } : activeNode;
343
- }
279
+ var mappedActiveNodePos = tr.docChanged && activeNode ? activeNodeWithNewNodeType || {
280
+ pos: tr.mapping.map(activeNode.pos),
281
+ anchorName: activeNode.anchorName,
282
+ nodeType: activeNode.nodeType
283
+ } : activeNode;
344
284
  return {
345
285
  decorations: decorations,
346
286
  decorationState: decorationState,
347
- activeNode: isEmptyDoc || isHandleMissing ? null : (_meta$activeNode4 = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode4 !== void 0 ? _meta$activeNode4 : mappedActiveNodePos,
287
+ activeNode: isEmptyDoc || isHandleMissing ? null : (_meta$activeNode3 = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode3 !== void 0 ? _meta$activeNode3 : mappedActiveNodePos,
348
288
  isDragging: (_meta$isDragging = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging !== void 0 ? _meta$isDragging : isDragging,
349
289
  isMenuOpen: meta !== null && meta !== void 0 && meta.toggleMenu ? !isMenuOpen : isMenuOpen,
350
290
  editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : currentState.editorHeight,
@@ -287,12 +287,9 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
287
287
  display: 'none'
288
288
  }),
289
289
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
290
- newPositionStyles = _useState6[0],
291
- setNewPositionStyles = _useState6[1];
290
+ positionStyles = _useState6[0],
291
+ setPositionStyles = _useState6[1];
292
292
  (0, _react.useEffect)(function () {
293
- if (!(0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896')) {
294
- return;
295
- }
296
293
  var cleanUpTransitionListener;
297
294
  if (nodeType === 'extension' || nodeType === 'embedCard') {
298
295
  var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(anchorName, "\"]"));
@@ -302,12 +299,12 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
302
299
  cleanUpTransitionListener = (0, _bindEventListener.bind)(dom, {
303
300
  type: 'transitionend',
304
301
  listener: function listener() {
305
- setNewPositionStyles(calculatePosition());
302
+ setPositionStyles(calculatePosition());
306
303
  }
307
304
  });
308
305
  }
309
306
  var calcPos = requestAnimationFrame(function () {
310
- setNewPositionStyles(calculatePosition());
307
+ setPositionStyles(calculatePosition());
311
308
  });
312
309
  return function () {
313
310
  var _cleanUpTransitionLis;
@@ -315,12 +312,6 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
315
312
  (_cleanUpTransitionLis = cleanUpTransitionListener) === null || _cleanUpTransitionLis === void 0 || _cleanUpTransitionLis();
316
313
  };
317
314
  }, [calculatePosition, view.dom, anchorName, nodeType]);
318
- var positionStyles = (0, _react.useMemo)(function () {
319
- if ((0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896')) {
320
- return newPositionStyles;
321
- }
322
- return calculatePosition();
323
- }, [calculatePosition, newPositionStyles]);
324
315
  (0, _react.useEffect)(function () {
325
316
  if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current && (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23873')) {
326
317
  var id = requestAnimationFrame(function () {
@@ -354,7 +345,7 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
354
345
  ref: buttonRef
355
346
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
356
347
  ,
357
- style: (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896') ? newPositionStyles : positionStyles,
348
+ style: positionStyles,
358
349
  onClick: handleOnClick,
359
350
  onMouseDown: handleMouseDown,
360
351
  onKeyDown: handleKeyDown,
@@ -369,6 +360,7 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
369
360
  content: (0, _react2.jsx)(_keymaps.TooltipContentWithMultipleShortcuts, {
370
361
  helpDescriptors: helpDescriptors
371
362
  }),
363
+ ignoreTooltipPointerEvents: true,
372
364
  onShow: function onShow() {
373
365
  var _api$accessibilityUti;
374
366
  api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(message, {
@@ -9,7 +9,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
9
9
  var _react = require("react");
10
10
  var _react2 = require("@emotion/react");
11
11
  var _hooks = require("@atlaskit/editor-common/hooks");
12
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
12
  var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
14
13
  var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
15
14
  var _constants = require("@atlaskit/theme/constants");
@@ -54,9 +53,6 @@ var getNodeMargins = function getNodeMargins(node) {
54
53
  return _consts.nodeMargins[nodeTypeName] || _consts.nodeMargins['default'];
55
54
  };
56
55
  var getDropTargetPositionStyle = function getDropTargetPositionStyle(prevNode, nextNode) {
57
- if (!(0, _platformFeatureFlags.fg)('platform_editor_drag_and_drop_target_gap_fix')) {
58
- return null;
59
- }
60
56
  if (!prevNode || !nextNode) {
61
57
  return null;
62
58
  }
@@ -7,5 +7,5 @@ exports.isBlocksDragTargetDebug = void 0;
7
7
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
8
  var IS_GEMINI_TEST_ENV = Boolean(process.env.NODE_ENV === 'development') && Boolean(window.__gemini_set_feature_flag__);
9
9
  var isBlocksDragTargetDebug = exports.isBlocksDragTargetDebug = function isBlocksDragTargetDebug() {
10
- return IS_GEMINI_TEST_ENV && (0, _platformFeatureFlags.fg)('platform_editor_drag_and_drop_target_gap_fix');
10
+ return IS_GEMINI_TEST_ENV && (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_debug');
11
11
  };
@@ -7,7 +7,8 @@ import { fg } from '@atlaskit/platform-feature-flags';
7
7
  import { DragHandle } from '../ui/drag-handle';
8
8
  import { DropTarget } from '../ui/drop-target';
9
9
  import { canMoveToIndex } from '../utils/validation';
10
- const IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn'];
10
+ const IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem'];
11
+ const IGNORE_NODES_AND_DESCENDANTS = ['listItem'];
11
12
  const NESTED_DEPTH = fg('platform_editor_elements_dnd_nested') ? 100 : 0;
12
13
  export const dropTargetDecorations = (oldState, newState, api, formatMessage, activeNodeType) => {
13
14
  const decs = [];
@@ -16,8 +17,7 @@ export const dropTargetDecorations = (oldState, newState, api, formatMessage, ac
16
17
  // and allows us to easily map the updated position in the plugin apply method.
17
18
  const decorationState = [];
18
19
  let prevNode;
19
- const state = fg('platform_editor_element_drag_and_drop_ed_24372') ? newState : oldState;
20
- state.doc.nodesBetween(0, newState.doc.nodeSize - 2, (node, pos, parent, index) => {
20
+ newState.doc.nodesBetween(0, newState.doc.nodeSize - 2, (node, pos, parent, index) => {
21
21
  let depth = 0;
22
22
  const nodeType = newState.doc.type.schema.nodes[activeNodeType];
23
23
  if (fg('platform_editor_elements_dnd_nested')) {
@@ -114,11 +114,12 @@ export const emptyParagraphNodeDecorations = () => {
114
114
  };
115
115
  export const nodeDecorations = newState => {
116
116
  const decs = [];
117
- newState.doc.descendants((node, pos, _parent, index) => {
117
+ newState.doc.descendants((node, pos, parent, index) => {
118
118
  let depth = 0;
119
119
  let anchorName;
120
120
  if (fg('platform_editor_elements_dnd_nested')) {
121
- if (node.isInline) {
121
+ // Doesn't descend into a node
122
+ if (node.isInline || IGNORE_NODES_AND_DESCENDANTS.includes((parent === null || parent === void 0 ? void 0 : parent.type.name) || '')) {
122
123
  return false;
123
124
  }
124
125
  if (IGNORE_NODES.includes(node.type.name)) {
@@ -143,9 +144,8 @@ export const nodeDecorations = newState => {
143
144
  };
144
145
  export const dragHandleDecoration = (api, getIntl, pos, anchorName, nodeType, handleOptions) => {
145
146
  let unbind;
146
- const elementType = fg('platform_editor_element_drag_and_drop_ed_24150') ? 'span' : 'div';
147
147
  return Decoration.widget(pos, (view, getPos) => {
148
- const element = document.createElement(elementType);
148
+ const element = document.createElement('span');
149
149
  // Need to set it to inline to avoid text being split when merging two paragraphs
150
150
  element.style.display = 'inline';
151
151
  element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
@@ -158,9 +158,7 @@ export const dragHandleDecoration = (api, getIntl, pos, anchorName, nodeType, ha
158
158
  }
159
159
  });
160
160
  }
161
- if (fg('platform_editor_element_drag_and_drop_ed_23896')) {
162
- unmountDecorations('data-blocks-drag-handle-container');
163
- }
161
+ unmountDecorations('data-blocks-drag-handle-container');
164
162
 
165
163
  // There are times when global clear: "both" styles are applied to this decoration causing jumpiness
166
164
  // due to margins applied to other nodes eg. Headings
@@ -179,13 +177,10 @@ export const dragHandleDecoration = (api, getIntl, pos, anchorName, nodeType, ha
179
177
  }, {
180
178
  side: -1,
181
179
  id: 'drag-handle',
182
- destroy: node => {
180
+ destroy: () => {
183
181
  if (fg('platform_editor_elements_dnd_nested')) {
184
182
  unbind && unbind();
185
183
  }
186
- if (!fg('platform_editor_element_drag_and_drop_ed_23896')) {
187
- ReactDOM.unmountComponentAtNode(node);
188
- }
189
184
  }
190
185
  });
191
186
  };