@atlaskit/editor-plugin-block-controls 20.0.0 → 20.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/blockControlsPlugin.js +12 -16
  3. package/dist/cjs/editor-commands/move-node-with-block-menu.js +0 -4
  4. package/dist/cjs/editor-commands/move-node.js +2 -2
  5. package/dist/cjs/editor-commands/utils/move-node-utils.js +6 -9
  6. package/dist/cjs/pm-plugins/handle-mouse-down.js +5 -13
  7. package/dist/cjs/pm-plugins/handle-mouse-over.js +17 -26
  8. package/dist/cjs/pm-plugins/main.js +11 -15
  9. package/dist/cjs/pm-plugins/utils/expand-and-update-selection.js +1 -5
  10. package/dist/cjs/pm-plugins/utils/getSelection.js +11 -95
  11. package/dist/cjs/ui/drag-handle.js +49 -127
  12. package/dist/es2019/blockControlsPlugin.js +12 -16
  13. package/dist/es2019/editor-commands/move-node-with-block-menu.js +0 -4
  14. package/dist/es2019/editor-commands/move-node.js +2 -2
  15. package/dist/es2019/editor-commands/utils/move-node-utils.js +6 -9
  16. package/dist/es2019/pm-plugins/handle-mouse-down.js +5 -13
  17. package/dist/es2019/pm-plugins/handle-mouse-over.js +17 -26
  18. package/dist/es2019/pm-plugins/main.js +11 -15
  19. package/dist/es2019/pm-plugins/utils/expand-and-update-selection.js +1 -5
  20. package/dist/es2019/pm-plugins/utils/getSelection.js +7 -93
  21. package/dist/es2019/ui/drag-handle.js +31 -109
  22. package/dist/esm/blockControlsPlugin.js +12 -16
  23. package/dist/esm/editor-commands/move-node-with-block-menu.js +0 -4
  24. package/dist/esm/editor-commands/move-node.js +2 -2
  25. package/dist/esm/editor-commands/utils/move-node-utils.js +6 -9
  26. package/dist/esm/pm-plugins/handle-mouse-down.js +5 -13
  27. package/dist/esm/pm-plugins/handle-mouse-over.js +17 -26
  28. package/dist/esm/pm-plugins/main.js +11 -15
  29. package/dist/esm/pm-plugins/utils/expand-and-update-selection.js +1 -5
  30. package/dist/esm/pm-plugins/utils/getSelection.js +11 -95
  31. package/dist/esm/ui/drag-handle.js +49 -127
  32. package/dist/types/pm-plugins/utils/getSelection.d.ts +1 -1
  33. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 20.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4acfc5de0ce75`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4acfc5de0ce75) -
8
+ Stop registering the `firstNodeDec` ProseMirror plugin when
9
+ the`platform_editor_block_control_migration` experiment is enabled. It is no longer needed after
10
+ migration, and causing issues with diffing margins.
11
+ - Updated dependencies
12
+
13
+ ## 20.0.1
14
+
15
+ ### Patch Changes
16
+
17
+ - [`8d37dc7e55d62`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8d37dc7e55d62) -
18
+ Clean up shipped experiment `platform_editor_block_menu`
19
+ - Updated dependencies
20
+
3
21
  ## 20.0.0
4
22
 
5
23
  ### Patch Changes
@@ -15,8 +15,8 @@ var _state = require("@atlaskit/editor-prosemirror/state");
15
15
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
16
16
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
17
17
  var _fg = require("@atlaskit/platform-feature-flags/fg");
18
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
19
18
  var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
19
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
20
20
  var _handleKeyDownWithPreservedSelection = require("./editor-commands/handle-key-down-with-preserved-selection");
21
21
  var _mapPreservedSelection2 = require("./editor-commands/map-preserved-selection");
22
22
  var _moveNode = require("./editor-commands/move-node");
@@ -153,15 +153,17 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
153
153
  }
154
154
  });
155
155
  }
156
- if ((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
157
- pmPlugins.push({
158
- name: 'blockControlsSelectionPreservationPlugin',
159
- plugin: (0, _pmPlugin2.createSelectionPreservationPlugin)(api)
160
- });
161
- }
156
+ pmPlugins.push({
157
+ name: 'blockControlsSelectionPreservationPlugin',
158
+ plugin: (0, _pmPlugin2.createSelectionPreservationPlugin)(api)
159
+ });
162
160
 
163
161
  // platform_editor_controls note: quick insert rendering fixes
164
- if ((0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar))) {
162
+ //
163
+ // Not registered under the registry migration: the decoration puts an inline
164
+ // `margin-top: 0` on the first document node, which fights features that render their own
165
+ // content above it — a leading show-diff widget is left flush against the node below.
166
+ if ((0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) && legacyBlockControlsEnabled) {
165
167
  pmPlugins.push({
166
168
  name: 'firstNodeDec',
167
169
  plugin: _firstNodeDecPlugin.firstNodeDecPlugin
@@ -212,9 +214,6 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
212
214
  return function (_ref6) {
213
215
  var _api$userIntent, _api$blockControls2, _options$anchorName, _api$blockControls3;
214
216
  var tr = _ref6.tr;
215
- if (!(0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
216
- return tr;
217
- }
218
217
  var currMeta = tr.getMeta(_main.key);
219
218
  var currentUserIntent = api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent;
220
219
  var isMenuCurrentlyOpen = api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.sharedState.currentState()) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.isMenuOpen;
@@ -425,7 +424,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
425
424
  }
426
425
  },
427
426
  getSharedState: function getSharedState(editorState) {
428
- var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$menuTri2, _key$getState3, _key$getState$blockMe, _key$getState4, _key$getState$activeN, _key$getState5, _key$getState$activeD, _key$getState6, _key$getState$isDragg, _key$getState7, _key$getState$isPMDra, _key$getState8, _key$getState$multiSe, _key$getState9, _key$getState$isShift, _key$getState0, _key$getState$lastDra, _key$getState1, _interactionTrackingP, _key$getState$isSelec, _key$getState10;
427
+ var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$menuTri2, _key$getState3, _key$getState$blockMe, _key$getState4, _key$getState$activeN, _key$getState5, _key$getState$activeD, _key$getState6, _key$getState$isDragg, _key$getState7, _key$getState$isPMDra, _key$getState8, _key$getState$multiSe, _key$getState9, _key$getState$isShift, _key$getState0, _key$getState$lastDra, _key$getState1, _interactionTrackingP, _key$getState$isSelec, _key$getState10, _selectionPreservatio;
429
428
  if (!editorState) {
430
429
  return undefined;
431
430
  }
@@ -455,10 +454,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
455
454
  sharedState.rightSideControlsEnabled = rightSideControlsEnabled;
456
455
  sharedState.hoverSide = rightSideControlsEnabled ? (_interactionTrackingP4 = _pmPlugin.interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP4 === void 0 ? void 0 : _interactionTrackingP4.hoverSide : undefined;
457
456
  }
458
- if ((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
459
- var _selectionPreservatio;
460
- sharedState.preservedSelection = (_selectionPreservatio = _pluginKey.selectionPreservationPluginKey.getState(editorState)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
461
- }
457
+ sharedState.preservedSelection = (_selectionPreservatio = _pluginKey.selectionPreservationPluginKey.getState(editorState)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
462
458
  return sharedState;
463
459
  },
464
460
  contentComponent: function contentComponent(_ref0) {
@@ -8,7 +8,6 @@ exports.moveNodeWithBlockMenu = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _analytics = require("@atlaskit/editor-common/analytics");
10
10
  var _types = require("@atlaskit/editor-common/types");
11
- var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
12
11
  var _main = require("../pm-plugins/main");
13
12
  var _selection = require("../pm-plugins/utils/selection");
14
13
  var _moveNode = require("./move-node");
@@ -30,9 +29,6 @@ var moveNodeWithBlockMenu = exports.moveNodeWithBlockMenu = function moveNodeWit
30
29
  return function (_ref) {
31
30
  var _api$blockControls$sh;
32
31
  var tr = _ref.tr;
33
- if (!(0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
34
- return tr;
35
- }
36
32
  var preservedSelection = api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.preservedSelection;
37
33
  var selection = preservedSelection !== null && preservedSelection !== void 0 ? preservedSelection : tr.selection;
38
34
 
@@ -380,7 +380,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
380
380
  tr: tr
381
381
  });
382
382
  }
383
- var preservedSelection = (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true) ? api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.preservedSelection : undefined;
383
+ var preservedSelection = api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.preservedSelection;
384
384
  if (preservedSelection) {
385
385
  var $from = tr.doc.resolve(Math.min(start, preservedSelection.from));
386
386
  var expandedRange = $from.blockRange(preservedSelection.$to);
@@ -484,7 +484,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
484
484
  }));
485
485
  if (
486
486
  // when move node via block menu, we need to keep the focus on block menu popup, so don't move focus to editor in this scenario
487
- !(inputMethod === _analytics.INPUT_METHOD.BLOCK_MENU && (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true))) {
487
+ inputMethod !== _analytics.INPUT_METHOD.BLOCK_MENU) {
488
488
  api === null || api === void 0 || api.core.actions.focus();
489
489
  }
490
490
  var $mappedTo = tr.doc.resolve(mappedTo);
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getShouldMoveNode = exports.getPosWhenMoveNodeUp = exports.getPosWhenMoveNodeDown = exports.getNodeBoundsFromSelection = exports.canMoveNodeUpOrDown = void 0;
7
7
  var _state = require("@atlaskit/editor-prosemirror/state");
8
8
  var _utils = require("@atlaskit/editor-tables/utils");
9
- var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
10
9
  var _selection = require("../../pm-plugins/utils/selection");
11
10
  /**
12
11
  * Gets the current node position and bounds from the selection using the preserved selection logic.
@@ -33,7 +32,7 @@ var getNodeBoundsFromSelection = exports.getNodeBoundsFromSelection = function g
33
32
  // Special case: if a media node (file) is selected, we need to get the parent mediaGroup
34
33
  // This handles the case where clicking on a file creates a NodeSelection of the media node
35
34
  // but we want to move the entire mediaGroup that wraps it
36
- if (selection instanceof _state.NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file' && (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
35
+ if (selection instanceof _state.NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file') {
37
36
  // The media node is wrapped in a mediaGroup, so we need to get the parent position
38
37
  var mediaGroupPos = selection.$from.pos - 1;
39
38
  var mediaGroupNode = selection.$from.doc.nodeAt(mediaGroupPos);
@@ -58,7 +57,7 @@ var getNodeBoundsFromSelection = exports.getNodeBoundsFromSelection = function g
58
57
  var getPosWhenMoveNodeUp = exports.getPosWhenMoveNodeUp = function getPosWhenMoveNodeUp($currentNodePos, currentNodePos) {
59
58
  var nodeIndex = $currentNodePos.index();
60
59
  var nodeBefore = $currentNodePos.depth > 1 && nodeIndex === 0 ? $currentNodePos.node($currentNodePos.depth) : $currentNodePos.nodeBefore;
61
- if ((nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name) === 'layoutColumn' && (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
60
+ if ((nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name) === 'layoutColumn') {
62
61
  return -1;
63
62
  }
64
63
  return nodeBefore ? currentNodePos - nodeBefore.nodeSize : -1;
@@ -72,12 +71,10 @@ var getPosWhenMoveNodeDown = exports.getPosWhenMoveNodeDown = function getPosWhe
72
71
  return -1;
73
72
  }
74
73
  var nodeAfter = tr.doc.nodeAt(nodeAfterPos);
75
- if ((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
76
- var nodeAtCurrentPos = tr.doc.nodeAt($currentNodePos.pos);
77
- // if move empty line down to another empty line, move to the position of the next empty line
78
- if ((nodeAtCurrentPos === null || nodeAtCurrentPos === void 0 ? void 0 : nodeAtCurrentPos.content.size) === 0 && nodeAtCurrentPos.type.name !== 'extension' && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.content.size) === 0 && nodeAfter.type.name !== 'extension') {
79
- return nodeAfterPos;
80
- }
74
+ var nodeAtCurrentPos = tr.doc.nodeAt($currentNodePos.pos);
75
+ // if move empty line down to another empty line, move to the position of the next empty line
76
+ if ((nodeAtCurrentPos === null || nodeAtCurrentPos === void 0 ? void 0 : nodeAtCurrentPos.content.size) === 0 && nodeAtCurrentPos.type.name !== 'extension' && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.content.size) === 0 && nodeAfter.type.name !== 'extension') {
77
+ return nodeAfterPos;
81
78
  }
82
79
 
83
80
  // if not the last node, move to the end of the next node
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.handleMouseDown = void 0;
7
7
  var _styles = require("@atlaskit/editor-common/styles");
8
8
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
9
- var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
10
9
  var handleMouseDown = exports.handleMouseDown = function handleMouseDown(api) {
11
10
  return function (view, event) {
12
11
  if (!(event.target instanceof HTMLElement)) {
@@ -34,7 +33,7 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(api) {
34
33
  api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.showDragHandleAt(rootPos, '', (_rootNode$type$name3 = rootNode.type.name) !== null && _rootNode$type$name3 !== void 0 ? _rootNode$type$name3 : '', undefined, rootPos, '', (_rootNode$type$name4 = rootNode.type.name) !== null && _rootNode$type$name4 !== void 0 ? _rootNode$type$name4 : ''));
35
34
  }
36
35
  } else {
37
- var isDragHandle = event.target.closest((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true) ? _styles.DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle]') !== null;
36
+ var isDragHandle = event.target.closest(_styles.DRAG_HANDLE_SELECTOR) !== null;
38
37
  api === null || api === void 0 || api.core.actions.execute(function (_ref) {
39
38
  var tr = _ref.tr;
40
39
  api === null || api === void 0 || api.blockControls.commands.setSelectedViaDragHandle(isDragHandle)({
@@ -44,17 +43,10 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(api) {
44
43
  * When block menu is enabled, reset intent back to 'default' as editor-plugin-block-menu sets the user intent to 'blockMenuOpen', and setting here
45
44
  * causes flickering as this runs before editor-plugin-block-menu.
46
45
  */
47
- if ((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
48
- // if target is drag handle, block menu will be opened
49
- if (!isDragHandle) {
50
- var _api$userIntent;
51
- api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('default')({
52
- tr: tr
53
- });
54
- }
55
- } else {
56
- var _api$userIntent2;
57
- (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || _api$userIntent2.commands.setCurrentUserIntent(isDragHandle ? 'dragHandleSelected' : 'default')({
46
+ // if target is drag handle, block menu will be opened
47
+ if (!isDragHandle) {
48
+ var _api$userIntent;
49
+ api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('default')({
58
50
  tr: tr
59
51
  });
60
52
  }
@@ -127,9 +127,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
127
127
  }
128
128
 
129
129
  // If the editor view is not in focus when the block menu is open, do not update the drag handle
130
- if (!view.hasFocus() && isMenuOpen && (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true, {
131
- exposure: true
132
- })) {
130
+ if (!view.hasFocus() && isMenuOpen) {
133
131
  return false;
134
132
  }
135
133
 
@@ -279,35 +277,28 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
279
277
  var nodeType = isNativeAnchorSupported ? (0, _domAttrName.getTypeNameFromDom)(rootElement) : // Fallback for table nodes: tr has data-prosemirror-node-name but not data-drag-handler-node-type.
280
278
  (_rootElement$getAttri2 = rootElement.getAttribute('data-drag-handler-node-type')) !== null && _rootElement$getAttri2 !== void 0 ? _rootElement$getAttri2 : (0, _domAttrName.getTypeNameFromDom)(rootElement);
281
279
  if (nodeType) {
280
+ var _api$userIntent2;
282
281
  // platform_editor_controls note: enables quick insert
283
282
  if (toolbarFlagsEnabled) {
284
- if ((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
285
- var _selectionPreservatio;
286
- var preservedSelection = (_selectionPreservatio = _pluginKey.selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
287
- var selection = preservedSelection || view.state.selection;
288
- var isMultipleSelected = selection && (0, _selection.isMultiBlockSelection)(selection);
283
+ var _selectionPreservatio;
284
+ var preservedSelection = (_selectionPreservatio = _pluginKey.selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
285
+ var selection = preservedSelection || view.state.selection;
286
+ var isMultipleSelected = selection && (0, _selection.isMultiBlockSelection)(selection);
289
287
 
290
- // Only execute when selection is not a multi-selection, block menu is open, and menu is opened via keyboard
291
- // as when it is a multi-selection, the showDragHandleAt command interfere with selection
292
- // sometimes makes the multi-selection not continous after block menu is opened with keyboard
293
- if (!(isMultipleSelected && isMenuOpen && blockMenuOptions !== null && blockMenuOptions !== void 0 && blockMenuOptions.openedViaKeyboard)) {
294
- var _api$core, _api$blockControls3;
295
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.showDragHandleAt(targetPos, anchorName, nodeType, undefined, rootPos !== null && rootPos !== void 0 ? rootPos : targetPos, rootAnchorName !== null && rootAnchorName !== void 0 ? rootAnchorName : anchorName, rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType));
296
- }
297
- } else {
298
- var _api$core2, _api$blockControls4;
299
- api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.showDragHandleAt(targetPos, anchorName, nodeType, undefined, rootPos !== null && rootPos !== void 0 ? rootPos : targetPos, rootAnchorName !== null && rootAnchorName !== void 0 ? rootAnchorName : anchorName, rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType));
288
+ // Only execute when selection is not a multi-selection, block menu is open, and menu is opened via keyboard
289
+ // as when it is a multi-selection, the showDragHandleAt command interfere with selection
290
+ // sometimes makes the multi-selection not continous after block menu is opened with keyboard
291
+ if (!(isMultipleSelected && isMenuOpen && blockMenuOptions !== null && blockMenuOptions !== void 0 && blockMenuOptions.openedViaKeyboard)) {
292
+ var _api$core, _api$blockControls3;
293
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.showDragHandleAt(targetPos, anchorName, nodeType, undefined, rootPos !== null && rootPos !== void 0 ? rootPos : targetPos, rootAnchorName !== null && rootAnchorName !== void 0 ? rootAnchorName : anchorName, rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType));
300
294
  }
301
295
  } else {
302
- var _api$core3, _api$blockControls5;
303
- api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(api === null || api === void 0 || (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 ? void 0 : _api$blockControls5.commands.showDragHandleAt(targetPos, anchorName, nodeType));
296
+ var _api$core2, _api$blockControls4;
297
+ api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.showDragHandleAt(targetPos, anchorName, nodeType));
304
298
  }
305
- if ((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
306
- var _api$userIntent2;
307
- if (isMenuOpen && originalAnchorName && (api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || (_api$userIntent2 = _api$userIntent2.sharedState.currentState()) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.currentUserIntent) === 'blockMenuOpen') {
308
- var _api$core4, _api$blockControls6;
309
- api === null || api === void 0 || (_api$core4 = api.core) === null || _api$core4 === void 0 || _api$core4.actions.execute(api === null || api === void 0 || (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 ? void 0 : _api$blockControls6.commands.toggleBlockMenu());
310
- }
299
+ if (isMenuOpen && originalAnchorName && (api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || (_api$userIntent2 = _api$userIntent2.sharedState.currentState()) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.currentUserIntent) === 'blockMenuOpen') {
300
+ var _api$core3, _api$blockControls5;
301
+ api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(api === null || api === void 0 || (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 ? void 0 : _api$blockControls5.commands.toggleBlockMenu());
311
302
  }
312
303
  }
313
304
  }
@@ -388,7 +388,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
388
388
  // Which caused the drag handle onClick event not firing, then block menu wouldn't be opened
389
389
  // This is caused by the mappedPos.deletedAfter sometimes returning true in webkit browsers even though the active node still exists
390
390
  // 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
391
- if (browser.webkit && (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
391
+ if (browser.webkit) {
392
392
  _mappedPos = tr.mapping.mapResult(activeNode.pos);
393
393
  isActiveNodeDeleted = _mappedPos.deleted;
394
394
  } else {
@@ -903,7 +903,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
903
903
  // handle - so findHandleDec is always empty. Don't clear activeNode in that case.
904
904
  var hasHandleOrViewModeControls = !flags.legacyDragHandleEnabled || 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;
905
905
  // Keep the registry surface mounted while its Block Menu owns focus.
906
- var keepActiveNodeForOpenBlockMenu = !flags.legacyDragHandleEnabled && isMenuOpen && (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true);
906
+ var keepActiveNodeForOpenBlockMenu = !flags.legacyDragHandleEnabled && isMenuOpen;
907
907
  newActiveNode = meta !== null && meta !== void 0 && meta.editorBlurred && !keepActiveNodeForOpenBlockMenu || !(meta !== null && meta !== void 0 && meta.activeNode) && !hasHandleOrViewModeControls ? null : latestActiveNode;
908
908
  } else {
909
909
  var _latestActiveNode13, _latestActiveNode14;
@@ -922,15 +922,11 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
922
922
  });
923
923
  }
924
924
  var isMenuOpenNew = isMenuOpen;
925
- if ((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
926
- if (meta !== null && meta !== void 0 && meta.closeMenu) {
927
- isMenuOpenNew = false;
928
- } else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
929
- var isSameAnchor = (meta === null || meta === void 0 ? void 0 : meta.toggleMenu.anchorName) === menuTriggerBy;
930
- isMenuOpenNew = menuTriggerBy === undefined || isSameAnchor || !isMenuOpen && !isSameAnchor ? !isMenuOpen : isMenuOpen;
931
- }
925
+ if (meta !== null && meta !== void 0 && meta.closeMenu) {
926
+ isMenuOpenNew = false;
932
927
  } else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
933
- isMenuOpenNew = !isMenuOpen;
928
+ var isSameAnchor = (meta === null || meta === void 0 ? void 0 : meta.toggleMenu.anchorName) === menuTriggerBy;
929
+ isMenuOpenNew = menuTriggerBy === undefined || isSameAnchor || !isMenuOpen && !isSameAnchor ? !isMenuOpen : isMenuOpen;
934
930
  }
935
931
  var isSelectedViaDragHandleNew;
936
932
  if (flags.toolbarFlagsEnabled) {
@@ -945,13 +941,13 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
945
941
  activeDropTargetNode: currentActiveDropTargetNode,
946
942
  isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
947
943
  isMenuOpen: isMenuOpenNew,
948
- menuTriggerBy: flags.toolbarFlagsEnabled || (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
944
+ menuTriggerBy: (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy,
949
945
  menuTriggerByNode: (meta === null || meta === void 0 || (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.triggerByNode) || menuTriggerByNode,
950
- blockMenuOptions: (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true) ? {
946
+ blockMenuOptions: {
951
947
  canMoveUp: (meta === null || meta === void 0 || (_meta$toggleMenu3 = meta.toggleMenu) === null || _meta$toggleMenu3 === void 0 ? void 0 : _meta$toggleMenu3.moveUp) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu4 = meta.toggleMenu) === null || _meta$toggleMenu4 === void 0 ? void 0 : _meta$toggleMenu4.moveUp : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveUp,
952
948
  canMoveDown: (meta === null || meta === void 0 || (_meta$toggleMenu5 = meta.toggleMenu) === null || _meta$toggleMenu5 === void 0 ? void 0 : _meta$toggleMenu5.moveDown) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu6 = meta.toggleMenu) === null || _meta$toggleMenu6 === void 0 ? void 0 : _meta$toggleMenu6.moveDown : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveDown,
953
949
  openedViaKeyboard: (meta === null || meta === void 0 || (_meta$toggleMenu7 = meta.toggleMenu) === null || _meta$toggleMenu7 === void 0 ? void 0 : _meta$toggleMenu7.openedViaKeyboard) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu8 = meta.toggleMenu) === null || _meta$toggleMenu8 === void 0 ? void 0 : _meta$toggleMenu8.openedViaKeyboard : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.openedViaKeyboard
954
- } : undefined,
950
+ },
955
951
  editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : editorHeight,
956
952
  editorWidthLeft: (_meta$editorWidthLeft = meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== null && _meta$editorWidthLeft !== void 0 ? _meta$editorWidthLeft : editorWidthLeft,
957
953
  editorWidthRight: (_meta$editorWidthRigh = meta === null || meta === void 0 ? void 0 : meta.editorWidthRight) !== null && _meta$editorWidthRigh !== void 0 ? _meta$editorWidthRigh : editorWidthRight,
@@ -1196,12 +1192,12 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
1196
1192
  }
1197
1193
  }
1198
1194
  if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
1199
- var isDragHandle = event.target.closest((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true) ? _styles.DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle="true"]') !== null;
1195
+ var isDragHandle = event.target.closest(_styles.DRAG_HANDLE_SELECTOR) !== null;
1200
1196
  api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
1201
1197
  }
1202
1198
  if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
1203
1199
  var _api$blockControls$sh2, _api$blockControls$sh3;
1204
- var isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.isMenuOpen) && (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true);
1200
+ var isBlockMenuOpen = api === null || api === void 0 || (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.isMenuOpen;
1205
1201
  // when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
1206
1202
  // in this scenario, isSelectedViaDragHandle should not be set to false
1207
1203
  if (api !== null && api !== void 0 && (_api$blockControls$sh3 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh3 !== void 0 && _api$blockControls$sh3.isSelectedViaDragHandle && !isBlockMenuOpen) {
@@ -6,11 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.expandAndUpdateSelection = void 0;
7
7
  var _nodeSelection = require("@atlaskit/editor-common/node-selection");
8
8
  var _selection = require("@atlaskit/editor-common/selection");
9
- var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
10
9
  var _state = require("@atlaskit/editor-prosemirror/state");
11
10
  var _utils = require("@atlaskit/editor-tables/utils");
12
11
  var _fg = require("@atlaskit/platform-feature-flags/fg");
13
- var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
14
12
  var _getSelection = require("./getSelection");
15
13
  var _selection2 = require("./selection");
16
14
  var isPosWithinRange = function isPosWithinRange(pos, range) {
@@ -64,9 +62,7 @@ var expandAndUpdateSelection = exports.expandAndUpdateSelection = function expan
64
62
  if (expandedRange.range && isPosWithinRange(startPos, expandedRange.range) && (0, _selection.isMultiBlockRange)(expandedRange.range)) {
65
63
  // Then create a selection from the start of the first node to the end of the last node
66
64
  tr.setSelection(_state.TextSelection.create(tr.doc, Math.min(selection.from, expandedRange.$from.pos), Math.max(selection.to, expandedRange.$to.pos)));
67
- } else if (
68
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
69
- (0, _fg.fg)('platform_editor_maui_jira_updates') && ((0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) || (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true))) {
65
+ } else if ((0, _fg.fg)('platform_editor_maui_jira_updates')) {
70
66
  // Under the gate (and when on the simplified newGetSelection path), use
71
67
  // the platform-level composer — same path as open-remix-modal, no drift.
72
68
  (0, _nodeSelection.selectNodeAtPos)(tr, startPos, nodeType);
@@ -11,7 +11,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
11
11
  var _utils = require("@atlaskit/editor-prosemirror/utils");
12
12
  var _utils2 = require("@atlaskit/editor-tables/utils");
13
13
  var _fg = require("@atlaskit/platform-feature-flags/fg");
14
- var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
15
14
  var getInlineNodePos = exports.getInlineNodePos = function getInlineNodePos(doc, start, nodeSize) {
16
15
  var $startPos = doc.resolve(start);
17
16
  // To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
@@ -44,45 +43,6 @@ var isNodeWithCodeBlock = exports.isNodeWithCodeBlock = function isNodeWithCodeB
44
43
  });
45
44
  return hasCodeBlock;
46
45
  };
47
- var isNodeWithMediaOrExtension = function isNodeWithMediaOrExtension(doc, start, nodeSize) {
48
- var $startPos = doc.resolve(start);
49
- var hasMediaOrExtension = false;
50
- doc.nodesBetween($startPos.pos, $startPos.pos + nodeSize, function (n) {
51
- if (['media', 'extension'].includes(n.type.name)) {
52
- hasMediaOrExtension = true;
53
- }
54
- });
55
- return hasMediaOrExtension;
56
- };
57
- var oldGetSelection = function oldGetSelection(tr, start) {
58
- var node = tr.doc.nodeAt(start);
59
- var isNodeSelection = node && _state.NodeSelection.isSelectable(node);
60
- var nodeSize = node ? node.nodeSize : 1;
61
- var $startPos = tr.doc.resolve(start);
62
- var nodeName = node === null || node === void 0 ? void 0 : node.type.name;
63
- var isBlockQuoteWithMediaOrExtension = nodeName === 'blockquote' && isNodeWithMediaOrExtension(tr.doc, start, nodeSize);
64
- var isListWithMediaOrExtension = nodeName === 'bulletList' && isNodeWithMediaOrExtension(tr.doc, start, nodeSize) || nodeName === 'orderedList' && isNodeWithMediaOrExtension(tr.doc, start, nodeSize);
65
- if (isNodeSelection && nodeName !== 'blockquote' || isListWithMediaOrExtension || isBlockQuoteWithMediaOrExtension ||
66
- // decisionList/layoutColumn node is not selectable, but we want to select the whole node not just text
67
- ['decisionList', 'layoutColumn'].includes(nodeName || '')) {
68
- return new _state.NodeSelection($startPos);
69
- } else if (nodeName === 'mediaGroup' && (node === null || node === void 0 ? void 0 : node.childCount) === 1) {
70
- var $mediaStartPos = tr.doc.resolve(start + 1);
71
- return new _state.NodeSelection($mediaStartPos);
72
- } else if (
73
- // Even though mediaGroup is not selectable,
74
- // we need a quick way to make all child media nodes appear as selected without the need for a custom selection
75
- nodeName === 'mediaGroup') {
76
- return new _state.NodeSelection($startPos);
77
- } else if (nodeName === 'taskList') {
78
- return _state.TextSelection.create(tr.doc, start, start + nodeSize);
79
- } else {
80
- var _getInlineNodePos = getInlineNodePos(tr.doc, start, nodeSize),
81
- inlineNodePos = _getInlineNodePos.inlineNodePos,
82
- inlineNodeEndPos = _getInlineNodePos.inlineNodeEndPos;
83
- return new _state.TextSelection(tr.doc.resolve(inlineNodePos), tr.doc.resolve(inlineNodeEndPos));
84
- }
85
- };
86
46
 
87
47
  /**
88
48
  * Gets the appropriate selection for the node at the given start position.
@@ -93,75 +53,31 @@ var oldGetSelection = function oldGetSelection(tr, start) {
93
53
  * @returns The appropriate selection for the node.
94
54
  */
95
55
  var newGetSelection = exports.newGetSelection = function newGetSelection(doc, selectionEmpty, start) {
96
- // Under the gate, delegate to getNodeSelectionForPos only when
97
- // platform_editor_block_menu is on — getNodeSelectionForPos matches that
98
- // simplified path (NodeSelection for all nodes). When block_menu is off,
99
- // fall through to the oldGetSelection branch which handles expand/taskList/
100
- // inline nodes correctly with TextSelection.
101
- if (
102
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
103
- (0, _fg.fg)('platform_editor_maui_jira_updates') && (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
56
+ if ((0, _fg.fg)('platform_editor_maui_jira_updates')) {
104
57
  return (0, _nodeSelection.getNodeSelectionForPos)(doc, start) || false;
105
58
  }
106
59
  var node = doc.nodeAt(start);
107
- var isNodeSelection = node && _state.NodeSelection.isSelectable(node);
108
- var nodeSize = node ? node.nodeSize : 1;
109
60
  var nodeName = node === null || node === void 0 ? void 0 : node.type.name;
110
- if ((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
111
- // if mediaGroup only has a single child, we want to select the child
112
- if (nodeName === 'mediaGroup' && (node === null || node === void 0 ? void 0 : node.childCount) === 1) {
113
- var $mediaStartPos = doc.resolve(start + 1);
114
- return new _state.NodeSelection($mediaStartPos);
115
- }
116
- return new _state.NodeSelection(doc.resolve(start));
117
- }
118
-
119
- // this is a fix for empty paragraph selection - put first to avoid any extra work
120
- if (nodeName === 'paragraph' && selectionEmpty && (node === null || node === void 0 ? void 0 : node.childCount) === 0) {
121
- return false;
122
- }
123
- var isBlockQuoteWithMediaOrExtension = nodeName === 'blockquote' && isNodeWithMediaOrExtension(doc, start, nodeSize);
124
- var isListWithMediaOrExtension = nodeName === 'bulletList' && isNodeWithMediaOrExtension(doc, start, nodeSize) || nodeName === 'orderedList' && isNodeWithMediaOrExtension(doc, start, nodeSize);
125
- if (isNodeSelection && nodeName !== 'blockquote' || isListWithMediaOrExtension || isBlockQuoteWithMediaOrExtension ||
126
- // decisionList/layoutColumn node is not selectable, but we want to select the whole node not just text
127
- ['decisionList', 'layoutColumn'].includes(nodeName || '') || nodeName === 'mediaGroup' && typeof (node === null || node === void 0 ? void 0 : node.childCount) === 'number' && (node === null || node === void 0 ? void 0 : node.childCount) > 1) {
128
- return new _state.NodeSelection(doc.resolve(start));
129
- }
130
61
 
131
62
  // if mediaGroup only has a single child, we want to select the child
132
- if (nodeName === 'mediaGroup') {
133
- var _$mediaStartPos = doc.resolve(start + 1);
134
- return new _state.NodeSelection(_$mediaStartPos);
135
- }
136
- if (nodeName === 'taskList') {
137
- return _state.TextSelection.create(doc, start, start + nodeSize);
63
+ if (nodeName === 'mediaGroup' && (node === null || node === void 0 ? void 0 : node.childCount) === 1) {
64
+ var $mediaStartPos = doc.resolve(start + 1);
65
+ return new _state.NodeSelection($mediaStartPos);
138
66
  }
139
- var _getInlineNodePos2 = getInlineNodePos(doc, start, nodeSize),
140
- inlineNodePos = _getInlineNodePos2.inlineNodePos,
141
- inlineNodeEndPos = _getInlineNodePos2.inlineNodeEndPos;
142
- return new _state.TextSelection(doc.resolve(inlineNodePos), doc.resolve(inlineNodeEndPos));
67
+ return new _state.NodeSelection(doc.resolve(start));
143
68
  };
144
- var getSelection = exports.getSelection = function getSelection(tr, start, api) {
145
- if ((0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) || (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
146
- return newGetSelection(tr.doc, tr.selection.empty, start);
147
- }
148
- return oldGetSelection(tr, start);
69
+ var getSelection = exports.getSelection = function getSelection(tr, start) {
70
+ return newGetSelection(tr.doc, tr.selection.empty, start);
149
71
  };
150
72
  var selectNode = exports.selectNode = function selectNode(tr, start, nodeType, api) {
151
- // Only use the platform path when already on the simplified newGetSelection
152
- // branch — i.e. when platform_editor_block_menu is on or toolbar flags are
153
- // enabled. This preserves oldGetSelection behaviour (e.g. taskList →
154
- // TextSelection) in legacy contexts where those flags are off.
155
- if (
156
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
157
- (0, _fg.fg)('platform_editor_maui_jira_updates') && (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
73
+ if ((0, _fg.fg)('platform_editor_maui_jira_updates')) {
158
74
  return (0, _nodeSelection.selectNodeAtPos)(tr, start, nodeType);
159
75
  }
160
76
  if (nodeType === 'table') {
161
77
  tr = (0, _utils2.selectTableClosestToPos)(tr, tr.doc.resolve(start + 1));
162
78
  return tr;
163
79
  }
164
- var selection = getSelection(tr, start, api);
80
+ var selection = getSelection(tr, start);
165
81
  if (selection) {
166
82
  tr.setSelection(selection);
167
83
  }
@@ -186,8 +102,8 @@ var setCursorPositionAtMovedNode = exports.setCursorPositionAtMovedNode = functi
186
102
  tr.setSelection(_selection);
187
103
  return tr;
188
104
  }
189
- var _getInlineNodePos3 = getInlineNodePos(tr.doc, start, nodeSize),
190
- inlineNodeEndPos = _getInlineNodePos3.inlineNodeEndPos;
105
+ var _getInlineNodePos = getInlineNodePos(tr.doc, start, nodeSize),
106
+ inlineNodeEndPos = _getInlineNodePos.inlineNodeEndPos;
191
107
  selection = new _state.TextSelection(tr.doc.resolve(inlineNodeEndPos));
192
108
  tr.setSelection(selection);
193
109
  return tr;