@atlaskit/editor-plugin-block-controls 1.4.12 → 1.4.14
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 +20 -0
- package/dist/cjs/pm-plugins/main.js +5 -2
- package/dist/cjs/ui/drag-handle.js +38 -13
- package/dist/cjs/ui/global-styles.js +3 -0
- package/dist/cjs/ui/mouse-move-wrapper.js +40 -24
- package/dist/es2019/pm-plugins/main.js +5 -2
- package/dist/es2019/ui/drag-handle.js +34 -8
- package/dist/es2019/ui/global-styles.js +3 -0
- package/dist/es2019/ui/mouse-move-wrapper.js +34 -21
- package/dist/esm/pm-plugins/main.js +5 -2
- package/dist/esm/ui/drag-handle.js +38 -13
- package/dist/esm/ui/global-styles.js +3 -0
- package/dist/esm/ui/mouse-move-wrapper.js +41 -25
- package/dist/types/types.d.ts +6 -1
- package/dist/types-ts4.5/types.d.ts +2 -0
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 1.4.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#109040](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109040)
|
|
8
|
+
[`5c5824e70db23`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5c5824e70db23) -
|
|
9
|
+
ED-23629 Improve performance of mousemoveWrapper hiding on hover
|
|
10
|
+
|
|
11
|
+
## 1.4.13
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#108531](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/108531)
|
|
16
|
+
[`bc1dab1f64bd8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bc1dab1f64bd8) -
|
|
17
|
+
[ux] Don't render decorations when Editor is disabled or in 'view' mode
|
|
18
|
+
- [#110258](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110258)
|
|
19
|
+
[`e12a40c7d31ee`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e12a40c7d31ee) -
|
|
20
|
+
set selection on drag handle mouse down to ensure drag and drop does not use native behaviour
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 1.4.12
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -30,7 +30,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
30
30
|
},
|
|
31
31
|
apply: function apply(tr, currentState, oldState, newState) {
|
|
32
32
|
var _decorationState, _meta$activeNode, _meta$isDragging, _meta$editorHeight;
|
|
33
|
-
// return currentState;
|
|
34
33
|
var activeNode = currentState.activeNode,
|
|
35
34
|
decorations = currentState.decorations,
|
|
36
35
|
isMenuOpen = currentState.isMenuOpen,
|
|
@@ -115,7 +114,11 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
115
114
|
},
|
|
116
115
|
props: {
|
|
117
116
|
decorations: function decorations(state) {
|
|
118
|
-
var _key$getState;
|
|
117
|
+
var _api$editorDisabled, _key$getState;
|
|
118
|
+
var isDisabled = api === null || api === void 0 || (_api$editorDisabled = api.editorDisabled) === null || _api$editorDisabled === void 0 || (_api$editorDisabled = _api$editorDisabled.sharedState.currentState()) === null || _api$editorDisabled === void 0 ? void 0 : _api$editorDisabled.editorDisabled;
|
|
119
|
+
if (isDisabled) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
119
122
|
return (_key$getState = key.getState(state)) === null || _key$getState === void 0 ? void 0 : _key$getState.decorations;
|
|
120
123
|
}
|
|
121
124
|
},
|
|
@@ -27,10 +27,13 @@ var dragHandleButtonStyles = (0, _react2.css)({
|
|
|
27
27
|
flexDirection: 'column',
|
|
28
28
|
justifyContent: 'center',
|
|
29
29
|
alignItems: 'center',
|
|
30
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
30
31
|
height: _consts.DRAG_HANDLE_HEIGHT,
|
|
32
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
31
33
|
width: _consts.DRAG_HANDLE_WIDTH,
|
|
32
34
|
border: 'none',
|
|
33
35
|
background: 'transparent',
|
|
36
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
34
37
|
borderRadius: _consts.DRAG_HANDLE_BORDER_RADIUS,
|
|
35
38
|
color: "var(--ds-icon, #44546F)",
|
|
36
39
|
cursor: 'grab',
|
|
@@ -60,7 +63,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
60
63
|
setDragHandleSelected = _useState2[1];
|
|
61
64
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['featureFlags']),
|
|
62
65
|
featureFlagsState = _useSharedPluginState.featureFlagsState;
|
|
63
|
-
var
|
|
66
|
+
var handleOnClick = (0, _react.useCallback)(function () {
|
|
64
67
|
var _api$core, _api$core2;
|
|
65
68
|
setDragHandleSelected(!dragHandleSelected);
|
|
66
69
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
|
|
@@ -76,6 +79,25 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
76
79
|
});
|
|
77
80
|
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.focus();
|
|
78
81
|
}, [start, api, dragHandleSelected, setDragHandleSelected, nodeType]);
|
|
82
|
+
|
|
83
|
+
// handleMouseDown required along with onClick to ensure the correct selection
|
|
84
|
+
// is set immediately when the drag handle is clicked. Otherwise browser native
|
|
85
|
+
// drag and drop can take over and cause unpredictable behaviour.
|
|
86
|
+
var handleMouseDown = (0, _react.useCallback)(function () {
|
|
87
|
+
var _api$core3, _api$core4;
|
|
88
|
+
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref3) {
|
|
89
|
+
var tr = _ref3.tr;
|
|
90
|
+
if (start === undefined) {
|
|
91
|
+
return tr;
|
|
92
|
+
}
|
|
93
|
+
tr = (0, _utils.selectNode)(tr, start, nodeType);
|
|
94
|
+
tr.setMeta(_main.key, {
|
|
95
|
+
pos: start
|
|
96
|
+
});
|
|
97
|
+
return tr;
|
|
98
|
+
});
|
|
99
|
+
api === null || api === void 0 || (_api$core4 = api.core) === null || _api$core4 === void 0 || _api$core4.actions.focus();
|
|
100
|
+
}, [start, api, nodeType]);
|
|
79
101
|
(0, _react.useEffect)(function () {
|
|
80
102
|
var element = buttonRef.current;
|
|
81
103
|
if (!element) {
|
|
@@ -83,11 +105,11 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
83
105
|
}
|
|
84
106
|
return (0, _adapter.draggable)({
|
|
85
107
|
element: element,
|
|
86
|
-
onGenerateDragPreview: function onGenerateDragPreview(
|
|
87
|
-
var nativeSetDragImage =
|
|
108
|
+
onGenerateDragPreview: function onGenerateDragPreview(_ref4) {
|
|
109
|
+
var nativeSetDragImage = _ref4.nativeSetDragImage;
|
|
88
110
|
(0, _setCustomNativeDragPreview.setCustomNativeDragPreview)({
|
|
89
|
-
render: function render(
|
|
90
|
-
var container =
|
|
111
|
+
render: function render(_ref5) {
|
|
112
|
+
var container = _ref5.container;
|
|
91
113
|
var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(anchorName, "\"]"));
|
|
92
114
|
if (!dom) {
|
|
93
115
|
return;
|
|
@@ -98,17 +120,17 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
98
120
|
});
|
|
99
121
|
},
|
|
100
122
|
onDragStart: function onDragStart() {
|
|
101
|
-
var _api$
|
|
123
|
+
var _api$core5, _api$blockControls, _api$core6;
|
|
102
124
|
if (start === undefined) {
|
|
103
125
|
return;
|
|
104
126
|
}
|
|
105
|
-
api === null || api === void 0 || (_api$
|
|
106
|
-
api === null || api === void 0 || (_api$
|
|
127
|
+
api === null || api === void 0 || (_api$core5 = api.core) === null || _api$core5 === void 0 || _api$core5.actions.execute(api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.commands.setNodeDragged(start, anchorName, nodeType));
|
|
128
|
+
api === null || api === void 0 || (_api$core6 = api.core) === null || _api$core6 === void 0 || _api$core6.actions.focus();
|
|
107
129
|
},
|
|
108
130
|
onDrop: function onDrop() {
|
|
109
|
-
var _api$
|
|
110
|
-
api === null || api === void 0 || (_api$
|
|
111
|
-
var tr =
|
|
131
|
+
var _api$core7;
|
|
132
|
+
api === null || api === void 0 || (_api$core7 = api.core) === null || _api$core7 === void 0 || _api$core7.actions.execute(function (_ref6) {
|
|
133
|
+
var tr = _ref6.tr;
|
|
112
134
|
return tr.setMeta(_main.key, {
|
|
113
135
|
isDragging: false
|
|
114
136
|
});
|
|
@@ -140,9 +162,12 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
140
162
|
return (0, _react2.jsx)("button", {
|
|
141
163
|
type: "button",
|
|
142
164
|
css: [dragHandleButtonStyles, dragHandleSelected && selectedStyles],
|
|
143
|
-
ref: buttonRef
|
|
165
|
+
ref: buttonRef
|
|
166
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
167
|
+
,
|
|
144
168
|
style: positionStyles,
|
|
145
|
-
onClick:
|
|
169
|
+
onClick: handleOnClick,
|
|
170
|
+
onMouseDown: handleMouseDown,
|
|
146
171
|
"data-testid": "block-ctrl-drag-handle"
|
|
147
172
|
}, (0, _react2.jsx)(_dragHandler.default, {
|
|
148
173
|
label: "",
|
|
@@ -6,9 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.GlobalStylesWrapper = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
/** @jsx jsx */
|
|
9
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles -- Ignored via go/DSP-18766
|
|
9
10
|
|
|
10
11
|
var globalStyles = (0, _react.css)({
|
|
12
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
11
13
|
'.ProseMirror-widget:first-child + *': {
|
|
14
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
12
15
|
marginTop: '0 !important'
|
|
13
16
|
}
|
|
14
17
|
});
|
|
@@ -8,7 +8,6 @@ exports.MouseMoveWrapper = void 0;
|
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
|
-
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
11
|
var _dragHandlePositions = require("../utils/drag-handle-positions");
|
|
13
12
|
/** @jsx jsx */
|
|
14
13
|
|
|
@@ -28,39 +27,54 @@ var MouseMoveWrapper = exports.MouseMoveWrapper = function MouseMoveWrapper(_ref
|
|
|
28
27
|
anchorName = _ref.anchorName,
|
|
29
28
|
nodeType = _ref.nodeType,
|
|
30
29
|
getPos = _ref.getPos;
|
|
31
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['blockControls']),
|
|
32
|
-
blockControlsState = _useSharedPluginState.blockControlsState;
|
|
33
|
-
var activeNode = blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.activeNode;
|
|
34
|
-
var isDragging = blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isDragging;
|
|
35
30
|
var _useState = (0, _react.useState)(false),
|
|
36
31
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var _useState3 = (0, _react.useState)(),
|
|
32
|
+
isDragging = _useState2[0],
|
|
33
|
+
setIsDragging = _useState2[1];
|
|
34
|
+
var _useState3 = (0, _react.useState)(false),
|
|
40
35
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
hideWrapper = _useState4[0],
|
|
37
|
+
setHideWrapper = _useState4[1];
|
|
38
|
+
var _useState5 = (0, _react.useState)(),
|
|
39
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
40
|
+
pos = _useState6[0],
|
|
41
|
+
setPos = _useState6[1];
|
|
43
42
|
var onMouseEnter = (0, _react.useCallback)(function () {
|
|
43
|
+
if (!isDragging) {
|
|
44
|
+
setHideWrapper(true);
|
|
45
|
+
}
|
|
44
46
|
var pos = getPos();
|
|
45
47
|
if (pos === undefined) {
|
|
46
48
|
return;
|
|
47
49
|
}
|
|
48
|
-
if (api && api.blockControls &&
|
|
50
|
+
if (api && api.blockControls && !isDragging) {
|
|
49
51
|
var _api$core;
|
|
50
52
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api.blockControls.commands.showDragHandleAt(pos, anchorName, nodeType));
|
|
51
53
|
}
|
|
52
|
-
}, [
|
|
53
|
-
(0, _react.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
}, [setHideWrapper, isDragging, api, getPos, anchorName, nodeType]);
|
|
55
|
+
(0, _react.useEffect)(function () {
|
|
56
|
+
var _api$blockControls;
|
|
57
|
+
var unbind = api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.onChange(function (_ref2) {
|
|
58
|
+
var _nextSharedState$acti;
|
|
59
|
+
var nextSharedState = _ref2.nextSharedState;
|
|
60
|
+
var pos = getPos();
|
|
61
|
+
setIsDragging(Boolean(nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.isDragging));
|
|
62
|
+
if (!(nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.activeNode)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if ((nextSharedState === null || nextSharedState === void 0 || (_nextSharedState$acti = nextSharedState.activeNode) === null || _nextSharedState$acti === void 0 ? void 0 : _nextSharedState$acti.pos) !== pos && !(nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.isDragging)) {
|
|
66
|
+
setHideWrapper(false);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.isDragging) {
|
|
70
|
+
setHideWrapper(nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.isDragging);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return function () {
|
|
75
|
+
unbind === null || unbind === void 0 || unbind();
|
|
76
|
+
};
|
|
77
|
+
}, [getPos, api]);
|
|
64
78
|
(0, _react.useLayoutEffect)(function () {
|
|
65
79
|
var supportsAnchor = CSS.supports('height', "anchor-size(".concat(anchorName, " height)")) && CSS.supports('top', "anchor(".concat(anchorName, " start)"));
|
|
66
80
|
if (supportsAnchor) {
|
|
@@ -86,7 +100,9 @@ var MouseMoveWrapper = exports.MouseMoveWrapper = function MouseMoveWrapper(_ref
|
|
|
86
100
|
}, [view, anchorName]);
|
|
87
101
|
return (0, _react2.jsx)("div", {
|
|
88
102
|
onMouseEnter: onMouseEnter,
|
|
89
|
-
css: [basicStyles, !hideWrapper && mouseMoveWrapperStyles]
|
|
103
|
+
css: [basicStyles, !hideWrapper && mouseMoveWrapperStyles]
|
|
104
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
105
|
+
,
|
|
90
106
|
style: pos
|
|
91
107
|
});
|
|
92
108
|
};
|
|
@@ -22,7 +22,6 @@ export const createPlugin = api => {
|
|
|
22
22
|
},
|
|
23
23
|
apply(tr, currentState, oldState, newState) {
|
|
24
24
|
var _decorationState, _meta$activeNode, _meta$isDragging, _meta$editorHeight;
|
|
25
|
-
// return currentState;
|
|
26
25
|
let {
|
|
27
26
|
activeNode,
|
|
28
27
|
decorations,
|
|
@@ -109,7 +108,11 @@ export const createPlugin = api => {
|
|
|
109
108
|
},
|
|
110
109
|
props: {
|
|
111
110
|
decorations: state => {
|
|
112
|
-
var _key$getState;
|
|
111
|
+
var _api$editorDisabled, _api$editorDisabled$s, _key$getState;
|
|
112
|
+
const isDisabled = api === null || api === void 0 ? void 0 : (_api$editorDisabled = api.editorDisabled) === null || _api$editorDisabled === void 0 ? void 0 : (_api$editorDisabled$s = _api$editorDisabled.sharedState.currentState()) === null || _api$editorDisabled$s === void 0 ? void 0 : _api$editorDisabled$s.editorDisabled;
|
|
113
|
+
if (isDisabled) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
113
116
|
return (_key$getState = key.getState(state)) === null || _key$getState === void 0 ? void 0 : _key$getState.decorations;
|
|
114
117
|
}
|
|
115
118
|
},
|
|
@@ -18,10 +18,13 @@ const dragHandleButtonStyles = css({
|
|
|
18
18
|
flexDirection: 'column',
|
|
19
19
|
justifyContent: 'center',
|
|
20
20
|
alignItems: 'center',
|
|
21
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
21
22
|
height: DRAG_HANDLE_HEIGHT,
|
|
23
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
22
24
|
width: DRAG_HANDLE_WIDTH,
|
|
23
25
|
border: 'none',
|
|
24
26
|
background: 'transparent',
|
|
27
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
25
28
|
borderRadius: DRAG_HANDLE_BORDER_RADIUS,
|
|
26
29
|
color: "var(--ds-icon, #44546F)",
|
|
27
30
|
cursor: 'grab',
|
|
@@ -50,7 +53,7 @@ export const DragHandle = ({
|
|
|
50
53
|
const {
|
|
51
54
|
featureFlagsState
|
|
52
55
|
} = useSharedPluginState(api, ['featureFlags']);
|
|
53
|
-
const
|
|
56
|
+
const handleOnClick = useCallback(() => {
|
|
54
57
|
var _api$core, _api$core2;
|
|
55
58
|
setDragHandleSelected(!dragHandleSelected);
|
|
56
59
|
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(({
|
|
@@ -67,6 +70,26 @@ export const DragHandle = ({
|
|
|
67
70
|
});
|
|
68
71
|
api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.focus();
|
|
69
72
|
}, [start, api, dragHandleSelected, setDragHandleSelected, nodeType]);
|
|
73
|
+
|
|
74
|
+
// handleMouseDown required along with onClick to ensure the correct selection
|
|
75
|
+
// is set immediately when the drag handle is clicked. Otherwise browser native
|
|
76
|
+
// drag and drop can take over and cause unpredictable behaviour.
|
|
77
|
+
const handleMouseDown = useCallback(() => {
|
|
78
|
+
var _api$core3, _api$core4;
|
|
79
|
+
api === null || api === void 0 ? void 0 : (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(({
|
|
80
|
+
tr
|
|
81
|
+
}) => {
|
|
82
|
+
if (start === undefined) {
|
|
83
|
+
return tr;
|
|
84
|
+
}
|
|
85
|
+
tr = selectNode(tr, start, nodeType);
|
|
86
|
+
tr.setMeta(key, {
|
|
87
|
+
pos: start
|
|
88
|
+
});
|
|
89
|
+
return tr;
|
|
90
|
+
});
|
|
91
|
+
api === null || api === void 0 ? void 0 : (_api$core4 = api.core) === null || _api$core4 === void 0 ? void 0 : _api$core4.actions.focus();
|
|
92
|
+
}, [start, api, nodeType]);
|
|
70
93
|
useEffect(() => {
|
|
71
94
|
const element = buttonRef.current;
|
|
72
95
|
if (!element) {
|
|
@@ -91,16 +114,16 @@ export const DragHandle = ({
|
|
|
91
114
|
});
|
|
92
115
|
},
|
|
93
116
|
onDragStart() {
|
|
94
|
-
var _api$
|
|
117
|
+
var _api$core5, _api$blockControls, _api$core6;
|
|
95
118
|
if (start === undefined) {
|
|
96
119
|
return;
|
|
97
120
|
}
|
|
98
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
99
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
121
|
+
api === null || api === void 0 ? void 0 : (_api$core5 = api.core) === null || _api$core5 === void 0 ? void 0 : _api$core5.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.commands.setNodeDragged(start, anchorName, nodeType));
|
|
122
|
+
api === null || api === void 0 ? void 0 : (_api$core6 = api.core) === null || _api$core6 === void 0 ? void 0 : _api$core6.actions.focus();
|
|
100
123
|
},
|
|
101
124
|
onDrop() {
|
|
102
|
-
var _api$
|
|
103
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
125
|
+
var _api$core7;
|
|
126
|
+
api === null || api === void 0 ? void 0 : (_api$core7 = api.core) === null || _api$core7 === void 0 ? void 0 : _api$core7.actions.execute(({
|
|
104
127
|
tr
|
|
105
128
|
}) => {
|
|
106
129
|
return tr.setMeta(key, {
|
|
@@ -134,9 +157,12 @@ export const DragHandle = ({
|
|
|
134
157
|
return jsx("button", {
|
|
135
158
|
type: "button",
|
|
136
159
|
css: [dragHandleButtonStyles, dragHandleSelected && selectedStyles],
|
|
137
|
-
ref: buttonRef
|
|
160
|
+
ref: buttonRef
|
|
161
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
162
|
+
,
|
|
138
163
|
style: positionStyles,
|
|
139
|
-
onClick:
|
|
164
|
+
onClick: handleOnClick,
|
|
165
|
+
onMouseDown: handleMouseDown,
|
|
140
166
|
"data-testid": "block-ctrl-drag-handle"
|
|
141
167
|
}, jsx(DragHandlerIcon, {
|
|
142
168
|
label: "",
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles -- Ignored via go/DSP-18766
|
|
2
3
|
import { css, Global, jsx } from '@emotion/react';
|
|
3
4
|
const globalStyles = css({
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
4
6
|
'.ProseMirror-widget:first-child + *': {
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
5
8
|
marginTop: '0 !important'
|
|
6
9
|
}
|
|
7
10
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { useCallback, useLayoutEffect, useState } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useState } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
5
4
|
import { getTopPosition } from '../utils/drag-handle-positions';
|
|
6
5
|
const basicStyles = css({
|
|
7
6
|
position: 'absolute',
|
|
@@ -20,34 +19,46 @@ export const MouseMoveWrapper = ({
|
|
|
20
19
|
nodeType,
|
|
21
20
|
getPos
|
|
22
21
|
}) => {
|
|
23
|
-
const
|
|
24
|
-
blockControlsState
|
|
25
|
-
} = useSharedPluginState(api, ['blockControls']);
|
|
26
|
-
const activeNode = blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.activeNode;
|
|
27
|
-
const isDragging = blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isDragging;
|
|
22
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
28
23
|
const [hideWrapper, setHideWrapper] = useState(false);
|
|
29
24
|
const [pos, setPos] = useState();
|
|
30
25
|
const onMouseEnter = useCallback(() => {
|
|
26
|
+
if (!isDragging) {
|
|
27
|
+
setHideWrapper(true);
|
|
28
|
+
}
|
|
31
29
|
const pos = getPos();
|
|
32
30
|
if (pos === undefined) {
|
|
33
31
|
return;
|
|
34
32
|
}
|
|
35
|
-
if (api && api.blockControls &&
|
|
33
|
+
if (api && api.blockControls && !isDragging) {
|
|
36
34
|
var _api$core;
|
|
37
35
|
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api.blockControls.commands.showDragHandleAt(pos, anchorName, nodeType));
|
|
38
36
|
}
|
|
39
|
-
}, [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
}, [setHideWrapper, isDragging, api, getPos, anchorName, nodeType]);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
var _api$blockControls;
|
|
40
|
+
const unbind = api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.onChange(({
|
|
41
|
+
nextSharedState
|
|
42
|
+
}) => {
|
|
43
|
+
var _nextSharedState$acti;
|
|
44
|
+
const pos = getPos();
|
|
45
|
+
setIsDragging(Boolean(nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.isDragging));
|
|
46
|
+
if (!(nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.activeNode)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if ((nextSharedState === null || nextSharedState === void 0 ? void 0 : (_nextSharedState$acti = nextSharedState.activeNode) === null || _nextSharedState$acti === void 0 ? void 0 : _nextSharedState$acti.pos) !== pos && !(nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.isDragging)) {
|
|
50
|
+
setHideWrapper(false);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.isDragging) {
|
|
54
|
+
setHideWrapper(nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.isDragging);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return () => {
|
|
59
|
+
unbind === null || unbind === void 0 ? void 0 : unbind();
|
|
60
|
+
};
|
|
61
|
+
}, [getPos, api]);
|
|
51
62
|
useLayoutEffect(() => {
|
|
52
63
|
const supportsAnchor = CSS.supports('height', `anchor-size(${anchorName} height)`) && CSS.supports('top', `anchor(${anchorName} start)`);
|
|
53
64
|
if (supportsAnchor) {
|
|
@@ -71,7 +82,9 @@ export const MouseMoveWrapper = ({
|
|
|
71
82
|
}, [view, anchorName]);
|
|
72
83
|
return jsx("div", {
|
|
73
84
|
onMouseEnter: onMouseEnter,
|
|
74
|
-
css: [basicStyles, !hideWrapper && mouseMoveWrapperStyles]
|
|
85
|
+
css: [basicStyles, !hideWrapper && mouseMoveWrapperStyles]
|
|
86
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
87
|
+
,
|
|
75
88
|
style: pos
|
|
76
89
|
});
|
|
77
90
|
};
|
|
@@ -23,7 +23,6 @@ export var createPlugin = function createPlugin(api) {
|
|
|
23
23
|
},
|
|
24
24
|
apply: function apply(tr, currentState, oldState, newState) {
|
|
25
25
|
var _decorationState, _meta$activeNode, _meta$isDragging, _meta$editorHeight;
|
|
26
|
-
// return currentState;
|
|
27
26
|
var activeNode = currentState.activeNode,
|
|
28
27
|
decorations = currentState.decorations,
|
|
29
28
|
isMenuOpen = currentState.isMenuOpen,
|
|
@@ -108,7 +107,11 @@ export var createPlugin = function createPlugin(api) {
|
|
|
108
107
|
},
|
|
109
108
|
props: {
|
|
110
109
|
decorations: function decorations(state) {
|
|
111
|
-
var _key$getState;
|
|
110
|
+
var _api$editorDisabled, _key$getState;
|
|
111
|
+
var isDisabled = api === null || api === void 0 || (_api$editorDisabled = api.editorDisabled) === null || _api$editorDisabled === void 0 || (_api$editorDisabled = _api$editorDisabled.sharedState.currentState()) === null || _api$editorDisabled === void 0 ? void 0 : _api$editorDisabled.editorDisabled;
|
|
112
|
+
if (isDisabled) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
112
115
|
return (_key$getState = key.getState(state)) === null || _key$getState === void 0 ? void 0 : _key$getState.decorations;
|
|
113
116
|
}
|
|
114
117
|
},
|
|
@@ -19,10 +19,13 @@ var dragHandleButtonStyles = css({
|
|
|
19
19
|
flexDirection: 'column',
|
|
20
20
|
justifyContent: 'center',
|
|
21
21
|
alignItems: 'center',
|
|
22
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
22
23
|
height: DRAG_HANDLE_HEIGHT,
|
|
24
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
23
25
|
width: DRAG_HANDLE_WIDTH,
|
|
24
26
|
border: 'none',
|
|
25
27
|
background: 'transparent',
|
|
28
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
26
29
|
borderRadius: DRAG_HANDLE_BORDER_RADIUS,
|
|
27
30
|
color: "var(--ds-icon, #44546F)",
|
|
28
31
|
cursor: 'grab',
|
|
@@ -52,7 +55,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
52
55
|
setDragHandleSelected = _useState2[1];
|
|
53
56
|
var _useSharedPluginState = useSharedPluginState(api, ['featureFlags']),
|
|
54
57
|
featureFlagsState = _useSharedPluginState.featureFlagsState;
|
|
55
|
-
var
|
|
58
|
+
var handleOnClick = useCallback(function () {
|
|
56
59
|
var _api$core, _api$core2;
|
|
57
60
|
setDragHandleSelected(!dragHandleSelected);
|
|
58
61
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
|
|
@@ -68,6 +71,25 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
68
71
|
});
|
|
69
72
|
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.focus();
|
|
70
73
|
}, [start, api, dragHandleSelected, setDragHandleSelected, nodeType]);
|
|
74
|
+
|
|
75
|
+
// handleMouseDown required along with onClick to ensure the correct selection
|
|
76
|
+
// is set immediately when the drag handle is clicked. Otherwise browser native
|
|
77
|
+
// drag and drop can take over and cause unpredictable behaviour.
|
|
78
|
+
var handleMouseDown = useCallback(function () {
|
|
79
|
+
var _api$core3, _api$core4;
|
|
80
|
+
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref3) {
|
|
81
|
+
var tr = _ref3.tr;
|
|
82
|
+
if (start === undefined) {
|
|
83
|
+
return tr;
|
|
84
|
+
}
|
|
85
|
+
tr = selectNode(tr, start, nodeType);
|
|
86
|
+
tr.setMeta(key, {
|
|
87
|
+
pos: start
|
|
88
|
+
});
|
|
89
|
+
return tr;
|
|
90
|
+
});
|
|
91
|
+
api === null || api === void 0 || (_api$core4 = api.core) === null || _api$core4 === void 0 || _api$core4.actions.focus();
|
|
92
|
+
}, [start, api, nodeType]);
|
|
71
93
|
useEffect(function () {
|
|
72
94
|
var element = buttonRef.current;
|
|
73
95
|
if (!element) {
|
|
@@ -75,11 +97,11 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
75
97
|
}
|
|
76
98
|
return draggable({
|
|
77
99
|
element: element,
|
|
78
|
-
onGenerateDragPreview: function onGenerateDragPreview(
|
|
79
|
-
var nativeSetDragImage =
|
|
100
|
+
onGenerateDragPreview: function onGenerateDragPreview(_ref4) {
|
|
101
|
+
var nativeSetDragImage = _ref4.nativeSetDragImage;
|
|
80
102
|
setCustomNativeDragPreview({
|
|
81
|
-
render: function render(
|
|
82
|
-
var container =
|
|
103
|
+
render: function render(_ref5) {
|
|
104
|
+
var container = _ref5.container;
|
|
83
105
|
var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(anchorName, "\"]"));
|
|
84
106
|
if (!dom) {
|
|
85
107
|
return;
|
|
@@ -90,17 +112,17 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
90
112
|
});
|
|
91
113
|
},
|
|
92
114
|
onDragStart: function onDragStart() {
|
|
93
|
-
var _api$
|
|
115
|
+
var _api$core5, _api$blockControls, _api$core6;
|
|
94
116
|
if (start === undefined) {
|
|
95
117
|
return;
|
|
96
118
|
}
|
|
97
|
-
api === null || api === void 0 || (_api$
|
|
98
|
-
api === null || api === void 0 || (_api$
|
|
119
|
+
api === null || api === void 0 || (_api$core5 = api.core) === null || _api$core5 === void 0 || _api$core5.actions.execute(api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.commands.setNodeDragged(start, anchorName, nodeType));
|
|
120
|
+
api === null || api === void 0 || (_api$core6 = api.core) === null || _api$core6 === void 0 || _api$core6.actions.focus();
|
|
99
121
|
},
|
|
100
122
|
onDrop: function onDrop() {
|
|
101
|
-
var _api$
|
|
102
|
-
api === null || api === void 0 || (_api$
|
|
103
|
-
var tr =
|
|
123
|
+
var _api$core7;
|
|
124
|
+
api === null || api === void 0 || (_api$core7 = api.core) === null || _api$core7 === void 0 || _api$core7.actions.execute(function (_ref6) {
|
|
125
|
+
var tr = _ref6.tr;
|
|
104
126
|
return tr.setMeta(key, {
|
|
105
127
|
isDragging: false
|
|
106
128
|
});
|
|
@@ -132,9 +154,12 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
132
154
|
return jsx("button", {
|
|
133
155
|
type: "button",
|
|
134
156
|
css: [dragHandleButtonStyles, dragHandleSelected && selectedStyles],
|
|
135
|
-
ref: buttonRef
|
|
157
|
+
ref: buttonRef
|
|
158
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
159
|
+
,
|
|
136
160
|
style: positionStyles,
|
|
137
|
-
onClick:
|
|
161
|
+
onClick: handleOnClick,
|
|
162
|
+
onMouseDown: handleMouseDown,
|
|
138
163
|
"data-testid": "block-ctrl-drag-handle"
|
|
139
164
|
}, jsx(DragHandlerIcon, {
|
|
140
165
|
label: "",
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles -- Ignored via go/DSP-18766
|
|
2
3
|
import { css, Global, jsx } from '@emotion/react';
|
|
3
4
|
var globalStyles = css({
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
4
6
|
'.ProseMirror-widget:first-child + *': {
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
5
8
|
marginTop: '0 !important'
|
|
6
9
|
}
|
|
7
10
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import { useCallback, useLayoutEffect, useState } from 'react';
|
|
3
|
+
import { useCallback, useEffect, useLayoutEffect, useState } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
6
5
|
import { getTopPosition } from '../utils/drag-handle-positions';
|
|
7
6
|
var basicStyles = css({
|
|
8
7
|
position: 'absolute',
|
|
@@ -20,39 +19,54 @@ export var MouseMoveWrapper = function MouseMoveWrapper(_ref) {
|
|
|
20
19
|
anchorName = _ref.anchorName,
|
|
21
20
|
nodeType = _ref.nodeType,
|
|
22
21
|
getPos = _ref.getPos;
|
|
23
|
-
var _useSharedPluginState = useSharedPluginState(api, ['blockControls']),
|
|
24
|
-
blockControlsState = _useSharedPluginState.blockControlsState;
|
|
25
|
-
var activeNode = blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.activeNode;
|
|
26
|
-
var isDragging = blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isDragging;
|
|
27
22
|
var _useState = useState(false),
|
|
28
23
|
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var _useState3 = useState(),
|
|
24
|
+
isDragging = _useState2[0],
|
|
25
|
+
setIsDragging = _useState2[1];
|
|
26
|
+
var _useState3 = useState(false),
|
|
32
27
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
hideWrapper = _useState4[0],
|
|
29
|
+
setHideWrapper = _useState4[1];
|
|
30
|
+
var _useState5 = useState(),
|
|
31
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
32
|
+
pos = _useState6[0],
|
|
33
|
+
setPos = _useState6[1];
|
|
35
34
|
var onMouseEnter = useCallback(function () {
|
|
35
|
+
if (!isDragging) {
|
|
36
|
+
setHideWrapper(true);
|
|
37
|
+
}
|
|
36
38
|
var pos = getPos();
|
|
37
39
|
if (pos === undefined) {
|
|
38
40
|
return;
|
|
39
41
|
}
|
|
40
|
-
if (api && api.blockControls &&
|
|
42
|
+
if (api && api.blockControls && !isDragging) {
|
|
41
43
|
var _api$core;
|
|
42
44
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api.blockControls.commands.showDragHandleAt(pos, anchorName, nodeType));
|
|
43
45
|
}
|
|
44
|
-
}, [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
}, [setHideWrapper, isDragging, api, getPos, anchorName, nodeType]);
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
var _api$blockControls;
|
|
49
|
+
var unbind = api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.onChange(function (_ref2) {
|
|
50
|
+
var _nextSharedState$acti;
|
|
51
|
+
var nextSharedState = _ref2.nextSharedState;
|
|
52
|
+
var pos = getPos();
|
|
53
|
+
setIsDragging(Boolean(nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.isDragging));
|
|
54
|
+
if (!(nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.activeNode)) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if ((nextSharedState === null || nextSharedState === void 0 || (_nextSharedState$acti = nextSharedState.activeNode) === null || _nextSharedState$acti === void 0 ? void 0 : _nextSharedState$acti.pos) !== pos && !(nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.isDragging)) {
|
|
58
|
+
setHideWrapper(false);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.isDragging) {
|
|
62
|
+
setHideWrapper(nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.isDragging);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return function () {
|
|
67
|
+
unbind === null || unbind === void 0 || unbind();
|
|
68
|
+
};
|
|
69
|
+
}, [getPos, api]);
|
|
56
70
|
useLayoutEffect(function () {
|
|
57
71
|
var supportsAnchor = CSS.supports('height', "anchor-size(".concat(anchorName, " height)")) && CSS.supports('top', "anchor(".concat(anchorName, " start)"));
|
|
58
72
|
if (supportsAnchor) {
|
|
@@ -78,7 +92,9 @@ export var MouseMoveWrapper = function MouseMoveWrapper(_ref) {
|
|
|
78
92
|
}, [view, anchorName]);
|
|
79
93
|
return jsx("div", {
|
|
80
94
|
onMouseEnter: onMouseEnter,
|
|
81
|
-
css: [basicStyles, !hideWrapper && mouseMoveWrapperStyles]
|
|
95
|
+
css: [basicStyles, !hideWrapper && mouseMoveWrapperStyles]
|
|
96
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
97
|
+
,
|
|
82
98
|
style: pos
|
|
83
99
|
});
|
|
84
100
|
};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
2
3
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
3
4
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
4
5
|
import { type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -16,7 +17,11 @@ export interface PluginState {
|
|
|
16
17
|
}
|
|
17
18
|
export type ReleaseHiddenDecoration = () => boolean | undefined;
|
|
18
19
|
export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
19
|
-
dependencies: [
|
|
20
|
+
dependencies: [
|
|
21
|
+
OptionalPlugin<EditorDisabledPlugin>,
|
|
22
|
+
OptionalPlugin<WidthPlugin>,
|
|
23
|
+
OptionalPlugin<FeatureFlagsPlugin>
|
|
24
|
+
];
|
|
20
25
|
sharedState: {
|
|
21
26
|
isMenuOpen: boolean;
|
|
22
27
|
activeNode: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
2
3
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
3
4
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
4
5
|
import { type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -17,6 +18,7 @@ export interface PluginState {
|
|
|
17
18
|
export type ReleaseHiddenDecoration = () => boolean | undefined;
|
|
18
19
|
export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
19
20
|
dependencies: [
|
|
21
|
+
OptionalPlugin<EditorDisabledPlugin>,
|
|
20
22
|
OptionalPlugin<WidthPlugin>,
|
|
21
23
|
OptionalPlugin<FeatureFlagsPlugin>
|
|
22
24
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.14",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/editor-common": "^82.
|
|
34
|
+
"@atlaskit/editor-common": "^82.3.0",
|
|
35
|
+
"@atlaskit/editor-plugin-editor-disabled": "^1.1.5",
|
|
35
36
|
"@atlaskit/editor-plugin-feature-flags": "^1.1.0",
|
|
36
37
|
"@atlaskit/editor-plugin-width": "^1.1.0",
|
|
37
38
|
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
"@atlaskit/pragmatic-drag-and-drop": "^1.1.0",
|
|
41
42
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.3.0",
|
|
42
43
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
43
|
-
"@atlaskit/tokens": "^1.
|
|
44
|
+
"@atlaskit/tokens": "^1.50.0",
|
|
44
45
|
"@babel/runtime": "^7.0.0",
|
|
45
46
|
"@emotion/react": "^11.7.1",
|
|
46
47
|
"raf-schd": "^4.0.3"
|