@atlaskit/editor-plugin-block-controls 34.0.4 → 34.0.5

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 (35) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/blockControlsPlugin.js +2 -10
  3. package/dist/cjs/pm-plugins/sparse-gutter-hover.js +15 -22
  4. package/dist/cjs/pm-plugins/sparse-surfaces.js +2 -2
  5. package/dist/cjs/ui/block-controls-left-surface.js +19 -83
  6. package/dist/cjs/ui/block-controls-right-surface.js +19 -70
  7. package/dist/cjs/ui/block-controls-surface-targets.js +1 -1
  8. package/dist/es2019/blockControlsPlugin.js +2 -10
  9. package/dist/es2019/pm-plugins/sparse-gutter-hover.js +15 -22
  10. package/dist/es2019/pm-plugins/sparse-surfaces.js +2 -2
  11. package/dist/es2019/ui/block-controls-left-surface.js +10 -76
  12. package/dist/es2019/ui/block-controls-right-surface.js +10 -63
  13. package/dist/es2019/ui/block-controls-surface-targets.js +1 -1
  14. package/dist/esm/blockControlsPlugin.js +2 -10
  15. package/dist/esm/pm-plugins/sparse-gutter-hover.js +15 -22
  16. package/dist/esm/pm-plugins/sparse-surfaces.js +2 -2
  17. package/dist/esm/ui/block-controls-left-surface.js +19 -83
  18. package/dist/esm/ui/block-controls-right-surface.js +19 -70
  19. package/dist/esm/ui/block-controls-surface-targets.js +1 -1
  20. package/dist/types/ui/block-controls-left-surface.d.ts +1 -1
  21. package/dist/types/ui/block-controls-right-surface.d.ts +1 -1
  22. package/dist/types/ui/block-controls-surface-targets.d.ts +1 -1
  23. package/package.json +1 -1
  24. package/dist/cjs/pm-plugins/sparse-surfaces-view.js +0 -149
  25. package/dist/cjs/ui/block-controls-left-surfaces.js +0 -294
  26. package/dist/cjs/ui/block-controls-right-surfaces.js +0 -285
  27. package/dist/es2019/pm-plugins/sparse-surfaces-view.js +0 -136
  28. package/dist/es2019/ui/block-controls-left-surfaces.js +0 -259
  29. package/dist/es2019/ui/block-controls-right-surfaces.js +0 -245
  30. package/dist/esm/pm-plugins/sparse-surfaces-view.js +0 -142
  31. package/dist/esm/ui/block-controls-left-surfaces.js +0 -285
  32. package/dist/esm/ui/block-controls-right-surfaces.js +0 -276
  33. package/dist/types/pm-plugins/sparse-surfaces-view.d.ts +0 -16
  34. package/dist/types/ui/block-controls-left-surfaces.d.ts +0 -15
  35. package/dist/types/ui/block-controls-right-surfaces.d.ts +0 -24
@@ -3,12 +3,7 @@ import "./block-controls-right-surface.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
5
5
  import { BLOCK_CONTROL_UI_CONTEXT } from '@atlaskit/editor-common/block-controls/block-control-ui-context';
6
- import { BLOCK_CONTROLS_RIGHT_SURFACE } from '@atlaskit/editor-common/block-controls/surface-keys';
7
- import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model/surface-renderer';
8
- import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
9
6
  import { BlockControlsSurfaceWithClsFix } from '../surface-lifecycle/block-controls-surface-with-cls-fix';
10
- import { BlockControlsVisibilityProvider } from './block-controls-surface-components';
11
- import { useBlockControlsVisibility } from './visibility-container';
12
7
  const rightSurfaceHiddenWrapperStyles = null;
13
8
  const rightSurfaceOuterStyles = null;
14
9
  const rightSurfaceRowStyles = null;
@@ -21,43 +16,6 @@ const rightSurfaceStickyStyles = null;
21
16
 
22
17
  // Keep in sync with STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER in ./consts (must be a static literal here)
23
18
  const rightSurfaceStickyTableHeaderStyles = null;
24
- const BlockControlsRightSurfaceContent = ({
25
- api,
26
- components,
27
- forceVisibleOnMouseOut,
28
- placement,
29
- source,
30
- surfaceContext
31
- }) => {
32
- const blockControlsContext = surfaceContext.get(BLOCK_CONTROL_UI_CONTEXT);
33
- const {
34
- shouldHide: shouldHideHoverControls,
35
- useCssStyles
36
- } = useBlockControlsVisibility({
37
- api,
38
- controlSide: 'right',
39
- forceVisibleOnMouseOut
40
- });
41
- const isSticky = placement.isSticky;
42
- return /*#__PURE__*/React.createElement("div", {
43
- "data-editor-block-controls-surface": true,
44
- "data-editor-block-controls-side": "right",
45
- "data-testid": source === 'stored' ? 'block-controls-right-surface-stored' : source === 'active' ? 'block-controls-right-surface-active' : 'block-controls-right-surface'
46
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Placement is resolved per target node, from its runtime DOM geometry or from its CSS anchor.
47
- ,
48
- style: placement.style,
49
- className: ax(["_kqswstnw _17c61i8t _1pbyb4wl"])
50
- }, /*#__PURE__*/React.createElement("div", {
51
- className: ax(["_zulpv77o _4cvr1h6o _1e0c1txw", isSticky && "_kqsw1if8 _154iu2gc", isSticky && (blockControlsContext === null || blockControlsContext === void 0 ? void 0 : blockControlsContext.targetNode.type.name) === 'table' && "_154i1ejb"])
52
- }, /*#__PURE__*/React.createElement(BlockControlsVisibilityProvider, {
53
- shouldHideHoverControls: shouldHideHoverControls,
54
- useCssStyles: useCssStyles
55
- }, /*#__PURE__*/React.createElement(SurfaceRenderer, {
56
- components: components,
57
- surface: BLOCK_CONTROLS_RIGHT_SURFACE,
58
- surfaceContext: surfaceContext
59
- }))));
60
- };
61
19
  const BlockControlsRightSurfaceWrapper = ({
62
20
  children,
63
21
  placement,
@@ -91,25 +49,14 @@ export const BlockControlsRightSurface = ({
91
49
  if (!placement) {
92
50
  return null;
93
51
  }
94
- if (isExperimentEnabled('platform_editor_block_controls_cls_fix')) {
95
- return /*#__PURE__*/React.createElement(BlockControlsSurfaceWithClsFix, {
96
- side: "right",
97
- SurfaceWrapper: BlockControlsRightSurfaceWrapper,
98
- api: api,
99
- components: components,
100
- forceVisibleOnMouseOut: forceVisibleOnMouseOut,
101
- placement: placement,
102
- source: source,
103
- surfaceContext: surfaceContext
104
- });
105
- } else {
106
- return /*#__PURE__*/React.createElement(BlockControlsRightSurfaceContent, {
107
- api: api,
108
- components: components,
109
- forceVisibleOnMouseOut: forceVisibleOnMouseOut,
110
- placement: placement,
111
- source: source,
112
- surfaceContext: surfaceContext
113
- });
114
- }
52
+ return /*#__PURE__*/React.createElement(BlockControlsSurfaceWithClsFix, {
53
+ side: "right",
54
+ SurfaceWrapper: BlockControlsRightSurfaceWrapper,
55
+ api: api,
56
+ components: components,
57
+ forceVisibleOnMouseOut: forceVisibleOnMouseOut,
58
+ placement: placement,
59
+ source: source,
60
+ surfaceContext: surfaceContext
61
+ });
115
62
  };
@@ -3,7 +3,7 @@
3
3
  * Shared by both the left and right surfaces: this is pure position bookkeeping with no
4
4
  * surface-specific behavior, so there's nothing to keep independent between them. What *is*
5
5
  * kept independent is each surface's own React tree (component lookup, measurement effects,
6
- * observers) — see block-controls-left-surfaces.tsx / block-controls-right-surfaces.tsx.
6
+ * observers) — see ../surface-lifecycle/block-controls-surfaces.tsx.
7
7
  */
8
8
  export const getBlockControlsSurfaceTargets = (activeNode, storedPositions) => {
9
9
  const targetsByPosition = new Map();
@@ -26,8 +26,6 @@ import { createSparseSurfacesPlugin, sparseSurfacesKey } from './pm-plugins/spar
26
26
  import { expandAndUpdateSelection as _expandAndUpdateSelection } from './pm-plugins/utils/expand-and-update-selection';
27
27
  import { selectNode } from './pm-plugins/utils/getSelection';
28
28
  import { CommittedBlockControlsSurfaces } from './surface-lifecycle/block-controls-surfaces';
29
- import { BlockControlsLeftSurfaces } from './ui/block-controls-left-surfaces';
30
- import { BlockControlsRightSurfaces } from './ui/block-controls-right-surfaces';
31
29
  import { getBlockControlsSurfaceDragHandleComponents } from './ui/block-controls-surface-drag-handle-registration';
32
30
  import { GlobalStylesWrapper } from './ui/global-styles';
33
31
  import { SurfaceEditorViewContext } from './ui/surface-editor-view-context';
@@ -491,16 +489,10 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
491
489
  api: api
492
490
  }), registryBlockControlsEnabled && editorView && api ? /*#__PURE__*/React.createElement(SurfaceEditorViewContext.Provider, {
493
491
  value: editorView
494
- }, isExperimentEnabled('platform_editor_block_controls_cls_fix') ? /*#__PURE__*/React.createElement(CommittedBlockControlsSurfaces, {
492
+ }, /*#__PURE__*/React.createElement(CommittedBlockControlsSurfaces, {
495
493
  api: api,
496
494
  editorView: editorView
497
- }) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BlockControlsLeftSurfaces, {
498
- api: api,
499
- editorView: editorView
500
- }), /*#__PURE__*/React.createElement(BlockControlsRightSurfaces, {
501
- api: api,
502
- editorView: editorView
503
- }))) : null);
495
+ })) : null);
504
496
  }
505
497
  };
506
498
  };
@@ -1,7 +1,6 @@
1
1
  import { bind } from 'bind-event-listener';
2
2
  import { DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles/drag-handle';
3
3
  import { akEditorFullPageNarrowBreakout, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced } from '@atlaskit/editor-shared-styles/constants';
4
- import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
5
4
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
6
5
  import { BLOCK_CONTROLS_SURFACE_SELECTOR, DRAG_HANDLE_MAX_WIDTH_PLUS_GAP } from '../ui/consts';
7
6
  import { handleSparseHoverTarget, isSparseHoverSuppressed } from './handle-sparse-hover-target';
@@ -268,28 +267,22 @@ export var bindSparseGutterHover = function bindSparseGutterHover(_ref2) {
268
267
  }
269
268
  });
270
269
  };
271
- var unbindMouseOver;
272
- var unbindMouseMove;
273
- if (isExperimentEnabled('platform_editor_block_controls_cls_fix')) {
274
- // Match the legacy ignoreRestingPointerHover guard until the pointer first moves.
275
- var pointerHasMoved = false;
276
- unbindMouseOver = bindMouseListener('mouseover', function (event) {
277
- if (!pointerHasMoved) {
278
- return;
279
- }
270
+
271
+ // Ignore hover from a resting pointer until it first moves.
272
+ var pointerHasMoved = false;
273
+ var unbindMouseOver = bindMouseListener('mouseover', function (event) {
274
+ if (!pointerHasMoved) {
275
+ return;
276
+ }
277
+ onMouseOver(event);
278
+ });
279
+ var unbindMouseMove = bindMouseListener('mousemove', function (event) {
280
+ if (!pointerHasMoved) {
281
+ pointerHasMoved = true;
280
282
  onMouseOver(event);
281
- });
282
- unbindMouseMove = bindMouseListener('mousemove', function (event) {
283
- if (!pointerHasMoved) {
284
- pointerHasMoved = true;
285
- onMouseOver(event);
286
- }
287
- onMouseMove(event);
288
- });
289
- } else {
290
- unbindMouseOver = bindMouseListener('mouseover', onMouseOver);
291
- unbindMouseMove = bindMouseListener('mousemove', onMouseMove);
292
- }
283
+ }
284
+ onMouseMove(event);
285
+ });
293
286
  return function () {
294
287
  unbindMouseOver();
295
288
  unbindMouseMove();
@@ -2,8 +2,8 @@ import { BLOCK_CONTROLS_SURFACE_INVALIDATION } from '@atlaskit/editor-common/blo
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
4
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
+ import { createSparseSurfacesViewWithLifecycle } from '../surface-lifecycle/sparse-surfaces-view-with-lifecycle';
5
6
  import { key as blockControlsKey } from './main';
6
- import { createSparseSurfacesView } from './sparse-surfaces-view';
7
7
  import { emptySparseSurfaceCandidateState } from './utils/sparse-surface-candidates';
8
8
  import { applySparseSurfacesTransaction, createInitialSparseSurfacesState } from './utils/sparse-surfaces-state';
9
9
  export var sparseSurfacesKey = new PluginKey('blockControlsSparseSurfaces');
@@ -33,7 +33,7 @@ export var createSparseSurfacesPlugin = function createSparseSurfacesPlugin(api)
33
33
  }
34
34
  },
35
35
  view: function view(_view) {
36
- return createSparseSurfacesView({
36
+ return createSparseSurfacesViewWithLifecycle({
37
37
  api: api,
38
38
  pluginKey: sparseSurfacesKey,
39
39
  view: _view
@@ -3,28 +3,13 @@ import "./block-controls-left-surface.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
5
5
  import { BLOCK_CONTROL_UI_CONTEXT } from '@atlaskit/editor-common/block-controls/block-control-ui-context';
6
- import { BLOCK_CONTROLS_LEFT_SURFACE } from '@atlaskit/editor-common/block-controls/surface-keys';
7
- import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model/surface-renderer';
8
- import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
9
6
  import { BlockControlsSurfaceWithClsFix } from '../surface-lifecycle/block-controls-surface-with-cls-fix';
10
- import { BlockControlsVisibilityProvider } from './block-controls-surface-components';
11
- import { getBlockControlsSurfaceControlSide } from './block-controls-surface-context';
12
- import { useBlockControlsVisibility } from './visibility-container';
13
7
  var leftSurfaceHiddenWrapperStyles = null;
14
8
  var leftSurfaceOuterStyles = null;
15
9
  var leftSurfaceGutterStyles = {
16
10
  container: "_1f38ffwv _7cca15wb _lcxvglyw",
17
11
  row: "_1bahesu3 _lcxvglyw _w1y61wug _19vrglyw"
18
12
  };
19
-
20
- // Nested surfaces (e.g. a table inside an expand) can span the target node's full height and sit
21
- // over controls rendered in the node's own gutter, such as the table row insert button. Let pointer
22
- // events pass through the wrapper and row so those controls stay interactive, matching the top-level
23
- // gutter behaviour without applying its container query sizing.
24
- var nestedSurfacePointerEventsStyles = {
25
- container: "_lcxvglyw",
26
- row: "_lcxvglyw _w1y61wug"
27
- };
28
13
  var leftSurfaceRowStyles = null;
29
14
 
30
15
  // Applied in addition to leftSurfaceRowStyles when the target node is sticky-eligible (e.g. long
@@ -35,50 +20,12 @@ var leftSurfaceStickyStyles = null;
35
20
 
36
21
  // Keep in sync with STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER in ./consts (must be a static literal here)
37
22
  var leftSurfaceStickyTableHeaderStyles = null;
38
- var BlockControlsLeftSurfaceContent = function BlockControlsLeftSurfaceContent(_ref) {
39
- var api = _ref.api,
40
- components = _ref.components,
41
- forceVisibleOnMouseOut = _ref.forceVisibleOnMouseOut,
23
+ var BlockControlsLeftSurfaceWrapper = function BlockControlsLeftSurfaceWrapper(_ref) {
24
+ var children = _ref.children,
42
25
  placement = _ref.placement,
43
26
  source = _ref.source,
44
27
  surfaceContext = _ref.surfaceContext;
45
28
  var blockControlsContext = surfaceContext.get(BLOCK_CONTROL_UI_CONTEXT);
46
- var controlSide = getBlockControlsSurfaceControlSide(blockControlsContext, isExperimentEnabled('platform_editor_controls_reliable_anchor'));
47
- var _useBlockControlsVisi = useBlockControlsVisibility({
48
- api: api,
49
- controlSide: controlSide,
50
- forceVisibleOnMouseOut: forceVisibleOnMouseOut
51
- }),
52
- shouldHideHoverControls = _useBlockControlsVisi.shouldHide,
53
- useCssStyles = _useBlockControlsVisi.useCssStyles;
54
- var isSticky = placement.isSticky;
55
- var isTopLevel = (blockControlsContext === null || blockControlsContext === void 0 ? void 0 : blockControlsContext.targetNode.parentType) === 'doc';
56
- var shouldPassThroughNestedPointerEvents = !isTopLevel && isExperimentEnabled('platform_editor_nested_left_surface_pointer_fix');
57
- return /*#__PURE__*/React.createElement("div", {
58
- "data-editor-block-controls-surface": true,
59
- "data-editor-block-controls-side": "left",
60
- "data-testid": source === 'stored' ? 'block-controls-left-surface-stored' : source === 'active' ? 'block-controls-left-surface-active' : 'block-controls-left-surface'
61
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Placement is resolved per target node, from its runtime DOM geometry or from its CSS anchor.
62
- ,
63
- style: placement.style,
64
- className: ax(["_kqswstnw _17c61i8t _1pbyb4wl", isTopLevel && leftSurfaceGutterStyles.container, shouldPassThroughNestedPointerEvents && nestedSurfacePointerEventsStyles.container])
65
- }, /*#__PURE__*/React.createElement("div", {
66
- className: ax(["_zulpv77o _4cvr1h6o _1e0c1txw", isTopLevel && leftSurfaceGutterStyles.row, shouldPassThroughNestedPointerEvents && nestedSurfacePointerEventsStyles.row, isSticky && "_kqsw1if8 _154iu2gc", isSticky && (blockControlsContext === null || blockControlsContext === void 0 ? void 0 : blockControlsContext.targetNode.type.name) === 'table' && "_154i1ejb"])
67
- }, /*#__PURE__*/React.createElement(BlockControlsVisibilityProvider, {
68
- shouldHideHoverControls: shouldHideHoverControls,
69
- useCssStyles: useCssStyles
70
- }, /*#__PURE__*/React.createElement(SurfaceRenderer, {
71
- components: components,
72
- surface: BLOCK_CONTROLS_LEFT_SURFACE,
73
- surfaceContext: surfaceContext
74
- }))));
75
- };
76
- var BlockControlsLeftSurfaceWrapper = function BlockControlsLeftSurfaceWrapper(_ref2) {
77
- var children = _ref2.children,
78
- placement = _ref2.placement,
79
- source = _ref2.source,
80
- surfaceContext = _ref2.surfaceContext;
81
- var blockControlsContext = surfaceContext.get(BLOCK_CONTROL_UI_CONTEXT);
82
29
  var isSticky = placement.isSticky;
83
30
  var isTopLevel = (blockControlsContext === null || blockControlsContext === void 0 ? void 0 : blockControlsContext.targetNode.parentType) === 'doc';
84
31
  return /*#__PURE__*/React.createElement("div", {
@@ -95,35 +42,24 @@ var BlockControlsLeftSurfaceWrapper = function BlockControlsLeftSurfaceWrapper(_
95
42
  };
96
43
 
97
44
  /** Renders one left block-controls surface at a document position. */
98
- export var BlockControlsLeftSurface = function BlockControlsLeftSurface(_ref3) {
99
- var api = _ref3.api,
100
- components = _ref3.components,
101
- forceVisibleOnMouseOut = _ref3.forceVisibleOnMouseOut,
102
- placement = _ref3.placement,
103
- source = _ref3.source,
104
- surfaceContext = _ref3.surfaceContext;
45
+ export var BlockControlsLeftSurface = function BlockControlsLeftSurface(_ref2) {
46
+ var api = _ref2.api,
47
+ components = _ref2.components,
48
+ forceVisibleOnMouseOut = _ref2.forceVisibleOnMouseOut,
49
+ placement = _ref2.placement,
50
+ source = _ref2.source,
51
+ surfaceContext = _ref2.surfaceContext;
105
52
  if (!placement) {
106
53
  return null;
107
54
  }
108
- if (isExperimentEnabled('platform_editor_block_controls_cls_fix')) {
109
- return /*#__PURE__*/React.createElement(BlockControlsSurfaceWithClsFix, {
110
- side: "left",
111
- SurfaceWrapper: BlockControlsLeftSurfaceWrapper,
112
- api: api,
113
- components: components,
114
- forceVisibleOnMouseOut: forceVisibleOnMouseOut,
115
- placement: placement,
116
- source: source,
117
- surfaceContext: surfaceContext
118
- });
119
- } else {
120
- return /*#__PURE__*/React.createElement(BlockControlsLeftSurfaceContent, {
121
- api: api,
122
- components: components,
123
- forceVisibleOnMouseOut: forceVisibleOnMouseOut,
124
- placement: placement,
125
- source: source,
126
- surfaceContext: surfaceContext
127
- });
128
- }
55
+ return /*#__PURE__*/React.createElement(BlockControlsSurfaceWithClsFix, {
56
+ side: "left",
57
+ SurfaceWrapper: BlockControlsLeftSurfaceWrapper,
58
+ api: api,
59
+ components: components,
60
+ forceVisibleOnMouseOut: forceVisibleOnMouseOut,
61
+ placement: placement,
62
+ source: source,
63
+ surfaceContext: surfaceContext
64
+ });
129
65
  };
@@ -3,12 +3,7 @@ import "./block-controls-right-surface.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
5
5
  import { BLOCK_CONTROL_UI_CONTEXT } from '@atlaskit/editor-common/block-controls/block-control-ui-context';
6
- import { BLOCK_CONTROLS_RIGHT_SURFACE } from '@atlaskit/editor-common/block-controls/surface-keys';
7
- import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model/surface-renderer';
8
- import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
9
6
  import { BlockControlsSurfaceWithClsFix } from '../surface-lifecycle/block-controls-surface-with-cls-fix';
10
- import { BlockControlsVisibilityProvider } from './block-controls-surface-components';
11
- import { useBlockControlsVisibility } from './visibility-container';
12
7
  var rightSurfaceHiddenWrapperStyles = null;
13
8
  var rightSurfaceOuterStyles = null;
14
9
  var rightSurfaceRowStyles = null;
@@ -21,47 +16,12 @@ var rightSurfaceStickyStyles = null;
21
16
 
22
17
  // Keep in sync with STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER in ./consts (must be a static literal here)
23
18
  var rightSurfaceStickyTableHeaderStyles = null;
24
- var BlockControlsRightSurfaceContent = function BlockControlsRightSurfaceContent(_ref) {
25
- var api = _ref.api,
26
- components = _ref.components,
27
- forceVisibleOnMouseOut = _ref.forceVisibleOnMouseOut,
19
+ var BlockControlsRightSurfaceWrapper = function BlockControlsRightSurfaceWrapper(_ref) {
20
+ var children = _ref.children,
28
21
  placement = _ref.placement,
29
22
  source = _ref.source,
30
23
  surfaceContext = _ref.surfaceContext;
31
24
  var blockControlsContext = surfaceContext.get(BLOCK_CONTROL_UI_CONTEXT);
32
- var _useBlockControlsVisi = useBlockControlsVisibility({
33
- api: api,
34
- controlSide: 'right',
35
- forceVisibleOnMouseOut: forceVisibleOnMouseOut
36
- }),
37
- shouldHideHoverControls = _useBlockControlsVisi.shouldHide,
38
- useCssStyles = _useBlockControlsVisi.useCssStyles;
39
- var isSticky = placement.isSticky;
40
- return /*#__PURE__*/React.createElement("div", {
41
- "data-editor-block-controls-surface": true,
42
- "data-editor-block-controls-side": "right",
43
- "data-testid": source === 'stored' ? 'block-controls-right-surface-stored' : source === 'active' ? 'block-controls-right-surface-active' : 'block-controls-right-surface'
44
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Placement is resolved per target node, from its runtime DOM geometry or from its CSS anchor.
45
- ,
46
- style: placement.style,
47
- className: ax(["_kqswstnw _17c61i8t _1pbyb4wl"])
48
- }, /*#__PURE__*/React.createElement("div", {
49
- className: ax(["_zulpv77o _4cvr1h6o _1e0c1txw", isSticky && "_kqsw1if8 _154iu2gc", isSticky && (blockControlsContext === null || blockControlsContext === void 0 ? void 0 : blockControlsContext.targetNode.type.name) === 'table' && "_154i1ejb"])
50
- }, /*#__PURE__*/React.createElement(BlockControlsVisibilityProvider, {
51
- shouldHideHoverControls: shouldHideHoverControls,
52
- useCssStyles: useCssStyles
53
- }, /*#__PURE__*/React.createElement(SurfaceRenderer, {
54
- components: components,
55
- surface: BLOCK_CONTROLS_RIGHT_SURFACE,
56
- surfaceContext: surfaceContext
57
- }))));
58
- };
59
- var BlockControlsRightSurfaceWrapper = function BlockControlsRightSurfaceWrapper(_ref2) {
60
- var children = _ref2.children,
61
- placement = _ref2.placement,
62
- source = _ref2.source,
63
- surfaceContext = _ref2.surfaceContext;
64
- var blockControlsContext = surfaceContext.get(BLOCK_CONTROL_UI_CONTEXT);
65
25
  var isSticky = placement.isSticky;
66
26
  return /*#__PURE__*/React.createElement("div", {
67
27
  "data-editor-block-controls-surface": true,
@@ -77,35 +37,24 @@ var BlockControlsRightSurfaceWrapper = function BlockControlsRightSurfaceWrapper
77
37
  };
78
38
 
79
39
  /** Renders one right block-controls surface at a document position. */
80
- export var BlockControlsRightSurface = function BlockControlsRightSurface(_ref3) {
81
- var api = _ref3.api,
82
- components = _ref3.components,
83
- forceVisibleOnMouseOut = _ref3.forceVisibleOnMouseOut,
84
- placement = _ref3.placement,
85
- source = _ref3.source,
86
- surfaceContext = _ref3.surfaceContext;
40
+ export var BlockControlsRightSurface = function BlockControlsRightSurface(_ref2) {
41
+ var api = _ref2.api,
42
+ components = _ref2.components,
43
+ forceVisibleOnMouseOut = _ref2.forceVisibleOnMouseOut,
44
+ placement = _ref2.placement,
45
+ source = _ref2.source,
46
+ surfaceContext = _ref2.surfaceContext;
87
47
  if (!placement) {
88
48
  return null;
89
49
  }
90
- if (isExperimentEnabled('platform_editor_block_controls_cls_fix')) {
91
- return /*#__PURE__*/React.createElement(BlockControlsSurfaceWithClsFix, {
92
- side: "right",
93
- SurfaceWrapper: BlockControlsRightSurfaceWrapper,
94
- api: api,
95
- components: components,
96
- forceVisibleOnMouseOut: forceVisibleOnMouseOut,
97
- placement: placement,
98
- source: source,
99
- surfaceContext: surfaceContext
100
- });
101
- } else {
102
- return /*#__PURE__*/React.createElement(BlockControlsRightSurfaceContent, {
103
- api: api,
104
- components: components,
105
- forceVisibleOnMouseOut: forceVisibleOnMouseOut,
106
- placement: placement,
107
- source: source,
108
- surfaceContext: surfaceContext
109
- });
110
- }
50
+ return /*#__PURE__*/React.createElement(BlockControlsSurfaceWithClsFix, {
51
+ side: "right",
52
+ SurfaceWrapper: BlockControlsRightSurfaceWrapper,
53
+ api: api,
54
+ components: components,
55
+ forceVisibleOnMouseOut: forceVisibleOnMouseOut,
56
+ placement: placement,
57
+ source: source,
58
+ surfaceContext: surfaceContext
59
+ });
111
60
  };
@@ -6,7 +6,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
6
6
  * Shared by both the left and right surfaces: this is pure position bookkeeping with no
7
7
  * surface-specific behavior, so there's nothing to keep independent between them. What *is*
8
8
  * kept independent is each surface's own React tree (component lookup, measurement effects,
9
- * observers) — see block-controls-left-surfaces.tsx / block-controls-right-surfaces.tsx.
9
+ * observers) — see ../surface-lifecycle/block-controls-surfaces.tsx.
10
10
  */
11
11
  export var getBlockControlsSurfaceTargets = function getBlockControlsSurfaceTargets(activeNode, storedPositions) {
12
12
  var targetsByPosition = new Map();
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import React from 'react';
7
7
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
8
- import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model/surface-renderer';
8
+ import type { SurfaceRenderer } from '@atlaskit/editor-ui-control-model/surface-renderer';
9
9
  import type { SurfaceContext } from '@atlaskit/editor-ui-control-model/types';
10
10
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
11
11
  import type { BlockControlsSurfaceTarget } from './block-controls-surface-targets';
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import React from 'react';
7
7
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
8
- import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model/surface-renderer';
8
+ import type { SurfaceRenderer } from '@atlaskit/editor-ui-control-model/surface-renderer';
9
9
  import type { SurfaceContext } from '@atlaskit/editor-ui-control-model/types';
10
10
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
11
11
  import type { BlockControlsSurfaceTarget } from './block-controls-surface-targets';
@@ -8,6 +8,6 @@ export type BlockControlsSurfaceTarget = {
8
8
  * Shared by both the left and right surfaces: this is pure position bookkeeping with no
9
9
  * surface-specific behavior, so there's nothing to keep independent between them. What *is*
10
10
  * kept independent is each surface's own React tree (component lookup, measurement effects,
11
- * observers) — see block-controls-left-surfaces.tsx / block-controls-right-surfaces.tsx.
11
+ * observers) — see ../surface-lifecycle/block-controls-surfaces.tsx.
12
12
  */
13
13
  export declare const getBlockControlsSurfaceTargets: (activeNode: ActiveNode | undefined, storedPositions: readonly number[]) => readonly BlockControlsSurfaceTarget[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "34.0.4",
3
+ "version": "34.0.5",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",