@atlaskit/editor-plugin-block-controls 2.10.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/pm-plugins/decorations-anchor.js +97 -0
  3. package/dist/cjs/pm-plugins/decorations-common.js +49 -0
  4. package/dist/cjs/pm-plugins/decorations-drag-handle.js +88 -0
  5. package/dist/cjs/pm-plugins/{decorations.js → decorations-drop-target.js} +11 -209
  6. package/dist/cjs/pm-plugins/main.js +21 -19
  7. package/dist/cjs/ui/drop-target-v2.js +3 -3
  8. package/dist/cjs/ui/global-styles.js +101 -86
  9. package/dist/cjs/ui/inline-drop-target.js +3 -3
  10. package/dist/es2019/pm-plugins/decorations-anchor.js +89 -0
  11. package/dist/es2019/pm-plugins/decorations-common.js +31 -0
  12. package/dist/es2019/pm-plugins/decorations-drag-handle.js +79 -0
  13. package/dist/es2019/pm-plugins/{decorations.js → decorations-drop-target.js} +6 -193
  14. package/dist/es2019/pm-plugins/main.js +3 -1
  15. package/dist/es2019/ui/drop-target-v2.js +1 -1
  16. package/dist/es2019/ui/global-styles.js +17 -6
  17. package/dist/es2019/ui/inline-drop-target.js +1 -1
  18. package/dist/esm/pm-plugins/decorations-anchor.js +90 -0
  19. package/dist/esm/pm-plugins/decorations-common.js +42 -0
  20. package/dist/esm/pm-plugins/decorations-drag-handle.js +81 -0
  21. package/dist/esm/pm-plugins/{decorations.js → decorations-drop-target.js} +6 -204
  22. package/dist/esm/pm-plugins/main.js +3 -1
  23. package/dist/esm/ui/drop-target-v2.js +1 -1
  24. package/dist/esm/ui/global-styles.js +101 -86
  25. package/dist/esm/ui/inline-drop-target.js +1 -1
  26. package/dist/types/pm-plugins/decorations-anchor.d.ts +13 -0
  27. package/dist/types/pm-plugins/decorations-common.d.ts +7 -0
  28. package/dist/types/pm-plugins/decorations-drag-handle.d.ts +7 -0
  29. package/dist/types/pm-plugins/decorations-drop-target.d.ts +17 -0
  30. package/dist/types-ts4.5/pm-plugins/decorations-anchor.d.ts +13 -0
  31. package/dist/types-ts4.5/pm-plugins/decorations-common.d.ts +7 -0
  32. package/dist/types-ts4.5/pm-plugins/decorations-drag-handle.d.ts +7 -0
  33. package/dist/types-ts4.5/pm-plugins/decorations-drop-target.d.ts +17 -0
  34. package/package.json +4 -4
  35. package/dist/types/pm-plugins/decorations.d.ts +0 -35
  36. package/dist/types-ts4.5/pm-plugins/decorations.d.ts +0 -35
@@ -22,7 +22,9 @@ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
22
22
  var _anchorUtils = require("../utils/anchor-utils");
23
23
  var _dragTargetDebug = require("../utils/drag-target-debug");
24
24
  var _transactions = require("../utils/transactions");
25
- var _decorations = require("./decorations");
25
+ var _decorationsAnchor = require("./decorations-anchor");
26
+ var _decorationsDragHandle = require("./decorations-drag-handle");
27
+ var _decorationsDropTarget = require("./decorations-drop-target");
26
28
  var _handleMouseOver = require("./handle-mouse-over");
27
29
  var _keymap = require("./keymap");
28
30
  var key = exports.key = new _state.PluginKey('blockControls');
@@ -138,13 +140,13 @@ var newApply = exports.newApply = function newApply(api, formatMessage, tr, curr
138
140
  var shouldRedrawNodeDecs = !isResizerResizing && isNodeDecsMissing;
139
141
  var isActiveNodeModified = false;
140
142
  if (api && shouldRedrawNodeDecs) {
141
- var oldNodeDecs = (0, _decorations.findNodeDecs)(decorations, from, to);
143
+ var oldNodeDecs = (0, _decorationsAnchor.findNodeDecs)(decorations, from, to);
142
144
  decorations = decorations.remove(oldNodeDecs);
143
- var newNodeDecs = (0, _decorations.nodeDecorations)(newState, isDecSetEmpty ? undefined : from, isDecSetEmpty ? undefined : to);
145
+ var newNodeDecs = (0, _decorationsAnchor.nodeDecorations)(newState, isDecSetEmpty ? undefined : from, isDecSetEmpty ? undefined : to);
144
146
  decorations = decorations.add(newState.doc, newNodeDecs);
145
147
  if (latestActiveNode && !isActiveNodeDeleted) {
146
148
  // Find the newly minted node decs that touch the active node
147
- var findNewNodeDecs = (0, _decorations.findNodeDecs)(decorations, latestActiveNode.pos - 1, to);
149
+ var findNewNodeDecs = (0, _decorationsAnchor.findNodeDecs)(decorations, latestActiveNode.pos - 1, to);
148
150
 
149
151
  // Find the specific dec that the active node corresponds to
150
152
  var nodeDecsAtActivePos = findNewNodeDecs.filter(function (dec) {
@@ -179,13 +181,13 @@ var newApply = exports.newApply = function newApply(api, formatMessage, tr, curr
179
181
  var shouldRemoveHandle = latestActiveNode && (isResizerResizing || isActiveNodeDeleted || (meta === null || meta === void 0 ? void 0 : meta.nodeMoved));
180
182
  if (shouldRemoveHandle) {
181
183
  var _activeNode3, _activeNode4;
182
- var oldHandle = (0, _decorations.findHandleDec)(decorations, (_activeNode3 = activeNode) === null || _activeNode3 === void 0 ? void 0 : _activeNode3.pos, (_activeNode4 = activeNode) === null || _activeNode4 === void 0 ? void 0 : _activeNode4.pos);
184
+ var oldHandle = (0, _decorationsDragHandle.findHandleDec)(decorations, (_activeNode3 = activeNode) === null || _activeNode3 === void 0 ? void 0 : _activeNode3.pos, (_activeNode4 = activeNode) === null || _activeNode4 === void 0 ? void 0 : _activeNode4.pos);
183
185
  decorations = decorations.remove(oldHandle);
184
186
  } else if (api && shouldRecreateHandle) {
185
187
  var _activeNode5, _activeNode6;
186
- var _oldHandle = (0, _decorations.findHandleDec)(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.pos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.pos);
188
+ var _oldHandle = (0, _decorationsDragHandle.findHandleDec)(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.pos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.pos);
187
189
  decorations = decorations.remove(_oldHandle);
188
- var handleDec = (0, _decorations.dragHandleDecoration)(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.pos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.handleOptions);
190
+ var handleDec = (0, _decorationsDragHandle.dragHandleDecoration)(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.pos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.handleOptions);
189
191
  decorations = decorations.add(newState.doc, [handleDec]);
190
192
  }
191
193
 
@@ -194,25 +196,25 @@ var newApply = exports.newApply = function newApply(api, formatMessage, tr, curr
194
196
 
195
197
  // Remove drop target decorations when dragging stops or they need to be redrawn
196
198
  if ((meta === null || meta === void 0 ? void 0 : meta.isDragging) === false || isDropTargetsMissing) {
197
- var dropTargetDecs = (0, _decorations.findDropTargetDecs)(decorations);
199
+ var dropTargetDecs = (0, _decorationsDropTarget.findDropTargetDecs)(decorations);
198
200
  decorations = decorations.remove(dropTargetDecs);
199
201
  }
200
202
 
201
203
  // Add drop targets when dragging starts or some are missing
202
204
  if (api) {
203
205
  if (meta !== null && meta !== void 0 && meta.isDragging || isDropTargetsMissing || (0, _dragTargetDebug.isBlocksDragTargetDebug)()) {
204
- var decs = (0, _decorations.dropTargetDecorations)(newState, api, formatMessage, latestActiveNode, anchorRectCache);
206
+ var decs = (0, _decorationsDropTarget.dropTargetDecorations)(newState, api, formatMessage, latestActiveNode, anchorRectCache);
205
207
  decorations = decorations.add(newState.doc, decs);
206
208
  }
207
209
  }
208
210
  var isEmptyDoc = (0, _utils.isEmptyDocument)(newState.doc);
209
211
  if (isEmptyDoc) {
210
- var hasNodeDecoration = !!(0, _decorations.findNodeDecs)(decorations).length;
212
+ var hasNodeDecoration = !!(0, _decorationsAnchor.findNodeDecs)(decorations).length;
211
213
  if (!hasNodeDecoration) {
212
- decorations = decorations.add(newState.doc, [(0, _decorations.emptyParagraphNodeDecorations)()]);
214
+ decorations = decorations.add(newState.doc, [(0, _decorationsDragHandle.emptyParagraphNodeDecorations)()]);
213
215
  }
214
216
  }
215
- var newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && (0, _decorations.findHandleDec)(decorations, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.pos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.pos).length === 0 ? null : latestActiveNode;
217
+ var newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && (0, _decorationsDragHandle.findHandleDec)(decorations, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.pos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.pos).length === 0 ? null : latestActiveNode;
216
218
  return {
217
219
  decorations: decorations,
218
220
  activeNode: newActiveNode,
@@ -307,7 +309,7 @@ var oldApply = exports.oldApply = function oldApply(api, formatMessage, tr, curr
307
309
  return spec.type !== 'drop-target-decoration';
308
310
  });
309
311
  decorations = decorations.remove(oldNodeDecs);
310
- var newNodeDecs = (0, _decorations.nodeDecorations)(newState);
312
+ var newNodeDecs = (0, _decorationsAnchor.nodeDecorations)(newState);
311
313
  decorations = decorations.add(newState.doc, (0, _toConsumableArray2.default)(newNodeDecs));
312
314
  if (activeNode && !(meta !== null && meta !== void 0 && meta.nodeMoved) && !isDecsMissing) {
313
315
  var mappedPosisiton = tr.mapping.map(activeNode.pos);
@@ -331,7 +333,7 @@ var oldApply = exports.oldApply = function oldApply(api, formatMessage, tr, curr
331
333
  var decAtPos = newNodeDecs.find(function (dec) {
332
334
  return dec.from === mappedPosisiton;
333
335
  });
334
- draghandleDec = (0, _decorations.dragHandleDecoration)(api, formatMessage, (_meta$activeNode$pos = meta === null || meta === void 0 || (_meta$activeNode3 = meta.activeNode) === null || _meta$activeNode3 === void 0 ? void 0 : _meta$activeNode3.pos) !== null && _meta$activeNode$pos !== void 0 ? _meta$activeNode$pos : mappedPosisiton, (_ref6 = (_meta$activeNode$anch = meta === null || meta === void 0 || (_meta$activeNode4 = meta.activeNode) === null || _meta$activeNode4 === void 0 ? void 0 : _meta$activeNode4.anchorName) !== null && _meta$activeNode$anch !== void 0 ? _meta$activeNode$anch : decAtPos === null || decAtPos === void 0 || (_decAtPos$spec = decAtPos.spec) === null || _decAtPos$spec === void 0 ? void 0 : _decAtPos$spec.anchorName) !== null && _ref6 !== void 0 ? _ref6 : activeNode === null || activeNode === void 0 ? void 0 : activeNode.anchorName, (_ref7 = (_meta$activeNode$node = meta === null || meta === void 0 || (_meta$activeNode5 = meta.activeNode) === null || _meta$activeNode5 === void 0 ? void 0 : _meta$activeNode5.nodeType) !== null && _meta$activeNode$node !== void 0 ? _meta$activeNode$node : decAtPos === null || decAtPos === void 0 || (_decAtPos$spec2 = decAtPos.spec) === null || _decAtPos$spec2 === void 0 ? void 0 : _decAtPos$spec2.nodeType) !== null && _ref7 !== void 0 ? _ref7 : activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType, meta === null || meta === void 0 || (_meta$activeNode6 = meta.activeNode) === null || _meta$activeNode6 === void 0 ? void 0 : _meta$activeNode6.handleOptions);
336
+ draghandleDec = (0, _decorationsDragHandle.dragHandleDecoration)(api, formatMessage, (_meta$activeNode$pos = meta === null || meta === void 0 || (_meta$activeNode3 = meta.activeNode) === null || _meta$activeNode3 === void 0 ? void 0 : _meta$activeNode3.pos) !== null && _meta$activeNode$pos !== void 0 ? _meta$activeNode$pos : mappedPosisiton, (_ref6 = (_meta$activeNode$anch = meta === null || meta === void 0 || (_meta$activeNode4 = meta.activeNode) === null || _meta$activeNode4 === void 0 ? void 0 : _meta$activeNode4.anchorName) !== null && _meta$activeNode$anch !== void 0 ? _meta$activeNode$anch : decAtPos === null || decAtPos === void 0 || (_decAtPos$spec = decAtPos.spec) === null || _decAtPos$spec === void 0 ? void 0 : _decAtPos$spec.anchorName) !== null && _ref6 !== void 0 ? _ref6 : activeNode === null || activeNode === void 0 ? void 0 : activeNode.anchorName, (_ref7 = (_meta$activeNode$node = meta === null || meta === void 0 || (_meta$activeNode5 = meta.activeNode) === null || _meta$activeNode5 === void 0 ? void 0 : _meta$activeNode5.nodeType) !== null && _meta$activeNode$node !== void 0 ? _meta$activeNode$node : decAtPos === null || decAtPos === void 0 || (_decAtPos$spec2 = decAtPos.spec) === null || _decAtPos$spec2 === void 0 ? void 0 : _decAtPos$spec2.nodeType) !== null && _ref7 !== void 0 ? _ref7 : activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType, meta === null || meta === void 0 || (_meta$activeNode6 = meta.activeNode) === null || _meta$activeNode6 === void 0 ? void 0 : _meta$activeNode6.handleOptions);
335
337
  } else {
336
338
  var nodeType = activeNode.nodeType;
337
339
  var anchorName = activeNode.anchorName;
@@ -344,7 +346,7 @@ var oldApply = exports.oldApply = function oldApply(api, formatMessage, tr, curr
344
346
  anchorName: anchorName
345
347
  };
346
348
  }
347
- draghandleDec = (0, _decorations.dragHandleDecoration)(api, formatMessage, activeNode.pos, anchorName, nodeType);
349
+ draghandleDec = (0, _decorationsDragHandle.dragHandleDecoration)(api, formatMessage, activeNode.pos, anchorName, nodeType);
348
350
  }
349
351
  decorations = decorations.add(newState.doc, [draghandleDec]);
350
352
  }
@@ -356,7 +358,7 @@ var oldApply = exports.oldApply = function oldApply(api, formatMessage, tr, curr
356
358
  return spec.type === 'drag-handle';
357
359
  });
358
360
  decorations = decorations.remove(_oldHandle3);
359
- var decs = (0, _decorations.dragHandleDecoration)(api, formatMessage, meta.activeNode.pos, meta.activeNode.anchorName, meta.activeNode.nodeType, meta.activeNode.handleOptions);
361
+ var decs = (0, _decorationsDragHandle.dragHandleDecoration)(api, formatMessage, meta.activeNode.pos, meta.activeNode.anchorName, meta.activeNode.nodeType, meta.activeNode.handleOptions);
360
362
  decorations = decorations.add(newState.doc, [decs]);
361
363
  }
362
364
 
@@ -366,7 +368,7 @@ var oldApply = exports.oldApply = function oldApply(api, formatMessage, tr, curr
366
368
  return spec.type === 'drag-handle';
367
369
  });
368
370
  decorations = decorations.remove(_oldHandle4);
369
- var _decs = (0, _decorations.dragHandleDecoration)(api, formatMessage, activeNodeWithNewNodeType.pos, activeNodeWithNewNodeType.anchorName, activeNodeWithNewNodeType.nodeType);
371
+ var _decs = (0, _decorationsDragHandle.dragHandleDecoration)(api, formatMessage, activeNodeWithNewNodeType.pos, activeNodeWithNewNodeType.anchorName, activeNodeWithNewNodeType.nodeType);
370
372
  decorations = decorations.add(newState.doc, [_decs]);
371
373
  }
372
374
  if ((meta === null || meta === void 0 ? void 0 : meta.isDragging) === false || isDropTargetsMissing) {
@@ -389,7 +391,7 @@ var oldApply = exports.oldApply = function oldApply(api, formatMessage, tr, curr
389
391
  // if the transaction is only for analytics and user is dragging, continue to draw drop targets
390
392
  if (shouldCreateDropTargets || (0, _dragTargetDebug.isBlocksDragTargetDebug)()) {
391
393
  var _meta$activeNode7;
392
- var _decs2 = (0, _decorations.dropTargetDecorations)(newState, api, formatMessage, isNestedEnabled ? (_meta$activeNode7 = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode7 !== void 0 ? _meta$activeNode7 : mappedActiveNodePos : meta === null || meta === void 0 ? void 0 : meta.activeNode, anchorRectCache);
394
+ var _decs2 = (0, _decorationsDropTarget.dropTargetDecorations)(newState, api, formatMessage, isNestedEnabled ? (_meta$activeNode7 = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode7 !== void 0 ? _meta$activeNode7 : mappedActiveNodePos : meta === null || meta === void 0 ? void 0 : meta.activeNode, anchorRectCache);
393
395
  decorations = decorations.add(newState.doc, _decs2);
394
396
  }
395
397
  }
@@ -399,7 +401,7 @@ var oldApply = exports.oldApply = function oldApply(api, formatMessage, tr, curr
399
401
  return spec.type === 'node-decoration';
400
402
  }).length;
401
403
  if (!hasNodeDecoration) {
402
- decorations = decorations.add(newState.doc, [(0, _decorations.emptyParagraphNodeDecorations)()]);
404
+ decorations = decorations.add(newState.doc, [(0, _decorationsDragHandle.emptyParagraphNodeDecorations)()]);
403
405
  }
404
406
  }
405
407
  var newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && decorations.find(undefined, undefined, function (spec) {
@@ -15,7 +15,7 @@ var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box")
15
15
  var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
16
16
  var _constants = require("@atlaskit/theme/constants");
17
17
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
18
- var _decorations = require("../pm-plugins/decorations");
18
+ var _decorationsCommon = require("../pm-plugins/decorations-common");
19
19
  var _anchorUtils = require("../utils/anchor-utils");
20
20
  var _dragTargetDebug = require("../utils/drag-target-debug");
21
21
  var _inlineDropTarget = require("../utils/inline-drop-target");
@@ -94,7 +94,7 @@ var HoverZone = function HoverZone(_ref) {
94
94
  }, [onDragEnter, onDragLeave, onDrop]);
95
95
  var isRemainingheight = dropTargetStyle === 'remainingHeight';
96
96
  var hoverZoneUpperStyle = (0, _react.useMemo)(function () {
97
- var anchorName = node ? (0, _decorations.getNodeAnchor)(node) : '';
97
+ var anchorName = node ? (0, _decorationsCommon.getNodeAnchor)(node) : '';
98
98
  var heightStyleOffset = "var(--editor-block-controls-drop-indicator-gap, 0)/2";
99
99
  var transformOffset = "var(".concat(EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET, ", 0)");
100
100
  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';
@@ -119,7 +119,7 @@ var HoverZone = function HoverZone(_ref) {
119
119
  // only apply upper drop zone
120
120
  if (isRemainingheight && position === 'upper') {
121
121
  // previous node
122
- var anchorName = node ? (0, _decorations.getNodeAnchor)(node) : '';
122
+ var anchorName = node ? (0, _decorationsCommon.getNodeAnchor)(node) : '';
123
123
  var top = 'unset';
124
124
  if (anchorName) {
125
125
  var enabledDropZone = enableDropZone.includes((node === null || node === void 0 ? void 0 : node.type.name) || '');
@@ -17,94 +17,100 @@ var _globalStyles = require("./empty-block-experiment/global-styles");
17
17
  */
18
18
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
19
19
 
20
- var extendedHoverZone = (0, _react.css)({
21
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
22
- '.block-ctrl-drag-preview [data-drag-handler-anchor-name]::after': {
23
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
24
- display: 'none !important'
25
- },
26
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
27
- '.ProseMirror': {
28
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
29
- '&& [data-drag-handler-anchor-name]::after': {
30
- content: '""',
31
- position: 'absolute',
32
- top: 0,
33
- left: '-100%',
34
- width: '100%',
35
- height: '100%',
36
- background: 'transparent',
37
- cursor: 'default',
38
- zIndex: -1
20
+ var extendedHoverZone = function extendedHoverZone() {
21
+ return (0, _react.css)({
22
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
23
+ '.block-ctrl-drag-preview [data-drag-handler-anchor-name]::after': {
24
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
25
+ display: 'none !important'
26
+ },
27
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
28
+ '.ProseMirror': {
29
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
30
+ '&& [data-drag-handler-anchor-name]::after': {
31
+ content: '""',
32
+ position: 'absolute',
33
+ top: 0,
34
+ left: '-100%',
35
+ width: '100%',
36
+ height: '100%',
37
+ background: 'transparent',
38
+ cursor: 'default',
39
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
40
+ zIndex: (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_3') ? 1 : -1
41
+ }
42
+ },
43
+ // TODO - ED-23995 this style override needs to be moved to the Rule styles after FF cleanup - packages/editor/editor-common/src/styles/shared/rule.ts
44
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
45
+ 'hr[data-drag-handler-anchor-name]': {
46
+ overflow: 'visible'
47
+ },
48
+ //eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
49
+ '[data-blocks-drag-handle-container="true"] + *::after': {
50
+ display: 'none'
39
51
  }
40
- },
41
- // TODO - ED-23995 this style override needs to be moved to the Rule styles after FF cleanup - packages/editor/editor-common/src/styles/shared/rule.ts
42
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
43
- 'hr[data-drag-handler-anchor-name]': {
44
- overflow: 'visible'
45
- },
46
- //eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
47
- '[data-blocks-drag-handle-container="true"] + *::after': {
48
- display: 'none'
49
- }
50
- });
51
- var extendedHoverZoneNested = (0, _react.css)({
52
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
53
- '.block-ctrl-drag-preview [data-drag-handler-anchor-name]::after': {
54
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
55
- display: 'none !important'
56
- },
57
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
58
- '.ProseMirror': {
59
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
60
- '&& [data-drag-handler-anchor-name]::after': {
61
- content: '""',
62
- position: 'absolute',
63
- top: 0,
64
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
65
- left: "-".concat(_consts.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP, "px"),
66
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
67
- width: "".concat(_consts.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP, "px"),
68
- height: '100%',
69
- cursor: 'default',
70
- zIndex: 1
52
+ });
53
+ };
54
+ var extendedHoverZoneNested = function extendedHoverZoneNested() {
55
+ return (0, _react.css)({
56
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
57
+ '.block-ctrl-drag-preview [data-drag-handler-anchor-name]::after': {
58
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
59
+ display: 'none !important'
71
60
  },
72
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
73
- '&& [data-drag-handler-anchor-depth="0"][data-drag-handler-anchor-name]::after': {
74
- content: '""',
75
- position: 'absolute',
76
- top: 0,
77
- left: '-100%',
78
- width: '100%',
79
- height: '100%',
80
- cursor: 'default',
81
- zIndex: -1
61
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
62
+ '.ProseMirror': {
63
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
64
+ '&& [data-drag-handler-anchor-name]::after': {
65
+ content: '""',
66
+ position: 'absolute',
67
+ top: 0,
68
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
69
+ left: "-".concat(_consts.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP, "px"),
70
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
71
+ width: "".concat(_consts.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP, "px"),
72
+ height: '100%',
73
+ cursor: 'default',
74
+ zIndex: 1
75
+ },
76
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
77
+ '&& [data-drag-handler-anchor-depth="0"][data-drag-handler-anchor-name]::after': {
78
+ content: '""',
79
+ position: 'absolute',
80
+ top: 0,
81
+ left: '-100%',
82
+ width: '100%',
83
+ height: '100%',
84
+ cursor: 'default',
85
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
86
+ zIndex: (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_3') ? 1 : -1
87
+ },
88
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
89
+ '&& :is(.pm-table-cell-content-wrap, .pm-table-header-content-wrap) > [data-drag-handler-anchor-name]::after': {
90
+ content: '""',
91
+ position: 'absolute',
92
+ top: 0,
93
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
94
+ left: "-".concat((0, _experiments.editorExperiment)('table-nested-dnd', true) ? _consts.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP : 0, "px"),
95
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
96
+ width: "".concat((0, _experiments.editorExperiment)('table-nested-dnd', true) ? _consts.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP : 0, "px"),
97
+ height: '100%',
98
+ cursor: 'default',
99
+ zIndex: 1
100
+ }
82
101
  },
83
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
84
- '&& :is(.pm-table-cell-content-wrap, .pm-table-header-content-wrap) > [data-drag-handler-anchor-name]::after': {
85
- content: '""',
86
- position: 'absolute',
87
- top: 0,
88
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
89
- left: "-".concat((0, _experiments.editorExperiment)('table-nested-dnd', true) ? _consts.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP : 0, "px"),
90
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
91
- width: "".concat((0, _experiments.editorExperiment)('table-nested-dnd', true) ? _consts.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP : 0, "px"),
92
- height: '100%',
93
- cursor: 'default',
94
- zIndex: 1
102
+ // TODO - ED-23995 this style override needs to be moved to the Rule styles after FF cleanup - packages/editor/editor-common/src/styles/shared/rule.ts
103
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
104
+ 'hr[data-drag-handler-anchor-name]': {
105
+ overflow: 'visible'
106
+ },
107
+ //Hide pseudo element at top depth level. Leave for nested depths to prevent mouseover loop.
108
+ //eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
109
+ '[data-blocks-drag-handle-container="true"] + [data-drag-handler-anchor-depth="0"]::after': {
110
+ display: 'none'
95
111
  }
96
- },
97
- // TODO - ED-23995 this style override needs to be moved to the Rule styles after FF cleanup - packages/editor/editor-common/src/styles/shared/rule.ts
98
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
99
- 'hr[data-drag-handler-anchor-name]': {
100
- overflow: 'visible'
101
- },
102
- //Hide pseudo element at top depth level. Leave for nested depths to prevent mouseover loop.
103
- //eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
104
- '[data-blocks-drag-handle-container="true"] + [data-drag-handler-anchor-depth="0"]::after': {
105
- display: 'none'
106
- }
107
- });
112
+ });
113
+ };
108
114
  var paragraphWithTrailingBreakAsOnlyChild = '+ :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
109
115
  var indentatedParagraphWithTrailingBreakAsOnlyChild = '+ div.fabric-editor-indentation-mark > :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
110
116
  var paragraphWithPlaceholder = '+ p > .placeholder-decoration';
@@ -157,10 +163,19 @@ var withFormatInLayoutStyleFix = (0, _react.css)((0, _defineProperty2.default)({
157
163
  var getTextNodeStyle = function getTextNodeStyle() {
158
164
  return (0, _platformFeatureFlags.fg)('platform_editor_element_controls_chrome_input_fix') ? withInlineNodeStyleWithChromeFix : withInlineNodeStyle;
159
165
  };
166
+ var withRelativePosStyle = (0, _react.css)({
167
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
168
+ '.ProseMirror': {
169
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
170
+ '&& [data-drag-handler-anchor-name]': {
171
+ position: 'relative'
172
+ }
173
+ }
174
+ });
160
175
  var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper() {
161
176
  return (0, _react.jsx)(_react.Global, {
162
- styles: [globalStyles, (0, _experiments.editorExperiment)('nested-dnd', true) ? extendedHoverZoneNested : extendedHoverZone, getTextNodeStyle(), withDeleteLinesStyleFix, withMediaSingleStyleFix, (0, _experiments.editorExperiment)('platform_editor_empty_line_prompt', true, {
177
+ styles: [globalStyles, (0, _experiments.editorExperiment)('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), getTextNodeStyle(), withDeleteLinesStyleFix, withMediaSingleStyleFix, (0, _experiments.editorExperiment)('platform_editor_empty_line_prompt', true, {
163
178
  exposure: false
164
- }) ? _globalStyles.emptyBlockExperimentGlobalStyles : undefined, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_1') ? withDividerInPanelStyleFix : undefined, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_2') ? withFormatInLayoutStyleFix : undefined]
179
+ }) ? _globalStyles.emptyBlockExperimentGlobalStyles : undefined, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_1') ? withDividerInPanelStyleFix : undefined, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_2') ? withFormatInLayoutStyleFix : undefined, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_3') ? withRelativePosStyle : undefined]
165
180
  });
166
181
  };
@@ -11,7 +11,7 @@ var _react2 = require("@emotion/react");
11
11
  var _hooks = require("@atlaskit/editor-common/hooks");
12
12
  var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
13
13
  var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
14
- var _decorations = require("../pm-plugins/decorations");
14
+ var _decorationsCommon = require("../pm-plugins/decorations-common");
15
15
  var _anchorUtils = require("../utils/anchor-utils");
16
16
  var _dragTargetDebug = require("../utils/drag-target-debug");
17
17
  /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
@@ -104,7 +104,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
104
104
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
105
105
  isDraggedOver = _useState2[0],
106
106
  setIsDraggedOver = _useState2[1];
107
- var anchorName = nextNode ? (0, _decorations.getNodeAnchor)(nextNode) : '';
107
+ var anchorName = nextNode ? (0, _decorationsCommon.getNodeAnchor)(nextNode) : '';
108
108
  var handleDragEnter = (0, _react.useCallback)(function () {
109
109
  setIsDraggedOver(true);
110
110
  }, []);
@@ -172,7 +172,7 @@ var InlineHoverZone = exports.InlineHoverZone = function InlineHoverZone(_ref3)
172
172
  var ref = (0, _react.useRef)(null);
173
173
  var _ref4 = editorWidthState || {},
174
174
  editorWith = _ref4.width;
175
- var anchorName = node ? (0, _decorations.getNodeAnchor)(node) : '';
175
+ var anchorName = node ? (0, _decorationsCommon.getNodeAnchor)(node) : '';
176
176
  (0, _react.useEffect)(function () {
177
177
  if (ref.current) {
178
178
  return (0, _adapter.dropTargetForElements)({
@@ -0,0 +1,89 @@
1
+ import { Decoration } from '@atlaskit/editor-prosemirror/view';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
3
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
+ import { getNestedDepth, getNodeAnchor, TYPE_NODE_DEC } from './decorations-common';
5
+ const IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
6
+ const IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList', 'mediaSingle'];
7
+ export const shouldDescendIntoNode = node => {
8
+ // Optimisation to avoid drawing node decorations for empty table cells
9
+ if (['tableCell', 'tableHeader'].includes(node.type.name) && !editorExperiment('table-nested-dnd', true) && fg('platform_editor_element_dnd_nested_fix_patch_3')) {
10
+ var _node$firstChild;
11
+ if (node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'paragraph') {
12
+ return false;
13
+ }
14
+ }
15
+ return !IGNORE_NODE_DESCENDANTS.includes(node.type.name);
16
+ };
17
+ const shouldIgnoreNode = node => {
18
+ const isEmbedCard = 'embedCard' === node.type.name && fg('platform_editor_element_dnd_nested_fix_patch_3');
19
+
20
+ // TODO use isWrappedMedia when clean up the feature flag
21
+ const isMediaSingle = 'mediaSingle' === node.type.name && fg('platform_editor_element_dnd_nested_fix_patch_1');
22
+ return (isEmbedCard || isMediaSingle) && ['wrap-right', 'wrap-left'].includes(node.attrs.layout) ? true : IGNORE_NODES.includes(node.type.name);
23
+ };
24
+
25
+ /**
26
+ * Find node decorations in the pos range between from and to (non-inclusive)
27
+ * @param decorations
28
+ * @param from
29
+ * @param to
30
+ * @returns
31
+ */
32
+ export const findNodeDecs = (decorations, from, to) => {
33
+ let newfrom = from;
34
+ let newTo = to;
35
+
36
+ // make it non-inclusive
37
+ if (newfrom !== undefined) {
38
+ newfrom++;
39
+ }
40
+
41
+ // make it non-inclusive
42
+ if (newTo !== undefined) {
43
+ newTo--;
44
+ }
45
+
46
+ // return empty array if range reversed
47
+ if (newfrom !== undefined && newTo !== undefined && newfrom > newTo) {
48
+ return new Array();
49
+ }
50
+ return decorations.find(newfrom, newTo, spec => spec.type === TYPE_NODE_DEC);
51
+ };
52
+ export const nodeDecorations = (newState, from, to) => {
53
+ const decs = [];
54
+ const docFrom = from === undefined || from < 0 ? 0 : from;
55
+ const docTo = to === undefined || to > newState.doc.nodeSize - 2 ? newState.doc.nodeSize - 2 : to;
56
+ newState.doc.nodesBetween(docFrom, docTo, (node, pos, _parent, index) => {
57
+ let depth = 0;
58
+ let anchorName;
59
+ const shouldDescend = shouldDescendIntoNode(node);
60
+ anchorName = getNodeAnchor(node);
61
+ if (editorExperiment('nested-dnd', true)) {
62
+ var _anchorName;
63
+ // Doesn't descend into a node
64
+ if (node.isInline) {
65
+ return false;
66
+ }
67
+ if (shouldIgnoreNode(node)) {
68
+ return shouldDescend; //skip over, don't consider it a valid depth
69
+ }
70
+ depth = newState.doc.resolve(pos).depth;
71
+ anchorName = (_anchorName = anchorName) !== null && _anchorName !== void 0 ? _anchorName : `--node-anchor-${node.type.name}-${pos}`;
72
+ } else {
73
+ var _anchorName2;
74
+ anchorName = (_anchorName2 = anchorName) !== null && _anchorName2 !== void 0 ? _anchorName2 : `--node-anchor-${node.type.name}-${index}`;
75
+ }
76
+ decs.push(Decoration.node(pos, pos + node.nodeSize, {
77
+ style: `anchor-name: ${anchorName}; ${pos === 0 ? 'margin-top: 0px;' : ''} ${fg('platform_editor_element_dnd_nested_fix_patch_3') ? '' : 'position: relative; z-index: 1;'}`,
78
+ ['data-drag-handler-anchor-name']: anchorName,
79
+ ['data-drag-handler-node-type']: node.type.name,
80
+ ['data-drag-handler-anchor-depth']: `${depth}`
81
+ }, {
82
+ type: TYPE_NODE_DEC,
83
+ anchorName,
84
+ nodeType: node.type.name
85
+ }));
86
+ return shouldDescend && depth < getNestedDepth();
87
+ });
88
+ return decs;
89
+ };
@@ -0,0 +1,31 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import ReactDOM from 'react-dom';
3
+ import uuid from 'uuid';
4
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
+ export const TYPE_DROP_TARGET_DEC = 'drop-target-decoration';
6
+ export const TYPE_HANDLE_DEC = 'drag-handle';
7
+ export const TYPE_NODE_DEC = 'node-decoration';
8
+ export const getNestedDepth = () => editorExperiment('nested-dnd', true) ? 100 : 0;
9
+ export const getNodeAnchor = node => {
10
+ const handleId = ObjHash.getForNode(node);
11
+ return `--node-anchor-${node.type.name}-${handleId}`;
12
+ };
13
+ class ObjHash {
14
+ static getForNode(node) {
15
+ if (this.caching.has(node)) {
16
+ return this.caching.get(node);
17
+ }
18
+ const uniqueId = uuid();
19
+ this.caching.set(node, uniqueId);
20
+ return uniqueId;
21
+ }
22
+ }
23
+ _defineProperty(ObjHash, "caching", new WeakMap());
24
+ export const unmountDecorations = selector => {
25
+ // Removing decorations manually instead of using native destroy function in prosemirror API
26
+ // as it was more responsive and causes less re-rendering
27
+ const decorationsToRemove = document.querySelectorAll(`[${selector}="true"]`);
28
+ decorationsToRemove.forEach(el => {
29
+ ReactDOM.unmountComponentAtNode(el);
30
+ });
31
+ };
@@ -0,0 +1,79 @@
1
+ import { createElement } from 'react';
2
+ import { bind } from 'bind-event-listener';
3
+ import ReactDOM from 'react-dom';
4
+ import uuid from 'uuid';
5
+ import { Decoration } from '@atlaskit/editor-prosemirror/view';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
7
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
+ import { DragHandle } from '../ui/drag-handle';
9
+ import { TYPE_HANDLE_DEC, TYPE_NODE_DEC, unmountDecorations } from './decorations-common';
10
+ export const emptyParagraphNodeDecorations = () => {
11
+ const anchorName = `--node-anchor-paragraph-0`;
12
+ const style = `anchor-name: ${anchorName}; margin-top: 0px;`;
13
+ return Decoration.node(0, 2, {
14
+ style,
15
+ ['data-drag-handler-anchor-name']: anchorName
16
+ }, {
17
+ type: TYPE_NODE_DEC
18
+ });
19
+ };
20
+ export const findHandleDec = (decorations, from, to) => {
21
+ return decorations.find(from, to, spec => spec.type === TYPE_HANDLE_DEC);
22
+ };
23
+ export const dragHandleDecoration = (api, formatMessage, pos, anchorName, nodeType, handleOptions) => {
24
+ unmountDecorations('data-blocks-drag-handle-container');
25
+ let unbind;
26
+ return Decoration.widget(pos, (view, getPos) => {
27
+ const element = document.createElement('span');
28
+ // Need to set it to inline to avoid text being split when merging two paragraphs
29
+ // platform_editor_element_dnd_nested_fix_patch_2 -> inline decoration causes focus issues when refocusing Editor into first line
30
+ element.style.display = fg('platform_editor_element_dnd_nested_fix_patch_2') ? 'block' : 'inline';
31
+ element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
32
+ element.setAttribute('data-blocks-drag-handle-container', 'true');
33
+ let isTopLevelNode = true;
34
+ if (editorExperiment('nested-dnd', true)) {
35
+ const newPos = fg('platform_editor_element_dnd_nested_fix_patch_3') ? getPos() : pos;
36
+ if (typeof newPos === 'number') {
37
+ const $pos = view.state.doc.resolve(newPos);
38
+ isTopLevelNode = ($pos === null || $pos === void 0 ? void 0 : $pos.parent.type.name) === 'doc';
39
+ }
40
+ /*
41
+ * We disable mouseover event to fix flickering issue on hover
42
+ * However, the tooltip for nested drag handle is no long working.
43
+ */
44
+ if (newPos === undefined || !isTopLevelNode) {
45
+ // This will also hide the tooltip.
46
+ unbind = bind(element, {
47
+ type: 'mouseover',
48
+ listener: e => {
49
+ e.stopPropagation();
50
+ }
51
+ });
52
+ }
53
+ }
54
+
55
+ // There are times when global clear: "both" styles are applied to this decoration causing jumpiness
56
+ // due to margins applied to other nodes eg. Headings
57
+ element.style.clear = 'unset';
58
+ ReactDOM.render( /*#__PURE__*/createElement(DragHandle, {
59
+ view,
60
+ api,
61
+ formatMessage,
62
+ getPos,
63
+ anchorName,
64
+ nodeType,
65
+ handleOptions,
66
+ isTopLevelNode
67
+ }), element);
68
+ return element;
69
+ }, {
70
+ side: -1,
71
+ type: TYPE_HANDLE_DEC,
72
+ testid: `${TYPE_HANDLE_DEC}-${uuid()}`,
73
+ destroy: () => {
74
+ if (editorExperiment('nested-dnd', true)) {
75
+ unbind && unbind();
76
+ }
77
+ }
78
+ });
79
+ };