@atlaskit/editor-plugin-block-controls 3.19.14 → 3.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/blockControlsPlugin.js +3 -1
  3. package/dist/cjs/pm-plugins/decorations-drop-target-active.js +7 -7
  4. package/dist/cjs/pm-plugins/decorations-find-surrounding-nodes.js +4 -2
  5. package/dist/cjs/pm-plugins/main.js +9 -3
  6. package/dist/cjs/ui/global-styles.js +15 -2
  7. package/dist/es2019/blockControlsPlugin.js +3 -1
  8. package/dist/es2019/pm-plugins/decorations-drop-target-active.js +7 -7
  9. package/dist/es2019/pm-plugins/decorations-find-surrounding-nodes.js +4 -2
  10. package/dist/es2019/pm-plugins/main.js +9 -3
  11. package/dist/es2019/ui/global-styles.js +19 -2
  12. package/dist/esm/blockControlsPlugin.js +3 -1
  13. package/dist/esm/pm-plugins/decorations-drop-target-active.js +7 -7
  14. package/dist/esm/pm-plugins/decorations-find-surrounding-nodes.js +4 -2
  15. package/dist/esm/pm-plugins/main.js +9 -3
  16. package/dist/esm/ui/global-styles.js +15 -2
  17. package/dist/types/pm-plugins/decorations-drag-handle.d.ts +1 -1
  18. package/dist/types/pm-plugins/decorations-drop-target-active.d.ts +3 -2
  19. package/dist/types/pm-plugins/decorations-quick-insert-button.d.ts +2 -2
  20. package/dist/types/pm-plugins/interaction-tracking/handle-key-down.d.ts +1 -1
  21. package/dist/types/pm-plugins/keymap.d.ts +1 -1
  22. package/dist/types/pm-plugins/quick-insert-calculate-position.d.ts +1 -1
  23. package/dist/types/pm-plugins/utils/check-fragment.d.ts +1 -1
  24. package/dist/types/pm-plugins/utils/drag-handle-positions.d.ts +1 -1
  25. package/dist/types/pm-plugins/utils/getSelection.d.ts +2 -2
  26. package/dist/types/pm-plugins/vanilla-quick-insert.d.ts +1 -1
  27. package/dist/types/ui/block-menu.d.ts +1 -1
  28. package/dist/types/ui/drag-handle.d.ts +1 -1
  29. package/dist/types/ui/global-styles.d.ts +5 -1
  30. package/dist/types/ui/quick-insert-button.d.ts +1 -1
  31. package/dist/types/ui/utils/anchor-name.d.ts +1 -1
  32. package/dist/types-ts4.5/pm-plugins/decorations-drag-handle.d.ts +1 -1
  33. package/dist/types-ts4.5/pm-plugins/decorations-drop-target-active.d.ts +3 -2
  34. package/dist/types-ts4.5/pm-plugins/decorations-quick-insert-button.d.ts +2 -2
  35. package/dist/types-ts4.5/pm-plugins/interaction-tracking/handle-key-down.d.ts +1 -1
  36. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
  37. package/dist/types-ts4.5/pm-plugins/quick-insert-calculate-position.d.ts +1 -1
  38. package/dist/types-ts4.5/pm-plugins/utils/check-fragment.d.ts +1 -1
  39. package/dist/types-ts4.5/pm-plugins/utils/drag-handle-positions.d.ts +1 -1
  40. package/dist/types-ts4.5/pm-plugins/utils/getSelection.d.ts +2 -2
  41. package/dist/types-ts4.5/pm-plugins/vanilla-quick-insert.d.ts +1 -1
  42. package/dist/types-ts4.5/ui/block-menu.d.ts +1 -1
  43. package/dist/types-ts4.5/ui/drag-handle.d.ts +1 -1
  44. package/dist/types-ts4.5/ui/global-styles.d.ts +5 -1
  45. package/dist/types-ts4.5/ui/quick-insert-button.d.ts +1 -1
  46. package/dist/types-ts4.5/ui/utils/anchor-name.d.ts +1 -1
  47. package/package.json +6 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 3.20.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#181590](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/181590)
8
+ [`d44ad3c53ed98`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d44ad3c53ed98) -
9
+ ED-28433 fix drop zone after performance optimzations
10
+
3
11
  ## 3.19.14
4
12
 
5
13
  ### Patch Changes
@@ -216,7 +216,9 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
216
216
  api: api
217
217
  }) : /*#__PURE__*/_react.default.createElement(_dragHandleMenu.DragHandleMenu, {
218
218
  api: api
219
- }), /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, null));
219
+ }), /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, {
220
+ api: api
221
+ }));
220
222
  }
221
223
  };
222
224
  };
@@ -59,7 +59,7 @@ var canMoveNodeOrSliceToPos = exports.canMoveNodeOrSliceToPos = function canMove
59
59
  }
60
60
  return true;
61
61
  };
62
- var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = function getActiveDropTargetDecorations(activeDropTargetNode, state, api, existingDecs, formatMessage, nodeViewPortalProviderAPI, activeNode) {
62
+ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = function getActiveDropTargetDecorations(activeDropTargetNode, state, api, existingDecs, formatMessage, nodeViewPortalProviderAPI, activeNode, anchorRectCache) {
63
63
  if (!(0, _platformFeatureFlags.fg)('platform_editor_block_controls_drop_target_mem_fix')) {
64
64
  (0, _decorationsCommon.unmountDecorations)(nodeViewPortalProviderAPI, 'data-blocks-drop-target-container', 'data-blocks-drop-target-key');
65
65
  }
@@ -105,7 +105,7 @@ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = fu
105
105
  parentNode: node,
106
106
  formatMessage: formatMessage,
107
107
  dropTargetStyle: isEmptyContainer ? 'remainingHeight' : 'default'
108
- }, nodeViewPortalProviderAPI, 1));
108
+ }, nodeViewPortalProviderAPI, 1, anchorRectCache));
109
109
  }
110
110
  }
111
111
 
@@ -130,7 +130,7 @@ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = fu
130
130
  parentNode: node,
131
131
  formatMessage: formatMessage,
132
132
  dropTargetStyle: 'remainingHeight'
133
- }, nodeViewPortalProviderAPI, -1));
133
+ }, nodeViewPortalProviderAPI, -1, anchorRectCache));
134
134
  }
135
135
  }
136
136
  }
@@ -157,7 +157,7 @@ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = fu
157
157
  parentNode: parent || undefined,
158
158
  formatMessage: formatMessage,
159
159
  dropTargetStyle: shouldShowFullHeight ? 'remainingHeight' : 'default'
160
- }, nodeViewPortalProviderAPI, -1, undefined, isSameLayout));
160
+ }, nodeViewPortalProviderAPI, -1, anchorRectCache, isSameLayout));
161
161
  }
162
162
  }
163
163
 
@@ -177,7 +177,7 @@ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = fu
177
177
  parentNode: parent || undefined,
178
178
  formatMessage: formatMessage,
179
179
  dropTargetStyle: shouldShowFullHeight ? 'remainingHeight' : 'default'
180
- }, nodeViewPortalProviderAPI, -1, undefined, isSameLayout));
180
+ }, nodeViewPortalProviderAPI, -1, anchorRectCache, isSameLayout));
181
181
  }
182
182
  }
183
183
  }
@@ -202,7 +202,7 @@ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = fu
202
202
  parentNode: state.doc || undefined,
203
203
  formatMessage: formatMessage,
204
204
  dropTargetStyle: 'default'
205
- }, nodeViewPortalProviderAPI, -1, undefined, false));
205
+ }, nodeViewPortalProviderAPI, -1, anchorRectCache, false));
206
206
  }
207
207
  rootNodeWithPos = {
208
208
  node: root.node,
@@ -228,7 +228,7 @@ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = fu
228
228
  api: api,
229
229
  parent: parent,
230
230
  formatMessage: formatMessage
231
- }, nodeViewPortalProviderAPI, undefined));
231
+ }, nodeViewPortalProviderAPI, anchorRectCache));
232
232
  }
233
233
  }
234
234
  return false;
@@ -4,8 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.findSurroundingNodes = void 0;
7
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
7
8
  var IGNORE_NODES = ['tableRow', 'listItem', 'caption', 'media'];
8
9
  var blockLeafNodes = ['blockCard', 'rule'];
10
+ var blockLeafNodesNext = ['blockCard', 'rule', 'extension'];
9
11
  var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
10
12
 
11
13
  /**
@@ -19,9 +21,9 @@ var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
19
21
  */
20
22
  var _findSurroundingNodes = exports.findSurroundingNodes = function findSurroundingNodes(state, $pos, nodeType) {
21
23
  var depth = $pos.depth;
22
-
24
+ var blockLeafNodeList = (0, _platformFeatureFlags.fg)('platform_editor_block_controls_perf_opt_patch_1') ? blockLeafNodesNext : blockLeafNodes;
23
25
  // special cases like hr rule here
24
- if (blockLeafNodes.includes(nodeType || '') || $pos.pos === 0) {
26
+ if (blockLeafNodeList.includes(nodeType || '') || $pos.pos === 0) {
25
27
  var _parent = $pos.node(depth);
26
28
  var _node = $pos.nodeAfter;
27
29
  var _index = $pos.index();
@@ -472,7 +472,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
472
472
  if (meta !== null && meta !== void 0 && meta.activeDropTargetNode) {
473
473
  currentActiveDropTargetNode = meta === null || meta === void 0 ? void 0 : meta.activeDropTargetNode;
474
474
  var _oldDropTargetDecs = (0, _decorationsDropTarget.findDropTargetDecs)(decorations);
475
- var _getActiveDropTargetD = (0, _decorationsDropTargetActive.getActiveDropTargetDecorations)(meta.activeDropTargetNode, newState, api, _oldDropTargetDecs, formatMessage, nodeViewPortalProviderAPI, latestActiveNode),
475
+ var _getActiveDropTargetD = (0, _decorationsDropTargetActive.getActiveDropTargetDecorations)(meta.activeDropTargetNode, newState, api, _oldDropTargetDecs, formatMessage, nodeViewPortalProviderAPI, latestActiveNode, anchorRectCache),
476
476
  decsToAdd = _getActiveDropTargetD.decsToAdd,
477
477
  decsToRemove = _getActiveDropTargetD.decsToRemove;
478
478
  decorations = decorations.remove(decsToRemove);
@@ -648,12 +648,18 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
648
648
  }
649
649
  },
650
650
  dragstart: function dragstart(view) {
651
- var _anchorRectCache;
651
+ var _anchorRectCache2;
652
652
  (0, _performanceMeasures.startMeasure)(EDITOR_BLOCKS_DRAG_INIT);
653
653
  if (isAdvancedLayoutEnabled) {
654
654
  _activeAnchorTracker.defaultActiveAnchorTracker.reset();
655
655
  }
656
- (_anchorRectCache = anchorRectCache) === null || _anchorRectCache === void 0 || _anchorRectCache.setEditorView(view);
656
+ if ((0, _expValEquals.expValEquals)('platform_editor_block_controls_perf_optimization', 'isEnabled', true)) {
657
+ if ((0, _platformFeatureFlags.fg)('platform_editor_block_controls_perf_opt_patch_1')) {
658
+ var _anchorRectCache;
659
+ (_anchorRectCache = anchorRectCache) === null || _anchorRectCache === void 0 || _anchorRectCache.clear();
660
+ }
661
+ }
662
+ (_anchorRectCache2 = anchorRectCache) === null || _anchorRectCache2 === void 0 || _anchorRectCache2.setEditorView(view);
657
663
  view.dispatch(view.state.tr.setMeta(key, _objectSpread(_objectSpread({}, view.state.tr.getMeta(key)), {}, {
658
664
  isPMDragging: true
659
665
  })));
@@ -8,10 +8,12 @@ exports.GlobalStylesWrapper = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _react = require("@emotion/react");
10
10
  var _styles = require("@atlaskit/editor-common/styles");
11
+ var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
11
12
  var _whitespace = require("@atlaskit/editor-common/whitespace");
12
13
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
13
14
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _constants = require("@atlaskit/theme/constants");
16
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
15
17
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
16
18
  var _consts = require("./consts");
17
19
  /**
@@ -88,6 +90,13 @@ var extendedHoverZone = function extendedHoverZone() {
88
90
  display: 'none'
89
91
  }));
90
92
  };
93
+ var extendedDragZone = (0, _react.css)({
94
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
95
+ '.ProseMirror': (0, _defineProperty2.default)({}, "&& [data-drag-handler-anchor-depth=\"0\"]".concat(dragHandlerAnchorSelector, "::after"), {
96
+ width: 'var(--ak-editor-max-container-width)',
97
+ left: "calc((100% - var(--ak-editor-max-container-width))/2)"
98
+ })
99
+ });
91
100
  var paragraphWithTrailingBreakAsOnlyChild = '+ :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
92
101
  var indentatedParagraphWithTrailingBreakAsOnlyChild = '+ div.fabric-editor-indentation-mark > :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
93
102
  var paragraphWithPlaceholder = '+ p > .placeholder-decoration';
@@ -292,8 +301,12 @@ var blockCardWithoutLayout = (0, _react.css)({
292
301
  '--ak-editor-block-card-width': 'max(var(--ak-editor--legacy-breakout-wide-layout-width), var(--ak-editor--line-length))'
293
302
  }
294
303
  });
295
- var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper() {
304
+ var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
305
+ var api = _ref.api;
306
+ var isDragging = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockControls.isDragging', {
307
+ disabled: !(0, _expValEquals.expValEquals)('platform_editor_block_controls_perf_optimization', 'isEnabled', true) || !(0, _platformFeatureFlags.fg)('platform_editor_block_controls_perf_opt_patch_1')
308
+ });
296
309
  return (0, _react.jsx)(_react.Global, {
297
- styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_widget_visibility') ? 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]
310
+ styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_widget_visibility') ? 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]
298
311
  });
299
312
  };
@@ -208,6 +208,8 @@ export const blockControlsPlugin = ({
208
208
  api: api
209
209
  }) : /*#__PURE__*/React.createElement(DragHandleMenu, {
210
210
  api: api
211
- }), /*#__PURE__*/React.createElement(GlobalStylesWrapper, null));
211
+ }), /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
212
+ api: api
213
+ }));
212
214
  }
213
215
  });
@@ -55,7 +55,7 @@ export const canMoveNodeOrSliceToPos = (state, node, parent, index, $toPos, acti
55
55
  }
56
56
  return true;
57
57
  };
58
- export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api, existingDecs, formatMessage, nodeViewPortalProviderAPI, activeNode) => {
58
+ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api, existingDecs, formatMessage, nodeViewPortalProviderAPI, activeNode, anchorRectCache) => {
59
59
  if (!fg('platform_editor_block_controls_drop_target_mem_fix')) {
60
60
  unmountDecorations(nodeViewPortalProviderAPI, 'data-blocks-drop-target-container', 'data-blocks-drop-target-key');
61
61
  }
@@ -96,7 +96,7 @@ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api,
96
96
  parentNode: node,
97
97
  formatMessage,
98
98
  dropTargetStyle: isEmptyContainer ? 'remainingHeight' : 'default'
99
- }, nodeViewPortalProviderAPI, 1));
99
+ }, nodeViewPortalProviderAPI, 1, anchorRectCache));
100
100
  }
101
101
  }
102
102
 
@@ -119,7 +119,7 @@ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api,
119
119
  parentNode: node,
120
120
  formatMessage,
121
121
  dropTargetStyle: 'remainingHeight'
122
- }, nodeViewPortalProviderAPI, -1));
122
+ }, nodeViewPortalProviderAPI, -1, anchorRectCache));
123
123
  }
124
124
  }
125
125
  }
@@ -144,7 +144,7 @@ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api,
144
144
  parentNode: parent || undefined,
145
145
  formatMessage,
146
146
  dropTargetStyle: shouldShowFullHeight ? 'remainingHeight' : 'default'
147
- }, nodeViewPortalProviderAPI, -1, undefined, isSameLayout));
147
+ }, nodeViewPortalProviderAPI, -1, anchorRectCache, isSameLayout));
148
148
  }
149
149
  }
150
150
 
@@ -162,7 +162,7 @@ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api,
162
162
  parentNode: parent || undefined,
163
163
  formatMessage,
164
164
  dropTargetStyle: shouldShowFullHeight ? 'remainingHeight' : 'default'
165
- }, nodeViewPortalProviderAPI, -1, undefined, isSameLayout));
165
+ }, nodeViewPortalProviderAPI, -1, anchorRectCache, isSameLayout));
166
166
  }
167
167
  }
168
168
  }
@@ -185,7 +185,7 @@ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api,
185
185
  parentNode: state.doc || undefined,
186
186
  formatMessage,
187
187
  dropTargetStyle: 'default'
188
- }, nodeViewPortalProviderAPI, -1, undefined, false));
188
+ }, nodeViewPortalProviderAPI, -1, anchorRectCache, false));
189
189
  }
190
190
  rootNodeWithPos = {
191
191
  node: root.node,
@@ -209,7 +209,7 @@ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api,
209
209
  api,
210
210
  parent,
211
211
  formatMessage
212
- }, nodeViewPortalProviderAPI, undefined));
212
+ }, nodeViewPortalProviderAPI, anchorRectCache));
213
213
  }
214
214
  }
215
215
  return false;
@@ -1,5 +1,7 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  const IGNORE_NODES = ['tableRow', 'listItem', 'caption', 'media'];
2
3
  const blockLeafNodes = ['blockCard', 'rule'];
4
+ const blockLeafNodesNext = ['blockCard', 'rule', 'extension'];
3
5
  const DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
4
6
 
5
7
  /**
@@ -13,9 +15,9 @@ const DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
13
15
  */
14
16
  export const findSurroundingNodes = (state, $pos, nodeType) => {
15
17
  const depth = $pos.depth;
16
-
18
+ const blockLeafNodeList = fg('platform_editor_block_controls_perf_opt_patch_1') ? blockLeafNodesNext : blockLeafNodes;
17
19
  // special cases like hr rule here
18
- if (blockLeafNodes.includes(nodeType || '') || $pos.pos === 0) {
20
+ if (blockLeafNodeList.includes(nodeType || '') || $pos.pos === 0) {
19
21
  const parent = $pos.node(depth);
20
22
  const node = $pos.nodeAfter;
21
23
  const index = $pos.index();
@@ -474,7 +474,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
474
474
  const {
475
475
  decsToAdd,
476
476
  decsToRemove
477
- } = getActiveDropTargetDecorations(meta.activeDropTargetNode, newState, api, oldDropTargetDecs, formatMessage, nodeViewPortalProviderAPI, latestActiveNode);
477
+ } = getActiveDropTargetDecorations(meta.activeDropTargetNode, newState, api, oldDropTargetDecs, formatMessage, nodeViewPortalProviderAPI, latestActiveNode, anchorRectCache);
478
478
  decorations = decorations.remove(decsToRemove);
479
479
  if (decsToAdd.length > 0) {
480
480
  decorations = decorations.add(newState.doc, decsToAdd);
@@ -650,12 +650,18 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
650
650
  }
651
651
  },
652
652
  dragstart(view) {
653
- var _anchorRectCache;
653
+ var _anchorRectCache2;
654
654
  startMeasure(EDITOR_BLOCKS_DRAG_INIT);
655
655
  if (isAdvancedLayoutEnabled) {
656
656
  defaultActiveAnchorTracker.reset();
657
657
  }
658
- (_anchorRectCache = anchorRectCache) === null || _anchorRectCache === void 0 ? void 0 : _anchorRectCache.setEditorView(view);
658
+ if (expValEquals('platform_editor_block_controls_perf_optimization', 'isEnabled', true)) {
659
+ if (fg('platform_editor_block_controls_perf_opt_patch_1')) {
660
+ var _anchorRectCache;
661
+ (_anchorRectCache = anchorRectCache) === null || _anchorRectCache === void 0 ? void 0 : _anchorRectCache.clear();
662
+ }
663
+ }
664
+ (_anchorRectCache2 = anchorRectCache) === null || _anchorRectCache2 === void 0 ? void 0 : _anchorRectCache2.setEditorView(view);
659
665
  view.dispatch(view.state.tr.setMeta(key, {
660
666
  ...view.state.tr.getMeta(key),
661
667
  isPMDragging: true
@@ -5,10 +5,12 @@
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css, Global, jsx } from '@emotion/react';
7
7
  import { tableControlsSpacing } from '@atlaskit/editor-common/styles';
8
+ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
8
9
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
9
10
  import { akEditorBreakoutPadding, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
10
11
  import { fg } from '@atlaskit/platform-feature-flags';
11
12
  import { layers } from '@atlaskit/theme/constants';
13
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
14
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
15
  import { DRAG_HANDLE_MAX_WIDTH_PLUS_GAP, DRAG_HANDLE_WIDTH } from './consts';
14
16
 
@@ -95,6 +97,16 @@ const extendedHoverZone = () => css({
95
97
  display: 'none'
96
98
  }
97
99
  });
100
+ const extendedDragZone = css({
101
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
102
+ '.ProseMirror': {
103
+ // 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
104
+ [`&& [data-drag-handler-anchor-depth="0"]${dragHandlerAnchorSelector}::after`]: {
105
+ width: 'var(--ak-editor-max-container-width)',
106
+ left: `calc((100% - var(--ak-editor-max-container-width))/2)`
107
+ }
108
+ }
109
+ });
98
110
  const paragraphWithTrailingBreakAsOnlyChild = '+ :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
99
111
  const indentatedParagraphWithTrailingBreakAsOnlyChild = '+ div.fabric-editor-indentation-mark > :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
100
112
  const paragraphWithPlaceholder = '+ p > .placeholder-decoration';
@@ -321,8 +333,13 @@ const blockCardWithoutLayout = css({
321
333
  '--ak-editor-block-card-width': 'max(var(--ak-editor--legacy-breakout-wide-layout-width), var(--ak-editor--line-length))'
322
334
  }
323
335
  });
324
- export const GlobalStylesWrapper = () => {
336
+ export const GlobalStylesWrapper = ({
337
+ api
338
+ }) => {
339
+ const isDragging = useSharedPluginStateSelector(api, 'blockControls.isDragging', {
340
+ disabled: !expValEquals('platform_editor_block_controls_perf_optimization', 'isEnabled', true) || !fg('platform_editor_block_controls_perf_opt_patch_1')
341
+ });
325
342
  return jsx(Global, {
326
- styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_widget_visibility') ? 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]
343
+ styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_widget_visibility') ? 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]
327
344
  });
328
345
  };
@@ -209,7 +209,9 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
209
209
  api: api
210
210
  }) : /*#__PURE__*/React.createElement(DragHandleMenu, {
211
211
  api: api
212
- }), /*#__PURE__*/React.createElement(GlobalStylesWrapper, null));
212
+ }), /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
213
+ api: api
214
+ }));
213
215
  }
214
216
  };
215
217
  };
@@ -54,7 +54,7 @@ export var canMoveNodeOrSliceToPos = function canMoveNodeOrSliceToPos(state, nod
54
54
  }
55
55
  return true;
56
56
  };
57
- export var getActiveDropTargetDecorations = function getActiveDropTargetDecorations(activeDropTargetNode, state, api, existingDecs, formatMessage, nodeViewPortalProviderAPI, activeNode) {
57
+ export var getActiveDropTargetDecorations = function getActiveDropTargetDecorations(activeDropTargetNode, state, api, existingDecs, formatMessage, nodeViewPortalProviderAPI, activeNode, anchorRectCache) {
58
58
  if (!fg('platform_editor_block_controls_drop_target_mem_fix')) {
59
59
  unmountDecorations(nodeViewPortalProviderAPI, 'data-blocks-drop-target-container', 'data-blocks-drop-target-key');
60
60
  }
@@ -100,7 +100,7 @@ export var getActiveDropTargetDecorations = function getActiveDropTargetDecorati
100
100
  parentNode: node,
101
101
  formatMessage: formatMessage,
102
102
  dropTargetStyle: isEmptyContainer ? 'remainingHeight' : 'default'
103
- }, nodeViewPortalProviderAPI, 1));
103
+ }, nodeViewPortalProviderAPI, 1, anchorRectCache));
104
104
  }
105
105
  }
106
106
 
@@ -125,7 +125,7 @@ export var getActiveDropTargetDecorations = function getActiveDropTargetDecorati
125
125
  parentNode: node,
126
126
  formatMessage: formatMessage,
127
127
  dropTargetStyle: 'remainingHeight'
128
- }, nodeViewPortalProviderAPI, -1));
128
+ }, nodeViewPortalProviderAPI, -1, anchorRectCache));
129
129
  }
130
130
  }
131
131
  }
@@ -152,7 +152,7 @@ export var getActiveDropTargetDecorations = function getActiveDropTargetDecorati
152
152
  parentNode: parent || undefined,
153
153
  formatMessage: formatMessage,
154
154
  dropTargetStyle: shouldShowFullHeight ? 'remainingHeight' : 'default'
155
- }, nodeViewPortalProviderAPI, -1, undefined, isSameLayout));
155
+ }, nodeViewPortalProviderAPI, -1, anchorRectCache, isSameLayout));
156
156
  }
157
157
  }
158
158
 
@@ -172,7 +172,7 @@ export var getActiveDropTargetDecorations = function getActiveDropTargetDecorati
172
172
  parentNode: parent || undefined,
173
173
  formatMessage: formatMessage,
174
174
  dropTargetStyle: shouldShowFullHeight ? 'remainingHeight' : 'default'
175
- }, nodeViewPortalProviderAPI, -1, undefined, isSameLayout));
175
+ }, nodeViewPortalProviderAPI, -1, anchorRectCache, isSameLayout));
176
176
  }
177
177
  }
178
178
  }
@@ -197,7 +197,7 @@ export var getActiveDropTargetDecorations = function getActiveDropTargetDecorati
197
197
  parentNode: state.doc || undefined,
198
198
  formatMessage: formatMessage,
199
199
  dropTargetStyle: 'default'
200
- }, nodeViewPortalProviderAPI, -1, undefined, false));
200
+ }, nodeViewPortalProviderAPI, -1, anchorRectCache, false));
201
201
  }
202
202
  rootNodeWithPos = {
203
203
  node: root.node,
@@ -223,7 +223,7 @@ export var getActiveDropTargetDecorations = function getActiveDropTargetDecorati
223
223
  api: api,
224
224
  parent: parent,
225
225
  formatMessage: formatMessage
226
- }, nodeViewPortalProviderAPI, undefined));
226
+ }, nodeViewPortalProviderAPI, anchorRectCache));
227
227
  }
228
228
  }
229
229
  return false;
@@ -1,5 +1,7 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  var IGNORE_NODES = ['tableRow', 'listItem', 'caption', 'media'];
2
3
  var blockLeafNodes = ['blockCard', 'rule'];
4
+ var blockLeafNodesNext = ['blockCard', 'rule', 'extension'];
3
5
  var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
4
6
 
5
7
  /**
@@ -13,9 +15,9 @@ var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
13
15
  */
14
16
  var _findSurroundingNodes = function findSurroundingNodes(state, $pos, nodeType) {
15
17
  var depth = $pos.depth;
16
-
18
+ var blockLeafNodeList = fg('platform_editor_block_controls_perf_opt_patch_1') ? blockLeafNodesNext : blockLeafNodes;
17
19
  // special cases like hr rule here
18
- if (blockLeafNodes.includes(nodeType || '') || $pos.pos === 0) {
20
+ if (blockLeafNodeList.includes(nodeType || '') || $pos.pos === 0) {
19
21
  var _parent = $pos.node(depth);
20
22
  var _node = $pos.nodeAfter;
21
23
  var _index = $pos.index();
@@ -465,7 +465,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
465
465
  if (meta !== null && meta !== void 0 && meta.activeDropTargetNode) {
466
466
  currentActiveDropTargetNode = meta === null || meta === void 0 ? void 0 : meta.activeDropTargetNode;
467
467
  var _oldDropTargetDecs = findDropTargetDecs(decorations);
468
- var _getActiveDropTargetD = getActiveDropTargetDecorations(meta.activeDropTargetNode, newState, api, _oldDropTargetDecs, formatMessage, nodeViewPortalProviderAPI, latestActiveNode),
468
+ var _getActiveDropTargetD = getActiveDropTargetDecorations(meta.activeDropTargetNode, newState, api, _oldDropTargetDecs, formatMessage, nodeViewPortalProviderAPI, latestActiveNode, anchorRectCache),
469
469
  decsToAdd = _getActiveDropTargetD.decsToAdd,
470
470
  decsToRemove = _getActiveDropTargetD.decsToRemove;
471
471
  decorations = decorations.remove(decsToRemove);
@@ -642,12 +642,18 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
642
642
  }
643
643
  },
644
644
  dragstart: function dragstart(view) {
645
- var _anchorRectCache;
645
+ var _anchorRectCache2;
646
646
  startMeasure(EDITOR_BLOCKS_DRAG_INIT);
647
647
  if (isAdvancedLayoutEnabled) {
648
648
  defaultActiveAnchorTracker.reset();
649
649
  }
650
- (_anchorRectCache = anchorRectCache) === null || _anchorRectCache === void 0 || _anchorRectCache.setEditorView(view);
650
+ if (expValEquals('platform_editor_block_controls_perf_optimization', 'isEnabled', true)) {
651
+ if (fg('platform_editor_block_controls_perf_opt_patch_1')) {
652
+ var _anchorRectCache;
653
+ (_anchorRectCache = anchorRectCache) === null || _anchorRectCache === void 0 || _anchorRectCache.clear();
654
+ }
655
+ }
656
+ (_anchorRectCache2 = anchorRectCache) === null || _anchorRectCache2 === void 0 || _anchorRectCache2.setEditorView(view);
651
657
  view.dispatch(view.state.tr.setMeta(key, _objectSpread(_objectSpread({}, view.state.tr.getMeta(key)), {}, {
652
658
  isPMDragging: true
653
659
  })));
@@ -6,10 +6,12 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
6
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
7
  import { css, Global, jsx } from '@emotion/react';
8
8
  import { tableControlsSpacing } from '@atlaskit/editor-common/styles';
9
+ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
9
10
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
10
11
  import { akEditorBreakoutPadding, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
11
12
  import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { layers } from '@atlaskit/theme/constants';
14
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
15
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
14
16
  import { DRAG_HANDLE_MAX_WIDTH_PLUS_GAP, DRAG_HANDLE_WIDTH } from './consts';
15
17
 
@@ -81,6 +83,13 @@ var extendedHoverZone = function extendedHoverZone() {
81
83
  display: 'none'
82
84
  }));
83
85
  };
86
+ var extendedDragZone = css({
87
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
88
+ '.ProseMirror': _defineProperty({}, "&& [data-drag-handler-anchor-depth=\"0\"]".concat(dragHandlerAnchorSelector, "::after"), {
89
+ width: 'var(--ak-editor-max-container-width)',
90
+ left: "calc((100% - var(--ak-editor-max-container-width))/2)"
91
+ })
92
+ });
84
93
  var paragraphWithTrailingBreakAsOnlyChild = '+ :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
85
94
  var indentatedParagraphWithTrailingBreakAsOnlyChild = '+ div.fabric-editor-indentation-mark > :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
86
95
  var paragraphWithPlaceholder = '+ p > .placeholder-decoration';
@@ -285,8 +294,12 @@ var blockCardWithoutLayout = css({
285
294
  '--ak-editor-block-card-width': 'max(var(--ak-editor--legacy-breakout-wide-layout-width), var(--ak-editor--line-length))'
286
295
  }
287
296
  });
288
- export var GlobalStylesWrapper = function GlobalStylesWrapper() {
297
+ export var GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
298
+ var api = _ref.api;
299
+ var isDragging = useSharedPluginStateSelector(api, 'blockControls.isDragging', {
300
+ disabled: !expValEquals('platform_editor_block_controls_perf_optimization', 'isEnabled', true) || !fg('platform_editor_block_controls_perf_opt_patch_1')
301
+ });
289
302
  return jsx(Global, {
290
- styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_widget_visibility') ? 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]
303
+ styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_widget_visibility') ? 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]
291
304
  });
292
305
  };
@@ -4,7 +4,7 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
4
  import { type EditorState } from '@atlaskit/editor-prosemirror/state';
5
5
  import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { BlockControlsPlugin, HandleOptions } from '../blockControlsPluginType';
7
- import { AnchorRectCache } from './utils/anchor-utils';
7
+ import { type AnchorRectCache } from './utils/anchor-utils';
8
8
  export declare const emptyParagraphNodeDecorations: () => Decoration;
9
9
  export declare const findHandleDec: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
10
10
  type DragHandleDecorationParams = {
@@ -3,10 +3,11 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
4
  import type { Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
6
- import { Decoration } from '@atlaskit/editor-prosemirror/view';
6
+ import { type Decoration } from '@atlaskit/editor-prosemirror/view';
7
7
  import type { ActiveDropTargetNode, ActiveNode, BlockControlsPlugin } from '../blockControlsPluginType';
8
+ import type { AnchorRectCache } from './utils/anchor-utils';
8
9
  export declare const canMoveNodeOrSliceToPos: (state: EditorState, node: PMNode, parent: PMNode, index: number, $toPos: ResolvedPos, activeNode?: ActiveNode) => boolean | null;
9
- export declare const getActiveDropTargetDecorations: (activeDropTargetNode: ActiveDropTargetNode, state: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, existingDecs: Decoration[], formatMessage: IntlShape['formatMessage'], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode) => {
10
+ export declare const getActiveDropTargetDecorations: (activeDropTargetNode: ActiveDropTargetNode, state: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, existingDecs: Decoration[], formatMessage: IntlShape['formatMessage'], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache) => {
10
11
  decsToAdd: Decoration[];
11
12
  decsToRemove: Decoration[];
12
13
  };
@@ -1,10 +1,10 @@
1
1
  import { type IntlShape } from 'react-intl-next';
2
2
  import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import { EditorState } from '@atlaskit/editor-prosemirror/state';
4
+ import { type EditorState } from '@atlaskit/editor-prosemirror/state';
5
5
  import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
7
- import { AnchorRectCache } from './utils/anchor-utils';
7
+ import { type AnchorRectCache } from './utils/anchor-utils';
8
8
  export declare const findQuickInsertInsertButtonDecoration: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
9
9
  type QuickInsertButtonDecorationParams = {
10
10
  api: ExtractInjectionAPI<BlockControlsPlugin>;
@@ -1,2 +1,2 @@
1
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
1
+ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
2
2
  export declare const handleKeyDown: (view: EditorView, event: KeyboardEvent) => boolean;
@@ -1,5 +1,5 @@
1
1
  import { type IntlShape } from 'react-intl-next';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
3
+ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
5
5
  export declare const boundKeydownHandler: (api?: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage?: IntlShape['formatMessage']) => (view: EditorView, event: KeyboardEvent) => boolean;
@@ -1,6 +1,6 @@
1
1
  import { type CSSProperties } from 'react';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import { AnchorRectCache } from './utils/anchor-utils';
3
+ import { type AnchorRectCache } from './utils/anchor-utils';
4
4
  export declare const calculatePosition: ({ rootAnchorName, anchorName, view, getPos, rootNodeType, macroInteractionUpdates, anchorRectCache, }: {
5
5
  rootAnchorName: string | undefined;
6
6
  getPos: () => number | undefined;
@@ -1,4 +1,4 @@
1
- import { Fragment } from '@atlaskit/editor-prosemirror/model';
1
+ import { type Fragment } from '@atlaskit/editor-prosemirror/model';
2
2
  /**
3
3
  * Check if the fragment has only one node of the specified type
4
4
  */
@@ -1,4 +1,4 @@
1
- import { AnchorRectCache } from './anchor-utils';
1
+ import { type AnchorRectCache } from './anchor-utils';
2
2
  export declare const getTopPosition: (dom: HTMLElement | null, type?: string) => string;
3
3
  export declare const getLeftPosition: (dom: HTMLElement | null, type: string, innerContainer?: HTMLElement | null, macroInteractionUpdates?: boolean, parentType?: string) => string;
4
4
  export declare const getNodeHeight: (dom: HTMLElement | null, anchor: string, anchorRectCache?: AnchorRectCache) => number | undefined;
@@ -1,5 +1,5 @@
1
- import { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
- import { EditorState, NodeSelection, TextSelection, type Transaction, Selection } from '@atlaskit/editor-prosemirror/state';
1
+ import { type ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
+ import { type EditorState, NodeSelection, TextSelection, type Transaction, type Selection } from '@atlaskit/editor-prosemirror/state';
3
3
  export declare const getInlineNodePos: (tr: Transaction, start: number, nodeSize: number) => {
4
4
  inlineNodePos: number;
5
5
  inlineNodeEndPos: number;
@@ -2,7 +2,7 @@ import { type IntlShape } from 'react-intl-next';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
5
- import { AnchorRectCache } from './utils/anchor-utils';
5
+ import { type AnchorRectCache } from './utils/anchor-utils';
6
6
  type VanillaQuickInsertProps = {
7
7
  formatMessage: IntlShape['formatMessage'];
8
8
  api: ExtractInjectionAPI<BlockControlsPlugin>;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { WrappedComponentProps } from 'react-intl-next';
3
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
4
+ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
6
6
  type BlockMenuProps = {
7
7
  editorView: EditorView | undefined;
@@ -3,7 +3,7 @@ import { type IntlShape } from 'react-intl-next';
3
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { BlockControlsPlugin, HandleOptions } from '../blockControlsPluginType';
6
- import { AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
6
+ import { type AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
7
7
  type DragHandleProps = {
8
8
  view: EditorView;
9
9
  api: ExtractInjectionAPI<BlockControlsPlugin> | undefined;
@@ -3,4 +3,8 @@
3
3
  * @jsx jsx
4
4
  */
5
5
  import { jsx } from '@emotion/react';
6
- export declare const GlobalStylesWrapper: () => jsx.JSX.Element;
6
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
7
+ import type { BlockControlsPlugin } from '../blockControlsPluginType';
8
+ export declare const GlobalStylesWrapper: ({ api, }: {
9
+ api: ExtractInjectionAPI<BlockControlsPlugin> | undefined;
10
+ }) => jsx.JSX.Element;
@@ -7,7 +7,7 @@ import { type IntlShape } from 'react-intl-next';
7
7
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
8
8
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
9
9
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
10
- import { AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
10
+ import { type AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
11
11
  type Props = {
12
12
  view: EditorView;
13
13
  api: ExtractInjectionAPI<BlockControlsPlugin>;
@@ -1,4 +1,4 @@
1
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
1
+ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
2
2
  type RefreshAnchorNameParams = {
3
3
  getPos: () => number | undefined;
4
4
  view: EditorView;
@@ -4,7 +4,7 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
4
  import { type EditorState } from '@atlaskit/editor-prosemirror/state';
5
5
  import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { BlockControlsPlugin, HandleOptions } from '../blockControlsPluginType';
7
- import { AnchorRectCache } from './utils/anchor-utils';
7
+ import { type AnchorRectCache } from './utils/anchor-utils';
8
8
  export declare const emptyParagraphNodeDecorations: () => Decoration;
9
9
  export declare const findHandleDec: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
10
10
  type DragHandleDecorationParams = {
@@ -3,10 +3,11 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
4
  import type { Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
6
- import { Decoration } from '@atlaskit/editor-prosemirror/view';
6
+ import { type Decoration } from '@atlaskit/editor-prosemirror/view';
7
7
  import type { ActiveDropTargetNode, ActiveNode, BlockControlsPlugin } from '../blockControlsPluginType';
8
+ import type { AnchorRectCache } from './utils/anchor-utils';
8
9
  export declare const canMoveNodeOrSliceToPos: (state: EditorState, node: PMNode, parent: PMNode, index: number, $toPos: ResolvedPos, activeNode?: ActiveNode) => boolean | null;
9
- export declare const getActiveDropTargetDecorations: (activeDropTargetNode: ActiveDropTargetNode, state: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, existingDecs: Decoration[], formatMessage: IntlShape['formatMessage'], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode) => {
10
+ export declare const getActiveDropTargetDecorations: (activeDropTargetNode: ActiveDropTargetNode, state: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, existingDecs: Decoration[], formatMessage: IntlShape['formatMessage'], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache) => {
10
11
  decsToAdd: Decoration[];
11
12
  decsToRemove: Decoration[];
12
13
  };
@@ -1,10 +1,10 @@
1
1
  import { type IntlShape } from 'react-intl-next';
2
2
  import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import { EditorState } from '@atlaskit/editor-prosemirror/state';
4
+ import { type EditorState } from '@atlaskit/editor-prosemirror/state';
5
5
  import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
7
- import { AnchorRectCache } from './utils/anchor-utils';
7
+ import { type AnchorRectCache } from './utils/anchor-utils';
8
8
  export declare const findQuickInsertInsertButtonDecoration: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
9
9
  type QuickInsertButtonDecorationParams = {
10
10
  api: ExtractInjectionAPI<BlockControlsPlugin>;
@@ -1,2 +1,2 @@
1
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
1
+ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
2
2
  export declare const handleKeyDown: (view: EditorView, event: KeyboardEvent) => boolean;
@@ -1,5 +1,5 @@
1
1
  import { type IntlShape } from 'react-intl-next';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
3
+ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
5
5
  export declare const boundKeydownHandler: (api?: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage?: IntlShape['formatMessage']) => (view: EditorView, event: KeyboardEvent) => boolean;
@@ -1,6 +1,6 @@
1
1
  import { type CSSProperties } from 'react';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import { AnchorRectCache } from './utils/anchor-utils';
3
+ import { type AnchorRectCache } from './utils/anchor-utils';
4
4
  export declare const calculatePosition: ({ rootAnchorName, anchorName, view, getPos, rootNodeType, macroInteractionUpdates, anchorRectCache, }: {
5
5
  rootAnchorName: string | undefined;
6
6
  getPos: () => number | undefined;
@@ -1,4 +1,4 @@
1
- import { Fragment } from '@atlaskit/editor-prosemirror/model';
1
+ import { type Fragment } from '@atlaskit/editor-prosemirror/model';
2
2
  /**
3
3
  * Check if the fragment has only one node of the specified type
4
4
  */
@@ -1,4 +1,4 @@
1
- import { AnchorRectCache } from './anchor-utils';
1
+ import { type AnchorRectCache } from './anchor-utils';
2
2
  export declare const getTopPosition: (dom: HTMLElement | null, type?: string) => string;
3
3
  export declare const getLeftPosition: (dom: HTMLElement | null, type: string, innerContainer?: HTMLElement | null, macroInteractionUpdates?: boolean, parentType?: string) => string;
4
4
  export declare const getNodeHeight: (dom: HTMLElement | null, anchor: string, anchorRectCache?: AnchorRectCache) => number | undefined;
@@ -1,5 +1,5 @@
1
- import { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
- import { EditorState, NodeSelection, TextSelection, type Transaction, Selection } from '@atlaskit/editor-prosemirror/state';
1
+ import { type ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
+ import { type EditorState, NodeSelection, TextSelection, type Transaction, type Selection } from '@atlaskit/editor-prosemirror/state';
3
3
  export declare const getInlineNodePos: (tr: Transaction, start: number, nodeSize: number) => {
4
4
  inlineNodePos: number;
5
5
  inlineNodeEndPos: number;
@@ -2,7 +2,7 @@ import { type IntlShape } from 'react-intl-next';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
5
- import { AnchorRectCache } from './utils/anchor-utils';
5
+ import { type AnchorRectCache } from './utils/anchor-utils';
6
6
  type VanillaQuickInsertProps = {
7
7
  formatMessage: IntlShape['formatMessage'];
8
8
  api: ExtractInjectionAPI<BlockControlsPlugin>;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { WrappedComponentProps } from 'react-intl-next';
3
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
4
+ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
6
6
  type BlockMenuProps = {
7
7
  editorView: EditorView | undefined;
@@ -3,7 +3,7 @@ import { type IntlShape } from 'react-intl-next';
3
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { BlockControlsPlugin, HandleOptions } from '../blockControlsPluginType';
6
- import { AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
6
+ import { type AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
7
7
  type DragHandleProps = {
8
8
  view: EditorView;
9
9
  api: ExtractInjectionAPI<BlockControlsPlugin> | undefined;
@@ -3,4 +3,8 @@
3
3
  * @jsx jsx
4
4
  */
5
5
  import { jsx } from '@emotion/react';
6
- export declare const GlobalStylesWrapper: () => jsx.JSX.Element;
6
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
7
+ import type { BlockControlsPlugin } from '../blockControlsPluginType';
8
+ export declare const GlobalStylesWrapper: ({ api, }: {
9
+ api: ExtractInjectionAPI<BlockControlsPlugin> | undefined;
10
+ }) => jsx.JSX.Element;
@@ -7,7 +7,7 @@ import { type IntlShape } from 'react-intl-next';
7
7
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
8
8
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
9
9
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
10
- import { AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
10
+ import { type AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
11
11
  type Props = {
12
12
  view: EditorView;
13
13
  api: ExtractInjectionAPI<BlockControlsPlugin>;
@@ -1,4 +1,4 @@
1
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
1
+ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
2
2
  type RefreshAnchorNameParams = {
3
3
  getPos: () => number | undefined;
4
4
  view: EditorView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "3.19.14",
3
+ "version": "3.20.0",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^47.6.0",
35
- "@atlaskit/editor-common": "^107.4.0",
35
+ "@atlaskit/editor-common": "^107.6.0",
36
36
  "@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
38
38
  "@atlaskit/editor-plugin-editor-disabled": "^2.1.0",
@@ -55,7 +55,7 @@
55
55
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
56
56
  "@atlaskit/primitives": "^14.10.0",
57
57
  "@atlaskit/theme": "^18.0.0",
58
- "@atlaskit/tmp-editor-statsig": "^8.6.0",
58
+ "@atlaskit/tmp-editor-statsig": "^8.7.0",
59
59
  "@atlaskit/tokens": "^5.4.0",
60
60
  "@atlaskit/tooltip": "^20.3.0",
61
61
  "@babel/runtime": "^7.0.0",
@@ -185,6 +185,9 @@
185
185
  "platform_editor_controls_patch_15": {
186
186
  "type": "boolean"
187
187
  },
188
+ "platform_editor_block_controls_perf_opt_patch_1": {
189
+ "type": "boolean"
190
+ },
188
191
  "platform_editor_breakout_resizing_widget_fix": {
189
192
  "type": "boolean"
190
193
  }