@atlaskit/editor-plugin-block-controls 7.10.2 → 7.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 7.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`1d4a6d5ffb239`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1d4a6d5ffb239) -
8
+ Remove old block menu implementation in block controls
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 7.10.2
4
15
 
5
16
  ### Patch Changes
@@ -24,8 +24,6 @@ var _editorCommands = require("./pm-plugins/selection-preservation/editor-comman
24
24
  var _pluginKey = require("./pm-plugins/selection-preservation/plugin-key");
25
25
  var _pmPlugin2 = require("./pm-plugins/selection-preservation/pm-plugin");
26
26
  var _getSelection = require("./pm-plugins/utils/getSelection");
27
- var _blockMenu = _interopRequireDefault(require("./ui/block-menu"));
28
- var _dragHandleMenu = require("./ui/drag-handle-menu");
29
27
  var _globalStyles = require("./ui/global-styles");
30
28
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
31
29
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -80,8 +78,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
80
78
  rootPos: rootPos,
81
79
  rootAnchorName: rootAnchorName,
82
80
  rootNodeType: rootNodeType
83
- },
84
- closeMenu: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && !(0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? true : undefined
81
+ }
85
82
  }));
86
83
  return tr;
87
84
  };
@@ -286,28 +283,10 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
286
283
  }
287
284
  return sharedState;
288
285
  },
289
- contentComponent: function contentComponent(_ref8) {
290
- var editorView = _ref8.editorView,
291
- popupsMountPoint = _ref8.popupsMountPoint,
292
- popupsBoundariesElement = _ref8.popupsBoundariesElement,
293
- popupsScrollableElement = _ref8.popupsScrollableElement;
294
- if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
295
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, {
296
- api: api
297
- }));
298
- } else {
299
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? /*#__PURE__*/_react.default.createElement(_blockMenu.default, {
300
- editorView: editorView,
301
- mountPoint: popupsMountPoint,
302
- boundariesElement: popupsBoundariesElement,
303
- scrollableElement: popupsScrollableElement,
304
- api: api
305
- }) : /*#__PURE__*/_react.default.createElement(_dragHandleMenu.DragHandleMenu, {
306
- api: api
307
- }), /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, {
308
- api: api
309
- }));
310
- }
286
+ contentComponent: function contentComponent() {
287
+ return /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, {
288
+ api: api
289
+ });
311
290
  }
312
291
  };
313
292
  };
@@ -24,7 +24,6 @@ var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
24
24
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
25
25
  var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
26
26
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
27
- var _consts = require("../ui/consts");
28
27
  var _domAttrName = require("../ui/utils/dom-attr-name");
29
28
  var _decorationsAnchor = require("./decorations-anchor");
30
29
  var _decorationsDragHandle = require("./decorations-drag-handle");
@@ -533,7 +532,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
533
532
  newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && (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 ? null : latestActiveNode;
534
533
  }
535
534
  var isMenuOpenNew = isMenuOpen;
536
- if (_consts.BLOCK_MENU_ENABLED && flags.toolbarFlagsEnabled || (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
535
+ if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
537
536
  if (meta !== null && meta !== void 0 && meta.closeMenu) {
538
537
  isMenuOpenNew = false;
539
538
  } else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.topPositionAdjustment = exports.spacingBetweenNodesForPreview = exports.spaceLookupMap = exports.rootElementGap = exports.nodeMargins = exports.getNestedNodeLeftPaddingMargin = exports.dropTargetMarginMap = exports.dragHandleGap = exports.STICKY_CONTROLS_TOP_MARGIN = exports.QUICK_INSERT_WIDTH = exports.QUICK_INSERT_LEFT_OFFSET = exports.QUICK_INSERT_HEIGHT = exports.QUICK_INSERT_DIMENSIONS = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = exports.DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_H6_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H5_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H4_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H3_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H2_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H1_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_BORDER_RADIUS = exports.DEFAULT_COLUMN_DISTRIBUTIONS = exports.BLOCK_MENU_WIDTH = exports.BLOCK_MENU_ENABLED = void 0;
7
+ exports.topPositionAdjustment = exports.spacingBetweenNodesForPreview = exports.spaceLookupMap = exports.rootElementGap = exports.nodeMargins = exports.getNestedNodeLeftPaddingMargin = exports.dropTargetMarginMap = exports.dragHandleGap = exports.STICKY_CONTROLS_TOP_MARGIN = exports.QUICK_INSERT_WIDTH = exports.QUICK_INSERT_LEFT_OFFSET = exports.QUICK_INSERT_HEIGHT = exports.QUICK_INSERT_DIMENSIONS = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = exports.DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_H6_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H5_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H4_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H3_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H2_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H1_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_BORDER_RADIUS = exports.DEFAULT_COLUMN_DISTRIBUTIONS = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _styles = require("@atlaskit/editor-common/styles");
10
10
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
@@ -353,9 +353,4 @@ var DEFAULT_COLUMN_DISTRIBUTIONS = exports.DEFAULT_COLUMN_DISTRIBUTIONS = {
353
353
  3: 33.33,
354
354
  4: 25,
355
355
  5: 20
356
- };
357
- var BLOCK_MENU_WIDTH = exports.BLOCK_MENU_WIDTH = 220;
358
-
359
- // Temporarily disable BLOCK MENU feature until Q4 FY25.
360
- // For more details, refer to ticket ED-26972 https://product-fabric.atlassian.net/browse/ED-26972
361
- var BLOCK_MENU_ENABLED = exports.BLOCK_MENU_ENABLED = false;
356
+ };
@@ -17,7 +17,7 @@ var _browser = require("@atlaskit/editor-common/browser");
17
17
  var _hooks = require("@atlaskit/editor-common/hooks");
18
18
  var _keymaps = require("@atlaskit/editor-common/keymaps");
19
19
  var _messages = require("@atlaskit/editor-common/messages");
20
- var _selection2 = require("@atlaskit/editor-common/selection");
20
+ var _selection = require("@atlaskit/editor-common/selection");
21
21
  var _styles = require("@atlaskit/editor-common/styles");
22
22
  var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
23
23
  var _state = require("@atlaskit/editor-prosemirror/state");
@@ -39,7 +39,7 @@ var _pluginKey = require("../pm-plugins/selection-preservation/plugin-key");
39
39
  var _analytics2 = require("../pm-plugins/utils/analytics");
40
40
  var _dragHandlePositions = require("../pm-plugins/utils/drag-handle-positions");
41
41
  var _getSelection = require("../pm-plugins/utils/getSelection");
42
- var _selection3 = require("../pm-plugins/utils/selection");
42
+ var _selection2 = require("../pm-plugins/utils/selection");
43
43
  var _consts2 = require("./consts");
44
44
  var _dragPreview = require("./drag-preview");
45
45
  var _anchorName = require("./utils/anchor-name");
@@ -476,53 +476,13 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
476
476
  var mSelect = api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.multiSelectDnD;
477
477
  var $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? tr.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : tr.selection.$anchor;
478
478
  if (!isMultiSelect || tr.selection.empty || !e.shiftKey) {
479
- if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
480
- var node = tr.doc.nodeAt(startPos);
481
- var nodeSize = node ? node.nodeSize : 1;
482
- // It this will be required in other places, where selectNode is used, we should
483
- // move it inside of the newGetSelection in the selectNode
484
- if (nodeType === 'blockquote' && (0, _getSelection.isNodeWithCodeBlock)(tr, startPos, nodeSize)) {
485
- var _selection = new _state.NodeSelection(tr.doc.resolve(startPos));
486
- tr.setSelection(_selection);
487
- } else {
488
- tr = (0, _getSelection.selectNode)(tr, startPos, nodeType, api);
489
- }
490
- } else {
491
- tr = (0, _getSelection.selectNode)(tr, startPos, nodeType, api);
492
- }
493
- var rootPos = (0, _experiments.editorExperiment)('platform_synced_block', true) ? tr.doc.resolve(startPos).before(1) : undefined;
494
- var triggerByNode = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_synced_block', 'isEnabled', true) ? {
495
- nodeType: nodeType,
496
- pos: startPos,
497
- rootPos: rootPos
498
- } : undefined;
499
- if (_consts2.BLOCK_MENU_ENABLED && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
500
- var _api$blockControls3;
501
- api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 || _api$blockControls3.commands.toggleBlockMenu({
502
- anchorName: anchorName,
503
- triggerByNode: triggerByNode,
504
- openedViaKeyboard: false
505
- })({
506
- tr: tr
507
- });
508
- e.stopPropagation();
509
- } else if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
510
- var _api$blockControls4;
511
- api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.toggleBlockMenu({
512
- anchorName: anchorName,
513
- triggerByNode: triggerByNode,
514
- openedViaKeyboard: false
515
- })({
516
- tr: tr
517
- });
518
- e.stopPropagation();
519
- }
479
+ tr = (0, _getSelection.selectNode)(tr, startPos, nodeType, api);
520
480
  } else if (isTopLevelNode && $anchor.depth <= _consts2.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH && e.shiftKey && (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_shift_click_select')) {
521
- var _api$blockControls5;
522
- var alignAnchorHeadToSel = (0, _selection3.alignAnchorHeadInDirectionOfPos)(tr.selection, startPos);
523
- var selectionWithExpandedHead = (0, _selection3.expandSelectionHeadToNodeAtPos)(alignAnchorHeadToSel, startPos);
481
+ var _api$blockControls3;
482
+ var alignAnchorHeadToSel = (0, _selection2.alignAnchorHeadInDirectionOfPos)(tr.selection, startPos);
483
+ var selectionWithExpandedHead = (0, _selection2.expandSelectionHeadToNodeAtPos)(alignAnchorHeadToSel, startPos);
524
484
  tr.setSelection(selectionWithExpandedHead);
525
- api === null || api === void 0 || (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 || _api$blockControls5.commands.setMultiSelectPositions()({
485
+ api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 || _api$blockControls3.commands.setMultiSelectPositions()({
526
486
  tr: tr
527
487
  });
528
488
  }
@@ -542,7 +502,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
542
502
  return tr;
543
503
  });
544
504
  view.focus();
545
- }, [isMultiSelect, api, view, dragHandleSelected, getPos, isTopLevelNode, nodeType, anchorName]);
505
+ }, [isMultiSelect, api, view, dragHandleSelected, getPos, isTopLevelNode, nodeType]);
546
506
  var handleKeyDown = (0, _react.useCallback)(function (e) {
547
507
  // allow user to use spacebar to select the node
548
508
  if (!e.repeat && e.key === ' ') {
@@ -584,7 +544,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
584
544
  e.stopPropagation();
585
545
  var startPos = getPos();
586
546
  api === null || api === void 0 || (_api$core5 = api.core) === null || _api$core5 === void 0 || _api$core5.actions.execute(function (_ref6) {
587
- var _api$blockControls6, _api$userIntent;
547
+ var _api$blockControls4, _api$userIntent;
588
548
  var tr = _ref6.tr;
589
549
  if (startPos === undefined) {
590
550
  return tr;
@@ -599,7 +559,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
599
559
  pos: startPos,
600
560
  rootPos: rootPos
601
561
  } : undefined;
602
- api === null || api === void 0 || (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 || _api$blockControls6.commands.toggleBlockMenu({
562
+ api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.toggleBlockMenu({
603
563
  anchorName: anchorName,
604
564
  triggerByNode: triggerByNode,
605
565
  openedViaKeyboard: true
@@ -615,10 +575,10 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
615
575
  e.preventDefault();
616
576
  e.stopPropagation();
617
577
  api === null || api === void 0 || api.core.actions.execute(function (_ref7) {
618
- var _api$blockControls7;
578
+ var _api$blockControls5;
619
579
  var tr = _ref7.tr;
620
- (0, _selection2.deleteSelectedRange)(tr);
621
- api === null || api === void 0 || (_api$blockControls7 = api.blockControls) === null || _api$blockControls7 === void 0 || _api$blockControls7.commands.toggleBlockMenu({
580
+ (0, _selection.deleteSelectedRange)(tr);
581
+ api === null || api === void 0 || (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 || _api$blockControls5.commands.toggleBlockMenu({
622
582
  closeMenu: true
623
583
  })({
624
584
  tr: tr
@@ -659,8 +619,8 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
659
619
  }
660
620
  var newHandlePosCheck = (0, _getSelection.isHandleCorrelatedToSelection)(view.state, tr.selection, handlePos);
661
621
  if (!tr.selection.empty && newHandlePosCheck) {
662
- var _api$blockControls8;
663
- api === null || api === void 0 || (_api$blockControls8 = api.blockControls) === null || _api$blockControls8 === void 0 || _api$blockControls8.commands.setMultiSelectPositions()({
622
+ var _api$blockControls6;
623
+ api === null || api === void 0 || (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 || _api$blockControls6.commands.setMultiSelectPositions()({
664
624
  tr: tr
665
625
  });
666
626
  } else if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_select_node_on_drag')) {
@@ -768,7 +728,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
768
728
  return;
769
729
  }
770
730
  api === null || api === void 0 || (_api$core7 = api.core) === null || _api$core7 === void 0 || _api$core7.actions.execute(function (_ref1) {
771
- var _api$blockControls$sh3, _api$blockControls9, _api$analytics3;
731
+ var _api$blockControls$sh3, _api$blockControls7, _api$analytics3;
772
732
  var tr = _ref1.tr;
773
733
  var nodeTypes, hasSelectedMultipleNodes;
774
734
  var resolvedMovingNode = tr.doc.resolve(start);
@@ -782,7 +742,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
782
742
  nodeTypes = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.type.name;
783
743
  hasSelectedMultipleNodes = false;
784
744
  }
785
- api === null || api === void 0 || (_api$blockControls9 = api.blockControls) === null || _api$blockControls9 === void 0 || _api$blockControls9.commands.setNodeDragged(getPos, anchorName, nodeType)({
745
+ api === null || api === void 0 || (_api$blockControls7 = api.blockControls) === null || _api$blockControls7 === void 0 || _api$blockControls7.commands.setNodeDragged(getPos, anchorName, nodeType)({
786
746
  tr: tr
787
747
  });
788
748
  tr.setMeta('scrollIntoView', false);
@@ -16,8 +16,6 @@ import { startPreservingSelection, stopPreservingSelection } from './pm-plugins/
16
16
  import { selectionPreservationPluginKey } from './pm-plugins/selection-preservation/plugin-key';
17
17
  import { createSelectionPreservationPlugin } from './pm-plugins/selection-preservation/pm-plugin';
18
18
  import { selectNode } from './pm-plugins/utils/getSelection';
19
- import BlockMenu from './ui/block-menu';
20
- import { DragHandleMenu } from './ui/drag-handle-menu';
21
19
  import { GlobalStylesWrapper } from './ui/global-styles';
22
20
  export const blockControlsPlugin = ({
23
21
  api
@@ -70,8 +68,7 @@ export const blockControlsPlugin = ({
70
68
  rootPos,
71
69
  rootAnchorName,
72
70
  rootNodeType
73
- },
74
- closeMenu: editorExperiment('platform_editor_controls', 'variant1') && !expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? true : undefined
71
+ }
75
72
  });
76
73
  return tr;
77
74
  },
@@ -276,28 +273,9 @@ export const blockControlsPlugin = ({
276
273
  }
277
274
  return sharedState;
278
275
  },
279
- contentComponent({
280
- editorView,
281
- popupsMountPoint,
282
- popupsBoundariesElement,
283
- popupsScrollableElement
284
- }) {
285
- if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
286
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
287
- api: api
288
- }));
289
- } else {
290
- return /*#__PURE__*/React.createElement(React.Fragment, null, editorExperiment('platform_editor_controls', 'variant1') ? /*#__PURE__*/React.createElement(BlockMenu, {
291
- editorView: editorView,
292
- mountPoint: popupsMountPoint,
293
- boundariesElement: popupsBoundariesElement,
294
- scrollableElement: popupsScrollableElement,
295
- api: api
296
- }) : /*#__PURE__*/React.createElement(DragHandleMenu, {
297
- api: api
298
- }), /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
299
- api: api
300
- }));
301
- }
276
+ contentComponent() {
277
+ return /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
278
+ api: api
279
+ });
302
280
  }
303
281
  });
@@ -16,7 +16,6 @@ import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/ad
16
16
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
17
17
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
18
18
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
19
- import { BLOCK_MENU_ENABLED } from '../ui/consts';
20
19
  import { getAnchorAttrName } from '../ui/utils/dom-attr-name';
21
20
  import { findNodeDecs, nodeDecorations } from './decorations-anchor';
22
21
  import { dragHandleDecoration, emptyParagraphNodeDecorations, findHandleDec } from './decorations-drag-handle';
@@ -531,7 +530,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
531
530
  newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && findHandleDec(decorations, (_latestActiveNode11 = latestActiveNode) === null || _latestActiveNode11 === void 0 ? void 0 : _latestActiveNode11.pos, (_latestActiveNode12 = latestActiveNode) === null || _latestActiveNode12 === void 0 ? void 0 : _latestActiveNode12.pos).length === 0 ? null : latestActiveNode;
532
531
  }
533
532
  let isMenuOpenNew = isMenuOpen;
534
- if (BLOCK_MENU_ENABLED && flags.toolbarFlagsEnabled || expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
533
+ if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
535
534
  if (meta !== null && meta !== void 0 && meta.closeMenu) {
536
535
  isMenuOpenNew = false;
537
536
  } else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
@@ -362,9 +362,4 @@ export const DEFAULT_COLUMN_DISTRIBUTIONS = {
362
362
  3: 33.33,
363
363
  4: 25,
364
364
  5: 20
365
- };
366
- export const BLOCK_MENU_WIDTH = 220;
367
-
368
- // Temporarily disable BLOCK MENU feature until Q4 FY25.
369
- // For more details, refer to ticket ED-26972 https://product-fabric.atlassian.net/browse/ED-26972
370
- export const BLOCK_MENU_ENABLED = false;
365
+ };
@@ -17,7 +17,7 @@ import { blockControlsMessages } from '@atlaskit/editor-common/messages';
17
17
  import { deleteSelectedRange } from '@atlaskit/editor-common/selection';
18
18
  import { DRAG_HANDLE_WIDTH, tableControlsSpacing } from '@atlaskit/editor-common/styles';
19
19
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
20
- import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
20
+ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
21
21
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
22
22
  import { akEditorFullPageNarrowBreakout, akEditorTableToolbarSize, relativeSizeToBaseFontSize } from '@atlaskit/editor-shared-styles/consts';
23
23
  import DragHandleVerticalIcon from '@atlaskit/icon/core/drag-handle-vertical';
@@ -36,9 +36,9 @@ import { key } from '../pm-plugins/main';
36
36
  import { selectionPreservationPluginKey } from '../pm-plugins/selection-preservation/plugin-key';
37
37
  import { getMultiSelectAnalyticsAttributes } from '../pm-plugins/utils/analytics';
38
38
  import { getControlBottomCSSValue, getControlHeightCSSValue, getLeftPosition, getNodeHeight, getTopPosition, shouldBeSticky, shouldMaskNodeControls } from '../pm-plugins/utils/drag-handle-positions';
39
- import { isHandleCorrelatedToSelection, isNodeWithCodeBlock, selectNode } from '../pm-plugins/utils/getSelection';
39
+ import { isHandleCorrelatedToSelection, selectNode } from '../pm-plugins/utils/getSelection';
40
40
  import { alignAnchorHeadInDirectionOfPos, expandSelectionHeadToNodeAtPos } from '../pm-plugins/utils/selection';
41
- import { BLOCK_MENU_ENABLED, DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH, DRAG_HANDLE_ZINDEX, dragHandleGap, nodeMargins, spacingBetweenNodesForPreview, STICKY_CONTROLS_TOP_MARGIN, topPositionAdjustment } from './consts';
41
+ import { DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH, DRAG_HANDLE_ZINDEX, dragHandleGap, nodeMargins, spacingBetweenNodesForPreview, STICKY_CONTROLS_TOP_MARGIN, topPositionAdjustment } from './consts';
42
42
  import { dragPreview } from './drag-preview';
43
43
  import { refreshAnchorName } from './utils/anchor-name';
44
44
  import { getAnchorAttrName } from './utils/dom-attr-name';
@@ -455,53 +455,13 @@ export const DragHandle = ({
455
455
  const mSelect = api === null || api === void 0 ? void 0 : (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.multiSelectDnD;
456
456
  const $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? tr.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : tr.selection.$anchor;
457
457
  if (!isMultiSelect || tr.selection.empty || !e.shiftKey) {
458
- if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
459
- const node = tr.doc.nodeAt(startPos);
460
- const nodeSize = node ? node.nodeSize : 1;
461
- // It this will be required in other places, where selectNode is used, we should
462
- // move it inside of the newGetSelection in the selectNode
463
- if (nodeType === 'blockquote' && isNodeWithCodeBlock(tr, startPos, nodeSize)) {
464
- const selection = new NodeSelection(tr.doc.resolve(startPos));
465
- tr.setSelection(selection);
466
- } else {
467
- tr = selectNode(tr, startPos, nodeType, api);
468
- }
469
- } else {
470
- tr = selectNode(tr, startPos, nodeType, api);
471
- }
472
- const rootPos = editorExperiment('platform_synced_block', true) ? tr.doc.resolve(startPos).before(1) : undefined;
473
- const triggerByNode = expValEqualsNoExposure('platform_synced_block', 'isEnabled', true) ? {
474
- nodeType,
475
- pos: startPos,
476
- rootPos
477
- } : undefined;
478
- if (BLOCK_MENU_ENABLED && editorExperiment('platform_editor_controls', 'variant1')) {
479
- var _api$blockControls3;
480
- api === null || api === void 0 ? void 0 : (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.toggleBlockMenu({
481
- anchorName,
482
- triggerByNode,
483
- openedViaKeyboard: false
484
- })({
485
- tr
486
- });
487
- e.stopPropagation();
488
- } else if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
489
- var _api$blockControls4;
490
- api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.toggleBlockMenu({
491
- anchorName,
492
- triggerByNode,
493
- openedViaKeyboard: false
494
- })({
495
- tr
496
- });
497
- e.stopPropagation();
498
- }
458
+ tr = selectNode(tr, startPos, nodeType, api);
499
459
  } else if (isTopLevelNode && $anchor.depth <= DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH && e.shiftKey && fg('platform_editor_elements_dnd_shift_click_select')) {
500
- var _api$blockControls5;
460
+ var _api$blockControls3;
501
461
  const alignAnchorHeadToSel = alignAnchorHeadInDirectionOfPos(tr.selection, startPos);
502
462
  const selectionWithExpandedHead = expandSelectionHeadToNodeAtPos(alignAnchorHeadToSel, startPos);
503
463
  tr.setSelection(selectionWithExpandedHead);
504
- api === null || api === void 0 ? void 0 : (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 ? void 0 : _api$blockControls5.commands.setMultiSelectPositions()({
464
+ api === null || api === void 0 ? void 0 : (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.setMultiSelectPositions()({
505
465
  tr
506
466
  });
507
467
  }
@@ -521,7 +481,7 @@ export const DragHandle = ({
521
481
  return tr;
522
482
  });
523
483
  view.focus();
524
- }, [isMultiSelect, api, view, dragHandleSelected, getPos, isTopLevelNode, nodeType, anchorName]);
484
+ }, [isMultiSelect, api, view, dragHandleSelected, getPos, isTopLevelNode, nodeType]);
525
485
  const handleKeyDown = useCallback(e => {
526
486
  // allow user to use spacebar to select the node
527
487
  if (!e.repeat && e.key === ' ') {
@@ -564,7 +524,7 @@ export const DragHandle = ({
564
524
  api === null || api === void 0 ? void 0 : (_api$core5 = api.core) === null || _api$core5 === void 0 ? void 0 : _api$core5.actions.execute(({
565
525
  tr
566
526
  }) => {
567
- var _api$blockControls6, _api$userIntent;
527
+ var _api$blockControls4, _api$userIntent;
568
528
  if (startPos === undefined) {
569
529
  return tr;
570
530
  }
@@ -578,7 +538,7 @@ export const DragHandle = ({
578
538
  pos: startPos,
579
539
  rootPos
580
540
  } : undefined;
581
- api === null || api === void 0 ? void 0 : (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 ? void 0 : _api$blockControls6.commands.toggleBlockMenu({
541
+ api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.toggleBlockMenu({
582
542
  anchorName,
583
543
  triggerByNode,
584
544
  openedViaKeyboard: true
@@ -596,9 +556,9 @@ export const DragHandle = ({
596
556
  api === null || api === void 0 ? void 0 : api.core.actions.execute(({
597
557
  tr
598
558
  }) => {
599
- var _api$blockControls7;
559
+ var _api$blockControls5;
600
560
  deleteSelectedRange(tr);
601
- api === null || api === void 0 ? void 0 : (_api$blockControls7 = api.blockControls) === null || _api$blockControls7 === void 0 ? void 0 : _api$blockControls7.commands.toggleBlockMenu({
561
+ api === null || api === void 0 ? void 0 : (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 ? void 0 : _api$blockControls5.commands.toggleBlockMenu({
602
562
  closeMenu: true
603
563
  })({
604
564
  tr
@@ -637,8 +597,8 @@ export const DragHandle = ({
637
597
  }
638
598
  const newHandlePosCheck = isHandleCorrelatedToSelection(view.state, tr.selection, handlePos);
639
599
  if (!tr.selection.empty && newHandlePosCheck) {
640
- var _api$blockControls8;
641
- api === null || api === void 0 ? void 0 : (_api$blockControls8 = api.blockControls) === null || _api$blockControls8 === void 0 ? void 0 : _api$blockControls8.commands.setMultiSelectPositions()({
600
+ var _api$blockControls6;
601
+ api === null || api === void 0 ? void 0 : (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 ? void 0 : _api$blockControls6.commands.setMultiSelectPositions()({
642
602
  tr
643
603
  });
644
604
  } else if (fg('platform_editor_elements_dnd_select_node_on_drag')) {
@@ -753,7 +713,7 @@ export const DragHandle = ({
753
713
  api === null || api === void 0 ? void 0 : (_api$core7 = api.core) === null || _api$core7 === void 0 ? void 0 : _api$core7.actions.execute(({
754
714
  tr
755
715
  }) => {
756
- var _api$blockControls$sh3, _api$blockControls9, _api$analytics3;
716
+ var _api$blockControls$sh3, _api$blockControls7, _api$analytics3;
757
717
  let nodeTypes, hasSelectedMultipleNodes;
758
718
  const resolvedMovingNode = tr.doc.resolve(start);
759
719
  const maybeNode = resolvedMovingNode.nodeAfter;
@@ -766,7 +726,7 @@ export const DragHandle = ({
766
726
  nodeTypes = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.type.name;
767
727
  hasSelectedMultipleNodes = false;
768
728
  }
769
- api === null || api === void 0 ? void 0 : (_api$blockControls9 = api.blockControls) === null || _api$blockControls9 === void 0 ? void 0 : _api$blockControls9.commands.setNodeDragged(getPos, anchorName, nodeType)({
729
+ api === null || api === void 0 ? void 0 : (_api$blockControls7 = api.blockControls) === null || _api$blockControls7 === void 0 ? void 0 : _api$blockControls7.commands.setNodeDragged(getPos, anchorName, nodeType)({
770
730
  tr
771
731
  });
772
732
  tr.setMeta('scrollIntoView', false);
@@ -19,8 +19,6 @@ import { startPreservingSelection as _startPreservingSelection, stopPreservingSe
19
19
  import { selectionPreservationPluginKey } from './pm-plugins/selection-preservation/plugin-key';
20
20
  import { createSelectionPreservationPlugin } from './pm-plugins/selection-preservation/pm-plugin';
21
21
  import { selectNode } from './pm-plugins/utils/getSelection';
22
- import BlockMenu from './ui/block-menu';
23
- import { DragHandleMenu } from './ui/drag-handle-menu';
24
22
  import { GlobalStylesWrapper } from './ui/global-styles';
25
23
  export var blockControlsPlugin = function blockControlsPlugin(_ref) {
26
24
  var api = _ref.api;
@@ -73,8 +71,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
73
71
  rootPos: rootPos,
74
72
  rootAnchorName: rootAnchorName,
75
73
  rootNodeType: rootNodeType
76
- },
77
- closeMenu: editorExperiment('platform_editor_controls', 'variant1') && !expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? true : undefined
74
+ }
78
75
  }));
79
76
  return tr;
80
77
  };
@@ -279,28 +276,10 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
279
276
  }
280
277
  return sharedState;
281
278
  },
282
- contentComponent: function contentComponent(_ref8) {
283
- var editorView = _ref8.editorView,
284
- popupsMountPoint = _ref8.popupsMountPoint,
285
- popupsBoundariesElement = _ref8.popupsBoundariesElement,
286
- popupsScrollableElement = _ref8.popupsScrollableElement;
287
- if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
288
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
289
- api: api
290
- }));
291
- } else {
292
- return /*#__PURE__*/React.createElement(React.Fragment, null, editorExperiment('platform_editor_controls', 'variant1') ? /*#__PURE__*/React.createElement(BlockMenu, {
293
- editorView: editorView,
294
- mountPoint: popupsMountPoint,
295
- boundariesElement: popupsBoundariesElement,
296
- scrollableElement: popupsScrollableElement,
297
- api: api
298
- }) : /*#__PURE__*/React.createElement(DragHandleMenu, {
299
- api: api
300
- }), /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
301
- api: api
302
- }));
303
- }
279
+ contentComponent: function contentComponent() {
280
+ return /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
281
+ api: api
282
+ });
304
283
  }
305
284
  };
306
285
  };
@@ -19,7 +19,6 @@ import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/ad
19
19
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
20
20
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
21
21
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
22
- import { BLOCK_MENU_ENABLED } from '../ui/consts';
23
22
  import { getAnchorAttrName } from '../ui/utils/dom-attr-name';
24
23
  import { findNodeDecs, nodeDecorations } from './decorations-anchor';
25
24
  import { dragHandleDecoration, emptyParagraphNodeDecorations, findHandleDec } from './decorations-drag-handle';
@@ -526,7 +525,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
526
525
  newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && findHandleDec(decorations, (_latestActiveNode11 = latestActiveNode) === null || _latestActiveNode11 === void 0 ? void 0 : _latestActiveNode11.pos, (_latestActiveNode12 = latestActiveNode) === null || _latestActiveNode12 === void 0 ? void 0 : _latestActiveNode12.pos).length === 0 ? null : latestActiveNode;
527
526
  }
528
527
  var isMenuOpenNew = isMenuOpen;
529
- if (BLOCK_MENU_ENABLED && flags.toolbarFlagsEnabled || expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
528
+ if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
530
529
  if (meta !== null && meta !== void 0 && meta.closeMenu) {
531
530
  isMenuOpenNew = false;
532
531
  } else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
@@ -346,9 +346,4 @@ export var DEFAULT_COLUMN_DISTRIBUTIONS = {
346
346
  3: 33.33,
347
347
  4: 25,
348
348
  5: 20
349
- };
350
- export var BLOCK_MENU_WIDTH = 220;
351
-
352
- // Temporarily disable BLOCK MENU feature until Q4 FY25.
353
- // For more details, refer to ticket ED-26972 https://product-fabric.atlassian.net/browse/ED-26972
354
- export var BLOCK_MENU_ENABLED = false;
349
+ };