@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.
- package/CHANGELOG.md +8 -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 +1 -1
- 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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 34.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`cc413c0ae0c16`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cc413c0ae0c16) -
|
|
8
|
+
Clean up `platform_editor_block_controls_cls_fix`, keeping the block-controls CLS fixes and
|
|
9
|
+
removing the legacy surface rendering paths.
|
|
10
|
+
|
|
3
11
|
## 34.0.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -31,8 +31,6 @@ var _sparseSurfaces = require("./pm-plugins/sparse-surfaces");
|
|
|
31
31
|
var _expandAndUpdateSelection2 = require("./pm-plugins/utils/expand-and-update-selection");
|
|
32
32
|
var _getSelection = require("./pm-plugins/utils/getSelection");
|
|
33
33
|
var _blockControlsSurfaces = require("./surface-lifecycle/block-controls-surfaces");
|
|
34
|
-
var _blockControlsLeftSurfaces = require("./ui/block-controls-left-surfaces");
|
|
35
|
-
var _blockControlsRightSurfaces = require("./ui/block-controls-right-surfaces");
|
|
36
34
|
var _blockControlsSurfaceDragHandleRegistration = require("./ui/block-controls-surface-drag-handle-registration");
|
|
37
35
|
var _globalStyles = require("./ui/global-styles");
|
|
38
36
|
var _surfaceEditorViewContext = require("./ui/surface-editor-view-context");
|
|
@@ -498,16 +496,10 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
498
496
|
api: api
|
|
499
497
|
}), registryBlockControlsEnabled && editorView && api ? /*#__PURE__*/_react.default.createElement(_surfaceEditorViewContext.SurfaceEditorViewContext.Provider, {
|
|
500
498
|
value: editorView
|
|
501
|
-
},
|
|
499
|
+
}, /*#__PURE__*/_react.default.createElement(_blockControlsSurfaces.CommittedBlockControlsSurfaces, {
|
|
502
500
|
api: api,
|
|
503
501
|
editorView: editorView
|
|
504
|
-
}) :
|
|
505
|
-
api: api,
|
|
506
|
-
editorView: editorView
|
|
507
|
-
}), /*#__PURE__*/_react.default.createElement(_blockControlsRightSurfaces.BlockControlsRightSurfaces, {
|
|
508
|
-
api: api,
|
|
509
|
-
editorView: editorView
|
|
510
|
-
}))) : null);
|
|
502
|
+
})) : null);
|
|
511
503
|
}
|
|
512
504
|
};
|
|
513
505
|
};
|
|
@@ -7,7 +7,6 @@ exports.isPossibleGutterElement = exports.createGutterBlockFinder = exports.bind
|
|
|
7
7
|
var _bindEventListener = require("bind-event-listener");
|
|
8
8
|
var _dragHandle = require("@atlaskit/editor-common/styles/drag-handle");
|
|
9
9
|
var _constants = require("@atlaskit/editor-shared-styles/constants");
|
|
10
|
-
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
11
10
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
12
11
|
var _consts = require("../ui/consts");
|
|
13
12
|
var _handleSparseHoverTarget = require("./handle-sparse-hover-target");
|
|
@@ -274,28 +273,22 @@ var bindSparseGutterHover = exports.bindSparseGutterHover = function bindSparseG
|
|
|
274
273
|
}
|
|
275
274
|
});
|
|
276
275
|
};
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
276
|
+
|
|
277
|
+
// Ignore hover from a resting pointer until it first moves.
|
|
278
|
+
var pointerHasMoved = false;
|
|
279
|
+
var unbindMouseOver = bindMouseListener('mouseover', function (event) {
|
|
280
|
+
if (!pointerHasMoved) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
onMouseOver(event);
|
|
284
|
+
});
|
|
285
|
+
var unbindMouseMove = bindMouseListener('mousemove', function (event) {
|
|
286
|
+
if (!pointerHasMoved) {
|
|
287
|
+
pointerHasMoved = true;
|
|
286
288
|
onMouseOver(event);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
pointerHasMoved = true;
|
|
291
|
-
onMouseOver(event);
|
|
292
|
-
}
|
|
293
|
-
onMouseMove(event);
|
|
294
|
-
});
|
|
295
|
-
} else {
|
|
296
|
-
unbindMouseOver = bindMouseListener('mouseover', onMouseOver);
|
|
297
|
-
unbindMouseMove = bindMouseListener('mousemove', onMouseMove);
|
|
298
|
-
}
|
|
289
|
+
}
|
|
290
|
+
onMouseMove(event);
|
|
291
|
+
});
|
|
299
292
|
return function () {
|
|
300
293
|
unbindMouseOver();
|
|
301
294
|
unbindMouseMove();
|
|
@@ -8,8 +8,8 @@ var _surfaceCandidateInvalidation = require("@atlaskit/editor-common/block-contr
|
|
|
8
8
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
9
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
10
10
|
var _view2 = require("@atlaskit/editor-prosemirror/view");
|
|
11
|
+
var _sparseSurfacesViewWithLifecycle = require("../surface-lifecycle/sparse-surfaces-view-with-lifecycle");
|
|
11
12
|
var _main = require("./main");
|
|
12
|
-
var _sparseSurfacesView = require("./sparse-surfaces-view");
|
|
13
13
|
var _sparseSurfaceCandidates = require("./utils/sparse-surface-candidates");
|
|
14
14
|
var _sparseSurfacesState = require("./utils/sparse-surfaces-state");
|
|
15
15
|
var sparseSurfacesKey = exports.sparseSurfacesKey = new _state.PluginKey('blockControlsSparseSurfaces');
|
|
@@ -39,7 +39,7 @@ var createSparseSurfacesPlugin = exports.createSparseSurfacesPlugin = function c
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
view: function view(_view) {
|
|
42
|
-
return (0,
|
|
42
|
+
return (0, _sparseSurfacesViewWithLifecycle.createSparseSurfacesViewWithLifecycle)({
|
|
43
43
|
api: api,
|
|
44
44
|
pluginKey: sparseSurfacesKey,
|
|
45
45
|
view: _view
|
|
@@ -10,28 +10,13 @@ require("./block-controls-left-surface.compiled.css");
|
|
|
10
10
|
var _runtime = require("@compiled/react/runtime");
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _blockControlUiContext = require("@atlaskit/editor-common/block-controls/block-control-ui-context");
|
|
13
|
-
var _surfaceKeys = require("@atlaskit/editor-common/block-controls/surface-keys");
|
|
14
|
-
var _surfaceRenderer = require("@atlaskit/editor-ui-control-model/surface-renderer");
|
|
15
|
-
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
16
13
|
var _blockControlsSurfaceWithClsFix = require("../surface-lifecycle/block-controls-surface-with-cls-fix");
|
|
17
|
-
var _blockControlsSurfaceComponents = require("./block-controls-surface-components");
|
|
18
|
-
var _blockControlsSurfaceContext = require("./block-controls-surface-context");
|
|
19
|
-
var _visibilityContainer = require("./visibility-container");
|
|
20
14
|
var leftSurfaceHiddenWrapperStyles = null;
|
|
21
15
|
var leftSurfaceOuterStyles = null;
|
|
22
16
|
var leftSurfaceGutterStyles = {
|
|
23
17
|
container: "_1f38ffwv _7cca15wb _lcxvglyw",
|
|
24
18
|
row: "_1bahesu3 _lcxvglyw _w1y61wug _19vrglyw"
|
|
25
19
|
};
|
|
26
|
-
|
|
27
|
-
// Nested surfaces (e.g. a table inside an expand) can span the target node's full height and sit
|
|
28
|
-
// over controls rendered in the node's own gutter, such as the table row insert button. Let pointer
|
|
29
|
-
// events pass through the wrapper and row so those controls stay interactive, matching the top-level
|
|
30
|
-
// gutter behaviour without applying its container query sizing.
|
|
31
|
-
var nestedSurfacePointerEventsStyles = {
|
|
32
|
-
container: "_lcxvglyw",
|
|
33
|
-
row: "_lcxvglyw _w1y61wug"
|
|
34
|
-
};
|
|
35
20
|
var leftSurfaceRowStyles = null;
|
|
36
21
|
|
|
37
22
|
// Applied in addition to leftSurfaceRowStyles when the target node is sticky-eligible (e.g. long
|
|
@@ -42,50 +27,12 @@ var leftSurfaceStickyStyles = null;
|
|
|
42
27
|
|
|
43
28
|
// Keep in sync with STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER in ./consts (must be a static literal here)
|
|
44
29
|
var leftSurfaceStickyTableHeaderStyles = null;
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
components = _ref.components,
|
|
48
|
-
forceVisibleOnMouseOut = _ref.forceVisibleOnMouseOut,
|
|
30
|
+
var BlockControlsLeftSurfaceWrapper = function BlockControlsLeftSurfaceWrapper(_ref) {
|
|
31
|
+
var children = _ref.children,
|
|
49
32
|
placement = _ref.placement,
|
|
50
33
|
source = _ref.source,
|
|
51
34
|
surfaceContext = _ref.surfaceContext;
|
|
52
35
|
var blockControlsContext = surfaceContext.get(_blockControlUiContext.BLOCK_CONTROL_UI_CONTEXT);
|
|
53
|
-
var controlSide = (0, _blockControlsSurfaceContext.getBlockControlsSurfaceControlSide)(blockControlsContext, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_controls_reliable_anchor'));
|
|
54
|
-
var _useBlockControlsVisi = (0, _visibilityContainer.useBlockControlsVisibility)({
|
|
55
|
-
api: api,
|
|
56
|
-
controlSide: controlSide,
|
|
57
|
-
forceVisibleOnMouseOut: forceVisibleOnMouseOut
|
|
58
|
-
}),
|
|
59
|
-
shouldHideHoverControls = _useBlockControlsVisi.shouldHide,
|
|
60
|
-
useCssStyles = _useBlockControlsVisi.useCssStyles;
|
|
61
|
-
var isSticky = placement.isSticky;
|
|
62
|
-
var isTopLevel = (blockControlsContext === null || blockControlsContext === void 0 ? void 0 : blockControlsContext.targetNode.parentType) === 'doc';
|
|
63
|
-
var shouldPassThroughNestedPointerEvents = !isTopLevel && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_nested_left_surface_pointer_fix');
|
|
64
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
65
|
-
"data-editor-block-controls-surface": true,
|
|
66
|
-
"data-editor-block-controls-side": "left",
|
|
67
|
-
"data-testid": source === 'stored' ? 'block-controls-left-surface-stored' : source === 'active' ? 'block-controls-left-surface-active' : 'block-controls-left-surface'
|
|
68
|
-
// 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.
|
|
69
|
-
,
|
|
70
|
-
style: placement.style,
|
|
71
|
-
className: (0, _runtime.ax)(["_kqswstnw _17c61i8t _1pbyb4wl", isTopLevel && leftSurfaceGutterStyles.container, shouldPassThroughNestedPointerEvents && nestedSurfacePointerEventsStyles.container])
|
|
72
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
73
|
-
className: (0, _runtime.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"])
|
|
74
|
-
}, /*#__PURE__*/_react.default.createElement(_blockControlsSurfaceComponents.BlockControlsVisibilityProvider, {
|
|
75
|
-
shouldHideHoverControls: shouldHideHoverControls,
|
|
76
|
-
useCssStyles: useCssStyles
|
|
77
|
-
}, /*#__PURE__*/_react.default.createElement(_surfaceRenderer.SurfaceRenderer, {
|
|
78
|
-
components: components,
|
|
79
|
-
surface: _surfaceKeys.BLOCK_CONTROLS_LEFT_SURFACE,
|
|
80
|
-
surfaceContext: surfaceContext
|
|
81
|
-
}))));
|
|
82
|
-
};
|
|
83
|
-
var BlockControlsLeftSurfaceWrapper = function BlockControlsLeftSurfaceWrapper(_ref2) {
|
|
84
|
-
var children = _ref2.children,
|
|
85
|
-
placement = _ref2.placement,
|
|
86
|
-
source = _ref2.source,
|
|
87
|
-
surfaceContext = _ref2.surfaceContext;
|
|
88
|
-
var blockControlsContext = surfaceContext.get(_blockControlUiContext.BLOCK_CONTROL_UI_CONTEXT);
|
|
89
36
|
var isSticky = placement.isSticky;
|
|
90
37
|
var isTopLevel = (blockControlsContext === null || blockControlsContext === void 0 ? void 0 : blockControlsContext.targetNode.parentType) === 'doc';
|
|
91
38
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -102,35 +49,24 @@ var BlockControlsLeftSurfaceWrapper = function BlockControlsLeftSurfaceWrapper(_
|
|
|
102
49
|
};
|
|
103
50
|
|
|
104
51
|
/** Renders one left block-controls surface at a document position. */
|
|
105
|
-
var BlockControlsLeftSurface = exports.BlockControlsLeftSurface = function BlockControlsLeftSurface(
|
|
106
|
-
var api =
|
|
107
|
-
components =
|
|
108
|
-
forceVisibleOnMouseOut =
|
|
109
|
-
placement =
|
|
110
|
-
source =
|
|
111
|
-
surfaceContext =
|
|
52
|
+
var BlockControlsLeftSurface = exports.BlockControlsLeftSurface = function BlockControlsLeftSurface(_ref2) {
|
|
53
|
+
var api = _ref2.api,
|
|
54
|
+
components = _ref2.components,
|
|
55
|
+
forceVisibleOnMouseOut = _ref2.forceVisibleOnMouseOut,
|
|
56
|
+
placement = _ref2.placement,
|
|
57
|
+
source = _ref2.source,
|
|
58
|
+
surfaceContext = _ref2.surfaceContext;
|
|
112
59
|
if (!placement) {
|
|
113
60
|
return null;
|
|
114
61
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
});
|
|
126
|
-
} else {
|
|
127
|
-
return /*#__PURE__*/_react.default.createElement(BlockControlsLeftSurfaceContent, {
|
|
128
|
-
api: api,
|
|
129
|
-
components: components,
|
|
130
|
-
forceVisibleOnMouseOut: forceVisibleOnMouseOut,
|
|
131
|
-
placement: placement,
|
|
132
|
-
source: source,
|
|
133
|
-
surfaceContext: surfaceContext
|
|
134
|
-
});
|
|
135
|
-
}
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(_blockControlsSurfaceWithClsFix.BlockControlsSurfaceWithClsFix, {
|
|
63
|
+
side: "left",
|
|
64
|
+
SurfaceWrapper: BlockControlsLeftSurfaceWrapper,
|
|
65
|
+
api: api,
|
|
66
|
+
components: components,
|
|
67
|
+
forceVisibleOnMouseOut: forceVisibleOnMouseOut,
|
|
68
|
+
placement: placement,
|
|
69
|
+
source: source,
|
|
70
|
+
surfaceContext: surfaceContext
|
|
71
|
+
});
|
|
136
72
|
};
|
|
@@ -10,12 +10,7 @@ require("./block-controls-right-surface.compiled.css");
|
|
|
10
10
|
var _runtime = require("@compiled/react/runtime");
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _blockControlUiContext = require("@atlaskit/editor-common/block-controls/block-control-ui-context");
|
|
13
|
-
var _surfaceKeys = require("@atlaskit/editor-common/block-controls/surface-keys");
|
|
14
|
-
var _surfaceRenderer = require("@atlaskit/editor-ui-control-model/surface-renderer");
|
|
15
|
-
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
16
13
|
var _blockControlsSurfaceWithClsFix = require("../surface-lifecycle/block-controls-surface-with-cls-fix");
|
|
17
|
-
var _blockControlsSurfaceComponents = require("./block-controls-surface-components");
|
|
18
|
-
var _visibilityContainer = require("./visibility-container");
|
|
19
14
|
var rightSurfaceHiddenWrapperStyles = null;
|
|
20
15
|
var rightSurfaceOuterStyles = null;
|
|
21
16
|
var rightSurfaceRowStyles = null;
|
|
@@ -28,47 +23,12 @@ var rightSurfaceStickyStyles = null;
|
|
|
28
23
|
|
|
29
24
|
// Keep in sync with STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER in ./consts (must be a static literal here)
|
|
30
25
|
var rightSurfaceStickyTableHeaderStyles = null;
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
components = _ref.components,
|
|
34
|
-
forceVisibleOnMouseOut = _ref.forceVisibleOnMouseOut,
|
|
26
|
+
var BlockControlsRightSurfaceWrapper = function BlockControlsRightSurfaceWrapper(_ref) {
|
|
27
|
+
var children = _ref.children,
|
|
35
28
|
placement = _ref.placement,
|
|
36
29
|
source = _ref.source,
|
|
37
30
|
surfaceContext = _ref.surfaceContext;
|
|
38
31
|
var blockControlsContext = surfaceContext.get(_blockControlUiContext.BLOCK_CONTROL_UI_CONTEXT);
|
|
39
|
-
var _useBlockControlsVisi = (0, _visibilityContainer.useBlockControlsVisibility)({
|
|
40
|
-
api: api,
|
|
41
|
-
controlSide: 'right',
|
|
42
|
-
forceVisibleOnMouseOut: forceVisibleOnMouseOut
|
|
43
|
-
}),
|
|
44
|
-
shouldHideHoverControls = _useBlockControlsVisi.shouldHide,
|
|
45
|
-
useCssStyles = _useBlockControlsVisi.useCssStyles;
|
|
46
|
-
var isSticky = placement.isSticky;
|
|
47
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
48
|
-
"data-editor-block-controls-surface": true,
|
|
49
|
-
"data-editor-block-controls-side": "right",
|
|
50
|
-
"data-testid": source === 'stored' ? 'block-controls-right-surface-stored' : source === 'active' ? 'block-controls-right-surface-active' : 'block-controls-right-surface'
|
|
51
|
-
// 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.
|
|
52
|
-
,
|
|
53
|
-
style: placement.style,
|
|
54
|
-
className: (0, _runtime.ax)(["_kqswstnw _17c61i8t _1pbyb4wl"])
|
|
55
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
56
|
-
className: (0, _runtime.ax)(["_zulpv77o _4cvr1h6o _1e0c1txw", isSticky && "_kqsw1if8 _154iu2gc", isSticky && (blockControlsContext === null || blockControlsContext === void 0 ? void 0 : blockControlsContext.targetNode.type.name) === 'table' && "_154i1ejb"])
|
|
57
|
-
}, /*#__PURE__*/_react.default.createElement(_blockControlsSurfaceComponents.BlockControlsVisibilityProvider, {
|
|
58
|
-
shouldHideHoverControls: shouldHideHoverControls,
|
|
59
|
-
useCssStyles: useCssStyles
|
|
60
|
-
}, /*#__PURE__*/_react.default.createElement(_surfaceRenderer.SurfaceRenderer, {
|
|
61
|
-
components: components,
|
|
62
|
-
surface: _surfaceKeys.BLOCK_CONTROLS_RIGHT_SURFACE,
|
|
63
|
-
surfaceContext: surfaceContext
|
|
64
|
-
}))));
|
|
65
|
-
};
|
|
66
|
-
var BlockControlsRightSurfaceWrapper = function BlockControlsRightSurfaceWrapper(_ref2) {
|
|
67
|
-
var children = _ref2.children,
|
|
68
|
-
placement = _ref2.placement,
|
|
69
|
-
source = _ref2.source,
|
|
70
|
-
surfaceContext = _ref2.surfaceContext;
|
|
71
|
-
var blockControlsContext = surfaceContext.get(_blockControlUiContext.BLOCK_CONTROL_UI_CONTEXT);
|
|
72
32
|
var isSticky = placement.isSticky;
|
|
73
33
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
74
34
|
"data-editor-block-controls-surface": true,
|
|
@@ -84,35 +44,24 @@ var BlockControlsRightSurfaceWrapper = function BlockControlsRightSurfaceWrapper
|
|
|
84
44
|
};
|
|
85
45
|
|
|
86
46
|
/** Renders one right block-controls surface at a document position. */
|
|
87
|
-
var BlockControlsRightSurface = exports.BlockControlsRightSurface = function BlockControlsRightSurface(
|
|
88
|
-
var api =
|
|
89
|
-
components =
|
|
90
|
-
forceVisibleOnMouseOut =
|
|
91
|
-
placement =
|
|
92
|
-
source =
|
|
93
|
-
surfaceContext =
|
|
47
|
+
var BlockControlsRightSurface = exports.BlockControlsRightSurface = function BlockControlsRightSurface(_ref2) {
|
|
48
|
+
var api = _ref2.api,
|
|
49
|
+
components = _ref2.components,
|
|
50
|
+
forceVisibleOnMouseOut = _ref2.forceVisibleOnMouseOut,
|
|
51
|
+
placement = _ref2.placement,
|
|
52
|
+
source = _ref2.source,
|
|
53
|
+
surfaceContext = _ref2.surfaceContext;
|
|
94
54
|
if (!placement) {
|
|
95
55
|
return null;
|
|
96
56
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
});
|
|
108
|
-
} else {
|
|
109
|
-
return /*#__PURE__*/_react.default.createElement(BlockControlsRightSurfaceContent, {
|
|
110
|
-
api: api,
|
|
111
|
-
components: components,
|
|
112
|
-
forceVisibleOnMouseOut: forceVisibleOnMouseOut,
|
|
113
|
-
placement: placement,
|
|
114
|
-
source: source,
|
|
115
|
-
surfaceContext: surfaceContext
|
|
116
|
-
});
|
|
117
|
-
}
|
|
57
|
+
return /*#__PURE__*/_react.default.createElement(_blockControlsSurfaceWithClsFix.BlockControlsSurfaceWithClsFix, {
|
|
58
|
+
side: "right",
|
|
59
|
+
SurfaceWrapper: BlockControlsRightSurfaceWrapper,
|
|
60
|
+
api: api,
|
|
61
|
+
components: components,
|
|
62
|
+
forceVisibleOnMouseOut: forceVisibleOnMouseOut,
|
|
63
|
+
placement: placement,
|
|
64
|
+
source: source,
|
|
65
|
+
surfaceContext: surfaceContext
|
|
66
|
+
});
|
|
118
67
|
};
|
|
@@ -12,7 +12,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
12
12
|
* Shared by both the left and right surfaces: this is pure position bookkeeping with no
|
|
13
13
|
* surface-specific behavior, so there's nothing to keep independent between them. What *is*
|
|
14
14
|
* kept independent is each surface's own React tree (component lookup, measurement effects,
|
|
15
|
-
* observers) — see
|
|
15
|
+
* observers) — see ../surface-lifecycle/block-controls-surfaces.tsx.
|
|
16
16
|
*/
|
|
17
17
|
var getBlockControlsSurfaceTargets = exports.getBlockControlsSurfaceTargets = function getBlockControlsSurfaceTargets(activeNode, storedPositions) {
|
|
18
18
|
var targetsByPosition = new Map();
|
|
@@ -22,8 +22,6 @@ import { createSparseSurfacesPlugin, sparseSurfacesKey } from './pm-plugins/spar
|
|
|
22
22
|
import { expandAndUpdateSelection } from './pm-plugins/utils/expand-and-update-selection';
|
|
23
23
|
import { selectNode } from './pm-plugins/utils/getSelection';
|
|
24
24
|
import { CommittedBlockControlsSurfaces } from './surface-lifecycle/block-controls-surfaces';
|
|
25
|
-
import { BlockControlsLeftSurfaces } from './ui/block-controls-left-surfaces';
|
|
26
|
-
import { BlockControlsRightSurfaces } from './ui/block-controls-right-surfaces';
|
|
27
25
|
import { getBlockControlsSurfaceDragHandleComponents } from './ui/block-controls-surface-drag-handle-registration';
|
|
28
26
|
import { GlobalStylesWrapper } from './ui/global-styles';
|
|
29
27
|
import { SurfaceEditorViewContext } from './ui/surface-editor-view-context';
|
|
@@ -489,16 +487,10 @@ export const blockControlsPlugin = ({
|
|
|
489
487
|
api: api
|
|
490
488
|
}), registryBlockControlsEnabled && editorView && api ? /*#__PURE__*/React.createElement(SurfaceEditorViewContext.Provider, {
|
|
491
489
|
value: editorView
|
|
492
|
-
},
|
|
490
|
+
}, /*#__PURE__*/React.createElement(CommittedBlockControlsSurfaces, {
|
|
493
491
|
api: api,
|
|
494
492
|
editorView: editorView
|
|
495
|
-
}) :
|
|
496
|
-
api: api,
|
|
497
|
-
editorView: editorView
|
|
498
|
-
}), /*#__PURE__*/React.createElement(BlockControlsRightSurfaces, {
|
|
499
|
-
api: api,
|
|
500
|
-
editorView: editorView
|
|
501
|
-
}))) : null);
|
|
493
|
+
})) : null);
|
|
502
494
|
}
|
|
503
495
|
};
|
|
504
496
|
};
|
|
@@ -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';
|
|
@@ -262,28 +261,22 @@ export const bindSparseGutterHover = ({
|
|
|
262
261
|
passive: true
|
|
263
262
|
}
|
|
264
263
|
});
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
264
|
+
|
|
265
|
+
// Ignore hover from a resting pointer until it first moves.
|
|
266
|
+
let pointerHasMoved = false;
|
|
267
|
+
const unbindMouseOver = bindMouseListener('mouseover', event => {
|
|
268
|
+
if (!pointerHasMoved) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
onMouseOver(event);
|
|
272
|
+
});
|
|
273
|
+
const unbindMouseMove = bindMouseListener('mousemove', event => {
|
|
274
|
+
if (!pointerHasMoved) {
|
|
275
|
+
pointerHasMoved = true;
|
|
274
276
|
onMouseOver(event);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
pointerHasMoved = true;
|
|
279
|
-
onMouseOver(event);
|
|
280
|
-
}
|
|
281
|
-
onMouseMove(event);
|
|
282
|
-
});
|
|
283
|
-
} else {
|
|
284
|
-
unbindMouseOver = bindMouseListener('mouseover', onMouseOver);
|
|
285
|
-
unbindMouseMove = bindMouseListener('mousemove', onMouseMove);
|
|
286
|
-
}
|
|
277
|
+
}
|
|
278
|
+
onMouseMove(event);
|
|
279
|
+
});
|
|
287
280
|
return () => {
|
|
288
281
|
unbindMouseOver();
|
|
289
282
|
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 const sparseSurfacesKey = new PluginKey('blockControlsSparseSurfaces');
|
|
@@ -29,7 +29,7 @@ export const createSparseSurfacesPlugin = api => new SafePlugin({
|
|
|
29
29
|
return api !== null && api !== void 0 && (_api$limitedMode = api.limitedMode) !== null && _api$limitedMode !== void 0 && (_api$limitedMode$shar = _api$limitedMode.sharedState.currentState()) !== null && _api$limitedMode$shar !== void 0 && _api$limitedMode$shar.enabled || (_blockControlsKey$get = blockControlsKey.getState(state)) !== null && _blockControlsKey$get !== void 0 && _blockControlsKey$get.isDragging ? DecorationSet.empty : (_sparseSurfacesKey$ge = sparseSurfacesKey.getState(state)) === null || _sparseSurfacesKey$ge === void 0 ? void 0 : _sparseSurfacesKey$ge.decorations;
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
-
view: view =>
|
|
32
|
+
view: view => createSparseSurfacesViewWithLifecycle({
|
|
33
33
|
api,
|
|
34
34
|
pluginKey: sparseSurfacesKey,
|
|
35
35
|
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
|
const leftSurfaceHiddenWrapperStyles = null;
|
|
14
8
|
const leftSurfaceOuterStyles = null;
|
|
15
9
|
const 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
|
-
const nestedSurfacePointerEventsStyles = {
|
|
25
|
-
container: "_lcxvglyw",
|
|
26
|
-
row: "_lcxvglyw _w1y61wug"
|
|
27
|
-
};
|
|
28
13
|
const leftSurfaceRowStyles = null;
|
|
29
14
|
|
|
30
15
|
// Applied in addition to leftSurfaceRowStyles when the target node is sticky-eligible (e.g. long
|
|
@@ -35,46 +20,6 @@ const 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
|
const leftSurfaceStickyTableHeaderStyles = null;
|
|
38
|
-
const BlockControlsLeftSurfaceContent = ({
|
|
39
|
-
api,
|
|
40
|
-
components,
|
|
41
|
-
forceVisibleOnMouseOut,
|
|
42
|
-
placement,
|
|
43
|
-
source,
|
|
44
|
-
surfaceContext
|
|
45
|
-
}) => {
|
|
46
|
-
const blockControlsContext = surfaceContext.get(BLOCK_CONTROL_UI_CONTEXT);
|
|
47
|
-
const controlSide = getBlockControlsSurfaceControlSide(blockControlsContext, isExperimentEnabled('platform_editor_controls_reliable_anchor'));
|
|
48
|
-
const {
|
|
49
|
-
shouldHide: shouldHideHoverControls,
|
|
50
|
-
useCssStyles
|
|
51
|
-
} = useBlockControlsVisibility({
|
|
52
|
-
api,
|
|
53
|
-
controlSide,
|
|
54
|
-
forceVisibleOnMouseOut
|
|
55
|
-
});
|
|
56
|
-
const isSticky = placement.isSticky;
|
|
57
|
-
const isTopLevel = (blockControlsContext === null || blockControlsContext === void 0 ? void 0 : blockControlsContext.targetNode.parentType) === 'doc';
|
|
58
|
-
const shouldPassThroughNestedPointerEvents = !isTopLevel && isExperimentEnabled('platform_editor_nested_left_surface_pointer_fix');
|
|
59
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
60
|
-
"data-editor-block-controls-surface": true,
|
|
61
|
-
"data-editor-block-controls-side": "left",
|
|
62
|
-
"data-testid": source === 'stored' ? 'block-controls-left-surface-stored' : source === 'active' ? 'block-controls-left-surface-active' : 'block-controls-left-surface'
|
|
63
|
-
// 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.
|
|
64
|
-
,
|
|
65
|
-
style: placement.style,
|
|
66
|
-
className: ax(["_kqswstnw _17c61i8t _1pbyb4wl", isTopLevel && leftSurfaceGutterStyles.container, shouldPassThroughNestedPointerEvents && nestedSurfacePointerEventsStyles.container])
|
|
67
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
68
|
-
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"])
|
|
69
|
-
}, /*#__PURE__*/React.createElement(BlockControlsVisibilityProvider, {
|
|
70
|
-
shouldHideHoverControls: shouldHideHoverControls,
|
|
71
|
-
useCssStyles: useCssStyles
|
|
72
|
-
}, /*#__PURE__*/React.createElement(SurfaceRenderer, {
|
|
73
|
-
components: components,
|
|
74
|
-
surface: BLOCK_CONTROLS_LEFT_SURFACE,
|
|
75
|
-
surfaceContext: surfaceContext
|
|
76
|
-
}))));
|
|
77
|
-
};
|
|
78
23
|
const BlockControlsLeftSurfaceWrapper = ({
|
|
79
24
|
children,
|
|
80
25
|
placement,
|
|
@@ -109,25 +54,14 @@ export const BlockControlsLeftSurface = ({
|
|
|
109
54
|
if (!placement) {
|
|
110
55
|
return null;
|
|
111
56
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
});
|
|
123
|
-
} else {
|
|
124
|
-
return /*#__PURE__*/React.createElement(BlockControlsLeftSurfaceContent, {
|
|
125
|
-
api: api,
|
|
126
|
-
components: components,
|
|
127
|
-
forceVisibleOnMouseOut: forceVisibleOnMouseOut,
|
|
128
|
-
placement: placement,
|
|
129
|
-
source: source,
|
|
130
|
-
surfaceContext: surfaceContext
|
|
131
|
-
});
|
|
132
|
-
}
|
|
57
|
+
return /*#__PURE__*/React.createElement(BlockControlsSurfaceWithClsFix, {
|
|
58
|
+
side: "left",
|
|
59
|
+
SurfaceWrapper: BlockControlsLeftSurfaceWrapper,
|
|
60
|
+
api: api,
|
|
61
|
+
components: components,
|
|
62
|
+
forceVisibleOnMouseOut: forceVisibleOnMouseOut,
|
|
63
|
+
placement: placement,
|
|
64
|
+
source: source,
|
|
65
|
+
surfaceContext: surfaceContext
|
|
66
|
+
});
|
|
133
67
|
};
|