@atlaskit/editor-plugin-block-controls 17.1.4 → 17.2.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 (36) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/blockControlsPlugin.js +8 -3
  3. package/dist/cjs/pm-plugins/main.js +32 -5
  4. package/dist/cjs/pm-plugins/utils/surface-node-positions.js +71 -0
  5. package/dist/cjs/ui/block-controls-left-surface-targets.js +45 -0
  6. package/dist/cjs/ui/block-controls-left-surface.js +45 -0
  7. package/dist/cjs/ui/block-controls-left-surfaces.js +216 -0
  8. package/dist/cjs/ui/block-controls-surface-context.js +23 -17
  9. package/dist/es2019/blockControlsPlugin.js +8 -3
  10. package/dist/es2019/pm-plugins/main.js +33 -7
  11. package/dist/es2019/pm-plugins/utils/surface-node-positions.js +56 -0
  12. package/dist/es2019/ui/block-controls-left-surface-targets.js +25 -0
  13. package/dist/es2019/ui/block-controls-left-surface.js +39 -0
  14. package/dist/es2019/ui/block-controls-left-surfaces.js +181 -0
  15. package/dist/es2019/ui/block-controls-surface-context.js +21 -15
  16. package/dist/esm/blockControlsPlugin.js +8 -3
  17. package/dist/esm/pm-plugins/main.js +32 -5
  18. package/dist/esm/pm-plugins/utils/surface-node-positions.js +64 -0
  19. package/dist/esm/ui/block-controls-left-surface-targets.js +39 -0
  20. package/dist/esm/ui/block-controls-left-surface.js +38 -0
  21. package/dist/esm/ui/block-controls-left-surfaces.js +207 -0
  22. package/dist/esm/ui/block-controls-surface-context.js +22 -16
  23. package/dist/types/blockControlsPluginType.d.ts +2 -0
  24. package/dist/types/pm-plugins/main.d.ts +6 -2
  25. package/dist/types/pm-plugins/utils/surface-node-positions.d.ts +14 -0
  26. package/dist/types/ui/block-controls-left-surface-targets.d.ts +7 -0
  27. package/dist/types/ui/block-controls-left-surface.d.ts +23 -0
  28. package/dist/types/ui/{block-controls-surface.d.ts → block-controls-left-surfaces.d.ts} +1 -1
  29. package/dist/types/ui/block-controls-surface-context.d.ts +2 -0
  30. package/package.json +3 -3
  31. package/dist/cjs/ui/block-controls-surface.js +0 -185
  32. package/dist/es2019/ui/block-controls-surface.js +0 -170
  33. package/dist/esm/ui/block-controls-surface.js +0 -176
  34. /package/dist/cjs/ui/{block-controls-surface.compiled.css → block-controls-left-surface.compiled.css} +0 -0
  35. /package/dist/es2019/ui/{block-controls-surface.compiled.css → block-controls-left-surface.compiled.css} +0 -0
  36. /package/dist/esm/ui/{block-controls-surface.compiled.css → block-controls-left-surface.compiled.css} +0 -0
@@ -4,16 +4,16 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.createBlockControlsSurfaceContext = void 0;
7
+ exports.createBlockControlsSurfaceContextForPosition = exports.createBlockControlsSurfaceContext = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
10
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
- var getNodeContext = function getNodeContext(view, pos) {
12
- var node = view.state.doc.nodeAt(pos);
11
+ var getNodeContext = function getNodeContext(state, pos) {
12
+ var node = state.doc.nodeAt(pos);
13
13
  if (!node) {
14
14
  return undefined;
15
15
  }
16
- var $pos = view.state.doc.resolve(pos);
16
+ var $pos = state.doc.resolve(pos);
17
17
  var ancestors = [];
18
18
  for (var depth = 0; depth <= $pos.depth; depth++) {
19
19
  var ancestor = $pos.node(depth);
@@ -36,26 +36,32 @@ var getNodeContext = function getNodeContext(view, pos) {
36
36
  }
37
37
  };
38
38
  };
39
- var createBlockControlsSurfaceContext = exports.createBlockControlsSurfaceContext = function createBlockControlsSurfaceContext(view, activeNode) {
40
- var _activeNode$rootPos, _activeNode$rootNodeT;
41
- var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'root';
42
- if (!activeNode) {
43
- return undefined;
44
- }
45
- var rootPos = (_activeNode$rootPos = activeNode.rootPos) !== null && _activeNode$rootPos !== void 0 ? _activeNode$rootPos : activeNode.pos;
46
- var activeNodeContext = getNodeContext(view, activeNode.pos);
47
- var rootNodeContext = getNodeContext(view, rootPos);
48
- if (!activeNodeContext || !rootNodeContext) {
39
+ var createBlockControlsSurfaceContextForPosition = exports.createBlockControlsSurfaceContextForPosition = function createBlockControlsSurfaceContextForPosition(state, targetPos, activeNode) {
40
+ var _activeNode$rootPos, _getNodeContext, _activeNode$rootNodeT;
41
+ var targetNodeContext = getNodeContext(state, targetPos);
42
+ if (!targetNodeContext) {
49
43
  return undefined;
50
44
  }
45
+ var activeNodeContext = activeNode ? getNodeContext(state, activeNode.pos) : undefined;
46
+ var rootPos = activeNode ? (_activeNode$rootPos = activeNode.rootPos) !== null && _activeNode$rootPos !== void 0 ? _activeNode$rootPos : activeNode.pos : targetPos;
47
+ var rootNodeContext = (_getNodeContext = getNodeContext(state, rootPos)) !== null && _getNodeContext !== void 0 ? _getNodeContext : targetNodeContext;
51
48
  return {
52
- activeNode: _objectSpread(_objectSpread({}, activeNodeContext), {}, {
49
+ activeNode: activeNode && activeNodeContext ? _objectSpread(_objectSpread({}, activeNodeContext), {}, {
53
50
  rootPos: rootPos,
54
51
  rootType: {
55
52
  name: (_activeNode$rootNodeT = activeNode.rootNodeType) !== null && _activeNode$rootNodeT !== void 0 ? _activeNode$rootNodeT : rootNodeContext.type.name
56
53
  }
57
- }),
54
+ }) : undefined,
58
55
  rootNode: rootNodeContext,
59
- targetNode: target === 'active' ? activeNodeContext : rootNodeContext
56
+ targetNode: targetNodeContext
60
57
  };
58
+ };
59
+ var createBlockControlsSurfaceContext = exports.createBlockControlsSurfaceContext = function createBlockControlsSurfaceContext(view, activeNode) {
60
+ var _activeNode$rootPos2;
61
+ var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'root';
62
+ if (!activeNode) {
63
+ return undefined;
64
+ }
65
+ var rootPos = (_activeNode$rootPos2 = activeNode.rootPos) !== null && _activeNode$rootPos2 !== void 0 ? _activeNode$rootPos2 : activeNode.pos;
66
+ return createBlockControlsSurfaceContextForPosition(view.state, target === 'active' ? activeNode.pos : rootPos, activeNode);
61
67
  };
@@ -22,7 +22,7 @@ import { selectionPreservationPluginKey } from './pm-plugins/selection-preservat
22
22
  import { createSelectionPreservationPlugin } from './pm-plugins/selection-preservation/pm-plugin';
23
23
  import { expandAndUpdateSelection } from './pm-plugins/utils/expand-and-update-selection';
24
24
  import { selectNode } from './pm-plugins/utils/getSelection';
25
- import { BlockControlsSurface } from './ui/block-controls-surface';
25
+ import { BlockControlsLeftSurfaces } from './ui/block-controls-left-surfaces';
26
26
  import { getBlockControlsSurfaceDragHandleComponents } from './ui/block-controls-surface-drag-handle-registration';
27
27
  import { GlobalStylesWrapper } from './ui/global-styles';
28
28
  import { SurfaceEditorViewContext } from './ui/surface-editor-view-context';
@@ -35,6 +35,7 @@ export const blockControlsPlugin = ({
35
35
  const rightSideControlsEnabled = (_config$rightSideCont = config === null || config === void 0 ? void 0 : config.rightSideControlsEnabled) !== null && _config$rightSideCont !== void 0 ? _config$rightSideCont : false;
36
36
  const quickInsertButtonEnabled = (_config$quickInsertBu = config === null || config === void 0 ? void 0 : config.quickInsertButtonEnabled) !== null && _config$quickInsertBu !== void 0 ? _config$quickInsertBu : true;
37
37
  const registryBlockControlsEnabled = isExperimentEnabled('platform_editor_block_control_migration');
38
+ const surfaceNodePositionsEnabled = registryBlockControlsEnabled && isExperimentEnabled('platform_editor_collapsible_headings');
38
39
  const legacyBlockControlsEnabled = !registryBlockControlsEnabled;
39
40
  if (registryBlockControlsEnabled) {
40
41
  var _api$uiControlRegistr;
@@ -122,7 +123,7 @@ export const blockControlsPlugin = ({
122
123
  plugin: ({
123
124
  getIntl,
124
125
  nodeViewPortalProviderAPI
125
- }) => createPlugin(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled && legacyBlockControlsEnabled, legacyBlockControlsEnabled)
126
+ }) => createPlugin(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled && legacyBlockControlsEnabled, legacyBlockControlsEnabled, surfaceNodePositionsEnabled)
126
127
  }];
127
128
  if (editorExperiment('platform_editor_controls', 'variant1')) {
128
129
  pmPlugins.push({
@@ -418,6 +419,10 @@ export const blockControlsPlugin = ({
418
419
  isEditing: (_interactionTrackingP = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP === void 0 ? void 0 : _interactionTrackingP.isEditing,
419
420
  isSelectedViaDragHandle: (_key$getState$isSelec = (_key$getState10 = key.getState(editorState)) === null || _key$getState10 === void 0 ? void 0 : _key$getState10.isSelectedViaDragHandle) !== null && _key$getState$isSelec !== void 0 ? _key$getState$isSelec : false
420
421
  };
422
+ if (surfaceNodePositionsEnabled) {
423
+ var _key$getState$surface, _key$getState11;
424
+ sharedState.surfaceNodePositions = (_key$getState$surface = (_key$getState11 = key.getState(editorState)) === null || _key$getState11 === void 0 ? void 0 : _key$getState11.surfaceNodePositions) !== null && _key$getState$surface !== void 0 ? _key$getState$surface : [];
425
+ }
421
426
  if (editorExperiment('platform_editor_controls', 'variant1')) {
422
427
  var _interactionTrackingP2, _interactionTrackingP3, _interactionTrackingP4;
423
428
  sharedState.isMouseOut = (_interactionTrackingP2 = (_interactionTrackingP3 = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP3 === void 0 ? void 0 : _interactionTrackingP3.isMouseOut) !== null && _interactionTrackingP2 !== void 0 ? _interactionTrackingP2 : false;
@@ -438,7 +443,7 @@ export const blockControlsPlugin = ({
438
443
  api: api
439
444
  }), registryBlockControlsEnabled && editorView && api ? /*#__PURE__*/React.createElement(SurfaceEditorViewContext.Provider, {
440
445
  value: editorView
441
- }, /*#__PURE__*/React.createElement(BlockControlsSurface, {
446
+ }, /*#__PURE__*/React.createElement(BlockControlsLeftSurfaces, {
442
447
  api: api,
443
448
  editorView: editorView
444
449
  })) : null);
@@ -1,6 +1,7 @@
1
1
  import rafSchedule from 'raf-schd';
2
2
  import { getDocument } from '@atlaskit/browser-apis';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
+ import { BLOCK_CONTROLS_LEFT_SURFACE } from '@atlaskit/editor-common/block-controls/surface-keys';
4
5
  import { getBrowserInfo } from '@atlaskit/editor-common/browser';
5
6
  import { getNodeIdProvider } from '@atlaskit/editor-common/node-anchor';
6
7
  import { isMeasuring, startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
@@ -11,6 +12,7 @@ import { EDIT_AREA_ID } from '@atlaskit/editor-common/ui';
11
12
  import { isEmptyDocument } from '@atlaskit/editor-common/utils';
12
13
  import { PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
13
14
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
15
+ import { resolveSurface } from '@atlaskit/editor-ui-control-model/surface-renderer';
14
16
  import { fg } from '@atlaskit/platform-feature-flags/fg';
15
17
  import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/element';
16
18
  import { combine } from '@atlaskit/pragmatic-drag-and-drop/utils/combine';
@@ -32,6 +34,7 @@ import { getMultiSelectAnalyticsAttributes } from './utils/analytics';
32
34
  import { AnchorRectCache, isAnchorSupported } from './utils/anchor-utils';
33
35
  import { selectNode } from './utils/getSelection';
34
36
  import { getSelectedSlicePosition } from './utils/selection';
37
+ import { getSurfaceNodePositions, updateSurfaceNodePositions } from './utils/surface-node-positions';
35
38
  import { getTrMetadata } from './utils/transactions';
36
39
  export const key = new PluginKey('blockControls');
37
40
  const EDITOR_BLOCKS_DRAG_INIT = 'Editor Blocks Drag Initialization Time';
@@ -199,6 +202,7 @@ const destroyFn = (api, editorView) => {
199
202
  };
200
203
  const initialState = {
201
204
  decorations: DecorationSet.empty,
205
+ surfaceNodePositions: [],
202
206
  activeNode: undefined,
203
207
  isDragging: false,
204
208
  isMenuOpen: false,
@@ -227,14 +231,16 @@ const getDecorationAtPos = (state, decorations, pos, to) => {
227
231
  const nodeDecAtActivePos = nodeDecsAtActivePos.pop();
228
232
  return nodeDecAtActivePos;
229
233
  };
230
- export const apply = (api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled = false, quickInsertButtonEnabled = true, anchorRectCache, resizeObserverWidth, pragmaticCleanup) => {
234
+ export const apply = (api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled = false, quickInsertButtonEnabled = true, anchorRectCache, resizeObserverWidth, pragmaticCleanup, resolvedSurface) => {
231
235
  var _api$limitedMode, _api$limitedMode$shar, _api$limitedMode$shar2, _meta$multiSelectDnD, _api$editorViewMode, _api$editorViewMode$s, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$toggleMenu8, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
232
236
  let {
233
237
  activeNode,
234
238
  decorations,
235
239
  isResizerResizing,
236
- multiSelectDnD
240
+ multiSelectDnD,
241
+ surfaceNodePositions
237
242
  } = currentState;
243
+ const previousActiveNode = activeNode;
238
244
  const {
239
245
  editorHeight,
240
246
  editorWidthLeft,
@@ -711,6 +717,18 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
711
717
  var _latestActiveNode13, _latestActiveNode14;
712
718
  newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && flags.legacyDragHandleEnabled && findHandleDec(decorations, (_latestActiveNode13 = latestActiveNode) === null || _latestActiveNode13 === void 0 ? void 0 : _latestActiveNode13.pos, (_latestActiveNode14 = latestActiveNode) === null || _latestActiveNode14 === void 0 ? void 0 : _latestActiveNode14.pos).length === 0 ? null : latestActiveNode;
713
719
  }
720
+ if (flags.surfaceNodePositionsEnabled && resolvedSurface) {
721
+ surfaceNodePositions = updateSurfaceNodePositions({
722
+ activeNode: newActiveNode,
723
+ currentPositions: surfaceNodePositions,
724
+ from,
725
+ newState,
726
+ previousActiveNode,
727
+ resolvedSurface,
728
+ to,
729
+ tr
730
+ });
731
+ }
714
732
  let isMenuOpenNew = isMenuOpen;
715
733
  if (editorExperiment('platform_editor_block_menu', true)) {
716
734
  if (meta !== null && meta !== void 0 && meta.closeMenu) {
@@ -730,6 +748,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
730
748
  }
731
749
  return {
732
750
  decorations,
751
+ surfaceNodePositions,
733
752
  activeNode: newActiveNode,
734
753
  activeDropTargetNode: currentActiveDropTargetNode,
735
754
  isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
@@ -753,7 +772,8 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
753
772
  isSelectedViaDragHandle: isSelectedViaDragHandleNew
754
773
  };
755
774
  };
756
- export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled = false, quickInsertButtonEnabled = true, legacyDragHandleEnabled = true) => {
775
+ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled = false, quickInsertButtonEnabled = true, legacyDragHandleEnabled = true, surfaceNodePositionsEnabled = false) => {
776
+ var _api$uiControlRegistr, _api$uiControlRegistr2;
757
777
  const {
758
778
  formatMessage
759
779
  } = getIntl();
@@ -763,8 +783,10 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecora
763
783
  const toolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
764
784
  const flags = {
765
785
  legacyDragHandleEnabled,
786
+ surfaceNodePositionsEnabled,
766
787
  toolbarFlagsEnabled
767
788
  };
789
+ const resolvedSurface = surfaceNodePositionsEnabled ? resolveSurface((_api$uiControlRegistr = api === null || api === void 0 ? void 0 : (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(BLOCK_CONTROLS_LEFT_SURFACE)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [], BLOCK_CONTROLS_LEFT_SURFACE) : undefined;
768
790
  let anchorRectCache;
769
791
  if (!isAnchorSupported()) {
770
792
  anchorRectCache = new AnchorRectCache();
@@ -774,10 +796,13 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecora
774
796
  return new SafePlugin({
775
797
  key,
776
798
  state: {
777
- init() {
778
- return initialState;
799
+ init(_config, editorState) {
800
+ return {
801
+ ...initialState,
802
+ surfaceNodePositions: resolvedSurface ? getSurfaceNodePositions(editorState, resolvedSurface) : []
803
+ };
779
804
  },
780
- apply: (tr, currentState, _, newState) => apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled, anchorRectCache, resizeObserverWidth, pragmaticCleanup)
805
+ apply: (tr, currentState, _, newState) => apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled, anchorRectCache, resizeObserverWidth, pragmaticCleanup, resolvedSurface)
781
806
  },
782
807
  props: {
783
808
  decorations: state => {
@@ -1017,11 +1042,12 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecora
1017
1042
  var _api$core2;
1018
1043
  // Focus moving into the registry surface remains inside the editor experience.
1019
1044
  const isChildOfSurface = !flags.legacyDragHandleEnabled && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest(BLOCK_CONTROLS_SURFACE_SELECTOR) !== null;
1045
+ const shouldPreserveRemixInlineDropdownFocus = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('[data-editor-remix-inline-dropdown-preserve-focus]') !== null;
1020
1046
  const isChildOfEditor = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest(`#${EDIT_AREA_ID}`) !== null;
1021
1047
 
1022
1048
  // don't do anything if the event relatedTarget (the element receiving focus) is a child of the editor
1023
1049
  // or if the editor has focus
1024
- if (isChildOfEditor || isChildOfSurface || view.hasFocus()) {
1050
+ if (isChildOfEditor || isChildOfSurface || shouldPreserveRemixInlineDropdownFocus || view.hasFocus()) {
1025
1051
  return false;
1026
1052
  }
1027
1053
  api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(({
@@ -0,0 +1,56 @@
1
+ import { BLOCK_CONTROL_UI_CONTEXT } from '@atlaskit/editor-common/block-controls/block-control-ui-context';
2
+ import { willComponentRender } from '@atlaskit/editor-ui-control-model/surface-renderer';
3
+ import { createSurfaceContext } from '@atlaskit/editor-ui-control-model/types';
4
+ import { createBlockControlsSurfaceContextForPosition } from '../../ui/block-controls-surface-context';
5
+ const createSurfaceContextAtPosition = (state, position, activeNode) => {
6
+ const blockControlsContext = createBlockControlsSurfaceContextForPosition(state, position, activeNode);
7
+ return blockControlsContext ? createSurfaceContext(BLOCK_CONTROL_UI_CONTEXT, blockControlsContext) : undefined;
8
+ };
9
+ export const getSurfaceNodePositions = (state, resolvedSurface, activeNode, from = 0, to = state.doc.content.size) => {
10
+ const {
11
+ root,
12
+ childrenMap
13
+ } = resolvedSurface;
14
+ if (!root) {
15
+ return [];
16
+ }
17
+ const positions = [];
18
+ const start = Math.max(0, from);
19
+ const end = Math.min(state.doc.content.size, Math.max(start, to));
20
+ state.doc.nodesBetween(start, end, (node, position) => {
21
+ if (node.isBlock && willComponentRender(root, childrenMap, createSurfaceContextAtPosition(state, position, activeNode))) {
22
+ positions.push(position);
23
+ }
24
+ });
25
+ return positions;
26
+ };
27
+ const hasActiveNodeChanged = (previousActiveNode, activeNode) => (previousActiveNode === null || previousActiveNode === void 0 ? void 0 : previousActiveNode.pos) !== (activeNode === null || activeNode === void 0 ? void 0 : activeNode.pos) || (previousActiveNode === null || previousActiveNode === void 0 ? void 0 : previousActiveNode.nodeType) !== (activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) || (previousActiveNode === null || previousActiveNode === void 0 ? void 0 : previousActiveNode.rootPos) !== (activeNode === null || activeNode === void 0 ? void 0 : activeNode.rootPos);
28
+ export const updateSurfaceNodePositions = ({
29
+ activeNode,
30
+ currentPositions,
31
+ from,
32
+ newState,
33
+ previousActiveNode,
34
+ resolvedSurface,
35
+ to,
36
+ tr
37
+ }) => {
38
+ const activeNodeChanged = hasActiveNodeChanged(previousActiveNode, activeNode);
39
+ if (!tr.docChanged && !activeNodeChanged) {
40
+ return currentPositions;
41
+ }
42
+ const nextActiveNode = activeNode !== null && activeNode !== void 0 ? activeNode : undefined;
43
+ if (activeNodeChanged) {
44
+ return getSurfaceNodePositions(newState, resolvedSurface, nextActiveNode);
45
+ }
46
+ const {
47
+ root,
48
+ childrenMap
49
+ } = resolvedSurface;
50
+ const mappedPositions = currentPositions.map(position => tr.mapping.mapResult(position, -1)).filter(result => !result.deleted).map(result => result.pos).filter(position => {
51
+ const node = newState.doc.nodeAt(position);
52
+ return Boolean((node === null || node === void 0 ? void 0 : node.isBlock) && root && willComponentRender(root, childrenMap, createSurfaceContextAtPosition(newState, position, nextActiveNode)));
53
+ });
54
+ const changedPositions = getSurfaceNodePositions(newState, resolvedSurface, nextActiveNode, from - 1, to + 1);
55
+ return Array.from(new Set([...mappedPositions, ...changedPositions])).sort((first, second) => first - second);
56
+ };
@@ -0,0 +1,25 @@
1
+ /** Combines hover-driven and stored surface positions into one deduplicated list. */
2
+ export const getBlockControlsLeftSurfaceTargets = (activeNode, storedPositions) => {
3
+ const targetsByPosition = new Map();
4
+ for (const position of storedPositions) {
5
+ targetsByPosition.set(position, {
6
+ position,
7
+ source: 'stored'
8
+ });
9
+ }
10
+ if (activeNode) {
11
+ var _activeNode$rootPos;
12
+ const rootPosition = (_activeNode$rootPos = activeNode.rootPos) !== null && _activeNode$rootPos !== void 0 ? _activeNode$rootPos : activeNode.pos;
13
+ targetsByPosition.set(rootPosition, {
14
+ position: rootPosition,
15
+ source: 'root'
16
+ });
17
+ if (activeNode.pos !== rootPosition) {
18
+ targetsByPosition.set(activeNode.pos, {
19
+ position: activeNode.pos,
20
+ source: 'active'
21
+ });
22
+ }
23
+ }
24
+ return Array.from(targetsByPosition.values()).sort((first, second) => first.position - second.position);
25
+ };
@@ -0,0 +1,39 @@
1
+ /* block-controls-left-surface.tsx generated by @compiled/babel-plugin v2.0.0 */
2
+ import "./block-controls-left-surface.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React from 'react';
5
+ import { BLOCK_CONTROLS_LEFT_SURFACE } from '@atlaskit/editor-common/block-controls/surface-keys';
6
+ import { SurfaceRenderer, willSurfaceRender } from '@atlaskit/editor-ui-control-model/surface-renderer';
7
+ import { VisibilityContainer } from './visibility-container';
8
+ const leftSurfaceStyles = null;
9
+ /** Renders one left block-controls surface at a document position. */
10
+ export const BlockControlsLeftSurface = ({
11
+ api,
12
+ components,
13
+ forceVisibleOnMouseOut,
14
+ placement,
15
+ source,
16
+ surfaceContext
17
+ }) => {
18
+ if (!placement || !willSurfaceRender(components, BLOCK_CONTROLS_LEFT_SURFACE, surfaceContext)) {
19
+ return null;
20
+ }
21
+ const surface = /*#__PURE__*/React.createElement(SurfaceRenderer, {
22
+ components: components,
23
+ surface: BLOCK_CONTROLS_LEFT_SURFACE,
24
+ surfaceContext: surfaceContext
25
+ });
26
+ return /*#__PURE__*/React.createElement("div", {
27
+ "data-editor-block-controls-surface": true,
28
+ "data-testid": source === 'stored' ? 'block-controls-left-surface-stored' : source === 'active' ? 'block-controls-left-surface-active' : 'block-controls-left-surface'
29
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Placement is resolved from the target node's runtime DOM geometry.
30
+ ,
31
+ style: placement,
32
+ className: ax(["_zulpv77o _4cvr1h6o _1e0c1txw _kqswstnw _1pbyb4wl"])
33
+ }, /*#__PURE__*/React.createElement(VisibilityContainer, {
34
+ api: api,
35
+ controlSide: "left",
36
+ forceVisibleOnMouseOut: forceVisibleOnMouseOut,
37
+ shouldUseDisplayContents: true
38
+ }, surface));
39
+ };
@@ -0,0 +1,181 @@
1
+ /* block-controls-left-surfaces.tsx generated by @compiled/babel-plugin v2.0.0 */
2
+ import { ax, ix } from "@compiled/react/runtime";
3
+ import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
4
+ import { bind } from 'bind-event-listener';
5
+ import { getDocument } from '@atlaskit/browser-apis';
6
+ import { BLOCK_CONTROL_UI_CONTEXT } from '@atlaskit/editor-common/block-controls/block-control-ui-context';
7
+ import { BLOCK_CONTROLS_LEFT_SURFACE } from '@atlaskit/editor-common/block-controls/surface-keys';
8
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
9
+ import { createSurfaceContext } from '@atlaskit/editor-ui-control-model/types';
10
+ import { getNodeTypeWithLevel } from '../pm-plugins/decorations-common';
11
+ import { createBlockControlsSurfaceContext, createBlockControlsSurfaceContextForPosition } from './block-controls-surface-context';
12
+ import { BlockControlsLeftSurface } from './block-controls-left-surface';
13
+ import { getBlockControlsLeftSurfaceTargets } from './block-controls-left-surface-targets';
14
+ import { getNodeContentElement } from './utils/get-node-content-element';
15
+ import { getAbsoluteSurfacePlacement, getSurfacePlacement } from './utils/get-surface-placement';
16
+ const EMPTY_SURFACE_POSITIONS = [];
17
+ const EMPTY_SURFACE_COMPONENTS = [];
18
+ export const BlockControlsLeftSurfaces = ({
19
+ api,
20
+ editorView
21
+ }) => {
22
+ var _api$uiControlRegistr, _api$uiControlRegistr2;
23
+ const {
24
+ activeNode,
25
+ surfaceNodePositions
26
+ } = useSharedPluginStateWithSelector(api, ['blockControls'], states => {
27
+ var _states$blockControls, _states$blockControls2, _states$blockControls3;
28
+ return {
29
+ activeNode: (_states$blockControls = states.blockControlsState) === null || _states$blockControls === void 0 ? void 0 : _states$blockControls.activeNode,
30
+ surfaceNodePositions: (_states$blockControls2 = (_states$blockControls3 = states.blockControlsState) === null || _states$blockControls3 === void 0 ? void 0 : _states$blockControls3.surfaceNodePositions) !== null && _states$blockControls2 !== void 0 ? _states$blockControls2 : EMPTY_SURFACE_POSITIONS
31
+ };
32
+ });
33
+ const components = (_api$uiControlRegistr = (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(BLOCK_CONTROLS_LEFT_SURFACE)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : EMPTY_SURFACE_COMPONENTS;
34
+ const targets = useMemo(() => getBlockControlsLeftSurfaceTargets(activeNode, surfaceNodePositions), [activeNode, surfaceNodePositions]);
35
+ const surfaces = useMemo(() => targets.flatMap(target => {
36
+ const context = target.source === 'stored' ? createBlockControlsSurfaceContextForPosition(editorView.state, target.position, activeNode) : createBlockControlsSurfaceContext(editorView, activeNode, target.source);
37
+ if (!context) {
38
+ return [];
39
+ }
40
+ const surfaceContext = createSurfaceContext(BLOCK_CONTROL_UI_CONTEXT, context);
41
+ return [{
42
+ ...target,
43
+ blockControlsContext: context,
44
+ surfaceContext
45
+ }];
46
+ }), [activeNode, editorView, targets]);
47
+ const [placements, setPlacements] = useState(new Map());
48
+ const animationFrameRef = useRef(undefined);
49
+ useLayoutEffect(() => {
50
+ var _getDocument;
51
+ if (surfaces.length === 0) {
52
+ setPlacements(new Map());
53
+ return;
54
+ }
55
+ const measurementTargets = surfaces.flatMap(({
56
+ blockControlsContext,
57
+ position
58
+ }) => {
59
+ const targetNodeElement = editorView.nodeDOM(blockControlsContext.targetNode.pos);
60
+ const targetElementRoot = targetNodeElement instanceof HTMLElement ? targetNodeElement : targetNodeElement === null || targetNodeElement === void 0 ? void 0 : targetNodeElement.parentElement;
61
+ if (!targetElementRoot) {
62
+ return [];
63
+ }
64
+ return [{
65
+ blockControlsContext,
66
+ position,
67
+ targetElement: getNodeContentElement(targetElementRoot, blockControlsContext.targetNode.type.name),
68
+ targetElementRoot
69
+ }];
70
+ });
71
+ const offsetParent = editorView.dom.offsetParent;
72
+ const isDocumentOffsetParent = !offsetParent || offsetParent === ((_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.body);
73
+ const scrollingOffsetParent = offsetParent instanceof HTMLElement && !isDocumentOffsetParent ? offsetParent : undefined;
74
+ const updatePositions = () => {
75
+ var _scrollingOffsetParen, _scrollingOffsetParen2;
76
+ animationFrameRef.current = undefined;
77
+ const offsetParentRect = offsetParent === null || offsetParent === void 0 ? void 0 : offsetParent.getBoundingClientRect();
78
+ const offsetParentScrollTop = (_scrollingOffsetParen = scrollingOffsetParent === null || scrollingOffsetParent === void 0 ? void 0 : scrollingOffsetParent.scrollTop) !== null && _scrollingOffsetParen !== void 0 ? _scrollingOffsetParen : window.scrollY;
79
+ const offsetParentScrollLeft = (_scrollingOffsetParen2 = scrollingOffsetParent === null || scrollingOffsetParent === void 0 ? void 0 : scrollingOffsetParent.scrollLeft) !== null && _scrollingOffsetParen2 !== void 0 ? _scrollingOffsetParen2 : window.scrollX;
80
+ const nextPlacements = new Map();
81
+ for (const {
82
+ blockControlsContext,
83
+ position,
84
+ targetElement,
85
+ targetElementRoot
86
+ } of measurementTargets) {
87
+ var _targetElementRoot$ge;
88
+ if (!targetElementRoot.isConnected || !targetElement.isConnected) {
89
+ continue;
90
+ }
91
+ const placement = getSurfacePlacement({
92
+ layout: (_targetElementRoot$ge = targetElementRoot.getAttribute('layout')) !== null && _targetElementRoot$ge !== void 0 ? _targetElementRoot$ge : '',
93
+ nodeRect: targetElement.getBoundingClientRect(),
94
+ nodeType: blockControlsContext.targetNode.type.name,
95
+ nodeTypeWithLevel: getNodeTypeWithLevel(blockControlsContext.targetNode.node),
96
+ parentNodeType: blockControlsContext.targetNode.parentType === 'doc' ? undefined : blockControlsContext.targetNode.parentType
97
+ });
98
+ nextPlacements.set(position, getAbsoluteSurfacePlacement({
99
+ offsetParentRect,
100
+ offsetParentScrollLeft,
101
+ offsetParentScrollTop,
102
+ placement
103
+ }));
104
+ }
105
+ setPlacements(nextPlacements);
106
+ };
107
+ const schedulePositionUpdate = () => {
108
+ if (animationFrameRef.current === undefined) {
109
+ animationFrameRef.current = requestAnimationFrame(updatePositions);
110
+ }
111
+ };
112
+ updatePositions();
113
+ const resizeObserver = new ResizeObserver(schedulePositionUpdate);
114
+ const observedElements = new Set([editorView.dom]);
115
+ for (const {
116
+ targetElement
117
+ } of measurementTargets) {
118
+ observedElements.add(targetElement);
119
+ }
120
+ if (offsetParent instanceof HTMLElement) {
121
+ observedElements.add(offsetParent);
122
+ }
123
+ observedElements.forEach(element => resizeObserver.observe(element));
124
+ const unbindWindowResize = bind(window, {
125
+ type: 'resize',
126
+ listener: schedulePositionUpdate
127
+ });
128
+ const unbindWindowScroll = bind(window, {
129
+ type: 'scroll',
130
+ listener: schedulePositionUpdate,
131
+ options: {
132
+ capture: true,
133
+ passive: true
134
+ }
135
+ });
136
+ const visualViewport = window.visualViewport;
137
+ const unbindVisualViewportResize = visualViewport ? bind(visualViewport, {
138
+ type: 'resize',
139
+ listener: schedulePositionUpdate
140
+ }) : undefined;
141
+ const unbindVisualViewportScroll = visualViewport ? bind(visualViewport, {
142
+ type: 'scroll',
143
+ listener: schedulePositionUpdate
144
+ }) : undefined;
145
+ const unbindTransitionEnd = bind(editorView.dom, {
146
+ type: 'transitionend',
147
+ listener: schedulePositionUpdate,
148
+ options: {
149
+ capture: true
150
+ }
151
+ });
152
+ return () => {
153
+ if (animationFrameRef.current !== undefined) {
154
+ cancelAnimationFrame(animationFrameRef.current);
155
+ animationFrameRef.current = undefined;
156
+ }
157
+ resizeObserver.disconnect();
158
+ unbindWindowResize();
159
+ unbindWindowScroll();
160
+ unbindVisualViewportResize === null || unbindVisualViewportResize === void 0 ? void 0 : unbindVisualViewportResize();
161
+ unbindVisualViewportScroll === null || unbindVisualViewportScroll === void 0 ? void 0 : unbindVisualViewportScroll();
162
+ unbindTransitionEnd();
163
+ };
164
+ }, [editorView, surfaces]);
165
+ return /*#__PURE__*/React.createElement(React.Fragment, null, surfaces.map(({
166
+ position,
167
+ source,
168
+ surfaceContext
169
+ }) => {
170
+ var _activeNode$handleOpt;
171
+ return /*#__PURE__*/React.createElement(BlockControlsLeftSurface, {
172
+ api: api,
173
+ components: components,
174
+ forceVisibleOnMouseOut: Boolean(activeNode === null || activeNode === void 0 ? void 0 : (_activeNode$handleOpt = activeNode.handleOptions) === null || _activeNode$handleOpt === void 0 ? void 0 : _activeNode$handleOpt.isFocused),
175
+ key: position,
176
+ placement: placements.get(position),
177
+ source: source,
178
+ surfaceContext: surfaceContext
179
+ });
180
+ }));
181
+ };
@@ -1,9 +1,9 @@
1
- const getNodeContext = (view, pos) => {
2
- const node = view.state.doc.nodeAt(pos);
1
+ const getNodeContext = (state, pos) => {
2
+ const node = state.doc.nodeAt(pos);
3
3
  if (!node) {
4
4
  return undefined;
5
5
  }
6
- const $pos = view.state.doc.resolve(pos);
6
+ const $pos = state.doc.resolve(pos);
7
7
  const ancestors = [];
8
8
  for (let depth = 0; depth <= $pos.depth; depth++) {
9
9
  const ancestor = $pos.node(depth);
@@ -26,26 +26,32 @@ const getNodeContext = (view, pos) => {
26
26
  }
27
27
  };
28
28
  };
29
- export const createBlockControlsSurfaceContext = (view, activeNode, target = 'root') => {
30
- var _activeNode$rootPos, _activeNode$rootNodeT;
31
- if (!activeNode) {
32
- return undefined;
33
- }
34
- const rootPos = (_activeNode$rootPos = activeNode.rootPos) !== null && _activeNode$rootPos !== void 0 ? _activeNode$rootPos : activeNode.pos;
35
- const activeNodeContext = getNodeContext(view, activeNode.pos);
36
- const rootNodeContext = getNodeContext(view, rootPos);
37
- if (!activeNodeContext || !rootNodeContext) {
29
+ export const createBlockControlsSurfaceContextForPosition = (state, targetPos, activeNode) => {
30
+ var _activeNode$rootPos, _getNodeContext, _activeNode$rootNodeT;
31
+ const targetNodeContext = getNodeContext(state, targetPos);
32
+ if (!targetNodeContext) {
38
33
  return undefined;
39
34
  }
35
+ const activeNodeContext = activeNode ? getNodeContext(state, activeNode.pos) : undefined;
36
+ const rootPos = activeNode ? (_activeNode$rootPos = activeNode.rootPos) !== null && _activeNode$rootPos !== void 0 ? _activeNode$rootPos : activeNode.pos : targetPos;
37
+ const rootNodeContext = (_getNodeContext = getNodeContext(state, rootPos)) !== null && _getNodeContext !== void 0 ? _getNodeContext : targetNodeContext;
40
38
  return {
41
- activeNode: {
39
+ activeNode: activeNode && activeNodeContext ? {
42
40
  ...activeNodeContext,
43
41
  rootPos,
44
42
  rootType: {
45
43
  name: (_activeNode$rootNodeT = activeNode.rootNodeType) !== null && _activeNode$rootNodeT !== void 0 ? _activeNode$rootNodeT : rootNodeContext.type.name
46
44
  }
47
- },
45
+ } : undefined,
48
46
  rootNode: rootNodeContext,
49
- targetNode: target === 'active' ? activeNodeContext : rootNodeContext
47
+ targetNode: targetNodeContext
50
48
  };
49
+ };
50
+ export const createBlockControlsSurfaceContext = (view, activeNode, target = 'root') => {
51
+ var _activeNode$rootPos2;
52
+ if (!activeNode) {
53
+ return undefined;
54
+ }
55
+ const rootPos = (_activeNode$rootPos2 = activeNode.rootPos) !== null && _activeNode$rootPos2 !== void 0 ? _activeNode$rootPos2 : activeNode.pos;
56
+ return createBlockControlsSurfaceContextForPosition(view.state, target === 'active' ? activeNode.pos : rootPos, activeNode);
51
57
  };
@@ -26,7 +26,7 @@ import { selectionPreservationPluginKey } from './pm-plugins/selection-preservat
26
26
  import { createSelectionPreservationPlugin } from './pm-plugins/selection-preservation/pm-plugin';
27
27
  import { expandAndUpdateSelection as _expandAndUpdateSelection } from './pm-plugins/utils/expand-and-update-selection';
28
28
  import { selectNode } from './pm-plugins/utils/getSelection';
29
- import { BlockControlsSurface } from './ui/block-controls-surface';
29
+ import { BlockControlsLeftSurfaces } from './ui/block-controls-left-surfaces';
30
30
  import { getBlockControlsSurfaceDragHandleComponents } from './ui/block-controls-surface-drag-handle-registration';
31
31
  import { GlobalStylesWrapper } from './ui/global-styles';
32
32
  import { SurfaceEditorViewContext } from './ui/surface-editor-view-context';
@@ -38,6 +38,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
38
38
  var rightSideControlsEnabled = (_config$rightSideCont = config === null || config === void 0 ? void 0 : config.rightSideControlsEnabled) !== null && _config$rightSideCont !== void 0 ? _config$rightSideCont : false;
39
39
  var quickInsertButtonEnabled = (_config$quickInsertBu = config === null || config === void 0 ? void 0 : config.quickInsertButtonEnabled) !== null && _config$quickInsertBu !== void 0 ? _config$quickInsertBu : true;
40
40
  var registryBlockControlsEnabled = isExperimentEnabled('platform_editor_block_control_migration');
41
+ var surfaceNodePositionsEnabled = registryBlockControlsEnabled && isExperimentEnabled('platform_editor_collapsible_headings');
41
42
  var legacyBlockControlsEnabled = !registryBlockControlsEnabled;
42
43
  if (registryBlockControlsEnabled) {
43
44
  var _api$uiControlRegistr;
@@ -121,7 +122,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
121
122
  plugin: function plugin(_ref2) {
122
123
  var getIntl = _ref2.getIntl,
123
124
  nodeViewPortalProviderAPI = _ref2.nodeViewPortalProviderAPI;
124
- return createPlugin(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled && legacyBlockControlsEnabled, legacyBlockControlsEnabled);
125
+ return createPlugin(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled && legacyBlockControlsEnabled, legacyBlockControlsEnabled, surfaceNodePositionsEnabled);
125
126
  }
126
127
  }];
127
128
  if (editorExperiment('platform_editor_controls', 'variant1')) {
@@ -423,6 +424,10 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
423
424
  isEditing: (_interactionTrackingP = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP === void 0 ? void 0 : _interactionTrackingP.isEditing,
424
425
  isSelectedViaDragHandle: (_key$getState$isSelec = (_key$getState10 = key.getState(editorState)) === null || _key$getState10 === void 0 ? void 0 : _key$getState10.isSelectedViaDragHandle) !== null && _key$getState$isSelec !== void 0 ? _key$getState$isSelec : false
425
426
  };
427
+ if (surfaceNodePositionsEnabled) {
428
+ var _key$getState$surface, _key$getState11;
429
+ sharedState.surfaceNodePositions = (_key$getState$surface = (_key$getState11 = key.getState(editorState)) === null || _key$getState11 === void 0 ? void 0 : _key$getState11.surfaceNodePositions) !== null && _key$getState$surface !== void 0 ? _key$getState$surface : [];
430
+ }
426
431
  if (editorExperiment('platform_editor_controls', 'variant1')) {
427
432
  var _interactionTrackingP2, _interactionTrackingP3, _interactionTrackingP4;
428
433
  sharedState.isMouseOut = (_interactionTrackingP2 = (_interactionTrackingP3 = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP3 === void 0 ? void 0 : _interactionTrackingP3.isMouseOut) !== null && _interactionTrackingP2 !== void 0 ? _interactionTrackingP2 : false;
@@ -442,7 +447,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
442
447
  api: api
443
448
  }), registryBlockControlsEnabled && editorView && api ? /*#__PURE__*/React.createElement(SurfaceEditorViewContext.Provider, {
444
449
  value: editorView
445
- }, /*#__PURE__*/React.createElement(BlockControlsSurface, {
450
+ }, /*#__PURE__*/React.createElement(BlockControlsLeftSurfaces, {
446
451
  api: api,
447
452
  editorView: editorView
448
453
  })) : null);