@atlaskit/editor-plugin-block-controls 4.1.10 → 4.1.12

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 (36) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/blockControlsPlugin.js +16 -4
  3. package/dist/cjs/pm-plugins/decorations-drop-target.js +6 -2
  4. package/dist/cjs/pm-plugins/decorations-quick-insert-button.js +3 -1
  5. package/dist/cjs/pm-plugins/handle-mouse-down.js +3 -1
  6. package/dist/cjs/pm-plugins/handle-mouse-over.js +2 -1
  7. package/dist/cjs/pm-plugins/main.js +44 -29
  8. package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +3 -2
  9. package/dist/cjs/ui/consts.js +4 -4
  10. package/dist/cjs/ui/drag-handle.js +6 -6
  11. package/dist/cjs/ui/global-styles.js +2 -2
  12. package/dist/es2019/blockControlsPlugin.js +16 -4
  13. package/dist/es2019/pm-plugins/decorations-drop-target.js +6 -2
  14. package/dist/es2019/pm-plugins/decorations-quick-insert-button.js +3 -1
  15. package/dist/es2019/pm-plugins/handle-mouse-down.js +3 -1
  16. package/dist/es2019/pm-plugins/handle-mouse-over.js +2 -1
  17. package/dist/es2019/pm-plugins/main.js +44 -31
  18. package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +2 -1
  19. package/dist/es2019/ui/consts.js +1 -1
  20. package/dist/es2019/ui/drag-handle.js +2 -2
  21. package/dist/es2019/ui/global-styles.js +2 -2
  22. package/dist/esm/blockControlsPlugin.js +16 -4
  23. package/dist/esm/pm-plugins/decorations-drop-target.js +6 -2
  24. package/dist/esm/pm-plugins/decorations-quick-insert-button.js +3 -1
  25. package/dist/esm/pm-plugins/handle-mouse-down.js +3 -1
  26. package/dist/esm/pm-plugins/handle-mouse-over.js +2 -1
  27. package/dist/esm/pm-plugins/main.js +44 -29
  28. package/dist/esm/pm-plugins/utils/drag-handle-positions.js +2 -1
  29. package/dist/esm/ui/consts.js +1 -1
  30. package/dist/esm/ui/drag-handle.js +2 -2
  31. package/dist/esm/ui/global-styles.js +2 -2
  32. package/dist/types/pm-plugins/main.d.ts +19 -2
  33. package/dist/types/ui/consts.d.ts +0 -1
  34. package/dist/types-ts4.5/pm-plugins/main.d.ts +19 -2
  35. package/dist/types-ts4.5/ui/consts.d.ts +0 -1
  36. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 4.1.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [`20d3223b57972`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/20d3223b57972) -
8
+ Opted out of debounced portal provider
9
+ - [`e33be5daddd2b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e33be5daddd2b) -
10
+ ED-28892 Limited mode: adjust how we're triggering cleanup logic for block control plugin. Hook up
11
+ banner. Other misc setup.
12
+ - Updated dependencies
13
+
14
+ ## 4.1.11
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 4.1.10
4
21
 
5
22
  ### Patch Changes
@@ -65,14 +65,14 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
65
65
  rootAnchorName: rootAnchorName,
66
66
  rootNodeType: rootNodeType
67
67
  },
68
- closeMenu: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? true : undefined
68
+ closeMenu: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && !(0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? true : undefined
69
69
  }));
70
70
  return tr;
71
71
  };
72
72
  },
73
73
  toggleBlockMenu: function toggleBlockMenu(options) {
74
74
  return function (_ref4) {
75
- var _options$anchorName;
75
+ var _options$anchorName, _api$blockControls;
76
76
  var tr = _ref4.tr;
77
77
  var currMeta = tr.getMeta(_main.key);
78
78
  if (options !== null && options !== void 0 && options.closeMenu) {
@@ -94,12 +94,24 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
94
94
  anchorName: options === null || options === void 0 ? void 0 : options.anchorName
95
95
  }
96
96
  }));
97
+ var menuTriggerBy = api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.sharedState.currentState()) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.menuTriggerBy;
98
+ if (menuTriggerBy === undefined || !!menuTriggerBy && menuTriggerBy === (options === null || options === void 0 ? void 0 : options.anchorName)) {
99
+ var _api$userIntent;
100
+ // Toggled from drag handle
101
+ var currentUserIntent = api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent;
102
+ if (currentUserIntent === 'blockMenuOpen') {
103
+ var _api$userIntent2;
104
+ api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || _api$userIntent2.commands.setCurrentUserIntent('default')({
105
+ tr: tr
106
+ });
107
+ }
108
+ }
97
109
  return tr;
98
110
  };
99
111
  },
100
112
  setNodeDragged: function setNodeDragged(getPos, anchorName, nodeType) {
101
113
  return function (_ref5) {
102
- var _api$userIntent;
114
+ var _api$userIntent3;
103
115
  var tr = _ref5.tr;
104
116
  var pos = getPos();
105
117
  if (pos === undefined) {
@@ -123,7 +135,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
123
135
  tr: tr
124
136
  });
125
137
  }
126
- api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('dragging')({
138
+ api === null || api === void 0 || (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 || _api$userIntent3.commands.setCurrentUserIntent('dragging')({
127
139
  tr: tr
128
140
  });
129
141
  return tr;
@@ -109,7 +109,9 @@ var createDropTargetDecoration = exports.createDropTargetDecoration = function c
109
109
  anchorRectCache: anchorRectCache,
110
110
  isSameLayout: isSameLayout
111
111
  }));
112
- }, element, key);
112
+ }, element, key, undefined,
113
+ // @portal-render-immediately
114
+ true);
113
115
  return element;
114
116
  }, {
115
117
  type: _decorationsCommon.TYPE_DROP_TARGET_DEC,
@@ -140,7 +142,9 @@ var createLayoutDropTargetDecoration = exports.createLayoutDropTargetDecoration
140
142
  getPos: getPos,
141
143
  anchorRectCache: anchorRectCache
142
144
  }));
143
- }, element, key);
145
+ }, element, key, undefined,
146
+ // @portal-render-immediately
147
+ true);
144
148
  return element;
145
149
  }, {
146
150
  type: _decorationsCommon.TYPE_DROP_TARGET_DEC,
@@ -100,7 +100,9 @@ var quickInsertButtonDecoration = exports.quickInsertButtonDecoration = function
100
100
  rootNodeType: rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType,
101
101
  anchorRectCache: anchorRectCache
102
102
  });
103
- }, element, key);
103
+ }, element, key, undefined,
104
+ // @portal-render-immediately
105
+ true);
104
106
  return element;
105
107
  }, widgetSpec);
106
108
  };
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.handleMouseDown = void 0;
7
+ var _styles = require("@atlaskit/editor-common/styles");
8
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
7
9
  var handleMouseDown = exports.handleMouseDown = function handleMouseDown(api) {
8
10
  return function (view, event) {
9
11
  if (!(event.target instanceof HTMLElement)) {
@@ -20,7 +22,7 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(api) {
20
22
  }
21
23
  api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.showDragHandleAt(rootPos, '', (_rootNode$type$name = rootNode.type.name) !== null && _rootNode$type$name !== void 0 ? _rootNode$type$name : '', undefined, rootPos, '', (_rootNode$type$name2 = rootNode.type.name) !== null && _rootNode$type$name2 !== void 0 ? _rootNode$type$name2 : ''));
22
24
  } else {
23
- var isDragHandle = event.target.closest('[data-editor-block-ctrl-drag-handle]') !== null;
25
+ var isDragHandle = event.target.closest((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? _styles.DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle]') !== null;
24
26
  api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
25
27
  }
26
28
  return false;
@@ -131,7 +131,8 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
131
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));
132
132
  }
133
133
  if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
134
- if (isMenuOpen && originalAnchorName) {
134
+ var _api$userIntent;
135
+ if (isMenuOpen && originalAnchorName && (api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent) === 'blockMenuOpen') {
135
136
  var _api$core3, _api$blockControls4;
136
137
  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
  }
@@ -11,6 +11,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
11
11
  var _browser = require("@atlaskit/editor-common/browser");
12
12
  var _performanceMeasures = require("@atlaskit/editor-common/performance-measures");
13
13
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
14
+ var _styles = require("@atlaskit/editor-common/styles");
14
15
  var _ui = require("@atlaskit/editor-common/ui");
15
16
  var _utils = require("@atlaskit/editor-common/utils");
16
17
  var _state = require("@atlaskit/editor-prosemirror/state");
@@ -75,7 +76,6 @@ var destroyFn = function destroyFn(api, editorView) {
75
76
  if ((0, _performanceMeasures.isMeasuring)(EDITOR_BLOCKS_DRAG_INIT)) {
76
77
  (0, _performanceMeasures.stopMeasure)(EDITOR_BLOCKS_DRAG_INIT, function (duration, startTime) {
77
78
  var _api$analytics;
78
- var state = editorView.state;
79
79
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
80
80
  action: _analytics.ACTION.BLOCKS_DRAG_INIT,
81
81
  actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
@@ -83,7 +83,7 @@ var destroyFn = function destroyFn(api, editorView) {
83
83
  attributes: {
84
84
  duration: duration,
85
85
  startTime: startTime,
86
- nodesCount: state.doc.nodeSize
86
+ nodesCount: editorView === null || editorView === void 0 ? void 0 : editorView.state.doc.nodeSize
87
87
  }
88
88
  });
89
89
  });
@@ -195,7 +195,7 @@ var destroyFn = function destroyFn(api, editorView) {
195
195
  dragInitializationDuration: dragInitializationDuration,
196
196
  dropProcessingDuration: duration,
197
197
  isCancelled: isCancelled,
198
- nodesCount: editorView.state.doc.nodeSize
198
+ nodesCount: editorView === null || editorView === void 0 ? void 0 : editorView.state.doc.nodeSize
199
199
  }
200
200
  });
201
201
  });
@@ -238,8 +238,8 @@ var getDecorationAtPos = function getDecorationAtPos(state, decorations, pos, to
238
238
  var nodeDecAtActivePos = nodeDecsAtActivePos.pop();
239
239
  return nodeDecAtActivePos;
240
240
  };
241
- var _apply = exports.apply = function apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache) {
242
- var _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
241
+ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache, resizeObserverWidth, pragmaticCleanup) {
242
+ var _api$limitedMode, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
243
243
  var activeNode = currentState.activeNode,
244
244
  decorations = currentState.decorations,
245
245
  isResizerResizing = currentState.isResizerResizing,
@@ -262,6 +262,18 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
262
262
  isAllText = _getTrMetadata.isAllText,
263
263
  isReplacedWithSameSize = _getTrMetadata.isReplacedWithSameSize;
264
264
  var meta = tr.getMeta(key);
265
+ var hasDocumentSizeBreachedThreshold = api === null || api === void 0 || (_api$limitedMode = api.limitedMode) === null || _api$limitedMode === void 0 || (_api$limitedMode = _api$limitedMode.sharedState.currentState()) === null || _api$limitedMode === void 0 || (_api$limitedMode = _api$limitedMode.limitedModePluginKey.getState(newState)) === null || _api$limitedMode === void 0 ? void 0 : _api$limitedMode.documentSizeBreachesThreshold;
266
+ if (hasDocumentSizeBreachedThreshold) {
267
+ /**
268
+ * INFO: This if statement is a duplicate of the logic in destroy(). When the threshold is breached and we enter limited mode, we want to trigger the cleanup logic in destroy().
269
+ */
270
+ var editorContentArea = document.querySelector('.fabric-editor-popup-scroll-parent');
271
+ if (editorContentArea && resizeObserverWidth) {
272
+ resizeObserverWidth.unobserve(editorContentArea);
273
+ }
274
+ pragmaticCleanup === null || pragmaticCleanup === void 0 || pragmaticCleanup();
275
+ return currentState;
276
+ }
265
277
 
266
278
  // When steps exist, remap existing decorations, activeNode and multi select positions
267
279
  if (tr.docChanged) {
@@ -556,6 +568,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
556
568
  if (!(0, _anchorUtils.isAnchorSupported)()) {
557
569
  anchorRectCache = new _anchorUtils.AnchorRectCache();
558
570
  }
571
+ var resizeObserverWidth;
572
+ var pragmaticCleanup = null;
559
573
  return new _safePlugin.SafePlugin({
560
574
  key: key,
561
575
  state: {
@@ -563,13 +577,13 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
563
577
  return initialState;
564
578
  },
565
579
  apply: function apply(tr, currentState, _, newState) {
566
- return _apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache);
580
+ return _apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache, resizeObserverWidth, pragmaticCleanup);
567
581
  }
568
582
  },
569
583
  props: {
570
584
  decorations: function decorations(state) {
571
- var _api$limitedMode, _api$editorDisabled, _key$getState2;
572
- if (api !== null && api !== void 0 && (_api$limitedMode = api.limitedMode) !== null && _api$limitedMode !== void 0 && (_api$limitedMode = _api$limitedMode.sharedState.currentState()) !== null && _api$limitedMode !== void 0 && _api$limitedMode.enabled) {
585
+ var _api$limitedMode2, _api$editorDisabled, _key$getState2;
586
+ if (api !== null && api !== void 0 && (_api$limitedMode2 = api.limitedMode) !== null && _api$limitedMode2 !== void 0 && (_api$limitedMode2 = _api$limitedMode2.sharedState.currentState()) !== null && _api$limitedMode2 !== void 0 && _api$limitedMode2.enabled) {
573
587
  return;
574
588
  }
575
589
  var isDisabled = api === null || api === void 0 || (_api$editorDisabled = api.editorDisabled) === null || _api$editorDisabled === void 0 || (_api$editorDisabled = _api$editorDisabled.sharedState.currentState()) === null || _api$editorDisabled === void 0 ? void 0 : _api$editorDisabled.editorDisabled;
@@ -628,8 +642,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
628
642
  return false;
629
643
  },
630
644
  dragenter: function dragenter(view, event) {
631
- var _api$limitedMode2;
632
- if (api !== null && api !== void 0 && (_api$limitedMode2 = api.limitedMode) !== null && _api$limitedMode2 !== void 0 && (_api$limitedMode2 = _api$limitedMode2.sharedState.currentState()) !== null && _api$limitedMode2 !== void 0 && _api$limitedMode2.enabled) {
645
+ var _api$limitedMode3;
646
+ if (api !== null && api !== void 0 && (_api$limitedMode3 = api.limitedMode) !== null && _api$limitedMode3 !== void 0 && (_api$limitedMode3 = _api$limitedMode3.sharedState.currentState()) !== null && _api$limitedMode3 !== void 0 && _api$limitedMode3.enabled) {
633
647
  return;
634
648
  }
635
649
  if (isHTMLElement(event.target) && (0, _expValEquals.expValEquals)('platform_editor_block_controls_perf_optimization', 'isEnabled', true)) {
@@ -662,8 +676,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
662
676
  }
663
677
  },
664
678
  dragstart: function dragstart(view) {
665
- var _api$limitedMode3, _anchorRectCache2;
666
- if (api !== null && api !== void 0 && (_api$limitedMode3 = api.limitedMode) !== null && _api$limitedMode3 !== void 0 && (_api$limitedMode3 = _api$limitedMode3.sharedState.currentState()) !== null && _api$limitedMode3 !== void 0 && _api$limitedMode3.enabled) {
679
+ var _api$limitedMode4, _anchorRectCache2;
680
+ if (api !== null && api !== void 0 && (_api$limitedMode4 = api.limitedMode) !== null && _api$limitedMode4 !== void 0 && (_api$limitedMode4 = _api$limitedMode4.sharedState.currentState()) !== null && _api$limitedMode4 !== void 0 && _api$limitedMode4.enabled) {
667
681
  return;
668
682
  }
669
683
  (0, _performanceMeasures.startMeasure)(EDITOR_BLOCKS_DRAG_INIT);
@@ -680,8 +694,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
680
694
  })));
681
695
  },
682
696
  dragend: function dragend(view) {
683
- var _api$limitedMode4, _key$getState3;
684
- if (api !== null && api !== void 0 && (_api$limitedMode4 = api.limitedMode) !== null && _api$limitedMode4 !== void 0 && (_api$limitedMode4 = _api$limitedMode4.sharedState.currentState()) !== null && _api$limitedMode4 !== void 0 && _api$limitedMode4.enabled) {
697
+ var _api$limitedMode5, _key$getState3;
698
+ if (api !== null && api !== void 0 && (_api$limitedMode5 = api.limitedMode) !== null && _api$limitedMode5 !== void 0 && (_api$limitedMode5 = _api$limitedMode5.sharedState.currentState()) !== null && _api$limitedMode5 !== void 0 && _api$limitedMode5.enabled) {
685
699
  return;
686
700
  }
687
701
  var state = view.state,
@@ -701,23 +715,23 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
701
715
  }
702
716
  },
703
717
  mouseover: function mouseover(view, event) {
704
- var _api$limitedMode5;
705
- if (api !== null && api !== void 0 && (_api$limitedMode5 = api.limitedMode) !== null && _api$limitedMode5 !== void 0 && (_api$limitedMode5 = _api$limitedMode5.sharedState.currentState()) !== null && _api$limitedMode5 !== void 0 && _api$limitedMode5.enabled) {
718
+ var _api$limitedMode6;
719
+ if (api !== null && api !== void 0 && (_api$limitedMode6 = api.limitedMode) !== null && _api$limitedMode6 !== void 0 && (_api$limitedMode6 = _api$limitedMode6.sharedState.currentState()) !== null && _api$limitedMode6 !== void 0 && _api$limitedMode6.enabled) {
706
720
  return;
707
721
  }
708
722
  (0, _handleMouseOver.handleMouseOver)(view, event, api);
709
723
  return false;
710
724
  },
711
725
  mousedown: function mousedown(view, event) {
712
- var _api$limitedMode6;
713
- if (api !== null && api !== void 0 && (_api$limitedMode6 = api.limitedMode) !== null && _api$limitedMode6 !== void 0 && (_api$limitedMode6 = _api$limitedMode6.sharedState.currentState()) !== null && _api$limitedMode6 !== void 0 && _api$limitedMode6.enabled) {
726
+ var _api$limitedMode7;
727
+ if (api !== null && api !== void 0 && (_api$limitedMode7 = api.limitedMode) !== null && _api$limitedMode7 !== void 0 && (_api$limitedMode7 = _api$limitedMode7.sharedState.currentState()) !== null && _api$limitedMode7 !== void 0 && _api$limitedMode7.enabled) {
714
728
  return;
715
729
  }
716
730
  return (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _handleMouseDown.handleMouseDown)(api)(view, event) : undefined;
717
731
  },
718
732
  keydown: function keydown(view, event) {
719
- var _api$limitedMode7;
720
- if (api !== null && api !== void 0 && (_api$limitedMode7 = api.limitedMode) !== null && _api$limitedMode7 !== void 0 && (_api$limitedMode7 = _api$limitedMode7.sharedState.currentState()) !== null && _api$limitedMode7 !== void 0 && _api$limitedMode7.enabled) {
733
+ var _api$limitedMode8;
734
+ if (api !== null && api !== void 0 && (_api$limitedMode8 = api.limitedMode) !== null && _api$limitedMode8 !== void 0 && (_api$limitedMode8 = _api$limitedMode8.sharedState.currentState()) !== null && _api$limitedMode8 !== void 0 && _api$limitedMode8.enabled) {
721
735
  return;
722
736
  }
723
737
  if (isMultiSelectEnabled) {
@@ -743,7 +757,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
743
757
  }
744
758
  }
745
759
  if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
746
- var isDragHandle = event.target.closest('[data-editor-block-ctrl-drag-handle="true"]') !== null;
760
+ var isDragHandle = event.target.closest((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? _styles.DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle="true"]') !== null;
747
761
  api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
748
762
  }
749
763
  if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
@@ -780,7 +794,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
780
794
  }
781
795
  }
782
796
  if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
783
- var _isDragHandle = event.target.closest('[data-editor-block-ctrl-drag-handle="true"]') !== null;
797
+ var _isDragHandle = event.target.closest((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? _styles.DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle="true"]') !== null;
784
798
  api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(_isDragHandle));
785
799
  }
786
800
  if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
@@ -792,8 +806,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
792
806
  }
793
807
  },
794
808
  keyup: function keyup(view, event) {
795
- var _api$limitedMode8;
796
- if (api !== null && api !== void 0 && (_api$limitedMode8 = api.limitedMode) !== null && _api$limitedMode8 !== void 0 && (_api$limitedMode8 = _api$limitedMode8.sharedState.currentState()) !== null && _api$limitedMode8 !== void 0 && _api$limitedMode8.enabled) {
809
+ var _api$limitedMode9;
810
+ if (api !== null && api !== void 0 && (_api$limitedMode9 = api.limitedMode) !== null && _api$limitedMode9 !== void 0 && (_api$limitedMode9 = _api$limitedMode9.sharedState.currentState()) !== null && _api$limitedMode9 !== void 0 && _api$limitedMode9.enabled) {
797
811
  return;
798
812
  }
799
813
  if (!event.repeat && event.key === 'Shift') {
@@ -803,8 +817,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
803
817
  }
804
818
  },
805
819
  blur: function blur(view, event) {
806
- var _api$limitedMode9;
807
- if (api !== null && api !== void 0 && (_api$limitedMode9 = api.limitedMode) !== null && _api$limitedMode9 !== void 0 && (_api$limitedMode9 = _api$limitedMode9.sharedState.currentState()) !== null && _api$limitedMode9 !== void 0 && _api$limitedMode9.enabled) {
820
+ var _api$limitedMode0;
821
+ if (api !== null && api !== void 0 && (_api$limitedMode0 = api.limitedMode) !== null && _api$limitedMode0 !== void 0 && (_api$limitedMode0 = _api$limitedMode0.sharedState.currentState()) !== null && _api$limitedMode0 !== void 0 && _api$limitedMode0.enabled) {
808
822
  return;
809
823
  }
810
824
  if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
@@ -834,7 +848,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
834
848
  var editorContentArea = editorView.dom.closest('.fabric-editor-popup-scroll-parent');
835
849
 
836
850
  // Use ResizeObserver to observe resizer (scroll-parent typically grows when resizing) and editor width changes
837
- var resizeObserverWidth = new ResizeObserver((0, _rafSchd.default)(function (entries) {
851
+ resizeObserverWidth = new ResizeObserver((0, _rafSchd.default)(function (entries) {
838
852
  var pluginState = key.getState(editorView.state);
839
853
  if (!(pluginState !== null && pluginState !== void 0 && pluginState.isDragging)) {
840
854
  var isResizerResizing = !!dom.querySelector('.is-resizing');
@@ -863,13 +877,14 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
863
877
  }
864
878
 
865
879
  // Start pragmatic monitors
866
- var pragmaticCleanup = destroyFn(api, editorView);
880
+ pragmaticCleanup = destroyFn(api, editorView);
867
881
  return {
868
882
  destroy: function destroy() {
883
+ var _pragmaticCleanup;
869
884
  if (editorContentArea) {
870
885
  resizeObserverWidth.unobserve(editorContentArea);
871
886
  }
872
- pragmaticCleanup();
887
+ (_pragmaticCleanup = pragmaticCleanup) === null || _pragmaticCleanup === void 0 || _pragmaticCleanup();
873
888
  }
874
889
  };
875
890
  }
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.shouldMaskNodeControls = exports.shouldBeSticky = exports.getTopPosition = exports.getNodeHeight = exports.getLeftPosition = exports.getControlHeightCSSValue = exports.getControlBottomCSSValue = void 0;
7
+ var _styles = require("@atlaskit/editor-common/styles");
7
8
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
8
9
  var _consts = require("../../ui/consts");
9
10
  var STICKY_NODES = ['panel', 'table', 'expand', 'layoutSection', 'bodiedExtension'];
@@ -42,14 +43,14 @@ var getLeftPosition = exports.getLeftPosition = function getLeftPosition(dom, ty
42
43
  return 'auto';
43
44
  }
44
45
  if (!innerContainer) {
45
- return type === 'layoutColumn' ? "".concat(dom.offsetLeft + dom.clientWidth / 2 - _consts.DRAG_HANDLE_HEIGHT / 2, "px") : "".concat(dom.offsetLeft - (0, _consts.dragHandleGap)(type, parentType) - _consts.DRAG_HANDLE_WIDTH, "px");
46
+ return type === 'layoutColumn' ? "".concat(dom.offsetLeft + dom.clientWidth / 2 - _consts.DRAG_HANDLE_HEIGHT / 2, "px") : "".concat(dom.offsetLeft - (0, _consts.dragHandleGap)(type, parentType) - _styles.DRAG_HANDLE_WIDTH, "px");
46
47
  }
47
48
 
48
49
  // There is a showMacroInteractionDesignUpdates prop in extension node wrapper that can add a relative span under the top level div
49
50
  // We need to adjust the left offset position of the drag handle to account for the relative span
50
51
  var relativeSpan = macroInteractionUpdates ? dom.querySelector('span.relative') : null;
51
52
  var leftAdjustment = relativeSpan ? relativeSpan.offsetLeft : 0;
52
- return getComputedStyle(innerContainer).transform === 'none' ? "".concat(innerContainer.offsetLeft + leftAdjustment - (0, _consts.dragHandleGap)(type, parentType) - _consts.DRAG_HANDLE_WIDTH, "px") : "".concat(innerContainer.offsetLeft + leftAdjustment - innerContainer.offsetWidth / 2 - (0, _consts.dragHandleGap)(type, parentType) - _consts.DRAG_HANDLE_WIDTH, "px");
53
+ return getComputedStyle(innerContainer).transform === 'none' ? "".concat(innerContainer.offsetLeft + leftAdjustment - (0, _consts.dragHandleGap)(type, parentType) - _styles.DRAG_HANDLE_WIDTH, "px") : "".concat(innerContainer.offsetLeft + leftAdjustment - innerContainer.offsetWidth / 2 - (0, _consts.dragHandleGap)(type, parentType) - _styles.DRAG_HANDLE_WIDTH, "px");
53
54
  };
54
55
 
55
56
  // anchorRectCache seems to have a 100% cache miss rate
@@ -4,19 +4,19 @@ 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_WIDTH = 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 = exports.BLOCK_MENU_WIDTH = exports.BLOCK_MENU_ENABLED = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _styles = require("@atlaskit/editor-common/styles");
9
10
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
10
11
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
11
12
  var _dropTargetMarginMap;
12
13
  var DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_HEIGHT = 24;
13
- var DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_WIDTH = 12;
14
14
  var DRAG_HANDLE_BORDER_RADIUS = exports.DRAG_HANDLE_BORDER_RADIUS = 4;
15
15
  var DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_ZINDEX = _editorSharedStyles.akRichMediaResizeZIndex + _editorSharedStyles.akEditorUnitZIndex; //place above legacy resizer
16
16
  var DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_DEFAULT_GAP = 8;
17
17
  var DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_NARROW_GAP = 4;
18
18
  var DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_MAX_GAP = 12;
19
- var DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = DRAG_HANDLE_WIDTH + DRAG_HANDLE_MAX_GAP;
19
+ var DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = _styles.DRAG_HANDLE_WIDTH + DRAG_HANDLE_MAX_GAP;
20
20
  var DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = 4 + 2; // 4px for the divider vertical padding and 2px for the divider height
21
21
  var DRAG_HANDLE_H1_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H1_TOP_ADJUSTMENT = 5;
22
22
  var DRAG_HANDLE_H2_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H2_TOP_ADJUSTMENT = 2;
@@ -94,7 +94,7 @@ var getNestedNodeLeftPaddingMargin = exports.getNestedNodeLeftPaddingMargin = fu
94
94
  case 'tableHeader':
95
95
  return '8px';
96
96
  default:
97
- return "".concat(DRAG_HANDLE_WIDTH + DRAG_HANDLE_NARROW_GAP, "px");
97
+ return "".concat(_styles.DRAG_HANDLE_WIDTH + DRAG_HANDLE_NARROW_GAP, "px");
98
98
  }
99
99
  };
100
100
  var topPositionAdjustment = exports.topPositionAdjustment = function topPositionAdjustment(nodeType) {
@@ -108,7 +108,7 @@ var dragHandleButtonStyles = (0, _react2.css)({
108
108
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
109
109
  height: _consts2.DRAG_HANDLE_HEIGHT,
110
110
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
111
- width: _consts2.DRAG_HANDLE_WIDTH,
111
+ width: _styles.DRAG_HANDLE_WIDTH,
112
112
  border: 'none',
113
113
  background: 'transparent',
114
114
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
@@ -154,7 +154,7 @@ var dragHandleButtonStylesOld = (0, _react2.css)({
154
154
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
155
155
  height: _consts2.DRAG_HANDLE_HEIGHT,
156
156
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
157
- width: _consts2.DRAG_HANDLE_WIDTH,
157
+ width: _styles.DRAG_HANDLE_WIDTH,
158
158
  border: 'none',
159
159
  background: 'transparent',
160
160
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
@@ -675,8 +675,8 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
675
675
  if (supportsAnchor) {
676
676
  var bottom = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlBottomCSSValue)(safeAnchorName, isSticky, isTopLevelNode, isLayoutColumn) : {};
677
677
  return _objectSpread({
678
- left: isEdgeCase ? "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(safeAnchorName, " right) + anchor(").concat(safeAnchorName, " left))/2 - ").concat(_consts2.DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(_consts2.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts2.dragHandleGap)(nodeType, parentNodeType), "px)"),
679
- top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_consts2.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _consts2.topPositionAdjustment)(nodeType), "px)")
678
+ left: isEdgeCase ? "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(safeAnchorName, " right) + anchor(").concat(safeAnchorName, " left))/2 - ").concat(_consts2.DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts2.dragHandleGap)(nodeType, parentNodeType), "px)"),
679
+ top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _consts2.topPositionAdjustment)(nodeType), "px)")
680
680
  }, bottom);
681
681
  }
682
682
  var height = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlHeightCSSValue)((0, _dragHandlePositions.getNodeHeight)(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNode, "".concat(_consts2.DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
@@ -721,8 +721,8 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
721
721
  if (supportsAnchor) {
722
722
  var bottom = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlBottomCSSValue)(safeAnchorName, isSticky, isTopLevelNode, isLayoutColumn) : {};
723
723
  return _objectSpread({
724
- left: isEdgeCase ? "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(safeAnchorName, " right) + anchor(").concat(safeAnchorName, " left))/2 - ").concat(_consts2.DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(_consts2.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts2.dragHandleGap)(nodeType, parentNodeType), "px)"),
725
- top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_consts2.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _consts2.topPositionAdjustment)(nodeType), "px)")
724
+ left: isEdgeCase ? "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(safeAnchorName, " right) + anchor(").concat(safeAnchorName, " left))/2 - ").concat(_consts2.DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts2.dragHandleGap)(nodeType, parentNodeType), "px)"),
725
+ top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _consts2.topPositionAdjustment)(nodeType), "px)")
726
726
  }, bottom);
727
727
  }
728
728
  var height = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlHeightCSSValue)((0, _dragHandlePositions.getNodeHeight)(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNode, "".concat(_consts2.DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
@@ -74,13 +74,13 @@ var extendedHoverZone = function extendedHoverZone() {
74
74
  content: '""',
75
75
  position: 'absolute',
76
76
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
77
- top: "".concat(-_consts.DRAG_HANDLE_WIDTH / 2, "px"),
77
+ top: "".concat(-_styles.DRAG_HANDLE_WIDTH / 2, "px"),
78
78
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
79
79
  left: 0,
80
80
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
81
81
  width: '100%',
82
82
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
83
- height: "".concat(_consts.DRAG_HANDLE_WIDTH, "px"),
83
+ height: "".concat(_styles.DRAG_HANDLE_WIDTH, "px"),
84
84
  cursor: 'default',
85
85
  zIndex: 1
86
86
  })), 'hr[data-drag-handler-anchor-name]', {
@@ -55,14 +55,14 @@ export const blockControlsPlugin = ({
55
55
  rootAnchorName,
56
56
  rootNodeType
57
57
  },
58
- closeMenu: editorExperiment('platform_editor_controls', 'variant1') ? true : undefined
58
+ closeMenu: editorExperiment('platform_editor_controls', 'variant1') && !expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? true : undefined
59
59
  });
60
60
  return tr;
61
61
  },
62
62
  toggleBlockMenu: options => ({
63
63
  tr
64
64
  }) => {
65
- var _options$anchorName;
65
+ var _options$anchorName, _api$blockControls, _api$blockControls$sh;
66
66
  const currMeta = tr.getMeta(key);
67
67
  if (options !== null && options !== void 0 && options.closeMenu) {
68
68
  tr.setMeta(key, {
@@ -86,12 +86,24 @@ export const blockControlsPlugin = ({
86
86
  anchorName: options === null || options === void 0 ? void 0 : options.anchorName
87
87
  }
88
88
  });
89
+ const menuTriggerBy = api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : (_api$blockControls$sh = _api$blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.menuTriggerBy;
90
+ if (menuTriggerBy === undefined || !!menuTriggerBy && menuTriggerBy === (options === null || options === void 0 ? void 0 : options.anchorName)) {
91
+ var _api$userIntent, _api$userIntent$share;
92
+ // Toggled from drag handle
93
+ const currentUserIntent = api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : (_api$userIntent$share = _api$userIntent.sharedState.currentState()) === null || _api$userIntent$share === void 0 ? void 0 : _api$userIntent$share.currentUserIntent;
94
+ if (currentUserIntent === 'blockMenuOpen') {
95
+ var _api$userIntent2;
96
+ api === null || api === void 0 ? void 0 : (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('default')({
97
+ tr
98
+ });
99
+ }
100
+ }
89
101
  return tr;
90
102
  },
91
103
  setNodeDragged: (getPos, anchorName, nodeType) => ({
92
104
  tr
93
105
  }) => {
94
- var _api$userIntent;
106
+ var _api$userIntent3;
95
107
  const pos = getPos();
96
108
  if (pos === undefined) {
97
109
  return tr;
@@ -115,7 +127,7 @@ export const blockControlsPlugin = ({
115
127
  tr
116
128
  });
117
129
  }
118
- api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('dragging')({
130
+ api === null || api === void 0 ? void 0 : (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 ? void 0 : _api$userIntent3.commands.setCurrentUserIntent('dragging')({
119
131
  tr
120
132
  });
121
133
  return tr;
@@ -97,7 +97,9 @@ export const createDropTargetDecoration = (pos, props, nodeViewPortalProviderAPI
97
97
  getPos,
98
98
  anchorRectCache,
99
99
  isSameLayout
100
- }), element, key);
100
+ }), element, key, undefined,
101
+ // @portal-render-immediately
102
+ true);
101
103
  return element;
102
104
  }, {
103
105
  type: TYPE_DROP_TARGET_DEC,
@@ -127,7 +129,9 @@ export const createLayoutDropTargetDecoration = (pos, props, nodeViewPortalProvi
127
129
  ...props,
128
130
  getPos,
129
131
  anchorRectCache
130
- }), element, key);
132
+ }), element, key, undefined,
133
+ // @portal-render-immediately
134
+ true);
131
135
  return element;
132
136
  }, {
133
137
  type: TYPE_DROP_TARGET_DEC,
@@ -90,7 +90,9 @@ export const quickInsertButtonDecoration = ({
90
90
  rootAnchorName,
91
91
  rootNodeType: rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType,
92
92
  anchorRectCache
93
- }), element, key);
93
+ }), element, key, undefined,
94
+ // @portal-render-immediately
95
+ true);
94
96
  return element;
95
97
  }, widgetSpec);
96
98
  };
@@ -1,3 +1,5 @@
1
+ import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles';
2
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
1
3
  export const handleMouseDown = api => (view, event) => {
2
4
  if (!(event.target instanceof HTMLElement)) {
3
5
  return false;
@@ -13,7 +15,7 @@ export const handleMouseDown = api => (view, event) => {
13
15
  }
14
16
  api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.showDragHandleAt(rootPos, '', (_rootNode$type$name = rootNode.type.name) !== null && _rootNode$type$name !== void 0 ? _rootNode$type$name : '', undefined, rootPos, '', (_rootNode$type$name2 = rootNode.type.name) !== null && _rootNode$type$name2 !== void 0 ? _rootNode$type$name2 : ''));
15
17
  } else {
16
- const isDragHandle = event.target.closest('[data-editor-block-ctrl-drag-handle]') !== null;
18
+ const isDragHandle = event.target.closest(expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle]') !== null;
17
19
  api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
18
20
  }
19
21
  return false;
@@ -126,7 +126,8 @@ export const handleMouseOver = (view, event, api) => {
126
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));
127
127
  }
128
128
  if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
129
- if (isMenuOpen && originalAnchorName) {
129
+ var _api$userIntent, _api$userIntent$share;
130
+ if (isMenuOpen && originalAnchorName && (api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : (_api$userIntent$share = _api$userIntent.sharedState.currentState()) === null || _api$userIntent$share === void 0 ? void 0 : _api$userIntent$share.currentUserIntent) === 'blockMenuOpen') {
130
131
  var _api$core3, _api$blockControls4;
131
132
  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
  }