@atlaskit/editor-plugin-block-controls 33.0.0 → 34.0.1

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 (32) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/blockControlsPlugin.js +1 -2
  3. package/dist/cjs/editor-commands/move-node.js +1 -1
  4. package/dist/cjs/pm-plugins/handle-mouse-over.js +21 -33
  5. package/dist/cjs/pm-plugins/interaction-tracking/handle-mouse-move.js +8 -14
  6. package/dist/cjs/pm-plugins/interaction-tracking/pm-plugin.js +11 -24
  7. package/dist/cjs/pm-plugins/main.js +115 -170
  8. package/dist/cjs/pm-plugins/utils/getSelection.js +2 -3
  9. package/dist/cjs/pm-plugins/utils/transactions.js +2 -5
  10. package/dist/cjs/ui/global-styles.js +1 -19
  11. package/dist/es2019/blockControlsPlugin.js +1 -2
  12. package/dist/es2019/editor-commands/move-node.js +1 -1
  13. package/dist/es2019/pm-plugins/handle-mouse-over.js +21 -33
  14. package/dist/es2019/pm-plugins/interaction-tracking/handle-mouse-move.js +8 -14
  15. package/dist/es2019/pm-plugins/interaction-tracking/pm-plugin.js +11 -24
  16. package/dist/es2019/pm-plugins/main.js +85 -138
  17. package/dist/es2019/pm-plugins/utils/getSelection.js +2 -3
  18. package/dist/es2019/pm-plugins/utils/transactions.js +2 -5
  19. package/dist/es2019/ui/global-styles.js +1 -22
  20. package/dist/esm/blockControlsPlugin.js +1 -2
  21. package/dist/esm/editor-commands/move-node.js +1 -1
  22. package/dist/esm/pm-plugins/handle-mouse-over.js +21 -33
  23. package/dist/esm/pm-plugins/interaction-tracking/handle-mouse-move.js +8 -14
  24. package/dist/esm/pm-plugins/interaction-tracking/pm-plugin.js +11 -24
  25. package/dist/esm/pm-plugins/main.js +115 -170
  26. package/dist/esm/pm-plugins/utils/getSelection.js +2 -3
  27. package/dist/esm/pm-plugins/utils/transactions.js +2 -5
  28. package/dist/esm/ui/global-styles.js +1 -19
  29. package/dist/types/pm-plugins/main.d.ts +1 -4
  30. package/dist/types/pm-plugins/utils/getSelection.d.ts +1 -1
  31. package/dist/types/pm-plugins/utils/transactions.d.ts +1 -2
  32. package/package.json +25 -22
@@ -14,7 +14,6 @@ var _browser = require("@atlaskit/editor-common/browser");
14
14
  var _nodeAnchorProvider = require("@atlaskit/editor-common/node-anchor-provider");
15
15
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
16
16
  var _dragHandle = require("@atlaskit/editor-common/styles/drag-handle");
17
- var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
18
17
  var _uiToolbar = require("@atlaskit/editor-common/ui-toolbar");
19
18
  var _utils = require("@atlaskit/editor-common/utils");
20
19
  var _state = require("@atlaskit/editor-prosemirror/state");
@@ -180,14 +179,14 @@ var getDecorationAtPos = function getDecorationAtPos(state, decorations, pos, to
180
179
  var nodeDecAtActivePos = nodeDecsAtActivePos.pop();
181
180
  return nodeDecAtActivePos;
182
181
  };
183
- var _apply = exports.apply = function apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry) {
184
- var _meta$multiSelectDnD, _api$editorViewMode, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$toggleMenu, _meta$isDragging3, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$toggleMenu8, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$lastDragCancell;
185
- var rightSideControlsEnabled = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
186
- var quickInsertButtonEnabled = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : true;
187
- var anchorRectCache = arguments.length > 10 ? arguments[10] : undefined;
188
- var resizeObserverWidth = arguments.length > 11 ? arguments[11] : undefined;
189
- var pragmaticCleanup = arguments.length > 12 ? arguments[12] : undefined;
190
- var limitedModeTeardown = arguments.length > 13 ? arguments[13] : undefined;
182
+ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState, newState, nodeViewPortalProviderAPI, nodeDecorationRegistry) {
183
+ var _meta$multiSelectDnD, _api$editorViewMode, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _latestActiveNode11, _latestActiveNode12, _meta$toggleMenu, _meta$isDragging3, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$toggleMenu8, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$lastDragCancell;
184
+ var rightSideControlsEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
185
+ var quickInsertButtonEnabled = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
186
+ var anchorRectCache = arguments.length > 9 ? arguments[9] : undefined;
187
+ var resizeObserverWidth = arguments.length > 10 ? arguments[10] : undefined;
188
+ var pragmaticCleanup = arguments.length > 11 ? arguments[11] : undefined;
189
+ var limitedModeTeardown = arguments.length > 12 ? arguments[12] : undefined;
191
190
  var activeNode = currentState.activeNode,
192
191
  decorations = currentState.decorations,
193
192
  isResizerResizing = currentState.isResizerResizing,
@@ -205,7 +204,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
205
204
  isPMDragging = currentState.isPMDragging,
206
205
  lastDragCancelled = currentState.lastDragCancelled;
207
206
  var isActiveNodeDeleted = false;
208
- var _getTrMetadata = (0, _transactions.getTrMetadata)(tr, flags),
207
+ var _getTrMetadata = (0, _transactions.getTrMetadata)(tr),
209
208
  from = _getTrMetadata.from,
210
209
  to = _getTrMetadata.to,
211
210
  numReplaceSteps = _getTrMetadata.numReplaceSteps,
@@ -304,62 +303,50 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
304
303
 
305
304
  // enables quick insert
306
305
  // don't remap activeNode if it's being dragged
307
- if (!flags.toolbarFlagsEnabled) {
308
- if (activeNode) {
309
- var mappedPos = tr.mapping.mapResult(activeNode.pos);
306
+ if (activeNode && (meta === null || meta === void 0 ? void 0 : meta.isDragging) !== true) {
307
+ var _mappedRootPos$pos, _mappedRootPos;
308
+ var mappedPos;
309
+ var browser = (0, _browser.getBrowserInfo)();
310
+ // In safari,
311
+ // sometimes the drag handle for the layout disppears after you click on the handle for a few times
312
+ // Which caused the drag handle onClick event not firing, then block menu wouldn't be opened
313
+ // This is caused by the mappedPos.deletedAfter sometimes returning true in webkit browsers even though the active node still exists
314
+ // This is likely a prosemirror and safari integration bug, but to unblock the issue, we are going to use mappedPos.deleted in safari for now
315
+ if (browser.webkit) {
316
+ mappedPos = tr.mapping.mapResult(activeNode.pos);
310
317
  isActiveNodeDeleted = mappedPos.deleted;
311
- activeNode = {
312
- pos: mappedPos.pos,
313
- anchorName: activeNode.anchorName,
314
- nodeType: activeNode.nodeType
315
- };
318
+ } else {
319
+ mappedPos = tr.mapping.mapResult(activeNode.pos, -1);
320
+ isActiveNodeDeleted = mappedPos.deletedAfter;
316
321
  }
317
- } else {
318
- if (activeNode && (meta === null || meta === void 0 ? void 0 : meta.isDragging) !== true) {
319
- var _mappedRootPos$pos, _mappedRootPos;
320
- var _mappedPos;
321
- var browser = (0, _browser.getBrowserInfo)();
322
- // In safari,
323
- // sometimes the drag handle for the layout disppears after you click on the handle for a few times
324
- // Which caused the drag handle onClick event not firing, then block menu wouldn't be opened
325
- // This is caused by the mappedPos.deletedAfter sometimes returning true in webkit browsers even though the active node still exists
326
- // This is likely a prosemirror and safari integration bug, but to unblock the issue, we are going to use mappedPos.deleted in safari for now
327
- if (browser.webkit) {
328
- _mappedPos = tr.mapping.mapResult(activeNode.pos);
329
- isActiveNodeDeleted = _mappedPos.deleted;
330
- } else {
331
- _mappedPos = tr.mapping.mapResult(activeNode.pos, -1);
332
- isActiveNodeDeleted = _mappedPos.deletedAfter;
333
- }
334
- // for editor controls, remap the rootPos as well
335
- var mappedRootPos;
336
- if (activeNode.rootPos !== undefined) {
337
- mappedRootPos = tr.mapping.mapResult(activeNode.rootPos, -1);
322
+ // for editor controls, remap the rootPos as well
323
+ var mappedRootPos;
324
+ if (activeNode.rootPos !== undefined) {
325
+ mappedRootPos = tr.mapping.mapResult(activeNode.rootPos, -1);
326
+ }
327
+ var mappedNodeType = activeNode.nodeType;
328
+ var mappedRootNodeType = activeNode.rootNodeType;
329
+ // Sparse mode does not redraw the old decorations. A block-type transaction may report
330
+ // a text range that excludes the active block position, so always refresh the already
331
+ // active node and root from the new document (for example, paragraph → heading-1).
332
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) {
333
+ var mappedNode = newState.doc.nodeAt(mappedPos.pos);
334
+ if (mappedNode !== null && mappedNode !== void 0 && mappedNode.isBlock) {
335
+ mappedNodeType = (0, _decorationsCommon.getNodeTypeWithLevel)(mappedNode);
338
336
  }
339
- var mappedNodeType = activeNode.nodeType;
340
- var mappedRootNodeType = activeNode.rootNodeType;
341
- // Sparse mode does not redraw the old decorations. A block-type transaction may report
342
- // a text range that excludes the active block position, so always refresh the already
343
- // active node and root from the new document (for example, paragraph → heading-1).
344
- if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) {
345
- var mappedNode = newState.doc.nodeAt(_mappedPos.pos);
346
- if (mappedNode !== null && mappedNode !== void 0 && mappedNode.isBlock) {
347
- mappedNodeType = (0, _decorationsCommon.getNodeTypeWithLevel)(mappedNode);
348
- }
349
- var mappedRootNode = mappedRootPos ? mappedRootPos.pos === _mappedPos.pos && mappedNode ? mappedNode : newState.doc.nodeAt(mappedRootPos.pos) : undefined;
350
- if (mappedRootNode !== null && mappedRootNode !== void 0 && mappedRootNode.isBlock) {
351
- mappedRootNodeType = (0, _decorationsCommon.getNodeTypeWithLevel)(mappedRootNode);
352
- }
337
+ var mappedRootNode = mappedRootPos ? mappedRootPos.pos === mappedPos.pos && mappedNode ? mappedNode : newState.doc.nodeAt(mappedRootPos.pos) : undefined;
338
+ if (mappedRootNode !== null && mappedRootNode !== void 0 && mappedRootNode.isBlock) {
339
+ mappedRootNodeType = (0, _decorationsCommon.getNodeTypeWithLevel)(mappedRootNode);
353
340
  }
354
- activeNode = {
355
- pos: _mappedPos.pos,
356
- anchorName: activeNode.anchorName,
357
- nodeType: mappedNodeType,
358
- rootPos: (_mappedRootPos$pos = (_mappedRootPos = mappedRootPos) === null || _mappedRootPos === void 0 ? void 0 : _mappedRootPos.pos) !== null && _mappedRootPos$pos !== void 0 ? _mappedRootPos$pos : activeNode.rootPos,
359
- rootAnchorName: activeNode.rootAnchorName,
360
- rootNodeType: mappedRootNodeType
361
- };
362
341
  }
342
+ activeNode = {
343
+ pos: mappedPos.pos,
344
+ anchorName: activeNode.anchorName,
345
+ nodeType: mappedNodeType,
346
+ rootPos: (_mappedRootPos$pos = (_mappedRootPos = mappedRootPos) === null || _mappedRootPos === void 0 ? void 0 : _mappedRootPos.pos) !== null && _mappedRootPos$pos !== void 0 ? _mappedRootPos$pos : activeNode.rootPos,
347
+ rootAnchorName: activeNode.rootAnchorName,
348
+ rootNodeType: mappedRootNodeType
349
+ };
363
350
  }
364
351
  if (multiSelectDnD) {
365
352
  multiSelectDnD.anchor = tr.mapping.map(multiSelectDnD.anchor);
@@ -402,43 +389,21 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
402
389
  decorations = decorations.add(newState.doc, newNodeDecs);
403
390
 
404
391
  // enables quick insert
405
- if (!flags.toolbarFlagsEnabled) {
406
- if (latestActiveNode && !isActiveNodeDeleted) {
407
- // Find the newly minted node decs that touch the active node
408
- var findNewNodeDecs = (0, _decorationsAnchor.findNodeDecs)(newState, decorations, latestActiveNode.pos - 1, to);
409
-
410
- // Find the specific dec that the active node corresponds to
411
- var nodeDecsAtActivePos = findNewNodeDecs.filter(function (dec) {
412
- return (dec === null || dec === void 0 ? void 0 : dec.from) === latestActiveNode.pos;
413
- });
414
-
415
- // If multiple decorations at the active node pos, we want the last one
416
- var nodeDecAtActivePos = nodeDecsAtActivePos.pop();
417
-
418
- // Update the active node anchor-name and type for accurate positioning
419
- if (nodeDecAtActivePos) {
420
- isActiveNodeModified = true;
421
- latestActiveNode.anchorName = nodeDecAtActivePos.spec.anchorName;
422
- latestActiveNode.nodeType = nodeDecAtActivePos.spec.nodeType;
423
- }
392
+ if (latestActiveNode && (!isActiveNodeDeleted || isReplacedWithSameSize)) {
393
+ var nodeDecAtActivePos = getDecorationAtPos(newState, decorations, latestActiveNode.pos, to);
394
+ var rootNodeDecAtActivePos = latestActiveNode.rootPos !== undefined ? getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to) : undefined;
395
+ if (nodeDecAtActivePos || rootNodeDecAtActivePos) {
396
+ isActiveNodeModified = true;
424
397
  }
425
- } else {
426
- if (latestActiveNode && (!isActiveNodeDeleted || isReplacedWithSameSize)) {
427
- var _nodeDecAtActivePos = getDecorationAtPos(newState, decorations, latestActiveNode.pos, to);
428
- var rootNodeDecAtActivePos = latestActiveNode.rootPos !== undefined ? getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to) : undefined;
429
- if (_nodeDecAtActivePos || rootNodeDecAtActivePos) {
430
- isActiveNodeModified = true;
431
- }
432
398
 
433
- // Update the active node anchor-name and type for accurate positioning
434
- if (_nodeDecAtActivePos) {
435
- latestActiveNode.anchorName = _nodeDecAtActivePos.spec.anchorName;
436
- latestActiveNode.nodeType = _nodeDecAtActivePos.spec.nodeType;
437
- }
438
- if (rootNodeDecAtActivePos) {
439
- latestActiveNode.rootAnchorName = rootNodeDecAtActivePos.spec.anchorName;
440
- latestActiveNode.rootNodeType = rootNodeDecAtActivePos.spec.nodeType;
441
- }
399
+ // Update the active node anchor-name and type for accurate positioning
400
+ if (nodeDecAtActivePos) {
401
+ latestActiveNode.anchorName = nodeDecAtActivePos.spec.anchorName;
402
+ latestActiveNode.nodeType = nodeDecAtActivePos.spec.nodeType;
403
+ }
404
+ if (rootNodeDecAtActivePos) {
405
+ latestActiveNode.rootAnchorName = rootNodeDecAtActivePos.spec.anchorName;
406
+ latestActiveNode.rootNodeType = rootNodeDecAtActivePos.spec.nodeType;
442
407
  }
443
408
  }
444
409
  }
@@ -461,10 +426,8 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
461
426
  var shouldRemoveHandle = latestActiveNode ? isResizerResizing || isActiveNodeDeleted && !isReplacedWithSameSize || (meta === null || meta === void 0 ? void 0 : meta.nodeMoved) : true;
462
427
 
463
428
  // enables quick insert
464
- if (flags.toolbarFlagsEnabled) {
465
- // Remove handle dec when editor is blurred
466
- shouldRemoveHandle = shouldRemoveHandle || (meta === null || meta === void 0 ? void 0 : meta.editorBlurred);
467
- }
429
+ // Remove handle dec when editor is blurred
430
+ shouldRemoveHandle = shouldRemoveHandle || (meta === null || meta === void 0 ? void 0 : meta.editorBlurred);
468
431
 
469
432
  // In view mode with right-side controls, remove any lingering drag handle decorations
470
433
  // (they may carry over from edit mode). Only remove drag handles specifically, not
@@ -497,54 +460,52 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
497
460
  // nodeDecorationRegistry cleanup (e.g. the legacy Remix button) is independent of the legacy
498
461
  // quick-insert button, so this must not be gated by quickInsertButtonEnabled — otherwise a
499
462
  // stale decoration is left behind whenever platform_editor_block_control_migration is on.
500
- if (flags.toolbarFlagsEnabled) {
501
- // enables quick insert
502
- if (quickInsertButtonEnabled) {
503
- var _activeNode7, _activeNode8;
504
- var oldQuickInsertButton = (0, _decorationsQuickInsertButton.findQuickInsertInsertButtonDecoration)(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.rootPos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.rootPos);
505
- decorations = decorations.remove(oldQuickInsertButton);
463
+ // enables quick insert
464
+ if (quickInsertButtonEnabled) {
465
+ var _activeNode7, _activeNode8;
466
+ var oldQuickInsertButton = (0, _decorationsQuickInsertButton.findQuickInsertInsertButtonDecoration)(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.rootPos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.rootPos);
467
+ decorations = decorations.remove(oldQuickInsertButton);
468
+ }
469
+ var _iterator = _createForOfIteratorHelper(nodeDecorationRegistry),
470
+ _step;
471
+ try {
472
+ var _loop2 = function _loop2() {
473
+ var _activeNode1, _activeNode10;
474
+ var factory = _step.value;
475
+ var old = decorations.find((_activeNode1 = activeNode) === null || _activeNode1 === void 0 ? void 0 : _activeNode1.rootPos, (_activeNode10 = activeNode) === null || _activeNode10 === void 0 ? void 0 : _activeNode10.rootPos, function (spec) {
476
+ return spec.type === factory.type;
477
+ });
478
+ decorations = decorations.remove(old);
479
+ };
480
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
481
+ _loop2();
506
482
  }
507
- var _iterator = _createForOfIteratorHelper(nodeDecorationRegistry),
508
- _step;
483
+ } catch (err) {
484
+ _iterator.e(err);
485
+ } finally {
486
+ _iterator.f();
487
+ }
488
+ if (rightSideControlsEnabled && isViewMode) {
489
+ var _iterator2 = _createForOfIteratorHelper(nodeDecorationRegistry),
490
+ _step2;
509
491
  try {
510
- var _loop2 = function _loop2() {
511
- var _activeNode1, _activeNode10;
512
- var factory = _step.value;
513
- var old = decorations.find((_activeNode1 = activeNode) === null || _activeNode1 === void 0 ? void 0 : _activeNode1.rootPos, (_activeNode10 = activeNode) === null || _activeNode10 === void 0 ? void 0 : _activeNode10.rootPos, function (spec) {
514
- return spec.type === factory.type;
515
- });
516
- decorations = decorations.remove(old);
492
+ var _loop = function _loop() {
493
+ var factory = _step2.value;
494
+ if (factory.showInViewMode) {
495
+ var _activeNode9, _activeNode0;
496
+ var old = decorations.find((_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.rootPos, (_activeNode0 = activeNode) === null || _activeNode0 === void 0 ? void 0 : _activeNode0.rootPos, function (spec) {
497
+ return spec.type === factory.type;
498
+ });
499
+ decorations = decorations.remove(old);
500
+ }
517
501
  };
518
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
519
- _loop2();
502
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
503
+ _loop();
520
504
  }
521
505
  } catch (err) {
522
- _iterator.e(err);
506
+ _iterator2.e(err);
523
507
  } finally {
524
- _iterator.f();
525
- }
526
- if (rightSideControlsEnabled && isViewMode) {
527
- var _iterator2 = _createForOfIteratorHelper(nodeDecorationRegistry),
528
- _step2;
529
- try {
530
- var _loop = function _loop() {
531
- var factory = _step2.value;
532
- if (factory.showInViewMode) {
533
- var _activeNode9, _activeNode0;
534
- var old = decorations.find((_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.rootPos, (_activeNode0 = activeNode) === null || _activeNode0 === void 0 ? void 0 : _activeNode0.rootPos, function (spec) {
535
- return spec.type === factory.type;
536
- });
537
- decorations = decorations.remove(old);
538
- }
539
- };
540
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
541
- _loop();
542
- }
543
- } catch (err) {
544
- _iterator2.e(err);
545
- } finally {
546
- _iterator2.f();
547
- }
508
+ _iterator2.f();
548
509
  }
549
510
  }
550
511
  } else if (api) {
@@ -622,9 +583,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
622
583
  }
623
584
  }
624
585
  }
625
- if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined && (quickInsertButtonEnabled || nodeDecorationRegistry.length > 0) &&
626
- // enables quick insert
627
- flags.toolbarFlagsEnabled && (!rightSideControlsEnabled || !isViewMode)) {
586
+ if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined && (quickInsertButtonEnabled || nodeDecorationRegistry.length > 0) && (!rightSideControlsEnabled || !isViewMode)) {
628
587
  var _latestActiveNode1;
629
588
  if (quickInsertButtonEnabled) {
630
589
  var _activeNode13, _activeNode14, _latestActiveNode6, _latestActiveNode7, _latestActiveNode8, _latestActiveNode9, _latestActiveNode0;
@@ -730,7 +689,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
730
689
  var rootPos = (_latestActiveNode10 = latestActiveNode) === null || _latestActiveNode10 === void 0 ? void 0 : _latestActiveNode10.rootPos;
731
690
  // rootPos is computed using the same logic as the floating insert menu, so it always points to a top-level (doc child) block when defined.
732
691
  var isDocLevel = rootPos !== undefined && !isNaN(rootPos);
733
- if (isViewMode && isDocLevel && flags.toolbarFlagsEnabled && rightSideControlsEnabled) {
692
+ if (isViewMode && isDocLevel && rightSideControlsEnabled) {
734
693
  var _iterator5 = _createForOfIteratorHelper(nodeDecorationRegistry),
735
694
  _step5;
736
695
  try {
@@ -842,21 +801,15 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
842
801
  decorations = decorations.add(newState.doc, [(0, _decorationsDragHandle.emptyParagraphNodeDecorations)()]);
843
802
  }
844
803
  }
845
- var newActiveNode;
804
+
846
805
  // enables quick insert
847
- if (flags.toolbarFlagsEnabled) {
848
- var _latestActiveNode11, _latestActiveNode12;
849
- // remove isEmptyDoc check and let decorations render and determine their own visibility
850
- // In view mode with right-side controls we render node decorations (right-edge button), not the
851
- // handle - so findHandleDec is always empty. Don't clear activeNode in that case.
852
- var hasHandleOrViewModeControls = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') || isViewMode && rightSideControlsEnabled || (0, _decorationsDragHandle.findHandleDec)(decorations, (_latestActiveNode11 = latestActiveNode) === null || _latestActiveNode11 === void 0 ? void 0 : _latestActiveNode11.pos, (_latestActiveNode12 = latestActiveNode) === null || _latestActiveNode12 === void 0 ? void 0 : _latestActiveNode12.pos).length > 0;
853
- // Keep the registry surface mounted while its Block Menu owns focus.
854
- var keepActiveNodeForOpenBlockMenu = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') && isMenuOpen;
855
- newActiveNode = meta !== null && meta !== void 0 && meta.editorBlurred && !keepActiveNodeForOpenBlockMenu || !(meta !== null && meta !== void 0 && meta.activeNode) && !hasHandleOrViewModeControls ? null : latestActiveNode;
856
- } else {
857
- var _latestActiveNode13, _latestActiveNode14;
858
- newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && !(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') && (0, _decorationsDragHandle.findHandleDec)(decorations, (_latestActiveNode13 = latestActiveNode) === null || _latestActiveNode13 === void 0 ? void 0 : _latestActiveNode13.pos, (_latestActiveNode14 = latestActiveNode) === null || _latestActiveNode14 === void 0 ? void 0 : _latestActiveNode14.pos).length === 0 ? null : latestActiveNode;
859
- }
806
+ // remove isEmptyDoc check and let decorations render and determine their own visibility
807
+ // In view mode with right-side controls we render node decorations (right-edge button), not the
808
+ // handle - so findHandleDec is always empty. Don't clear activeNode in that case.
809
+ var hasHandleOrViewModeControls = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') || isViewMode && rightSideControlsEnabled || (0, _decorationsDragHandle.findHandleDec)(decorations, (_latestActiveNode11 = latestActiveNode) === null || _latestActiveNode11 === void 0 ? void 0 : _latestActiveNode11.pos, (_latestActiveNode12 = latestActiveNode) === null || _latestActiveNode12 === void 0 ? void 0 : _latestActiveNode12.pos).length > 0;
810
+ // Keep the registry surface mounted while its Block Menu owns focus.
811
+ var keepActiveNodeForOpenBlockMenu = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') && isMenuOpen;
812
+ var newActiveNode = meta !== null && meta !== void 0 && meta.editorBlurred && !keepActiveNodeForOpenBlockMenu || !(meta !== null && meta !== void 0 && meta.activeNode) && !hasHandleOrViewModeControls ? null : latestActiveNode;
860
813
  var nextMenuTriggerByNode = (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.triggerByNode) || menuTriggerByNode;
861
814
  if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') && tr.docChanged && menuTriggerByNode && !(meta !== null && meta !== void 0 && meta.toggleMenu)) {
862
815
  var _menuTriggerByNode$ro, _newState$doc$nodeAt4;
@@ -878,11 +831,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
878
831
  var isSameAnchor = (meta === null || meta === void 0 ? void 0 : meta.toggleMenu.anchorName) === menuTriggerBy;
879
832
  isMenuOpen = menuTriggerBy === undefined || isSameAnchor || !isMenuOpen && !isSameAnchor ? !isMenuOpen : isMenuOpen;
880
833
  }
881
- if (flags.toolbarFlagsEnabled) {
882
- isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined ? meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle : isSelectedViaDragHandle;
883
- } else {
884
- isSelectedViaDragHandle = false;
885
- }
834
+ isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined ? meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle : isSelectedViaDragHandle;
886
835
  return {
887
836
  decorations: decorations,
888
837
  surfaceNodePositions: surfaceNodePositions,
@@ -916,10 +865,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
916
865
  var isAdvancedLayoutEnabled = (0, _editorExperiment.editorExperiment)('advanced_layouts', true, {
917
866
  exposure: true
918
867
  });
919
- var toolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
920
- var flags = {
921
- toolbarFlagsEnabled: toolbarFlagsEnabled
922
- };
923
868
  var anchorRectCache;
924
869
  if (!(0, _anchorUtils.isAnchorSupported)()) {
925
870
  anchorRectCache = new _anchorUtils.AnchorRectCache();
@@ -968,7 +913,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
968
913
  return _objectSpread({}, initialState);
969
914
  },
970
915
  apply: function apply(tr, currentState, _, newState) {
971
- return _apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled, anchorRectCache, resizeObserverWidth, pragmaticCleanup, limitedModeTeardown);
916
+ return _apply(api, formatMessage, tr, currentState, newState, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled, anchorRectCache, resizeObserverWidth, pragmaticCleanup, limitedModeTeardown);
972
917
  }
973
918
  },
974
919
  props: {
@@ -7,7 +7,6 @@ exports.setCursorPositionAtMovedNode = exports.selectNode = exports.rootTaskList
7
7
  var _nodeSelection = require("@atlaskit/editor-common/node-selection");
8
8
  var _selection2 = require("@atlaskit/editor-common/selection");
9
9
  var _selection3 = require("@atlaskit/editor-common/selection/gap-cursor/selection");
10
- var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
11
10
  var _state = require("@atlaskit/editor-prosemirror/state");
12
11
  var _utils = require("@atlaskit/editor-prosemirror/utils");
13
12
  var _selectTableClosestToPos = require("@atlaskit/editor-tables/select-table-closest-to-pos");
@@ -74,7 +73,7 @@ var selectNode = exports.selectNode = function selectNode(tr, start, nodeType, a
74
73
  }
75
74
  return tr;
76
75
  };
77
- var setCursorPositionAtMovedNode = exports.setCursorPositionAtMovedNode = function setCursorPositionAtMovedNode(tr, start, api) {
76
+ var setCursorPositionAtMovedNode = exports.setCursorPositionAtMovedNode = function setCursorPositionAtMovedNode(tr, start) {
78
77
  var node = tr.doc.nodeAt(start);
79
78
  var isNodeSelection = node && _state.NodeSelection.isSelectable(node);
80
79
  var nodeSize = node ? node.nodeSize : 1;
@@ -88,7 +87,7 @@ var setCursorPositionAtMovedNode = exports.setCursorPositionAtMovedNode = functi
88
87
  }
89
88
 
90
89
  // this is a fix for empty paragraph selection - can safely use start position as the paragraph is empty
91
- if ((node === null || node === void 0 ? void 0 : node.type.name) === 'paragraph' && (node === null || node === void 0 ? void 0 : node.childCount) === 0 && (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar))) {
90
+ if ((node === null || node === void 0 ? void 0 : node.type.name) === 'paragraph' && (node === null || node === void 0 ? void 0 : node.childCount) === 0) {
92
91
  var _selection = new _state.TextSelection(tr.doc.resolve(start));
93
92
  tr.setSelection(_selection);
94
93
  return tr;
@@ -51,7 +51,7 @@ var isStepContentReplacedWithAnotherOfSameSize = function isStepContentReplacedW
51
51
  * Number of ReplaceStep and ReplaceAroundStep steps 'numReplaceSteps'.
52
52
  * 'isAllText' if all steps are represent adding inline text or a backspace/delete or no-op
53
53
  */
54
- var getTrMetadata = exports.getTrMetadata = function getTrMetadata(tr, flags) {
54
+ var getTrMetadata = exports.getTrMetadata = function getTrMetadata(tr) {
55
55
  var from;
56
56
  var to;
57
57
  var numReplaceSteps = 0;
@@ -63,10 +63,7 @@ var getTrMetadata = exports.getTrMetadata = function getTrMetadata(tr, flags) {
63
63
  isAllText = false;
64
64
  }
65
65
  // Fixes drag handle and quick insert button overlap issues
66
- if (flags.toolbarFlagsEnabled) {
67
- // fixes drag handle and quick insert button overlap issues
68
- isReplacedWithSameSize = isStepContentReplacedWithAnotherOfSameSize(s);
69
- }
66
+ isReplacedWithSameSize = isStepContentReplacedWithAnotherOfSameSize(s);
70
67
  var mappedTo = tr.mapping.map(s.to);
71
68
  var $to = s.from + s.slice.size;
72
69
  $to = $to > mappedTo ? $to : mappedTo;
@@ -9,7 +9,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _react = require("@emotion/react");
10
10
  var _dragHandle = require("@atlaskit/editor-common/styles/drag-handle");
11
11
  var _nativeAnchor = require("@atlaskit/editor-common/styles/native-anchor");
12
- var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
13
12
  var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
14
13
  var _whitespace = require("@atlaskit/editor-common/whitespace/whitespace");
15
14
  var _constants = require("@atlaskit/editor-shared-styles/constants");
@@ -197,24 +196,10 @@ var extendedDragZoneNext = (0, _react.css)({
197
196
  left: "calc((100% - var(--ak-editor-max-container-width))/2)"
198
197
  })
199
198
  });
200
- var paragraphWithTrailingBreakAsOnlyChild = '+ :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
201
- var indentatedParagraphWithTrailingBreakAsOnlyChild = '+ div.fabric-editor-indentation-mark > :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
202
- var paragraphWithPlaceholder = '+ p > .placeholder-decoration';
203
199
  var dragHandleContainer = '.ProseMirror-widget[data-blocks-drag-handle-container="true"]';
204
- var dragHandleSelector = 'button[data-testid="block-ctrl-drag-handle"]';
205
200
  var dropTargetContainer = '.ProseMirror-widget[data-blocks-drop-target-container="true"]';
206
201
  var dividerBodiedInCustomPanelWithNoIconSelector = '[data-panel-type].ak-editor-panel__no-icon .ProseMirror-widget:first-child + .ProseMirror-widget:nth-child(2) + hr, [data-panel-type] hr:first-child';
207
- var withInlineNodeStyleSelectors = ["".concat(dragHandleContainer, ":has(").concat(paragraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(indentatedParagraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(paragraphWithPlaceholder, ") ").concat(dragHandleSelector)].join(', ');
208
202
  var withFormatInLayoutStyleFixSelectors = ["".concat(dragHandleContainer, ":first-child + .fabric-editor-indentation-mark > p:first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-alignment > p:first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-font-size > p:first-child"), "".concat(dragHandleContainer, ":first-child + ").concat(dropTargetContainer, " + .fabric-editor-indentation-mark > p:first-child"), "".concat(dragHandleContainer, ":first-child + ").concat(dropTargetContainer, " + .fabric-editor-alignment > p:first-child"), "".concat(dragHandleContainer, ":first-child + ").concat(dropTargetContainer, " + .fabric-editor-font-size > p:first-child"), "".concat(dropTargetContainer, ":first-child + .fabric-editor-alignment > p:first-child"), "".concat(dropTargetContainer, ":first-child + .fabric-editor-indentation-mark > p:first-child"), "".concat(dropTargetContainer, ":first-child + .fabric-editor-font-size > p:first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-indentation-mark > :is(h1, h2, h3, h4, h5, h6):first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-font-size > :is(h1, h2, h3, h4, h5, h6):first-child")].join(', ');
209
-
210
- /**
211
- * Please do not change change transform to display:none, or visibility:hidden
212
- * Otherwise it might break composition input for Chrome
213
- * https://product-fabric.atlassian.net/browse/ED-24136
214
- */
215
- var withInlineNodeStyle = (0, _react.css)((0, _defineProperty2.default)({}, withInlineNodeStyleSelectors, {
216
- transform: 'scale(0)'
217
- }));
218
203
  var legacyBreakoutWideLayoutStyle = (0, _react.css)({
219
204
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
220
205
  '.ProseMirror-widget[data-blocks-drop-target-container="true"]': {
@@ -499,15 +484,12 @@ var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWra
499
484
  var isDragging = isDraggingFromState;
500
485
  var shouldRenderAnchors = (0, _nativeAnchor.isCSSAnchorSupported)() && (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true);
501
486
  var sparseSurfaceAnchorsEnabled = Boolean((0, _nativeAnchor.isCSSAnchorSupported)()) && sparseSurfacesEnabled;
502
- var toolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
503
487
  return (0, _react.jsx)(_react.Global
504
488
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
505
489
  , {
506
490
  styles: [globalStyles(), globalDnDStyle, (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? extendedHoverZoneNext() : extendedHoverZone()), isDragging && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? extendedDragZoneNext : extendedDragZone), (!sparseSurfacesEnabled || isDragging) && (0, _editorExperiment.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
507
491
  exposure: true
508
- }) ? (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined,
509
- // this allows drag handles to render on empty lines
510
- toolbarFlagsEnabled ? undefined : withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _editorExperiment.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_lovability_dividers') && withRuleOverflowStyleFix, withFormatInLayoutStyleFix, (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? withRelativePosStyleNext : withRelativePosStyle), (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle), (!sparseSurfacesEnabled || isDragging) && (((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) && (0, _expValEquals.expValEquals)('advanced_layouts', 'isEnabled', true) ? layoutColumnExtendedHoverZone : layoutColumnWithoutHoverZone), sparseSurfaceAnchorsEnabled ? isDragging ? dragAnchorStyles : false : (0, _expValEquals.expValEquals)('platform_editor_controls_reliable_anchor', 'isEnabled', true) ?
492
+ }) ? (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _editorExperiment.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_lovability_dividers') && withRuleOverflowStyleFix, withFormatInLayoutStyleFix, (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? withRelativePosStyleNext : withRelativePosStyle), (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle), (!sparseSurfacesEnabled || isDragging) && (((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) && (0, _expValEquals.expValEquals)('advanced_layouts', 'isEnabled', true) ? layoutColumnExtendedHoverZone : layoutColumnWithoutHoverZone), sparseSurfaceAnchorsEnabled ? isDragging ? dragAnchorStyles : false : (0, _expValEquals.expValEquals)('platform_editor_controls_reliable_anchor', 'isEnabled', true) ?
511
493
  // dragAnchorStyles sets anchor-name on ALL nodes during drag (needed for drop target positioning).
512
494
  // staticControlsAnchorStyles handles anchor-name via node decorations for non-drag state.
513
495
  // shouldRenderAnchors guards both: only apply anchor styles on browsers that support CSS anchor positioning.
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import { BLOCK_CONTROLS_LEFT_GROUP, BLOCK_CONTROLS_LEFT_SECTION, BLOCK_CONTROLS_LEFT_SURFACE, BLOCK_CONTROLS_RIGHT_GROUP, BLOCK_CONTROLS_RIGHT_SECTION, BLOCK_CONTROLS_RIGHT_SURFACE } from '@atlaskit/editor-common/block-controls/surface-keys';
3
3
  import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
4
- import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
5
4
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
6
5
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
7
6
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
@@ -170,7 +169,7 @@ export const blockControlsPlugin = ({
170
169
  // Not registered under the registry migration: the decoration puts an inline
171
170
  // `margin-top: 0` on the first document node, which fights features that render their own
172
171
  // content above it — a leading show-diff widget is left flush against the node below.
173
- if (areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) && !registryBlockControlsEnabled) {
172
+ if (!registryBlockControlsEnabled) {
174
173
  pmPlugins.push({
175
174
  name: 'firstNodeDec',
176
175
  plugin: firstNodeDecPlugin
@@ -465,7 +465,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
465
465
  }
466
466
  const sliceSize = sliceTo - sliceFrom;
467
467
  if (inputMethod === INPUT_METHOD.DRAG_AND_DROP) {
468
- tr = setCursorPositionAtMovedNode(tr, mappedTo, api);
468
+ tr = setCursorPositionAtMovedNode(tr, mappedTo);
469
469
  } else if (preservedSelection) {
470
470
  const currMeta = tr.getMeta(key);
471
471
  const nodeMovedOffset = mappedTo - sliceFrom;