@atlaskit/editor-plugin-block-controls 4.1.7 → 4.1.9

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 (37) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/blockControlsPlugin.js +27 -11
  3. package/dist/cjs/pm-plugins/handle-mouse-over.js +10 -1
  4. package/dist/cjs/pm-plugins/main.js +3 -2
  5. package/dist/cjs/ui/drag-handle.js +16 -8
  6. package/dist/cjs/ui/global-styles.js +1 -8
  7. package/dist/es2019/blockControlsPlugin.js +28 -11
  8. package/dist/es2019/pm-plugins/handle-mouse-over.js +10 -1
  9. package/dist/es2019/pm-plugins/main.js +3 -2
  10. package/dist/es2019/ui/drag-handle.js +16 -8
  11. package/dist/es2019/ui/global-styles.js +1 -11
  12. package/dist/esm/blockControlsPlugin.js +27 -11
  13. package/dist/esm/pm-plugins/handle-mouse-over.js +10 -1
  14. package/dist/esm/pm-plugins/main.js +3 -2
  15. package/dist/esm/ui/drag-handle.js +16 -8
  16. package/dist/esm/ui/global-styles.js +1 -8
  17. package/dist/types/editor-commands/move-node.d.ts +2 -2
  18. package/dist/types/pm-plugins/decorations-drop-target-active.d.ts +1 -1
  19. package/dist/types/pm-plugins/decorations-drop-target.d.ts +3 -3
  20. package/dist/types/pm-plugins/main.d.ts +1 -1
  21. package/dist/types/pm-plugins/utils/active-anchor-tracker.d.ts +0 -3
  22. package/dist/types/pm-plugins/utils/inline-drop-target.d.ts +5 -1
  23. package/dist/types/ui/block-menu-items.d.ts +3 -3
  24. package/dist/types/ui/drop-target-layout.d.ts +1 -1
  25. package/dist/types/ui/drop-target.d.ts +2 -2
  26. package/dist/types/ui/inline-drop-target.d.ts +2 -2
  27. package/dist/types-ts4.5/editor-commands/move-node.d.ts +2 -2
  28. package/dist/types-ts4.5/pm-plugins/decorations-drop-target-active.d.ts +1 -1
  29. package/dist/types-ts4.5/pm-plugins/decorations-drop-target.d.ts +3 -3
  30. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
  31. package/dist/types-ts4.5/pm-plugins/utils/active-anchor-tracker.d.ts +0 -3
  32. package/dist/types-ts4.5/pm-plugins/utils/inline-drop-target.d.ts +5 -1
  33. package/dist/types-ts4.5/ui/block-menu-items.d.ts +3 -3
  34. package/dist/types-ts4.5/ui/drop-target-layout.d.ts +1 -1
  35. package/dist/types-ts4.5/ui/drop-target.d.ts +2 -2
  36. package/dist/types-ts4.5/ui/inline-drop-target.d.ts +2 -2
  37. package/package.json +5 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 4.1.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#198359](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/198359)
8
+ [`077794c6e9512`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/077794c6e9512) -
9
+ Remove fg to ensure safari cursor is not hidden due to block controls
10
+
11
+ ## 4.1.8
12
+
13
+ ### Patch Changes
14
+
15
+ - [#196697](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/196697)
16
+ [`18b5fbc52627b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/18b5fbc52627b) -
17
+ [ux] Adds block menu plugin for full-page preset and shows the menu when drag handle is clicked.
18
+ - Updated dependencies
19
+
3
20
  ## 4.1.7
4
21
 
5
22
  ### Patch Changes
@@ -10,6 +10,7 @@ var _react = _interopRequireDefault(require("react"));
10
10
  var _selection = require("@atlaskit/editor-common/selection");
11
11
  var _state = require("@atlaskit/editor-prosemirror/state");
12
12
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
13
14
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
14
15
  var _moveNode = require("./editor-commands/move-node");
15
16
  var _moveToLayout = require("./editor-commands/move-to-layout");
@@ -71,6 +72,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
71
72
  },
72
73
  toggleBlockMenu: function toggleBlockMenu(options) {
73
74
  return function (_ref4) {
75
+ var _options$anchorName;
74
76
  var tr = _ref4.tr;
75
77
  var currMeta = tr.getMeta(_main.key);
76
78
  if (options !== null && options !== void 0 && options.closeMenu) {
@@ -79,6 +81,14 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
79
81
  }));
80
82
  return tr;
81
83
  }
84
+
85
+ // Do not open menu on layoutColumn and close opened menu when layoutColumn drag handle is clicked
86
+ if (options !== null && options !== void 0 && (_options$anchorName = options.anchorName) !== null && _options$anchorName !== void 0 && _options$anchorName.includes('layoutColumn')) {
87
+ tr.setMeta(_main.key, _objectSpread(_objectSpread({}, currMeta), {}, {
88
+ closeMenu: true
89
+ }));
90
+ return tr;
91
+ }
82
92
  tr.setMeta(_main.key, _objectSpread(_objectSpread({}, currMeta), {}, {
83
93
  toggleMenu: {
84
94
  anchorName: options === null || options === void 0 ? void 0 : options.anchorName
@@ -206,17 +216,23 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
206
216
  popupsMountPoint = _ref8.popupsMountPoint,
207
217
  popupsBoundariesElement = _ref8.popupsBoundariesElement,
208
218
  popupsScrollableElement = _ref8.popupsScrollableElement;
209
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? /*#__PURE__*/_react.default.createElement(_blockMenu.default, {
210
- editorView: editorView,
211
- mountPoint: popupsMountPoint,
212
- boundariesElement: popupsBoundariesElement,
213
- scrollableElement: popupsScrollableElement,
214
- api: api
215
- }) : /*#__PURE__*/_react.default.createElement(_dragHandleMenu.DragHandleMenu, {
216
- api: api
217
- }), /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, {
218
- api: api
219
- }));
219
+ if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
220
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, {
221
+ api: api
222
+ }));
223
+ } else {
224
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? /*#__PURE__*/_react.default.createElement(_blockMenu.default, {
225
+ editorView: editorView,
226
+ mountPoint: popupsMountPoint,
227
+ boundariesElement: popupsBoundariesElement,
228
+ scrollableElement: popupsScrollableElement,
229
+ api: api
230
+ }) : /*#__PURE__*/_react.default.createElement(_dragHandleMenu.DragHandleMenu, {
231
+ api: api
232
+ }), /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, {
233
+ api: api
234
+ }));
235
+ }
220
236
  }
221
237
  };
222
238
  };
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.handleMouseOver = void 0;
7
7
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
8
9
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
9
10
  var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(target) {
10
11
  if (target instanceof HTMLHeadingElement || target instanceof HTMLParagraphElement) {
@@ -17,7 +18,9 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
17
18
  var _api$blockControls, _target$classList;
18
19
  var _ref = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
19
20
  isDragging = _ref.isDragging,
20
- activeNode = _ref.activeNode;
21
+ activeNode = _ref.activeNode,
22
+ isMenuOpen = _ref.isMenuOpen,
23
+ originalAnchorName = _ref.menuTriggerBy;
21
24
 
22
25
  // Most mouseover events don't fire during drag but some can slip through
23
26
  // when the drag begins. This prevents those.
@@ -127,6 +130,12 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
127
130
  var _api$core2, _api$blockControls3;
128
131
  api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.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));
129
132
  }
133
+ if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
134
+ if (isMenuOpen && originalAnchorName) {
135
+ var _api$core3, _api$blockControls4;
136
+ api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.toggleBlockMenu());
137
+ }
138
+ }
130
139
  }
131
140
  }
132
141
  };
@@ -20,6 +20,7 @@ var _element = require("@atlaskit/pragmatic-drag-and-drop-auto-scroll/element");
20
20
  var _combine = require("@atlaskit/pragmatic-drag-and-drop/combine");
21
21
  var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
22
22
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
23
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
23
24
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
24
25
  var _consts = require("../ui/consts");
25
26
  var _decorationsAnchor = require("./decorations-anchor");
@@ -504,7 +505,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
504
505
  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;
505
506
  }
506
507
  var isMenuOpenNew = isMenuOpen;
507
- if (_consts.BLOCK_MENU_ENABLED && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
508
+ if (_consts.BLOCK_MENU_ENABLED && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') || (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
508
509
  if (meta !== null && meta !== void 0 && meta.closeMenu) {
509
510
  isMenuOpenNew = false;
510
511
  } else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
@@ -526,7 +527,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
526
527
  activeDropTargetNode: currentActiveDropTargetNode,
527
528
  isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
528
529
  isMenuOpen: isMenuOpenNew,
529
- menuTriggerBy: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
530
+ menuTriggerBy: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') || (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
530
531
  editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : editorHeight,
531
532
  editorWidthLeft: (_meta$editorWidthLeft = meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== null && _meta$editorWidthLeft !== void 0 ? _meta$editorWidthLeft : editorWidthLeft,
532
533
  editorWidthRight: (_meta$editorWidthRigh = meta === null || meta === void 0 ? void 0 : meta.editorWidthRight) !== null && _meta$editorWidthRigh !== void 0 ? _meta$editorWidthRigh : editorWidthRight,
@@ -291,7 +291,7 @@ var useDragHandlePluginState = (0, _hooks.sharedPluginStateHookMigratorFactory)(
291
291
  };
292
292
  });
293
293
  var DragHandle = exports.DragHandle = function DragHandle(_ref) {
294
- var _api$core2, _api$blockControls3, _api$analytics2, _api$core4;
294
+ var _api$core2, _api$blockControls4, _api$analytics2, _api$core4;
295
295
  var view = _ref.view,
296
296
  api = _ref.api,
297
297
  formatMessage = _ref.formatMessage,
@@ -377,13 +377,21 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
377
377
  tr: tr
378
378
  });
379
379
  e.stopPropagation();
380
+ } else if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
381
+ var _api$blockControls2;
382
+ api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || _api$blockControls2.commands.toggleBlockMenu({
383
+ anchorName: anchorName
384
+ })({
385
+ tr: tr
386
+ });
387
+ e.stopPropagation();
380
388
  }
381
389
  } else if (isTopLevelNode && $anchor.depth <= _consts2.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH && e.shiftKey && (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_shift_click_select')) {
382
- var _api$blockControls2;
390
+ var _api$blockControls3;
383
391
  var alignAnchorHeadToSel = (0, _selection.alignAnchorHeadInDirectionOfPos)(tr.selection, startPos);
384
392
  var selectionWithExpandedHead = (0, _selection.expandSelectionHeadToNodeAtPos)(alignAnchorHeadToSel, startPos);
385
393
  tr.setSelection(selectionWithExpandedHead);
386
- api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || _api$blockControls2.commands.setMultiSelectPositions()({
394
+ api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 || _api$blockControls3.commands.setMultiSelectPositions()({
387
395
  tr: tr
388
396
  });
389
397
  }
@@ -403,7 +411,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
403
411
  return tr;
404
412
  });
405
413
  view.focus();
406
- }, [isMultiSelect, api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions, api === null || api === void 0 ? void 0 : api.blockControls.sharedState, api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, view, dragHandleSelected, getPos, isTopLevelNode, nodeType, anchorName]);
414
+ }, [isMultiSelect, api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions, api === null || api === void 0 ? void 0 : api.blockControls.sharedState, api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, view, dragHandleSelected, getPos, isTopLevelNode, nodeType, anchorName]);
407
415
 
408
416
  // TODO: ED-26959 - This needs to be investigated further. Drag preview generation is not always working
409
417
  // as expected with a node selection. This workaround sets the selection to the node on mouseDown,
@@ -477,8 +485,8 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
477
485
  var oldHandlePosCheck = handlePos >= tr.selection.$from.start() - 1 && handlePos <= tr.selection.to;
478
486
  var newHandlePosCheck = (0, _getSelection.isHandleCorrelatedToSelection)(view.state, tr.selection, handlePos);
479
487
  if (!tr.selection.empty && ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_1') ? newHandlePosCheck : oldHandlePosCheck)) {
480
- var _api$blockControls4;
481
- api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.setMultiSelectPositions()({
488
+ var _api$blockControls5;
489
+ api === null || api === void 0 || (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 || _api$blockControls5.commands.setMultiSelectPositions()({
482
490
  tr: tr
483
491
  });
484
492
  } else if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_select_node_on_drag')) {
@@ -586,7 +594,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
586
594
  return;
587
595
  }
588
596
  api === null || api === void 0 || (_api$core6 = api.core) === null || _api$core6 === void 0 || _api$core6.actions.execute(function (_ref7) {
589
- var _api$blockControls$sh3, _api$blockControls5, _api$analytics3;
597
+ var _api$blockControls$sh3, _api$blockControls6, _api$analytics3;
590
598
  var tr = _ref7.tr;
591
599
  var nodeTypes, hasSelectedMultipleNodes;
592
600
  var resolvedMovingNode = tr.doc.resolve(start);
@@ -600,7 +608,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
600
608
  nodeTypes = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.type.name;
601
609
  hasSelectedMultipleNodes = false;
602
610
  }
603
- api === null || api === void 0 || (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 || _api$blockControls5.commands.setNodeDragged(getPos, anchorName, nodeType)({
611
+ api === null || api === void 0 || (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 || _api$blockControls6.commands.setNodeDragged(getPos, anchorName, nodeType)({
604
612
  tr: tr
605
613
  });
606
614
  tr.setMeta('scrollIntoView', false);
@@ -11,7 +11,6 @@ var _styles = require("@atlaskit/editor-common/styles");
11
11
  var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
12
12
  var _whitespace = require("@atlaskit/editor-common/whitespace");
13
13
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
14
  var _constants = require("@atlaskit/theme/constants");
16
15
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
17
16
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
@@ -269,12 +268,6 @@ var headingWithIndentationInLayoutStyleFix = (0, _react.css)((0, _defineProperty
269
268
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
270
269
  marginTop: '0 !important'
271
270
  }));
272
- var withRelativePosStyleLegacy = (0, _react.css)({
273
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
274
- '.ProseMirror': (0, _defineProperty2.default)({}, "&& ".concat(dragHandlerAnchorSelector), {
275
- position: 'relative'
276
- })
277
- });
278
271
  var withRelativePosStyle = (0, _react.css)({
279
272
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
280
273
  '.ProseMirror': (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "&& ".concat(dragHandlerAnchorSelector), {
@@ -316,6 +309,6 @@ var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWra
316
309
  disabled: !(0, _expValEquals.expValEquals)('platform_editor_block_controls_perf_optimization', 'isEnabled', true)
317
310
  });
318
311
  return (0, _react.jsx)(_react.Global, {
319
- styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? extendHoverZoneReduced : undefined, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _experiments.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, (0, _platformFeatureFlags.fg)('platform_editor_fix_safari_cursor_hidden_empty') ? withRelativePosStyle : withRelativePosStyleLegacy, topLevelNodeMarginStyles, withAnchorNameZindexStyle]
312
+ styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? extendHoverZoneReduced : undefined, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _experiments.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, withRelativePosStyle, topLevelNodeMarginStyles, withAnchorNameZindexStyle]
320
313
  });
321
314
  };
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
3
3
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
5
6
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
7
  import { moveNode } from './editor-commands/move-node';
7
8
  import { moveToLayout } from './editor-commands/move-to-layout';
@@ -61,6 +62,7 @@ export const blockControlsPlugin = ({
61
62
  toggleBlockMenu: options => ({
62
63
  tr
63
64
  }) => {
65
+ var _options$anchorName;
64
66
  const currMeta = tr.getMeta(key);
65
67
  if (options !== null && options !== void 0 && options.closeMenu) {
66
68
  tr.setMeta(key, {
@@ -69,6 +71,15 @@ export const blockControlsPlugin = ({
69
71
  });
70
72
  return tr;
71
73
  }
74
+
75
+ // Do not open menu on layoutColumn and close opened menu when layoutColumn drag handle is clicked
76
+ if (options !== null && options !== void 0 && (_options$anchorName = options.anchorName) !== null && _options$anchorName !== void 0 && _options$anchorName.includes('layoutColumn')) {
77
+ tr.setMeta(key, {
78
+ ...currMeta,
79
+ closeMenu: true
80
+ });
81
+ return tr;
82
+ }
72
83
  tr.setMeta(key, {
73
84
  ...currMeta,
74
85
  toggleMenu: {
@@ -198,16 +209,22 @@ export const blockControlsPlugin = ({
198
209
  popupsBoundariesElement,
199
210
  popupsScrollableElement
200
211
  }) {
201
- return /*#__PURE__*/React.createElement(React.Fragment, null, editorExperiment('platform_editor_controls', 'variant1') ? /*#__PURE__*/React.createElement(BlockMenu, {
202
- editorView: editorView,
203
- mountPoint: popupsMountPoint,
204
- boundariesElement: popupsBoundariesElement,
205
- scrollableElement: popupsScrollableElement,
206
- api: api
207
- }) : /*#__PURE__*/React.createElement(DragHandleMenu, {
208
- api: api
209
- }), /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
210
- api: api
211
- }));
212
+ if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
213
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
214
+ api: api
215
+ }));
216
+ } else {
217
+ return /*#__PURE__*/React.createElement(React.Fragment, null, editorExperiment('platform_editor_controls', 'variant1') ? /*#__PURE__*/React.createElement(BlockMenu, {
218
+ editorView: editorView,
219
+ mountPoint: popupsMountPoint,
220
+ boundariesElement: popupsBoundariesElement,
221
+ scrollableElement: popupsScrollableElement,
222
+ api: api
223
+ }) : /*#__PURE__*/React.createElement(DragHandleMenu, {
224
+ api: api
225
+ }), /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
226
+ api: api
227
+ }));
228
+ }
212
229
  }
213
230
  });
@@ -1,4 +1,5 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
2
3
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
4
  const isEmptyNestedParagraphOrHeading = target => {
4
5
  if (target instanceof HTMLHeadingElement || target instanceof HTMLParagraphElement) {
@@ -11,7 +12,9 @@ export const handleMouseOver = (view, event, api) => {
11
12
  var _api$blockControls, _target$classList;
12
13
  const {
13
14
  isDragging,
14
- activeNode
15
+ activeNode,
16
+ isMenuOpen,
17
+ menuTriggerBy: originalAnchorName
15
18
  } = (api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {};
16
19
 
17
20
  // Most mouseover events don't fire during drag but some can slip through
@@ -122,6 +125,12 @@ export const handleMouseOver = (view, event, api) => {
122
125
  var _api$core2, _api$blockControls3;
123
126
  api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.showDragHandleAt(targetPos, anchorName, nodeType));
124
127
  }
128
+ if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
129
+ if (isMenuOpen && originalAnchorName) {
130
+ var _api$core3, _api$blockControls4;
131
+ api === null || api === void 0 ? void 0 : (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.toggleBlockMenu());
132
+ }
133
+ }
125
134
  }
126
135
  }
127
136
  };
@@ -12,6 +12,7 @@ import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-sc
12
12
  import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
13
13
  import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
14
14
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
15
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
15
16
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
16
17
  import { BLOCK_MENU_ENABLED } from '../ui/consts';
17
18
  import { findNodeDecs, nodeDecorations } from './decorations-anchor';
@@ -504,7 +505,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
504
505
  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;
505
506
  }
506
507
  let isMenuOpenNew = isMenuOpen;
507
- if (BLOCK_MENU_ENABLED && editorExperiment('platform_editor_controls', 'variant1')) {
508
+ if (BLOCK_MENU_ENABLED && editorExperiment('platform_editor_controls', 'variant1') || expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
508
509
  if (meta !== null && meta !== void 0 && meta.closeMenu) {
509
510
  isMenuOpenNew = false;
510
511
  } else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
@@ -526,7 +527,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
526
527
  activeDropTargetNode: currentActiveDropTargetNode,
527
528
  isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
528
529
  isMenuOpen: isMenuOpenNew,
529
- menuTriggerBy: editorExperiment('platform_editor_controls', 'variant1') ? (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
530
+ menuTriggerBy: editorExperiment('platform_editor_controls', 'variant1') || expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
530
531
  editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : editorHeight,
531
532
  editorWidthLeft: (_meta$editorWidthLeft = meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== null && _meta$editorWidthLeft !== void 0 ? _meta$editorWidthLeft : editorWidthLeft,
532
533
  editorWidthRight: (_meta$editorWidthRigh = meta === null || meta === void 0 ? void 0 : meta.editorWidthRight) !== null && _meta$editorWidthRigh !== void 0 ? _meta$editorWidthRigh : editorWidthRight,
@@ -298,7 +298,7 @@ export const DragHandle = ({
298
298
  isTopLevelNode = true,
299
299
  anchorRectCache
300
300
  }) => {
301
- var _api$core2, _api$blockControls3, _api$analytics2, _api$core4;
301
+ var _api$core2, _api$blockControls4, _api$analytics2, _api$core4;
302
302
  const buttonRef = useRef(null);
303
303
  const [dragHandleSelected, setDragHandleSelected] = useState(false);
304
304
  const [dragHandleDisabled, setDragHandleDisabled] = useState(false);
@@ -359,13 +359,21 @@ export const DragHandle = ({
359
359
  tr
360
360
  });
361
361
  e.stopPropagation();
362
+ } else if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
363
+ var _api$blockControls2;
364
+ api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.commands.toggleBlockMenu({
365
+ anchorName
366
+ })({
367
+ tr
368
+ });
369
+ e.stopPropagation();
362
370
  }
363
371
  } else if (isTopLevelNode && $anchor.depth <= DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH && e.shiftKey && fg('platform_editor_elements_dnd_shift_click_select')) {
364
- var _api$blockControls2;
372
+ var _api$blockControls3;
365
373
  const alignAnchorHeadToSel = alignAnchorHeadInDirectionOfPos(tr.selection, startPos);
366
374
  const selectionWithExpandedHead = expandSelectionHeadToNodeAtPos(alignAnchorHeadToSel, startPos);
367
375
  tr.setSelection(selectionWithExpandedHead);
368
- api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.commands.setMultiSelectPositions()({
376
+ api === null || api === void 0 ? void 0 : (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.setMultiSelectPositions()({
369
377
  tr
370
378
  });
371
379
  }
@@ -385,7 +393,7 @@ export const DragHandle = ({
385
393
  return tr;
386
394
  });
387
395
  view.focus();
388
- }, [isMultiSelect, api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions, api === null || api === void 0 ? void 0 : api.blockControls.sharedState, api === null || api === void 0 ? void 0 : (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, view, dragHandleSelected, getPos, isTopLevelNode, nodeType, anchorName]);
396
+ }, [isMultiSelect, api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions, api === null || api === void 0 ? void 0 : api.blockControls.sharedState, api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, view, dragHandleSelected, getPos, isTopLevelNode, nodeType, anchorName]);
389
397
 
390
398
  // TODO: ED-26959 - This needs to be investigated further. Drag preview generation is not always working
391
399
  // as expected with a node selection. This workaround sets the selection to the node on mouseDown,
@@ -458,8 +466,8 @@ export const DragHandle = ({
458
466
  const oldHandlePosCheck = handlePos >= tr.selection.$from.start() - 1 && handlePos <= tr.selection.to;
459
467
  const newHandlePosCheck = isHandleCorrelatedToSelection(view.state, tr.selection, handlePos);
460
468
  if (!tr.selection.empty && (fg('platform_editor_elements_dnd_multi_select_patch_1') ? newHandlePosCheck : oldHandlePosCheck)) {
461
- var _api$blockControls4;
462
- api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.setMultiSelectPositions()({
469
+ var _api$blockControls5;
470
+ api === null || api === void 0 ? void 0 : (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 ? void 0 : _api$blockControls5.commands.setMultiSelectPositions()({
463
471
  tr
464
472
  });
465
473
  } else if (fg('platform_editor_elements_dnd_select_node_on_drag')) {
@@ -574,7 +582,7 @@ export const DragHandle = ({
574
582
  api === null || api === void 0 ? void 0 : (_api$core6 = api.core) === null || _api$core6 === void 0 ? void 0 : _api$core6.actions.execute(({
575
583
  tr
576
584
  }) => {
577
- var _api$blockControls$sh3, _api$blockControls5, _api$analytics3;
585
+ var _api$blockControls$sh3, _api$blockControls6, _api$analytics3;
578
586
  let nodeTypes, hasSelectedMultipleNodes;
579
587
  const resolvedMovingNode = tr.doc.resolve(start);
580
588
  const maybeNode = resolvedMovingNode.nodeAfter;
@@ -587,7 +595,7 @@ export const DragHandle = ({
587
595
  nodeTypes = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.type.name;
588
596
  hasSelectedMultipleNodes = false;
589
597
  }
590
- api === null || api === void 0 ? void 0 : (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 ? void 0 : _api$blockControls5.commands.setNodeDragged(getPos, anchorName, nodeType)({
598
+ api === null || api === void 0 ? void 0 : (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 ? void 0 : _api$blockControls6.commands.setNodeDragged(getPos, anchorName, nodeType)({
591
599
  tr
592
600
  });
593
601
  tr.setMeta('scrollIntoView', false);
@@ -8,7 +8,6 @@ import { tableControlsSpacing } from '@atlaskit/editor-common/styles';
8
8
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
9
9
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
10
10
  import { akEditorBreakoutPadding, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
11
- import { fg } from '@atlaskit/platform-feature-flags';
12
11
  import { layers } from '@atlaskit/theme/constants';
13
12
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
14
13
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -299,15 +298,6 @@ const headingWithIndentationInLayoutStyleFix = css({
299
298
  marginTop: '0 !important'
300
299
  }
301
300
  });
302
- const withRelativePosStyleLegacy = css({
303
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
304
- '.ProseMirror': {
305
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
306
- [`&& ${dragHandlerAnchorSelector}`]: {
307
- position: 'relative'
308
- }
309
- }
310
- });
311
301
  const withRelativePosStyle = css({
312
302
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
313
303
  '.ProseMirror': {
@@ -355,6 +345,6 @@ export const GlobalStylesWrapper = ({
355
345
  disabled: !expValEquals('platform_editor_block_controls_perf_optimization', 'isEnabled', true)
356
346
  });
357
347
  return jsx(Global, {
358
- styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? extendHoverZoneReduced : undefined, editorExperiment('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, editorExperiment('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, fg('platform_editor_fix_safari_cursor_hidden_empty') ? withRelativePosStyle : withRelativePosStyleLegacy, topLevelNodeMarginStyles, withAnchorNameZindexStyle]
348
+ styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? extendHoverZoneReduced : undefined, editorExperiment('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, editorExperiment('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, withRelativePosStyle, topLevelNodeMarginStyles, withAnchorNameZindexStyle]
359
349
  });
360
350
  };
@@ -5,6 +5,7 @@ import React from 'react';
5
5
  import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
6
6
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
8
9
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
10
  import { moveNode } from './editor-commands/move-node';
10
11
  import { moveToLayout } from './editor-commands/move-to-layout';
@@ -64,6 +65,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
64
65
  },
65
66
  toggleBlockMenu: function toggleBlockMenu(options) {
66
67
  return function (_ref4) {
68
+ var _options$anchorName;
67
69
  var tr = _ref4.tr;
68
70
  var currMeta = tr.getMeta(key);
69
71
  if (options !== null && options !== void 0 && options.closeMenu) {
@@ -72,6 +74,14 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
72
74
  }));
73
75
  return tr;
74
76
  }
77
+
78
+ // Do not open menu on layoutColumn and close opened menu when layoutColumn drag handle is clicked
79
+ if (options !== null && options !== void 0 && (_options$anchorName = options.anchorName) !== null && _options$anchorName !== void 0 && _options$anchorName.includes('layoutColumn')) {
80
+ tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
81
+ closeMenu: true
82
+ }));
83
+ return tr;
84
+ }
75
85
  tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
76
86
  toggleMenu: {
77
87
  anchorName: options === null || options === void 0 ? void 0 : options.anchorName
@@ -199,17 +209,23 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
199
209
  popupsMountPoint = _ref8.popupsMountPoint,
200
210
  popupsBoundariesElement = _ref8.popupsBoundariesElement,
201
211
  popupsScrollableElement = _ref8.popupsScrollableElement;
202
- return /*#__PURE__*/React.createElement(React.Fragment, null, editorExperiment('platform_editor_controls', 'variant1') ? /*#__PURE__*/React.createElement(BlockMenu, {
203
- editorView: editorView,
204
- mountPoint: popupsMountPoint,
205
- boundariesElement: popupsBoundariesElement,
206
- scrollableElement: popupsScrollableElement,
207
- api: api
208
- }) : /*#__PURE__*/React.createElement(DragHandleMenu, {
209
- api: api
210
- }), /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
211
- api: api
212
- }));
212
+ if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
213
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
214
+ api: api
215
+ }));
216
+ } else {
217
+ return /*#__PURE__*/React.createElement(React.Fragment, null, editorExperiment('platform_editor_controls', 'variant1') ? /*#__PURE__*/React.createElement(BlockMenu, {
218
+ editorView: editorView,
219
+ mountPoint: popupsMountPoint,
220
+ boundariesElement: popupsBoundariesElement,
221
+ scrollableElement: popupsScrollableElement,
222
+ api: api
223
+ }) : /*#__PURE__*/React.createElement(DragHandleMenu, {
224
+ api: api
225
+ }), /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
226
+ api: api
227
+ }));
228
+ }
213
229
  }
214
230
  };
215
231
  };
@@ -1,4 +1,5 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
2
3
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
4
  var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(target) {
4
5
  if (target instanceof HTMLHeadingElement || target instanceof HTMLParagraphElement) {
@@ -11,7 +12,9 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
11
12
  var _api$blockControls, _target$classList;
12
13
  var _ref = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
13
14
  isDragging = _ref.isDragging,
14
- activeNode = _ref.activeNode;
15
+ activeNode = _ref.activeNode,
16
+ isMenuOpen = _ref.isMenuOpen,
17
+ originalAnchorName = _ref.menuTriggerBy;
15
18
 
16
19
  // Most mouseover events don't fire during drag but some can slip through
17
20
  // when the drag begins. This prevents those.
@@ -121,6 +124,12 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
121
124
  var _api$core2, _api$blockControls3;
122
125
  api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.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));
123
126
  }
127
+ if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
128
+ if (isMenuOpen && originalAnchorName) {
129
+ var _api$core3, _api$blockControls4;
130
+ api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.toggleBlockMenu());
131
+ }
132
+ }
124
133
  }
125
134
  }
126
135
  };
@@ -15,6 +15,7 @@ import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-sc
15
15
  import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
16
16
  import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
17
17
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
18
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
18
19
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
19
20
  import { BLOCK_MENU_ENABLED } from '../ui/consts';
20
21
  import { findNodeDecs, nodeDecorations } from './decorations-anchor';
@@ -497,7 +498,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
497
498
  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;
498
499
  }
499
500
  var isMenuOpenNew = isMenuOpen;
500
- if (BLOCK_MENU_ENABLED && editorExperiment('platform_editor_controls', 'variant1')) {
501
+ if (BLOCK_MENU_ENABLED && editorExperiment('platform_editor_controls', 'variant1') || expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
501
502
  if (meta !== null && meta !== void 0 && meta.closeMenu) {
502
503
  isMenuOpenNew = false;
503
504
  } else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
@@ -519,7 +520,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
519
520
  activeDropTargetNode: currentActiveDropTargetNode,
520
521
  isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
521
522
  isMenuOpen: isMenuOpenNew,
522
- menuTriggerBy: editorExperiment('platform_editor_controls', 'variant1') ? (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
523
+ menuTriggerBy: editorExperiment('platform_editor_controls', 'variant1') || expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
523
524
  editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : editorHeight,
524
525
  editorWidthLeft: (_meta$editorWidthLeft = meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== null && _meta$editorWidthLeft !== void 0 ? _meta$editorWidthLeft : editorWidthLeft,
525
526
  editorWidthRight: (_meta$editorWidthRigh = meta === null || meta === void 0 ? void 0 : meta.editorWidthRight) !== null && _meta$editorWidthRigh !== void 0 ? _meta$editorWidthRigh : editorWidthRight,
@@ -288,7 +288,7 @@ var useDragHandlePluginState = sharedPluginStateHookMigratorFactory(function (ap
288
288
  };
289
289
  });
290
290
  export var DragHandle = function DragHandle(_ref) {
291
- var _api$core2, _api$blockControls3, _api$analytics2, _api$core4;
291
+ var _api$core2, _api$blockControls4, _api$analytics2, _api$core4;
292
292
  var view = _ref.view,
293
293
  api = _ref.api,
294
294
  formatMessage = _ref.formatMessage,
@@ -374,13 +374,21 @@ export var DragHandle = function DragHandle(_ref) {
374
374
  tr: tr
375
375
  });
376
376
  e.stopPropagation();
377
+ } else if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
378
+ var _api$blockControls2;
379
+ api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || _api$blockControls2.commands.toggleBlockMenu({
380
+ anchorName: anchorName
381
+ })({
382
+ tr: tr
383
+ });
384
+ e.stopPropagation();
377
385
  }
378
386
  } else if (isTopLevelNode && $anchor.depth <= DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH && e.shiftKey && fg('platform_editor_elements_dnd_shift_click_select')) {
379
- var _api$blockControls2;
387
+ var _api$blockControls3;
380
388
  var alignAnchorHeadToSel = alignAnchorHeadInDirectionOfPos(tr.selection, startPos);
381
389
  var selectionWithExpandedHead = expandSelectionHeadToNodeAtPos(alignAnchorHeadToSel, startPos);
382
390
  tr.setSelection(selectionWithExpandedHead);
383
- api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || _api$blockControls2.commands.setMultiSelectPositions()({
391
+ api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 || _api$blockControls3.commands.setMultiSelectPositions()({
384
392
  tr: tr
385
393
  });
386
394
  }
@@ -400,7 +408,7 @@ export var DragHandle = function DragHandle(_ref) {
400
408
  return tr;
401
409
  });
402
410
  view.focus();
403
- }, [isMultiSelect, api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions, api === null || api === void 0 ? void 0 : api.blockControls.sharedState, api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, view, dragHandleSelected, getPos, isTopLevelNode, nodeType, anchorName]);
411
+ }, [isMultiSelect, api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions, api === null || api === void 0 ? void 0 : api.blockControls.sharedState, api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, view, dragHandleSelected, getPos, isTopLevelNode, nodeType, anchorName]);
404
412
 
405
413
  // TODO: ED-26959 - This needs to be investigated further. Drag preview generation is not always working
406
414
  // as expected with a node selection. This workaround sets the selection to the node on mouseDown,
@@ -474,8 +482,8 @@ export var DragHandle = function DragHandle(_ref) {
474
482
  var oldHandlePosCheck = handlePos >= tr.selection.$from.start() - 1 && handlePos <= tr.selection.to;
475
483
  var newHandlePosCheck = isHandleCorrelatedToSelection(view.state, tr.selection, handlePos);
476
484
  if (!tr.selection.empty && (fg('platform_editor_elements_dnd_multi_select_patch_1') ? newHandlePosCheck : oldHandlePosCheck)) {
477
- var _api$blockControls4;
478
- api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.setMultiSelectPositions()({
485
+ var _api$blockControls5;
486
+ api === null || api === void 0 || (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 || _api$blockControls5.commands.setMultiSelectPositions()({
479
487
  tr: tr
480
488
  });
481
489
  } else if (fg('platform_editor_elements_dnd_select_node_on_drag')) {
@@ -583,7 +591,7 @@ export var DragHandle = function DragHandle(_ref) {
583
591
  return;
584
592
  }
585
593
  api === null || api === void 0 || (_api$core6 = api.core) === null || _api$core6 === void 0 || _api$core6.actions.execute(function (_ref7) {
586
- var _api$blockControls$sh3, _api$blockControls5, _api$analytics3;
594
+ var _api$blockControls$sh3, _api$blockControls6, _api$analytics3;
587
595
  var tr = _ref7.tr;
588
596
  var nodeTypes, hasSelectedMultipleNodes;
589
597
  var resolvedMovingNode = tr.doc.resolve(start);
@@ -597,7 +605,7 @@ export var DragHandle = function DragHandle(_ref) {
597
605
  nodeTypes = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.type.name;
598
606
  hasSelectedMultipleNodes = false;
599
607
  }
600
- api === null || api === void 0 || (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 || _api$blockControls5.commands.setNodeDragged(getPos, anchorName, nodeType)({
608
+ api === null || api === void 0 || (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 || _api$blockControls6.commands.setNodeDragged(getPos, anchorName, nodeType)({
601
609
  tr: tr
602
610
  });
603
611
  tr.setMeta('scrollIntoView', false);
@@ -9,7 +9,6 @@ import { tableControlsSpacing } from '@atlaskit/editor-common/styles';
9
9
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
10
10
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
11
11
  import { akEditorBreakoutPadding, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
12
  import { layers } from '@atlaskit/theme/constants';
14
13
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
15
14
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -262,12 +261,6 @@ var headingWithIndentationInLayoutStyleFix = css(_defineProperty({}, "".concat(d
262
261
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
263
262
  marginTop: '0 !important'
264
263
  }));
265
- var withRelativePosStyleLegacy = css({
266
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
267
- '.ProseMirror': _defineProperty({}, "&& ".concat(dragHandlerAnchorSelector), {
268
- position: 'relative'
269
- })
270
- });
271
264
  var withRelativePosStyle = css({
272
265
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
273
266
  '.ProseMirror': _defineProperty(_defineProperty({}, "&& ".concat(dragHandlerAnchorSelector), {
@@ -309,6 +302,6 @@ export var GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
309
302
  disabled: !expValEquals('platform_editor_block_controls_perf_optimization', 'isEnabled', true)
310
303
  });
311
304
  return jsx(Global, {
312
- styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? extendHoverZoneReduced : undefined, editorExperiment('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, editorExperiment('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, fg('platform_editor_fix_safari_cursor_hidden_empty') ? withRelativePosStyle : withRelativePosStyleLegacy, topLevelNodeMarginStyles, withAnchorNameZindexStyle]
305
+ styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? extendHoverZoneReduced : undefined, editorExperiment('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, editorExperiment('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, withRelativePosStyle, topLevelNodeMarginStyles, withAnchorNameZindexStyle]
313
306
  });
314
307
  };
@@ -2,5 +2,5 @@ import { type IntlShape } from 'react-intl-next';
2
2
  import type { Command, EditorCommand, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { BlockControlsPlugin, MoveNodeMethod } from '../blockControlsPluginType';
4
4
  import { DIRECTION } from '../pm-plugins/utils/consts';
5
- export declare const moveNodeViaShortcut: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, direction: DIRECTION, formatMessage?: IntlShape['formatMessage']) => Command;
6
- export declare const moveNode: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape['formatMessage']) => EditorCommand;
5
+ export declare const moveNodeViaShortcut: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, direction: DIRECTION, formatMessage?: IntlShape["formatMessage"]) => Command;
6
+ export declare const moveNode: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape["formatMessage"]) => EditorCommand;
@@ -7,7 +7,7 @@ import { type Decoration } from '@atlaskit/editor-prosemirror/view';
7
7
  import type { ActiveDropTargetNode, ActiveNode, BlockControlsPlugin } from '../blockControlsPluginType';
8
8
  import type { AnchorRectCache } from './utils/anchor-utils';
9
9
  export declare const canMoveNodeOrSliceToPos: (state: EditorState, node: PMNode, parent: PMNode, index: number, $toPos: ResolvedPos, activeNode?: ActiveNode) => boolean | null;
10
- export declare const getActiveDropTargetDecorations: (activeDropTargetNode: ActiveDropTargetNode, state: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, existingDecs: Decoration[], formatMessage: IntlShape['formatMessage'], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache) => {
10
+ export declare const getActiveDropTargetDecorations: (activeDropTargetNode: ActiveDropTargetNode, state: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, existingDecs: Decoration[], formatMessage: IntlShape["formatMessage"], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache) => {
11
11
  decsToAdd: Decoration[];
12
12
  decsToRemove: Decoration[];
13
13
  };
@@ -15,6 +15,6 @@ import { type AnchorRectCache } from './utils/anchor-utils';
15
15
  * @returns
16
16
  */
17
17
  export declare const findDropTargetDecs: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
18
- export declare const createDropTargetDecoration: (pos: number, props: Omit<DropTargetProps, 'getPos'>, nodeViewPortalProviderAPI: PortalProviderAPI, side?: number, anchorRectCache?: AnchorRectCache, isSameLayout?: boolean) => Decoration;
19
- export declare const createLayoutDropTargetDecoration: (pos: number, props: Omit<DropTargetLayoutProps, 'getPos'>, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => Decoration;
20
- export declare const dropTargetDecorations: (newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache, from?: number, to?: number) => Decoration[];
18
+ export declare const createDropTargetDecoration: (pos: number, props: Omit<DropTargetProps, "getPos">, nodeViewPortalProviderAPI: PortalProviderAPI, side?: number, anchorRectCache?: AnchorRectCache, isSameLayout?: boolean) => Decoration;
19
+ export declare const createLayoutDropTargetDecoration: (pos: number, props: Omit<DropTargetLayoutProps, "getPos">, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => Decoration;
20
+ export declare const dropTargetDecorations: (newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape["formatMessage"], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache, from?: number, to?: number) => Decoration[];
@@ -12,7 +12,7 @@ export interface FlagType {
12
12
  isMultiSelectEnabled: boolean;
13
13
  }
14
14
  export declare const getDecorations: (state: EditorState) => DecorationSet | undefined;
15
- export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
15
+ export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
16
16
  decorations: DecorationSet;
17
17
  activeNode: any;
18
18
  activeDropTargetNode: ActiveDropTargetNode | undefined;
@@ -1,6 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node/events" />
3
- /// <reference types="typings/events" />
4
1
  import { EventEmitter } from 'events';
5
2
  export declare class ActiveAnchorTracker {
6
3
  emitter: EventEmitter | null;
@@ -1,3 +1,7 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import { type ActiveNode } from '../../blockControlsPluginType';
3
- export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode, isSameLayout?: boolean, activeNode?: ActiveNode) => boolean;
3
+ export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode,
4
+ /**
5
+ * Is the active node in the same layout as the target node
6
+ */
7
+ isSameLayout?: boolean, activeNode?: ActiveNode) => boolean;
@@ -6,10 +6,10 @@ import type { IntlShape } from 'react-intl-next';
6
6
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
7
7
  import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
8
8
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
9
- export declare const getBlockMenuItems: (formatMessage: IntlShape['formatMessage']) => {
9
+ export declare const getBlockMenuItems: (formatMessage: IntlShape["formatMessage"]) => {
10
10
  items: MenuItem[];
11
11
  }[];
12
12
  export declare const menuItemsCallback: {
13
- moveUp: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage']) => import("@atlaskit/editor-common/types").Command;
14
- moveDown: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage']) => import("@atlaskit/editor-common/types").Command;
13
+ moveUp: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"]) => import("@atlaskit/editor-common/types").Command;
14
+ moveDown: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"]) => import("@atlaskit/editor-common/types").Command;
15
15
  };
@@ -11,5 +11,5 @@ export type DropTargetLayoutProps = {
11
11
  formatMessage?: IntlShape['formatMessage'];
12
12
  };
13
13
  export declare const DropTargetLayout: (props: DropTargetLayoutProps & {
14
- anchorRectCache?: AnchorRectCache | undefined;
14
+ anchorRectCache?: AnchorRectCache;
15
15
  }) => jsx.JSX.Element | null;
@@ -17,6 +17,6 @@ export type DropTargetProps = {
17
17
  formatMessage?: IntlShape['formatMessage'];
18
18
  };
19
19
  export declare const DropTarget: (props: DropTargetProps & {
20
- anchorRectCache?: AnchorRectCache | undefined;
21
- isSameLayout?: boolean | undefined;
20
+ anchorRectCache?: AnchorRectCache;
21
+ isSameLayout?: boolean;
22
22
  }) => jsx.JSX.Element;
@@ -2,6 +2,6 @@ import { jsx } from '@emotion/react';
2
2
  import { type AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
3
3
  import { type DropTargetProps } from './drop-target';
4
4
  export declare const InlineDropTarget: ({ api, nextNode, position, anchorRectCache, getPos, }: DropTargetProps & {
5
- anchorRectCache?: AnchorRectCache | undefined;
6
- position: 'left' | 'right';
5
+ anchorRectCache?: AnchorRectCache;
6
+ position: "left" | "right";
7
7
  }) => jsx.JSX.Element;
@@ -2,5 +2,5 @@ import { type IntlShape } from 'react-intl-next';
2
2
  import type { Command, EditorCommand, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { BlockControlsPlugin, MoveNodeMethod } from '../blockControlsPluginType';
4
4
  import { DIRECTION } from '../pm-plugins/utils/consts';
5
- export declare const moveNodeViaShortcut: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, direction: DIRECTION, formatMessage?: IntlShape['formatMessage']) => Command;
6
- export declare const moveNode: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape['formatMessage']) => EditorCommand;
5
+ export declare const moveNodeViaShortcut: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, direction: DIRECTION, formatMessage?: IntlShape["formatMessage"]) => Command;
6
+ export declare const moveNode: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape["formatMessage"]) => EditorCommand;
@@ -7,7 +7,7 @@ import { type Decoration } from '@atlaskit/editor-prosemirror/view';
7
7
  import type { ActiveDropTargetNode, ActiveNode, BlockControlsPlugin } from '../blockControlsPluginType';
8
8
  import type { AnchorRectCache } from './utils/anchor-utils';
9
9
  export declare const canMoveNodeOrSliceToPos: (state: EditorState, node: PMNode, parent: PMNode, index: number, $toPos: ResolvedPos, activeNode?: ActiveNode) => boolean | null;
10
- export declare const getActiveDropTargetDecorations: (activeDropTargetNode: ActiveDropTargetNode, state: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, existingDecs: Decoration[], formatMessage: IntlShape['formatMessage'], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache) => {
10
+ export declare const getActiveDropTargetDecorations: (activeDropTargetNode: ActiveDropTargetNode, state: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, existingDecs: Decoration[], formatMessage: IntlShape["formatMessage"], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache) => {
11
11
  decsToAdd: Decoration[];
12
12
  decsToRemove: Decoration[];
13
13
  };
@@ -15,6 +15,6 @@ import { type AnchorRectCache } from './utils/anchor-utils';
15
15
  * @returns
16
16
  */
17
17
  export declare const findDropTargetDecs: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
18
- export declare const createDropTargetDecoration: (pos: number, props: Omit<DropTargetProps, 'getPos'>, nodeViewPortalProviderAPI: PortalProviderAPI, side?: number, anchorRectCache?: AnchorRectCache, isSameLayout?: boolean) => Decoration;
19
- export declare const createLayoutDropTargetDecoration: (pos: number, props: Omit<DropTargetLayoutProps, 'getPos'>, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => Decoration;
20
- export declare const dropTargetDecorations: (newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache, from?: number, to?: number) => Decoration[];
18
+ export declare const createDropTargetDecoration: (pos: number, props: Omit<DropTargetProps, "getPos">, nodeViewPortalProviderAPI: PortalProviderAPI, side?: number, anchorRectCache?: AnchorRectCache, isSameLayout?: boolean) => Decoration;
19
+ export declare const createLayoutDropTargetDecoration: (pos: number, props: Omit<DropTargetLayoutProps, "getPos">, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => Decoration;
20
+ export declare const dropTargetDecorations: (newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape["formatMessage"], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache, from?: number, to?: number) => Decoration[];
@@ -12,7 +12,7 @@ export interface FlagType {
12
12
  isMultiSelectEnabled: boolean;
13
13
  }
14
14
  export declare const getDecorations: (state: EditorState) => DecorationSet | undefined;
15
- export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
15
+ export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
16
16
  decorations: DecorationSet;
17
17
  activeNode: any;
18
18
  activeDropTargetNode: ActiveDropTargetNode | undefined;
@@ -1,6 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node/events" />
3
- /// <reference types="typings/events" />
4
1
  import { EventEmitter } from 'events';
5
2
  export declare class ActiveAnchorTracker {
6
3
  emitter: EventEmitter | null;
@@ -1,3 +1,7 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import { type ActiveNode } from '../../blockControlsPluginType';
3
- export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode, isSameLayout?: boolean, activeNode?: ActiveNode) => boolean;
3
+ export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode,
4
+ /**
5
+ * Is the active node in the same layout as the target node
6
+ */
7
+ isSameLayout?: boolean, activeNode?: ActiveNode) => boolean;
@@ -6,10 +6,10 @@ import type { IntlShape } from 'react-intl-next';
6
6
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
7
7
  import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
8
8
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
9
- export declare const getBlockMenuItems: (formatMessage: IntlShape['formatMessage']) => {
9
+ export declare const getBlockMenuItems: (formatMessage: IntlShape["formatMessage"]) => {
10
10
  items: MenuItem[];
11
11
  }[];
12
12
  export declare const menuItemsCallback: {
13
- moveUp: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage']) => import("@atlaskit/editor-common/types").Command;
14
- moveDown: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage']) => import("@atlaskit/editor-common/types").Command;
13
+ moveUp: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"]) => import("@atlaskit/editor-common/types").Command;
14
+ moveDown: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"]) => import("@atlaskit/editor-common/types").Command;
15
15
  };
@@ -11,5 +11,5 @@ export type DropTargetLayoutProps = {
11
11
  formatMessage?: IntlShape['formatMessage'];
12
12
  };
13
13
  export declare const DropTargetLayout: (props: DropTargetLayoutProps & {
14
- anchorRectCache?: AnchorRectCache | undefined;
14
+ anchorRectCache?: AnchorRectCache;
15
15
  }) => jsx.JSX.Element | null;
@@ -17,6 +17,6 @@ export type DropTargetProps = {
17
17
  formatMessage?: IntlShape['formatMessage'];
18
18
  };
19
19
  export declare const DropTarget: (props: DropTargetProps & {
20
- anchorRectCache?: AnchorRectCache | undefined;
21
- isSameLayout?: boolean | undefined;
20
+ anchorRectCache?: AnchorRectCache;
21
+ isSameLayout?: boolean;
22
22
  }) => jsx.JSX.Element;
@@ -2,6 +2,6 @@ import { jsx } from '@emotion/react';
2
2
  import { type AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
3
3
  import { type DropTargetProps } from './drop-target';
4
4
  export declare const InlineDropTarget: ({ api, nextNode, position, anchorRectCache, getPos, }: DropTargetProps & {
5
- anchorRectCache?: AnchorRectCache | undefined;
6
- position: 'left' | 'right';
5
+ anchorRectCache?: AnchorRectCache;
6
+ position: "left" | "right";
7
7
  }) => jsx.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "4.1.7",
3
+ "version": "4.1.9",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -44,9 +44,9 @@
44
44
  "@atlaskit/editor-plugin-user-intent": "^1.1.0",
45
45
  "@atlaskit/editor-plugin-width": "^4.0.0",
46
46
  "@atlaskit/editor-prosemirror": "7.0.0",
47
- "@atlaskit/editor-shared-styles": "^3.5.0",
47
+ "@atlaskit/editor-shared-styles": "^3.6.0",
48
48
  "@atlaskit/editor-tables": "^2.9.0",
49
- "@atlaskit/icon": "^27.9.0",
49
+ "@atlaskit/icon": "^27.11.0",
50
50
  "@atlaskit/link": "^3.2.0",
51
51
  "@atlaskit/platform-feature-flags": "^1.1.0",
52
52
  "@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
@@ -54,7 +54,7 @@
54
54
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
55
55
  "@atlaskit/primitives": "^14.11.0",
56
56
  "@atlaskit/theme": "^19.0.0",
57
- "@atlaskit/tmp-editor-statsig": "^9.22.0",
57
+ "@atlaskit/tmp-editor-statsig": "^9.26.0",
58
58
  "@atlaskit/tokens": "^6.0.0",
59
59
  "@atlaskit/tooltip": "^20.4.0",
60
60
  "@babel/runtime": "^7.0.0",
@@ -66,7 +66,7 @@
66
66
  "uuid": "^3.1.0"
67
67
  },
68
68
  "peerDependencies": {
69
- "@atlaskit/editor-common": "^107.16.0",
69
+ "@atlaskit/editor-common": "^107.20.0",
70
70
  "react": "^18.2.0",
71
71
  "react-dom": "^18.2.0",
72
72
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -149,9 +149,6 @@
149
149
  "platform_editor_elements_dnd_multi_select_patch_3": {
150
150
  "type": "boolean"
151
151
  },
152
- "platform_editor_fix_safari_cursor_hidden_empty": {
153
- "type": "boolean"
154
- },
155
152
  "platform_editor_drag_and_drop_perf_analytics": {
156
153
  "type": "boolean"
157
154
  },