@atlaskit/editor-plugin-block-controls 34.0.4 → 34.0.6
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.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/blockControlsPlugin.js +2 -10
- package/dist/cjs/pm-plugins/sparse-gutter-hover.js +15 -22
- package/dist/cjs/pm-plugins/sparse-surfaces.js +2 -2
- package/dist/cjs/ui/block-controls-left-surface.js +19 -83
- package/dist/cjs/ui/block-controls-right-surface.js +19 -70
- package/dist/cjs/ui/block-controls-surface-targets.js +1 -1
- package/dist/es2019/blockControlsPlugin.js +2 -10
- package/dist/es2019/pm-plugins/sparse-gutter-hover.js +15 -22
- package/dist/es2019/pm-plugins/sparse-surfaces.js +2 -2
- package/dist/es2019/ui/block-controls-left-surface.js +10 -76
- package/dist/es2019/ui/block-controls-right-surface.js +10 -63
- package/dist/es2019/ui/block-controls-surface-targets.js +1 -1
- package/dist/esm/blockControlsPlugin.js +2 -10
- package/dist/esm/pm-plugins/sparse-gutter-hover.js +15 -22
- package/dist/esm/pm-plugins/sparse-surfaces.js +2 -2
- package/dist/esm/ui/block-controls-left-surface.js +19 -83
- package/dist/esm/ui/block-controls-right-surface.js +19 -70
- package/dist/esm/ui/block-controls-surface-targets.js +1 -1
- package/dist/types/ui/block-controls-left-surface.d.ts +1 -1
- package/dist/types/ui/block-controls-right-surface.d.ts +1 -1
- package/dist/types/ui/block-controls-surface-targets.d.ts +1 -1
- package/package.json +7 -7
- package/dist/cjs/pm-plugins/sparse-surfaces-view.js +0 -149
- package/dist/cjs/ui/block-controls-left-surfaces.js +0 -294
- package/dist/cjs/ui/block-controls-right-surfaces.js +0 -285
- package/dist/es2019/pm-plugins/sparse-surfaces-view.js +0 -136
- package/dist/es2019/ui/block-controls-left-surfaces.js +0 -259
- package/dist/es2019/ui/block-controls-right-surfaces.js +0 -245
- package/dist/esm/pm-plugins/sparse-surfaces-view.js +0 -142
- package/dist/esm/ui/block-controls-left-surfaces.js +0 -285
- package/dist/esm/ui/block-controls-right-surfaces.js +0 -276
- package/dist/types/pm-plugins/sparse-surfaces-view.d.ts +0 -16
- package/dist/types/ui/block-controls-left-surfaces.d.ts +0 -15
- 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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
|
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
|
-
},
|
|
492
|
+
}, /*#__PURE__*/React.createElement(CommittedBlockControlsSurfaces, {
|
|
495
493
|
api: api,
|
|
496
494
|
editorView: editorView
|
|
497
|
-
}) :
|
|
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
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
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
|
-
|
|
283
|
-
|
|
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
|
|
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
|
|
39
|
-
var
|
|
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(
|
|
99
|
-
var api =
|
|
100
|
-
components =
|
|
101
|
-
forceVisibleOnMouseOut =
|
|
102
|
-
placement =
|
|
103
|
-
source =
|
|
104
|
-
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
|
25
|
-
var
|
|
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(
|
|
81
|
-
var api =
|
|
82
|
-
components =
|
|
83
|
-
forceVisibleOnMouseOut =
|
|
84
|
-
placement =
|
|
85
|
-
source =
|
|
86
|
-
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
|
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
|
|
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.
|
|
3
|
+
"version": "34.0.6",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/editor-plugin-interaction": "^47.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-limited-mode": "^30.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-metrics": "^34.0.0",
|
|
41
|
-
"@atlaskit/editor-plugin-quick-insert": "^33.
|
|
41
|
+
"@atlaskit/editor-plugin-quick-insert": "^33.1.0",
|
|
42
42
|
"@atlaskit/editor-plugin-selection": "^33.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-show-diff": "^33.1.0",
|
|
44
44
|
"@atlaskit/editor-plugin-toolbar": "^30.0.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@atlaskit/editor-shared-styles": "^5.2.0",
|
|
51
51
|
"@atlaskit/editor-tables": "^3.2.0",
|
|
52
52
|
"@atlaskit/editor-ui-control-model": "^3.0.0",
|
|
53
|
-
"@atlaskit/icon": "^38.
|
|
53
|
+
"@atlaskit/icon": "^38.2.0",
|
|
54
54
|
"@atlaskit/link": "^5.1.0",
|
|
55
55
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
56
56
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
"@atlaskit/primitives": "^22.8.0",
|
|
61
61
|
"@atlaskit/section-message": "^10.3.0",
|
|
62
62
|
"@atlaskit/theme": "^28.2.0",
|
|
63
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
63
|
+
"@atlaskit/tmp-editor-statsig": "^267.0.0",
|
|
64
64
|
"@atlaskit/tokens": "^20.14.0",
|
|
65
65
|
"@atlaskit/tooltip": "^24.4.0",
|
|
66
66
|
"@babel/runtime": "^7.0.0",
|
|
67
|
-
"@compiled/react": "^
|
|
67
|
+
"@compiled/react": "^2.0.0",
|
|
68
68
|
"@emotion/react": "^11.7.1",
|
|
69
69
|
"bind-event-listener": "^3.0.0",
|
|
70
70
|
"memoize-one": "^6.0.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"uuid": "^11.1.1"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@atlaskit/editor-common": "^137.
|
|
75
|
+
"@atlaskit/editor-common": "^137.6.0",
|
|
76
76
|
"react": "^18.2.0 || ^19.2.0",
|
|
77
77
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
78
78
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@af/editor-examples-helpers": "workspace:^",
|
|
100
|
-
"@atlaskit/editor-common": "^137.
|
|
100
|
+
"@atlaskit/editor-common": "^137.6.0",
|
|
101
101
|
"@atlaskit/editor-plugins": "^17.0.0",
|
|
102
102
|
"@atlaskit/synchrony-test-helpers": "workspace:^",
|
|
103
103
|
"@atlassian/structured-docs-types": "workspace:^",
|