@atlaskit/editor-plugin-block-controls 7.7.3 → 7.7.5

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,20 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 7.7.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`6f765533c791b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6f765533c791b) -
8
+ FG platform_editor_block_menu_patch_1 clean up.
9
+ - Updated dependencies
10
+
11
+ ## 7.7.4
12
+
13
+ ### Patch Changes
14
+
15
+ - [`1117e966eee41`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1117e966eee41) -
16
+ [ux] EDITOR-3384 Multiselect expand on doc changes
17
+
3
18
  ## 7.7.3
4
19
 
5
20
  ### Patch Changes
@@ -55,13 +55,17 @@ var createSelectionPreservationPlugin = exports.createSelectionPreservationPlugi
55
55
  newState.preservedSelection = undefined;
56
56
  }
57
57
  if (newState.preservedSelection && tr.docChanged) {
58
- var mapped = new _state.TextSelection(newState.preservedSelection.$from, newState.preservedSelection.$to);
59
- mapped.map(tr.doc, tr.mapping);
60
- if (mapped.from >= 0 && mapped.to <= tr.doc.content.size && mapped.from !== mapped.to) {
61
- newState.preservedSelection = mapped;
62
- } else if (mapped.from === mapped.to) {
63
- // If selection has collapsed to a cursor, e.g. after deleting the selection, stop preserving
58
+ var from = tr.mapping.map(newState.preservedSelection.from);
59
+ var to = tr.mapping.map(newState.preservedSelection.to);
60
+ if (from < 0 || to > tr.doc.content.size || from >= to) {
61
+ // stop preserving if preserved selection becomes invalid or collapsed to a cursor
62
+ // e.g. after deleting the selection
64
63
  newState.preservedSelection = undefined;
64
+ } else {
65
+ var _expandToBlockRange = expandToBlockRange(tr.doc.resolve(from), tr.doc.resolve(to)),
66
+ $from = _expandToBlockRange.$from,
67
+ $to = _expandToBlockRange.$to;
68
+ newState.preservedSelection = new _state.TextSelection($from, $to);
65
69
  }
66
70
  }
67
71
  return newState;
@@ -96,4 +100,17 @@ var createSelectionPreservationPlugin = exports.createSelectionPreservationPlugi
96
100
  return null;
97
101
  }
98
102
  });
103
+ };
104
+ var expandToBlockRange = function expandToBlockRange($from, $to) {
105
+ var range = $from.blockRange($to);
106
+ if (!range) {
107
+ return {
108
+ $from: $from,
109
+ $to: $to
110
+ };
111
+ }
112
+ return {
113
+ $from: $from.doc.resolve(range.start),
114
+ $to: $to.doc.resolve(range.end)
115
+ };
99
116
  };
@@ -13,10 +13,7 @@ var _pluginKey = require("./plugin-key");
13
13
  */
14
14
  var hasUserSelectionChange = exports.hasUserSelectionChange = function hasUserSelectionChange(transactions) {
15
15
  return transactions.some(function (tr) {
16
- return tr.getMeta('pointer') || tr.getMeta('uiEvent') || tr.getMeta('paste') || tr.getMeta('cut') || tr.getMeta('composition') ||
17
- // IME input
18
- // Keyboard events that change selection
19
- tr.getMeta('addToHistory') && tr.selectionSet;
16
+ return tr.getMeta('pointer') && tr.selectionSet;
20
17
  });
21
18
  };
22
19
  var getSelectionPreservationMeta = exports.getSelectionPreservationMeta = function getSelectionPreservationMeta(tr) {
@@ -298,7 +298,7 @@ var getNodeMargins = function getNodeMargins(node) {
298
298
  }
299
299
  return _consts2.nodeMargins[nodeTypeName] || _consts2.nodeMargins['default'];
300
300
  };
301
- var isRangeSpanningMultipleNodes = function isRangeSpanningMultipleNodes(range) {
301
+ var isMultiNodeRange = function isMultiNodeRange(range) {
302
302
  if (range.endIndex - range.startIndex <= 1) {
303
303
  return false; // At most one child
304
304
  }
@@ -315,64 +315,38 @@ var isRangeSpanningMultipleNodes = function isRangeSpanningMultipleNodes(range)
315
315
  }
316
316
  return false;
317
317
  };
318
- var shouldExpandSelection = function shouldExpandSelection(range, startPos) {
319
- return !!range && isRangeSpanningMultipleNodes(range) && range.start <= startPos && range.end >= startPos + 1;
318
+ var isPosWithinRange = function isPosWithinRange(pos, range) {
319
+ return range.start <= pos && range.end >= pos + 1;
320
320
  };
321
- var calculateBlockRange = function calculateBlockRange(_ref) {
321
+ /**
322
+ * From the current selection and the position of the drag handle being clicked,
323
+ * calculate the expanded block range up to the common ancestor.
324
+ */
325
+ var getExpandedSelectionRange = function getExpandedSelectionRange(_ref) {
322
326
  var selection = _ref.selection,
323
327
  doc = _ref.doc,
324
328
  resolvedStartPos = _ref.resolvedStartPos,
325
329
  isShiftPressed = _ref.isShiftPressed;
326
- if (!isShiftPressed) {
327
- // When not pressing shift, create range including all block nodes within the selection
328
- return selection.$from.blockRange(selection.$to);
329
- }
330
- if (resolvedStartPos.pos < selection.from) {
331
- // If shift+click selecting upwards, get range from start of node to end of selection
332
- return resolvedStartPos.blockRange(selection.$to);
333
- }
334
-
335
- // Shift+click selecting downwards, get range from start of selection to pos within or after node
336
- var resolvedPosWithinOrAfterNode = doc.resolve(resolvedStartPos.pos + 1);
337
- return selection.$from.blockRange(resolvedPosWithinOrAfterNode);
330
+ // When not pressing shift, expand the current selection
331
+ // When shift selecting upwards, expand from start of node to selection end
332
+ // When shift selecting downwards, expand from selection start to end of node
333
+ var selectUp = resolvedStartPos.pos < selection.from;
334
+ var $from = isShiftPressed && selectUp ? resolvedStartPos : selection.$from;
335
+ var $to = isShiftPressed && !selectUp ? doc.resolve(resolvedStartPos.pos + 1) : selection.$to;
336
+ return $from.blockRange($to);
338
337
  };
339
- var createExpandedSelection = function createExpandedSelection(doc, selection, range) {
340
- return _state.TextSelection.create(doc, Math.min(selection.from, range.start), Math.max(selection.to, range.end));
341
- };
342
- var createSelectionFromRange = function createSelectionFromRange(_ref2) {
343
- var tr = _ref2.tr,
344
- selection = _ref2.selection,
345
- startPos = _ref2.startPos,
346
- nodeType = _ref2.nodeType,
347
- range = _ref2.range,
348
- api = _ref2.api;
349
- if (range && shouldExpandSelection(range, startPos)) {
350
- var expandedSelection = createExpandedSelection(tr.doc, selection, range);
351
- if (!expandedSelection.eq(tr.selection)) {
352
- tr.setSelection(expandedSelection);
353
- }
354
- return tr;
355
- }
356
- var node = tr.doc.nodeAt(startPos);
357
- var isEmptyNode = (node === null || node === void 0 ? void 0 : node.content.size) === 0;
358
- if (isEmptyNode && node.type.name !== 'paragraph') {
359
- tr.setSelection(new _state.NodeSelection(tr.doc.resolve(startPos)));
360
- return tr;
361
- }
362
- return (0, _getSelection.selectNode)(tr, startPos, nodeType, api);
363
- };
364
- var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
338
+ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
365
339
  var _api$core4;
366
- var view = _ref3.view,
367
- api = _ref3.api,
368
- formatMessage = _ref3.formatMessage,
369
- getPos = _ref3.getPos,
370
- anchorName = _ref3.anchorName,
371
- nodeType = _ref3.nodeType,
372
- handleOptions = _ref3.handleOptions,
373
- _ref3$isTopLevelNode = _ref3.isTopLevelNode,
374
- isTopLevelNode = _ref3$isTopLevelNode === void 0 ? true : _ref3$isTopLevelNode,
375
- anchorRectCache = _ref3.anchorRectCache;
340
+ var view = _ref2.view,
341
+ api = _ref2.api,
342
+ formatMessage = _ref2.formatMessage,
343
+ getPos = _ref2.getPos,
344
+ anchorName = _ref2.anchorName,
345
+ nodeType = _ref2.nodeType,
346
+ handleOptions = _ref2.handleOptions,
347
+ _ref2$isTopLevelNode = _ref2.isTopLevelNode,
348
+ isTopLevelNode = _ref2$isTopLevelNode === void 0 ? true : _ref2$isTopLevelNode,
349
+ anchorRectCache = _ref2.anchorRectCache;
376
350
  var buttonRef = (0, _react.useRef)(null);
377
351
  var _useState = (0, _react.useState)(false),
378
352
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -435,9 +409,9 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
435
409
  }, [anchorName, nodeType, view.dom]);
436
410
  var handleOnClickNew = (0, _react.useCallback)(function (e) {
437
411
  var _api$core;
438
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref4) {
412
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref3) {
439
413
  var _api$analytics, _resolvedStartPos$nod, _selectionPreservatio, _api$blockControls, _api$blockControls2;
440
- var tr = _ref4.tr;
414
+ var tr = _ref3.tr;
441
415
  var startPos = getPos();
442
416
  if (startPos === undefined) {
443
417
  return tr;
@@ -453,22 +427,21 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
453
427
  nodeType: ((_resolvedStartPos$nod = resolvedStartPos.nodeAfter) === null || _resolvedStartPos$nod === void 0 ? void 0 : _resolvedStartPos$nod.type.name) || ''
454
428
  }
455
429
  })(tr);
456
- var preservedSelection = (_selectionPreservatio = _pluginKey.selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
457
- var selection = preservedSelection || tr.selection;
458
- var range = calculateBlockRange({
430
+ var selection = ((_selectionPreservatio = _pluginKey.selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection) || tr.selection;
431
+ var range = getExpandedSelectionRange({
459
432
  doc: tr.doc,
460
433
  selection: selection,
461
434
  resolvedStartPos: resolvedStartPos,
462
435
  isShiftPressed: e.shiftKey
463
436
  });
464
- tr = createSelectionFromRange({
465
- tr: tr,
466
- selection: selection,
467
- startPos: startPos,
468
- nodeType: nodeType,
469
- range: range,
470
- api: api
471
- });
437
+
438
+ // Set selection to expanded selection range if it encompases the clicked drag handle
439
+ if (range && isPosWithinRange(startPos, range) && isMultiNodeRange(range)) {
440
+ tr.setSelection(_state.TextSelection.create(tr.doc, Math.min(selection.from, range.start), Math.max(selection.to, range.end)));
441
+ } else {
442
+ // Select the clicked drag handle's node only
443
+ tr = (0, _getSelection.selectNode)(tr, startPos, nodeType, api);
444
+ }
472
445
  api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || _api$blockControls.commands.startPreservingSelection()({
473
446
  tr: tr
474
447
  });
@@ -493,9 +466,9 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
493
466
  if (!isMultiSelect) {
494
467
  setDragHandleSelected(!dragHandleSelected);
495
468
  }
496
- api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref5) {
469
+ api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref4) {
497
470
  var _api$blockControls$sh, _api$analytics2;
498
- var tr = _ref5.tr;
471
+ var tr = _ref4.tr;
499
472
  var startPos = getPos();
500
473
  if (startPos === undefined) {
501
474
  return tr;
@@ -575,8 +548,8 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
575
548
  if (!e.repeat && e.key === ' ') {
576
549
  var _api$core3;
577
550
  var startPos = getPos();
578
- api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref6) {
579
- var tr = _ref6.tr;
551
+ api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref5) {
552
+ var tr = _ref5.tr;
580
553
  if (startPos === undefined) {
581
554
  return tr;
582
555
  }
@@ -610,9 +583,9 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
610
583
  e.preventDefault();
611
584
  e.stopPropagation();
612
585
  var startPos = getPos();
613
- api === null || api === void 0 || (_api$core5 = api.core) === null || _api$core5 === void 0 || _api$core5.actions.execute(function (_ref7) {
586
+ api === null || api === void 0 || (_api$core5 = api.core) === null || _api$core5 === void 0 || _api$core5.actions.execute(function (_ref6) {
614
587
  var _api$blockControls6, _api$userIntent;
615
- var tr = _ref7.tr;
588
+ var tr = _ref6.tr;
616
589
  if (startPos === undefined) {
617
590
  return tr;
618
591
  }
@@ -641,9 +614,9 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
641
614
  } else if (e.key === 'Backspace' || e.key === 'Delete') {
642
615
  e.preventDefault();
643
616
  e.stopPropagation();
644
- api === null || api === void 0 || api.core.actions.execute(function (_ref8) {
617
+ api === null || api === void 0 || api.core.actions.execute(function (_ref7) {
645
618
  var _api$blockControls7;
646
- var tr = _ref8.tr;
619
+ var tr = _ref7.tr;
647
620
  (0, _selection2.deleteSelectedRange)(tr);
648
621
  api === null || api === void 0 || (_api$blockControls7 = api.blockControls) === null || _api$blockControls7 === void 0 || _api$blockControls7.commands.toggleBlockMenu({
649
622
  closeMenu: true
@@ -673,13 +646,13 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
673
646
  start: start
674
647
  };
675
648
  },
676
- onGenerateDragPreview: function onGenerateDragPreview(_ref9) {
649
+ onGenerateDragPreview: function onGenerateDragPreview(_ref8) {
677
650
  var _api$blockControls$sh2;
678
- var nativeSetDragImage = _ref9.nativeSetDragImage;
651
+ var nativeSetDragImage = _ref8.nativeSetDragImage;
679
652
  if (isMultiSelect) {
680
653
  var _api$core6;
681
- api === null || api === void 0 || (_api$core6 = api.core) === null || _api$core6 === void 0 || _api$core6.actions.execute(function (_ref0) {
682
- var tr = _ref0.tr;
654
+ api === null || api === void 0 || (_api$core6 = api.core) === null || _api$core6 === void 0 || _api$core6.actions.execute(function (_ref9) {
655
+ var tr = _ref9.tr;
683
656
  var handlePos = getPos();
684
657
  if (typeof handlePos !== 'number') {
685
658
  return tr;
@@ -757,8 +730,8 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
757
730
  };
758
731
  }
759
732
  },
760
- render: function render(_ref1) {
761
- var container = _ref1.container;
733
+ render: function render(_ref0) {
734
+ var container = _ref0.container;
762
735
  var dom = view.dom.querySelector("[".concat((0, _domAttrName.getAnchorAttrName)(), "=\"").concat(anchorName, "\"]"));
763
736
  if (!dom) {
764
737
  return;
@@ -794,9 +767,9 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
794
767
  if (start === undefined) {
795
768
  return;
796
769
  }
797
- api === null || api === void 0 || (_api$core7 = api.core) === null || _api$core7 === void 0 || _api$core7.actions.execute(function (_ref10) {
770
+ api === null || api === void 0 || (_api$core7 = api.core) === null || _api$core7 === void 0 || _api$core7.actions.execute(function (_ref1) {
798
771
  var _api$blockControls$sh3, _api$blockControls9, _api$analytics3;
799
- var tr = _ref10.tr;
772
+ var tr = _ref1.tr;
800
773
  var nodeTypes, hasSelectedMultipleNodes;
801
774
  var resolvedMovingNode = tr.doc.resolve(start);
802
775
  var maybeNode = resolvedMovingNode.nodeAfter;
@@ -1013,12 +986,12 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
1013
986
  setDragHandleDisabled(false);
1014
987
  }
1015
988
  }, [api === null || api === void 0 ? void 0 : api.blockControls.sharedState, isMultiSelect, isShiftDown, isTopLevelNode, view]);
1016
- var dragHandleMessage = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_block_menu_patch_1') ? formatMessage(_messages.blockControlsMessages.dragToMoveClickToOpen, {
989
+ var dragHandleMessage = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? formatMessage(_messages.blockControlsMessages.dragToMoveClickToOpen, {
1017
990
  br: (0, _react2.jsx)("br", null)
1018
991
  }) : formatMessage(_messages.blockControlsMessages.dragToMove);
1019
992
 
1020
993
  // Create a string version for aria-label
1021
- var dragHandleAriaLabel = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_block_menu_patch_1') ? formatMessage(_messages.blockControlsMessages.dragToMoveClickToOpen, {
994
+ var dragHandleAriaLabel = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? formatMessage(_messages.blockControlsMessages.dragToMoveClickToOpen, {
1022
995
  br: ' '
1023
996
  }) : formatMessage(_messages.blockControlsMessages.dragToMove);
1024
997
  var helpDescriptors = isTopLevelNode ? [{
@@ -1192,15 +1165,15 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
1192
1165
  var render = isTooltip ? buttonWithTooltip() : renderButton();
1193
1166
  return (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? stickyRender : render;
1194
1167
  };
1195
- var DragHandleWithVisibility = exports.DragHandleWithVisibility = function DragHandleWithVisibility(_ref11) {
1196
- var view = _ref11.view,
1197
- api = _ref11.api,
1198
- formatMessage = _ref11.formatMessage,
1199
- getPos = _ref11.getPos,
1200
- anchorName = _ref11.anchorName,
1201
- nodeType = _ref11.nodeType,
1202
- handleOptions = _ref11.handleOptions,
1203
- anchorRectCache = _ref11.anchorRectCache;
1168
+ var DragHandleWithVisibility = exports.DragHandleWithVisibility = function DragHandleWithVisibility(_ref10) {
1169
+ var view = _ref10.view,
1170
+ api = _ref10.api,
1171
+ formatMessage = _ref10.formatMessage,
1172
+ getPos = _ref10.getPos,
1173
+ anchorName = _ref10.anchorName,
1174
+ nodeType = _ref10.nodeType,
1175
+ handleOptions = _ref10.handleOptions,
1176
+ anchorRectCache = _ref10.anchorRectCache;
1204
1177
  return (0, _react2.jsx)(_visibilityContainer.VisibilityContainer, {
1205
1178
  api: api
1206
1179
  }, (0, _react2.jsx)(DragHandle, {
@@ -48,13 +48,18 @@ export const createSelectionPreservationPlugin = () => {
48
48
  newState.preservedSelection = undefined;
49
49
  }
50
50
  if (newState.preservedSelection && tr.docChanged) {
51
- const mapped = new TextSelection(newState.preservedSelection.$from, newState.preservedSelection.$to);
52
- mapped.map(tr.doc, tr.mapping);
53
- if (mapped.from >= 0 && mapped.to <= tr.doc.content.size && mapped.from !== mapped.to) {
54
- newState.preservedSelection = mapped;
55
- } else if (mapped.from === mapped.to) {
56
- // If selection has collapsed to a cursor, e.g. after deleting the selection, stop preserving
51
+ const from = tr.mapping.map(newState.preservedSelection.from);
52
+ const to = tr.mapping.map(newState.preservedSelection.to);
53
+ if (from < 0 || to > tr.doc.content.size || from >= to) {
54
+ // stop preserving if preserved selection becomes invalid or collapsed to a cursor
55
+ // e.g. after deleting the selection
57
56
  newState.preservedSelection = undefined;
57
+ } else {
58
+ const {
59
+ $from,
60
+ $to
61
+ } = expandToBlockRange(tr.doc.resolve(from), tr.doc.resolve(to));
62
+ newState.preservedSelection = new TextSelection($from, $to);
58
63
  }
59
64
  }
60
65
  return newState;
@@ -89,4 +94,17 @@ export const createSelectionPreservationPlugin = () => {
89
94
  return null;
90
95
  }
91
96
  });
97
+ };
98
+ const expandToBlockRange = ($from, $to) => {
99
+ const range = $from.blockRange($to);
100
+ if (!range) {
101
+ return {
102
+ $from,
103
+ $to
104
+ };
105
+ }
106
+ return {
107
+ $from: $from.doc.resolve(range.start),
108
+ $to: $to.doc.resolve(range.end)
109
+ };
92
110
  };
@@ -6,10 +6,7 @@ import { selectionPreservationPluginKey } from './plugin-key';
6
6
  * @returns True if any transaction includes a user-driven selection change, otherwise false.
7
7
  */
8
8
  export const hasUserSelectionChange = transactions => {
9
- return transactions.some(tr => tr.getMeta('pointer') || tr.getMeta('uiEvent') || tr.getMeta('paste') || tr.getMeta('cut') || tr.getMeta('composition') ||
10
- // IME input
11
- // Keyboard events that change selection
12
- tr.getMeta('addToHistory') && tr.selectionSet);
9
+ return transactions.some(tr => tr.getMeta('pointer') && tr.selectionSet);
13
10
  };
14
11
  export const getSelectionPreservationMeta = tr => {
15
12
  return tr.getMeta(selectionPreservationPluginKey);
@@ -293,7 +293,7 @@ const getNodeMargins = node => {
293
293
  }
294
294
  return nodeMargins[nodeTypeName] || nodeMargins['default'];
295
295
  };
296
- const isRangeSpanningMultipleNodes = range => {
296
+ const isMultiNodeRange = range => {
297
297
  if (range.endIndex - range.startIndex <= 1) {
298
298
  return false; // At most one child
299
299
  }
@@ -310,53 +310,26 @@ const isRangeSpanningMultipleNodes = range => {
310
310
  }
311
311
  return false;
312
312
  };
313
- const shouldExpandSelection = (range, startPos) => {
314
- return !!range && isRangeSpanningMultipleNodes(range) && range.start <= startPos && range.end >= startPos + 1;
313
+ const isPosWithinRange = (pos, range) => {
314
+ return range.start <= pos && range.end >= pos + 1;
315
315
  };
316
- const calculateBlockRange = ({
316
+ /**
317
+ * From the current selection and the position of the drag handle being clicked,
318
+ * calculate the expanded block range up to the common ancestor.
319
+ */
320
+ const getExpandedSelectionRange = ({
317
321
  selection,
318
322
  doc,
319
323
  resolvedStartPos,
320
324
  isShiftPressed
321
325
  }) => {
322
- if (!isShiftPressed) {
323
- // When not pressing shift, create range including all block nodes within the selection
324
- return selection.$from.blockRange(selection.$to);
325
- }
326
- if (resolvedStartPos.pos < selection.from) {
327
- // If shift+click selecting upwards, get range from start of node to end of selection
328
- return resolvedStartPos.blockRange(selection.$to);
329
- }
330
-
331
- // Shift+click selecting downwards, get range from start of selection to pos within or after node
332
- const resolvedPosWithinOrAfterNode = doc.resolve(resolvedStartPos.pos + 1);
333
- return selection.$from.blockRange(resolvedPosWithinOrAfterNode);
334
- };
335
- const createExpandedSelection = (doc, selection, range) => {
336
- return TextSelection.create(doc, Math.min(selection.from, range.start), Math.max(selection.to, range.end));
337
- };
338
- const createSelectionFromRange = ({
339
- tr,
340
- selection,
341
- startPos,
342
- nodeType,
343
- range,
344
- api
345
- }) => {
346
- if (range && shouldExpandSelection(range, startPos)) {
347
- const expandedSelection = createExpandedSelection(tr.doc, selection, range);
348
- if (!expandedSelection.eq(tr.selection)) {
349
- tr.setSelection(expandedSelection);
350
- }
351
- return tr;
352
- }
353
- const node = tr.doc.nodeAt(startPos);
354
- const isEmptyNode = (node === null || node === void 0 ? void 0 : node.content.size) === 0;
355
- if (isEmptyNode && node.type.name !== 'paragraph') {
356
- tr.setSelection(new NodeSelection(tr.doc.resolve(startPos)));
357
- return tr;
358
- }
359
- return selectNode(tr, startPos, nodeType, api);
326
+ // When not pressing shift, expand the current selection
327
+ // When shift selecting upwards, expand from start of node to selection end
328
+ // When shift selecting downwards, expand from selection start to end of node
329
+ const selectUp = resolvedStartPos.pos < selection.from;
330
+ const $from = isShiftPressed && selectUp ? resolvedStartPos : selection.$from;
331
+ const $to = isShiftPressed && !selectUp ? doc.resolve(resolvedStartPos.pos + 1) : selection.$to;
332
+ return $from.blockRange($to);
360
333
  };
361
334
  export const DragHandle = ({
362
335
  view,
@@ -432,22 +405,21 @@ export const DragHandle = ({
432
405
  nodeType: ((_resolvedStartPos$nod = resolvedStartPos.nodeAfter) === null || _resolvedStartPos$nod === void 0 ? void 0 : _resolvedStartPos$nod.type.name) || ''
433
406
  }
434
407
  })(tr);
435
- const preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
436
- const selection = preservedSelection || tr.selection;
437
- const range = calculateBlockRange({
408
+ const selection = ((_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection) || tr.selection;
409
+ const range = getExpandedSelectionRange({
438
410
  doc: tr.doc,
439
411
  selection,
440
412
  resolvedStartPos,
441
413
  isShiftPressed: e.shiftKey
442
414
  });
443
- tr = createSelectionFromRange({
444
- tr,
445
- selection,
446
- startPos,
447
- nodeType,
448
- range,
449
- api
450
- });
415
+
416
+ // Set selection to expanded selection range if it encompases the clicked drag handle
417
+ if (range && isPosWithinRange(startPos, range) && isMultiNodeRange(range)) {
418
+ tr.setSelection(TextSelection.create(tr.doc, Math.min(selection.from, range.start), Math.max(selection.to, range.end)));
419
+ } else {
420
+ // Select the clicked drag handle's node only
421
+ tr = selectNode(tr, startPos, nodeType, api);
422
+ }
451
423
  api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.commands.startPreservingSelection()({
452
424
  tr
453
425
  });
@@ -1003,12 +975,12 @@ export const DragHandle = ({
1003
975
  setDragHandleDisabled(false);
1004
976
  }
1005
977
  }, [api === null || api === void 0 ? void 0 : api.blockControls.sharedState, isMultiSelect, isShiftDown, isTopLevelNode, view]);
1006
- const dragHandleMessage = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_patch_1') ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
978
+ const dragHandleMessage = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
1007
979
  br: jsx("br", null)
1008
980
  }) : formatMessage(blockControlsMessages.dragToMove);
1009
981
 
1010
982
  // Create a string version for aria-label
1011
- const dragHandleAriaLabel = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_patch_1') ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
983
+ const dragHandleAriaLabel = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
1012
984
  br: ' '
1013
985
  }) : formatMessage(blockControlsMessages.dragToMove);
1014
986
  let helpDescriptors = isTopLevelNode ? [{
@@ -49,13 +49,17 @@ export var createSelectionPreservationPlugin = function createSelectionPreservat
49
49
  newState.preservedSelection = undefined;
50
50
  }
51
51
  if (newState.preservedSelection && tr.docChanged) {
52
- var mapped = new TextSelection(newState.preservedSelection.$from, newState.preservedSelection.$to);
53
- mapped.map(tr.doc, tr.mapping);
54
- if (mapped.from >= 0 && mapped.to <= tr.doc.content.size && mapped.from !== mapped.to) {
55
- newState.preservedSelection = mapped;
56
- } else if (mapped.from === mapped.to) {
57
- // If selection has collapsed to a cursor, e.g. after deleting the selection, stop preserving
52
+ var from = tr.mapping.map(newState.preservedSelection.from);
53
+ var to = tr.mapping.map(newState.preservedSelection.to);
54
+ if (from < 0 || to > tr.doc.content.size || from >= to) {
55
+ // stop preserving if preserved selection becomes invalid or collapsed to a cursor
56
+ // e.g. after deleting the selection
58
57
  newState.preservedSelection = undefined;
58
+ } else {
59
+ var _expandToBlockRange = expandToBlockRange(tr.doc.resolve(from), tr.doc.resolve(to)),
60
+ $from = _expandToBlockRange.$from,
61
+ $to = _expandToBlockRange.$to;
62
+ newState.preservedSelection = new TextSelection($from, $to);
59
63
  }
60
64
  }
61
65
  return newState;
@@ -90,4 +94,17 @@ export var createSelectionPreservationPlugin = function createSelectionPreservat
90
94
  return null;
91
95
  }
92
96
  });
97
+ };
98
+ var expandToBlockRange = function expandToBlockRange($from, $to) {
99
+ var range = $from.blockRange($to);
100
+ if (!range) {
101
+ return {
102
+ $from: $from,
103
+ $to: $to
104
+ };
105
+ }
106
+ return {
107
+ $from: $from.doc.resolve(range.start),
108
+ $to: $to.doc.resolve(range.end)
109
+ };
93
110
  };
@@ -7,10 +7,7 @@ import { selectionPreservationPluginKey } from './plugin-key';
7
7
  */
8
8
  export var hasUserSelectionChange = function hasUserSelectionChange(transactions) {
9
9
  return transactions.some(function (tr) {
10
- return tr.getMeta('pointer') || tr.getMeta('uiEvent') || tr.getMeta('paste') || tr.getMeta('cut') || tr.getMeta('composition') ||
11
- // IME input
12
- // Keyboard events that change selection
13
- tr.getMeta('addToHistory') && tr.selectionSet;
10
+ return tr.getMeta('pointer') && tr.selectionSet;
14
11
  });
15
12
  };
16
13
  export var getSelectionPreservationMeta = function getSelectionPreservationMeta(tr) {
@@ -295,7 +295,7 @@ var getNodeMargins = function getNodeMargins(node) {
295
295
  }
296
296
  return nodeMargins[nodeTypeName] || nodeMargins['default'];
297
297
  };
298
- var isRangeSpanningMultipleNodes = function isRangeSpanningMultipleNodes(range) {
298
+ var isMultiNodeRange = function isMultiNodeRange(range) {
299
299
  if (range.endIndex - range.startIndex <= 1) {
300
300
  return false; // At most one child
301
301
  }
@@ -312,64 +312,38 @@ var isRangeSpanningMultipleNodes = function isRangeSpanningMultipleNodes(range)
312
312
  }
313
313
  return false;
314
314
  };
315
- var shouldExpandSelection = function shouldExpandSelection(range, startPos) {
316
- return !!range && isRangeSpanningMultipleNodes(range) && range.start <= startPos && range.end >= startPos + 1;
315
+ var isPosWithinRange = function isPosWithinRange(pos, range) {
316
+ return range.start <= pos && range.end >= pos + 1;
317
317
  };
318
- var calculateBlockRange = function calculateBlockRange(_ref) {
318
+ /**
319
+ * From the current selection and the position of the drag handle being clicked,
320
+ * calculate the expanded block range up to the common ancestor.
321
+ */
322
+ var getExpandedSelectionRange = function getExpandedSelectionRange(_ref) {
319
323
  var selection = _ref.selection,
320
324
  doc = _ref.doc,
321
325
  resolvedStartPos = _ref.resolvedStartPos,
322
326
  isShiftPressed = _ref.isShiftPressed;
323
- if (!isShiftPressed) {
324
- // When not pressing shift, create range including all block nodes within the selection
325
- return selection.$from.blockRange(selection.$to);
326
- }
327
- if (resolvedStartPos.pos < selection.from) {
328
- // If shift+click selecting upwards, get range from start of node to end of selection
329
- return resolvedStartPos.blockRange(selection.$to);
330
- }
331
-
332
- // Shift+click selecting downwards, get range from start of selection to pos within or after node
333
- var resolvedPosWithinOrAfterNode = doc.resolve(resolvedStartPos.pos + 1);
334
- return selection.$from.blockRange(resolvedPosWithinOrAfterNode);
335
- };
336
- var createExpandedSelection = function createExpandedSelection(doc, selection, range) {
337
- return TextSelection.create(doc, Math.min(selection.from, range.start), Math.max(selection.to, range.end));
327
+ // When not pressing shift, expand the current selection
328
+ // When shift selecting upwards, expand from start of node to selection end
329
+ // When shift selecting downwards, expand from selection start to end of node
330
+ var selectUp = resolvedStartPos.pos < selection.from;
331
+ var $from = isShiftPressed && selectUp ? resolvedStartPos : selection.$from;
332
+ var $to = isShiftPressed && !selectUp ? doc.resolve(resolvedStartPos.pos + 1) : selection.$to;
333
+ return $from.blockRange($to);
338
334
  };
339
- var createSelectionFromRange = function createSelectionFromRange(_ref2) {
340
- var tr = _ref2.tr,
341
- selection = _ref2.selection,
342
- startPos = _ref2.startPos,
343
- nodeType = _ref2.nodeType,
344
- range = _ref2.range,
345
- api = _ref2.api;
346
- if (range && shouldExpandSelection(range, startPos)) {
347
- var expandedSelection = createExpandedSelection(tr.doc, selection, range);
348
- if (!expandedSelection.eq(tr.selection)) {
349
- tr.setSelection(expandedSelection);
350
- }
351
- return tr;
352
- }
353
- var node = tr.doc.nodeAt(startPos);
354
- var isEmptyNode = (node === null || node === void 0 ? void 0 : node.content.size) === 0;
355
- if (isEmptyNode && node.type.name !== 'paragraph') {
356
- tr.setSelection(new NodeSelection(tr.doc.resolve(startPos)));
357
- return tr;
358
- }
359
- return selectNode(tr, startPos, nodeType, api);
360
- };
361
- export var DragHandle = function DragHandle(_ref3) {
335
+ export var DragHandle = function DragHandle(_ref2) {
362
336
  var _api$core4;
363
- var view = _ref3.view,
364
- api = _ref3.api,
365
- formatMessage = _ref3.formatMessage,
366
- getPos = _ref3.getPos,
367
- anchorName = _ref3.anchorName,
368
- nodeType = _ref3.nodeType,
369
- handleOptions = _ref3.handleOptions,
370
- _ref3$isTopLevelNode = _ref3.isTopLevelNode,
371
- isTopLevelNode = _ref3$isTopLevelNode === void 0 ? true : _ref3$isTopLevelNode,
372
- anchorRectCache = _ref3.anchorRectCache;
337
+ var view = _ref2.view,
338
+ api = _ref2.api,
339
+ formatMessage = _ref2.formatMessage,
340
+ getPos = _ref2.getPos,
341
+ anchorName = _ref2.anchorName,
342
+ nodeType = _ref2.nodeType,
343
+ handleOptions = _ref2.handleOptions,
344
+ _ref2$isTopLevelNode = _ref2.isTopLevelNode,
345
+ isTopLevelNode = _ref2$isTopLevelNode === void 0 ? true : _ref2$isTopLevelNode,
346
+ anchorRectCache = _ref2.anchorRectCache;
373
347
  var buttonRef = useRef(null);
374
348
  var _useState = useState(false),
375
349
  _useState2 = _slicedToArray(_useState, 2),
@@ -432,9 +406,9 @@ export var DragHandle = function DragHandle(_ref3) {
432
406
  }, [anchorName, nodeType, view.dom]);
433
407
  var handleOnClickNew = useCallback(function (e) {
434
408
  var _api$core;
435
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref4) {
409
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref3) {
436
410
  var _api$analytics, _resolvedStartPos$nod, _selectionPreservatio, _api$blockControls, _api$blockControls2;
437
- var tr = _ref4.tr;
411
+ var tr = _ref3.tr;
438
412
  var startPos = getPos();
439
413
  if (startPos === undefined) {
440
414
  return tr;
@@ -450,22 +424,21 @@ export var DragHandle = function DragHandle(_ref3) {
450
424
  nodeType: ((_resolvedStartPos$nod = resolvedStartPos.nodeAfter) === null || _resolvedStartPos$nod === void 0 ? void 0 : _resolvedStartPos$nod.type.name) || ''
451
425
  }
452
426
  })(tr);
453
- var preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
454
- var selection = preservedSelection || tr.selection;
455
- var range = calculateBlockRange({
427
+ var selection = ((_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection) || tr.selection;
428
+ var range = getExpandedSelectionRange({
456
429
  doc: tr.doc,
457
430
  selection: selection,
458
431
  resolvedStartPos: resolvedStartPos,
459
432
  isShiftPressed: e.shiftKey
460
433
  });
461
- tr = createSelectionFromRange({
462
- tr: tr,
463
- selection: selection,
464
- startPos: startPos,
465
- nodeType: nodeType,
466
- range: range,
467
- api: api
468
- });
434
+
435
+ // Set selection to expanded selection range if it encompases the clicked drag handle
436
+ if (range && isPosWithinRange(startPos, range) && isMultiNodeRange(range)) {
437
+ tr.setSelection(TextSelection.create(tr.doc, Math.min(selection.from, range.start), Math.max(selection.to, range.end)));
438
+ } else {
439
+ // Select the clicked drag handle's node only
440
+ tr = selectNode(tr, startPos, nodeType, api);
441
+ }
469
442
  api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || _api$blockControls.commands.startPreservingSelection()({
470
443
  tr: tr
471
444
  });
@@ -490,9 +463,9 @@ export var DragHandle = function DragHandle(_ref3) {
490
463
  if (!isMultiSelect) {
491
464
  setDragHandleSelected(!dragHandleSelected);
492
465
  }
493
- api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref5) {
466
+ api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref4) {
494
467
  var _api$blockControls$sh, _api$analytics2;
495
- var tr = _ref5.tr;
468
+ var tr = _ref4.tr;
496
469
  var startPos = getPos();
497
470
  if (startPos === undefined) {
498
471
  return tr;
@@ -572,8 +545,8 @@ export var DragHandle = function DragHandle(_ref3) {
572
545
  if (!e.repeat && e.key === ' ') {
573
546
  var _api$core3;
574
547
  var startPos = getPos();
575
- api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref6) {
576
- var tr = _ref6.tr;
548
+ api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref5) {
549
+ var tr = _ref5.tr;
577
550
  if (startPos === undefined) {
578
551
  return tr;
579
552
  }
@@ -607,9 +580,9 @@ export var DragHandle = function DragHandle(_ref3) {
607
580
  e.preventDefault();
608
581
  e.stopPropagation();
609
582
  var startPos = getPos();
610
- api === null || api === void 0 || (_api$core5 = api.core) === null || _api$core5 === void 0 || _api$core5.actions.execute(function (_ref7) {
583
+ api === null || api === void 0 || (_api$core5 = api.core) === null || _api$core5 === void 0 || _api$core5.actions.execute(function (_ref6) {
611
584
  var _api$blockControls6, _api$userIntent;
612
- var tr = _ref7.tr;
585
+ var tr = _ref6.tr;
613
586
  if (startPos === undefined) {
614
587
  return tr;
615
588
  }
@@ -638,9 +611,9 @@ export var DragHandle = function DragHandle(_ref3) {
638
611
  } else if (e.key === 'Backspace' || e.key === 'Delete') {
639
612
  e.preventDefault();
640
613
  e.stopPropagation();
641
- api === null || api === void 0 || api.core.actions.execute(function (_ref8) {
614
+ api === null || api === void 0 || api.core.actions.execute(function (_ref7) {
642
615
  var _api$blockControls7;
643
- var tr = _ref8.tr;
616
+ var tr = _ref7.tr;
644
617
  deleteSelectedRange(tr);
645
618
  api === null || api === void 0 || (_api$blockControls7 = api.blockControls) === null || _api$blockControls7 === void 0 || _api$blockControls7.commands.toggleBlockMenu({
646
619
  closeMenu: true
@@ -670,13 +643,13 @@ export var DragHandle = function DragHandle(_ref3) {
670
643
  start: start
671
644
  };
672
645
  },
673
- onGenerateDragPreview: function onGenerateDragPreview(_ref9) {
646
+ onGenerateDragPreview: function onGenerateDragPreview(_ref8) {
674
647
  var _api$blockControls$sh2;
675
- var nativeSetDragImage = _ref9.nativeSetDragImage;
648
+ var nativeSetDragImage = _ref8.nativeSetDragImage;
676
649
  if (isMultiSelect) {
677
650
  var _api$core6;
678
- api === null || api === void 0 || (_api$core6 = api.core) === null || _api$core6 === void 0 || _api$core6.actions.execute(function (_ref0) {
679
- var tr = _ref0.tr;
651
+ api === null || api === void 0 || (_api$core6 = api.core) === null || _api$core6 === void 0 || _api$core6.actions.execute(function (_ref9) {
652
+ var tr = _ref9.tr;
680
653
  var handlePos = getPos();
681
654
  if (typeof handlePos !== 'number') {
682
655
  return tr;
@@ -754,8 +727,8 @@ export var DragHandle = function DragHandle(_ref3) {
754
727
  };
755
728
  }
756
729
  },
757
- render: function render(_ref1) {
758
- var container = _ref1.container;
730
+ render: function render(_ref0) {
731
+ var container = _ref0.container;
759
732
  var dom = view.dom.querySelector("[".concat(getAnchorAttrName(), "=\"").concat(anchorName, "\"]"));
760
733
  if (!dom) {
761
734
  return;
@@ -791,9 +764,9 @@ export var DragHandle = function DragHandle(_ref3) {
791
764
  if (start === undefined) {
792
765
  return;
793
766
  }
794
- api === null || api === void 0 || (_api$core7 = api.core) === null || _api$core7 === void 0 || _api$core7.actions.execute(function (_ref10) {
767
+ api === null || api === void 0 || (_api$core7 = api.core) === null || _api$core7 === void 0 || _api$core7.actions.execute(function (_ref1) {
795
768
  var _api$blockControls$sh3, _api$blockControls9, _api$analytics3;
796
- var tr = _ref10.tr;
769
+ var tr = _ref1.tr;
797
770
  var nodeTypes, hasSelectedMultipleNodes;
798
771
  var resolvedMovingNode = tr.doc.resolve(start);
799
772
  var maybeNode = resolvedMovingNode.nodeAfter;
@@ -1010,12 +983,12 @@ export var DragHandle = function DragHandle(_ref3) {
1010
983
  setDragHandleDisabled(false);
1011
984
  }
1012
985
  }, [api === null || api === void 0 ? void 0 : api.blockControls.sharedState, isMultiSelect, isShiftDown, isTopLevelNode, view]);
1013
- var dragHandleMessage = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_patch_1') ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
986
+ var dragHandleMessage = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
1014
987
  br: jsx("br", null)
1015
988
  }) : formatMessage(blockControlsMessages.dragToMove);
1016
989
 
1017
990
  // Create a string version for aria-label
1018
- var dragHandleAriaLabel = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_patch_1') ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
991
+ var dragHandleAriaLabel = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
1019
992
  br: ' '
1020
993
  }) : formatMessage(blockControlsMessages.dragToMove);
1021
994
  var helpDescriptors = isTopLevelNode ? [{
@@ -1189,15 +1162,15 @@ export var DragHandle = function DragHandle(_ref3) {
1189
1162
  var render = isTooltip ? buttonWithTooltip() : renderButton();
1190
1163
  return editorExperiment('platform_editor_controls', 'variant1') ? stickyRender : render;
1191
1164
  };
1192
- export var DragHandleWithVisibility = function DragHandleWithVisibility(_ref11) {
1193
- var view = _ref11.view,
1194
- api = _ref11.api,
1195
- formatMessage = _ref11.formatMessage,
1196
- getPos = _ref11.getPos,
1197
- anchorName = _ref11.anchorName,
1198
- nodeType = _ref11.nodeType,
1199
- handleOptions = _ref11.handleOptions,
1200
- anchorRectCache = _ref11.anchorRectCache;
1165
+ export var DragHandleWithVisibility = function DragHandleWithVisibility(_ref10) {
1166
+ var view = _ref10.view,
1167
+ api = _ref10.api,
1168
+ formatMessage = _ref10.formatMessage,
1169
+ getPos = _ref10.getPos,
1170
+ anchorName = _ref10.anchorName,
1171
+ nodeType = _ref10.nodeType,
1172
+ handleOptions = _ref10.handleOptions,
1173
+ anchorRectCache = _ref10.anchorRectCache;
1201
1174
  return jsx(VisibilityContainer, {
1202
1175
  api: api
1203
1176
  }, jsx(DragHandle, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "7.7.3",
3
+ "version": "7.7.5",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -52,10 +52,10 @@
52
52
  "@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
53
53
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
54
54
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
55
- "@atlaskit/primitives": "^16.1.0",
55
+ "@atlaskit/primitives": "^16.2.0",
56
56
  "@atlaskit/theme": "^21.0.0",
57
- "@atlaskit/tmp-editor-statsig": "^13.39.0",
58
- "@atlaskit/tokens": "^8.0.0",
57
+ "@atlaskit/tmp-editor-statsig": "^13.40.0",
58
+ "@atlaskit/tokens": "^8.1.0",
59
59
  "@atlaskit/tooltip": "^20.10.0",
60
60
  "@babel/runtime": "^7.0.0",
61
61
  "@emotion/react": "^11.7.1",
@@ -66,7 +66,7 @@
66
66
  "uuid": "^3.1.0"
67
67
  },
68
68
  "peerDependencies": {
69
- "@atlaskit/editor-common": "^110.32.0",
69
+ "@atlaskit/editor-common": "^110.33.0",
70
70
  "react": "^18.2.0",
71
71
  "react-dom": "^18.2.0",
72
72
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -143,9 +143,6 @@
143
143
  "dst-a11y__replace-anchor-with-link__editor-jenga": {
144
144
  "type": "boolean"
145
145
  },
146
- "platform_editor_block_menu_patch_1": {
147
- "type": "boolean"
148
- },
149
146
  "editor_native_anchor_remove_decoration_in_apply": {
150
147
  "type": "boolean"
151
148
  },