@atlaskit/editor-plugin-block-controls 2.13.13 → 2.13.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 +9 -0
- package/dist/cjs/pm-plugins/decorations-drop-target.js +3 -0
- package/dist/cjs/ui/drop-target-layout.js +7 -4
- package/dist/cjs/ui/drop-target-v2.js +4 -5
- package/dist/cjs/utils/inline-drop-target.js +4 -0
- package/dist/es2019/pm-plugins/decorations-drop-target.js +3 -0
- package/dist/es2019/ui/drop-target-layout.js +8 -5
- package/dist/es2019/ui/drop-target-v2.js +5 -5
- package/dist/es2019/utils/inline-drop-target.js +4 -1
- package/dist/esm/pm-plugins/decorations-drop-target.js +3 -0
- package/dist/esm/ui/drop-target-layout.js +7 -4
- package/dist/esm/ui/drop-target-v2.js +4 -5
- package/dist/esm/utils/inline-drop-target.js +4 -0
- package/dist/types/ui/drop-target-layout.d.ts +1 -1
- package/dist/types/utils/inline-drop-target.d.ts +2 -1
- package/dist/types-ts4.5/ui/drop-target-layout.d.ts +1 -1
- package/dist/types-ts4.5/utils/inline-drop-target.d.ts +2 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 2.13.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#163579](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/163579)
|
|
8
|
+
[`15dc53a3077f1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/15dc53a3077f1) -
|
|
9
|
+
Hide unnecessary inline drop targets
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 2.13.13
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -163,6 +163,9 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
|
|
|
163
163
|
if ((0, _experiments.editorExperiment)('nested-dnd', true)) {
|
|
164
164
|
depth = $pos.depth;
|
|
165
165
|
if (isAdvancedLayoutsPreRelease2) {
|
|
166
|
+
if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.pos) === pos && activeNode.nodeType !== 'layoutColumn') {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
166
169
|
if (node.type.name === 'layoutColumn' && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutSection' && (parent === null || parent === void 0 ? void 0 : parent.firstChild) !== node && (
|
|
167
170
|
// Not the first node
|
|
168
171
|
(parent === null || parent === void 0 ? void 0 : parent.childCount) < (0, _consts.maxLayoutColumnSupported)() || isSameLayout)) {
|
|
@@ -39,6 +39,7 @@ var dropTargetLayoutHintStyle = (0, _react2.css)({
|
|
|
39
39
|
width: 0
|
|
40
40
|
});
|
|
41
41
|
var DropTargetLayout = exports.DropTargetLayout = function DropTargetLayout(props) {
|
|
42
|
+
var _api$blockControls;
|
|
42
43
|
var api = props.api,
|
|
43
44
|
getPos = props.getPos,
|
|
44
45
|
parent = props.parent;
|
|
@@ -51,10 +52,9 @@ var DropTargetLayout = exports.DropTargetLayout = function DropTargetLayout(prop
|
|
|
51
52
|
var _useActiveAnchorTrack = (0, _activeAnchorTracker.useActiveAnchorTracker)(anchorName),
|
|
52
53
|
_useActiveAnchorTrack2 = (0, _slicedToArray2.default)(_useActiveAnchorTrack, 1),
|
|
53
54
|
isActiveAnchor = _useActiveAnchorTrack2[0];
|
|
55
|
+
var _ref = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
56
|
+
activeNode = _ref.activeNode;
|
|
54
57
|
var onDrop = (0, _react.useCallback)(function () {
|
|
55
|
-
var _api$blockControls;
|
|
56
|
-
var _ref = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
57
|
-
activeNode = _ref.activeNode;
|
|
58
58
|
if (!activeNode) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
@@ -64,7 +64,7 @@ var DropTargetLayout = exports.DropTargetLayout = function DropTargetLayout(prop
|
|
|
64
64
|
var from = activeNode.pos;
|
|
65
65
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.moveToLayout(from, to));
|
|
66
66
|
}
|
|
67
|
-
}, [api, getPos]);
|
|
67
|
+
}, [api, getPos, activeNode]);
|
|
68
68
|
(0, _react.useEffect)(function () {
|
|
69
69
|
if (ref.current) {
|
|
70
70
|
return (0, _adapter.dropTargetForElements)({
|
|
@@ -79,6 +79,9 @@ var DropTargetLayout = exports.DropTargetLayout = function DropTargetLayout(prop
|
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
}, [onDrop]);
|
|
82
|
+
if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) === 'layoutSection') {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
82
85
|
return (0, _react2.jsx)("div", {
|
|
83
86
|
ref: ref,
|
|
84
87
|
css: dropTargetLayoutStyle,
|
|
@@ -178,7 +178,7 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
178
178
|
});
|
|
179
179
|
};
|
|
180
180
|
var DropTargetV2 = exports.DropTargetV2 = function DropTargetV2(props) {
|
|
181
|
-
var _dynamicStyle;
|
|
181
|
+
var _api$blockControls, _dynamicStyle;
|
|
182
182
|
var api = props.api,
|
|
183
183
|
getPos = props.getPos,
|
|
184
184
|
prevNode = props.prevNode,
|
|
@@ -196,10 +196,9 @@ var DropTargetV2 = exports.DropTargetV2 = function DropTargetV2(props) {
|
|
|
196
196
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width']),
|
|
197
197
|
widthState = _useSharedPluginState.widthState;
|
|
198
198
|
var isNestedDropTarget = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name) !== 'doc';
|
|
199
|
+
var _ref2 = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
200
|
+
activeNode = _ref2.activeNode;
|
|
199
201
|
var onDrop = function onDrop() {
|
|
200
|
-
var _api$blockControls;
|
|
201
|
-
var _ref2 = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
202
|
-
activeNode = _ref2.activeNode;
|
|
203
202
|
if (!activeNode) {
|
|
204
203
|
return;
|
|
205
204
|
}
|
|
@@ -255,7 +254,7 @@ var DropTargetV2 = exports.DropTargetV2 = function DropTargetV2(props) {
|
|
|
255
254
|
anchorRectCache: anchorRectCache,
|
|
256
255
|
position: "lower",
|
|
257
256
|
isNestedDropTarget: isNestedDropTarget
|
|
258
|
-
}), (0, _inlineDropTarget.shouldAllowInlineDropTarget)(isNestedDropTarget, nextNode, isSameLayout) && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_inlineDropTarget2.InlineDropTarget, (0, _extends2.default)({}, props, {
|
|
257
|
+
}), (0, _inlineDropTarget.shouldAllowInlineDropTarget)(isNestedDropTarget, nextNode, isSameLayout, activeNode) && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_inlineDropTarget2.InlineDropTarget, (0, _extends2.default)({}, props, {
|
|
259
258
|
position: "left"
|
|
260
259
|
})), (0, _react2.jsx)(_inlineDropTarget2.InlineDropTarget, (0, _extends2.default)({}, props, {
|
|
261
260
|
position: "right"
|
|
@@ -10,12 +10,16 @@ var _advancedLayoutsFlags = require("./advanced-layouts-flags");
|
|
|
10
10
|
var _checkMediaLayout = require("./check-media-layout");
|
|
11
11
|
var shouldAllowInlineDropTarget = exports.shouldAllowInlineDropTarget = function shouldAllowInlineDropTarget(isNested, node) {
|
|
12
12
|
var isSameLayout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
13
|
+
var activeNode = arguments.length > 3 ? arguments[3] : undefined;
|
|
13
14
|
if (!(0, _advancedLayoutsFlags.isPreRelease1)() || isNested) {
|
|
14
15
|
return false;
|
|
15
16
|
}
|
|
16
17
|
if ((0, _checkMediaLayout.isWrappedMedia)(node)) {
|
|
17
18
|
return false;
|
|
18
19
|
}
|
|
20
|
+
if ((0, _advancedLayoutsFlags.isPreRelease2)() && (activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) === 'layoutSection') {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
19
23
|
if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutSection') {
|
|
20
24
|
return node.childCount < (0, _consts.maxLayoutColumnSupported)() || (0, _advancedLayoutsFlags.isPreRelease2)() && isSameLayout;
|
|
21
25
|
}
|
|
@@ -155,6 +155,9 @@ export const dropTargetDecorations = (newState, api, formatMessage, activeNode,
|
|
|
155
155
|
if (editorExperiment('nested-dnd', true)) {
|
|
156
156
|
depth = $pos.depth;
|
|
157
157
|
if (isAdvancedLayoutsPreRelease2) {
|
|
158
|
+
if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.pos) === pos && activeNode.nodeType !== 'layoutColumn') {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
158
161
|
if (node.type.name === 'layoutColumn' && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutSection' && (parent === null || parent === void 0 ? void 0 : parent.firstChild) !== node && (
|
|
159
162
|
// Not the first node
|
|
160
163
|
(parent === null || parent === void 0 ? void 0 : parent.childCount) < maxLayoutColumnSupported() || isSameLayout)) {
|
|
@@ -31,6 +31,7 @@ const dropTargetLayoutHintStyle = css({
|
|
|
31
31
|
width: 0
|
|
32
32
|
});
|
|
33
33
|
export const DropTargetLayout = props => {
|
|
34
|
+
var _api$blockControls;
|
|
34
35
|
const {
|
|
35
36
|
api,
|
|
36
37
|
getPos,
|
|
@@ -40,11 +41,10 @@ export const DropTargetLayout = props => {
|
|
|
40
41
|
const [isDraggedOver, setIsDraggedOver] = useState(false);
|
|
41
42
|
const anchorName = getNodeAnchor(parent);
|
|
42
43
|
const [isActiveAnchor] = useActiveAnchorTracker(anchorName);
|
|
44
|
+
const {
|
|
45
|
+
activeNode
|
|
46
|
+
} = (api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {};
|
|
43
47
|
const onDrop = useCallback(() => {
|
|
44
|
-
var _api$blockControls;
|
|
45
|
-
const {
|
|
46
|
-
activeNode
|
|
47
|
-
} = (api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {};
|
|
48
48
|
if (!activeNode) {
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
@@ -56,7 +56,7 @@ export const DropTargetLayout = props => {
|
|
|
56
56
|
} = activeNode;
|
|
57
57
|
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : (_api$blockControls2$c = _api$blockControls2.commands) === null || _api$blockControls2$c === void 0 ? void 0 : _api$blockControls2$c.moveToLayout(from, to));
|
|
58
58
|
}
|
|
59
|
-
}, [api, getPos]);
|
|
59
|
+
}, [api, getPos, activeNode]);
|
|
60
60
|
useEffect(() => {
|
|
61
61
|
if (ref.current) {
|
|
62
62
|
return dropTargetForElements({
|
|
@@ -71,6 +71,9 @@ export const DropTargetLayout = props => {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
}, [onDrop]);
|
|
74
|
+
if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) === 'layoutSection') {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
74
77
|
return jsx("div", {
|
|
75
78
|
ref: ref,
|
|
76
79
|
css: dropTargetLayoutStyle,
|
|
@@ -166,6 +166,7 @@ const HoverZone = ({
|
|
|
166
166
|
});
|
|
167
167
|
};
|
|
168
168
|
export const DropTargetV2 = props => {
|
|
169
|
+
var _api$blockControls;
|
|
169
170
|
const {
|
|
170
171
|
api,
|
|
171
172
|
getPos,
|
|
@@ -182,11 +183,10 @@ export const DropTargetV2 = props => {
|
|
|
182
183
|
widthState
|
|
183
184
|
} = useSharedPluginState(api, ['width']);
|
|
184
185
|
const isNestedDropTarget = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name) !== 'doc';
|
|
186
|
+
const {
|
|
187
|
+
activeNode
|
|
188
|
+
} = (api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {};
|
|
185
189
|
const onDrop = () => {
|
|
186
|
-
var _api$blockControls;
|
|
187
|
-
const {
|
|
188
|
-
activeNode
|
|
189
|
-
} = (api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {};
|
|
190
190
|
if (!activeNode) {
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
@@ -239,7 +239,7 @@ export const DropTargetV2 = props => {
|
|
|
239
239
|
anchorRectCache: anchorRectCache,
|
|
240
240
|
position: "lower",
|
|
241
241
|
isNestedDropTarget: isNestedDropTarget
|
|
242
|
-
}), shouldAllowInlineDropTarget(isNestedDropTarget, nextNode, isSameLayout) && jsx(Fragment, null, jsx(InlineDropTarget, _extends({}, props, {
|
|
242
|
+
}), shouldAllowInlineDropTarget(isNestedDropTarget, nextNode, isSameLayout, activeNode) && jsx(Fragment, null, jsx(InlineDropTarget, _extends({}, props, {
|
|
243
243
|
position: "left"
|
|
244
244
|
})), jsx(InlineDropTarget, _extends({}, props, {
|
|
245
245
|
position: "right"
|
|
@@ -6,13 +6,16 @@ export const shouldAllowInlineDropTarget = (isNested, node,
|
|
|
6
6
|
/**
|
|
7
7
|
* Is the active node in the same layout as the target node
|
|
8
8
|
*/
|
|
9
|
-
isSameLayout = false) => {
|
|
9
|
+
isSameLayout = false, activeNode) => {
|
|
10
10
|
if (!isPreRelease1() || isNested) {
|
|
11
11
|
return false;
|
|
12
12
|
}
|
|
13
13
|
if (isWrappedMedia(node)) {
|
|
14
14
|
return false;
|
|
15
15
|
}
|
|
16
|
+
if (isPreRelease2() && (activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) === 'layoutSection') {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
16
19
|
if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutSection') {
|
|
17
20
|
return node.childCount < maxLayoutColumnSupported() || isPreRelease2() && isSameLayout;
|
|
18
21
|
}
|
|
@@ -156,6 +156,9 @@ export var dropTargetDecorations = function dropTargetDecorations(newState, api,
|
|
|
156
156
|
if (editorExperiment('nested-dnd', true)) {
|
|
157
157
|
depth = $pos.depth;
|
|
158
158
|
if (isAdvancedLayoutsPreRelease2) {
|
|
159
|
+
if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.pos) === pos && activeNode.nodeType !== 'layoutColumn') {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
159
162
|
if (node.type.name === 'layoutColumn' && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutSection' && (parent === null || parent === void 0 ? void 0 : parent.firstChild) !== node && (
|
|
160
163
|
// Not the first node
|
|
161
164
|
(parent === null || parent === void 0 ? void 0 : parent.childCount) < maxLayoutColumnSupported() || isSameLayout)) {
|
|
@@ -32,6 +32,7 @@ var dropTargetLayoutHintStyle = css({
|
|
|
32
32
|
width: 0
|
|
33
33
|
});
|
|
34
34
|
export var DropTargetLayout = function DropTargetLayout(props) {
|
|
35
|
+
var _api$blockControls;
|
|
35
36
|
var api = props.api,
|
|
36
37
|
getPos = props.getPos,
|
|
37
38
|
parent = props.parent;
|
|
@@ -44,10 +45,9 @@ export var DropTargetLayout = function DropTargetLayout(props) {
|
|
|
44
45
|
var _useActiveAnchorTrack = useActiveAnchorTracker(anchorName),
|
|
45
46
|
_useActiveAnchorTrack2 = _slicedToArray(_useActiveAnchorTrack, 1),
|
|
46
47
|
isActiveAnchor = _useActiveAnchorTrack2[0];
|
|
48
|
+
var _ref = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
49
|
+
activeNode = _ref.activeNode;
|
|
47
50
|
var onDrop = useCallback(function () {
|
|
48
|
-
var _api$blockControls;
|
|
49
|
-
var _ref = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
50
|
-
activeNode = _ref.activeNode;
|
|
51
51
|
if (!activeNode) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
@@ -57,7 +57,7 @@ export var DropTargetLayout = function DropTargetLayout(props) {
|
|
|
57
57
|
var from = activeNode.pos;
|
|
58
58
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.moveToLayout(from, to));
|
|
59
59
|
}
|
|
60
|
-
}, [api, getPos]);
|
|
60
|
+
}, [api, getPos, activeNode]);
|
|
61
61
|
useEffect(function () {
|
|
62
62
|
if (ref.current) {
|
|
63
63
|
return dropTargetForElements({
|
|
@@ -72,6 +72,9 @@ export var DropTargetLayout = function DropTargetLayout(props) {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
}, [onDrop]);
|
|
75
|
+
if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) === 'layoutSection') {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
75
78
|
return jsx("div", {
|
|
76
79
|
ref: ref,
|
|
77
80
|
css: dropTargetLayoutStyle,
|
|
@@ -170,7 +170,7 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
170
170
|
});
|
|
171
171
|
};
|
|
172
172
|
export var DropTargetV2 = function DropTargetV2(props) {
|
|
173
|
-
var _dynamicStyle;
|
|
173
|
+
var _api$blockControls, _dynamicStyle;
|
|
174
174
|
var api = props.api,
|
|
175
175
|
getPos = props.getPos,
|
|
176
176
|
prevNode = props.prevNode,
|
|
@@ -188,10 +188,9 @@ export var DropTargetV2 = function DropTargetV2(props) {
|
|
|
188
188
|
var _useSharedPluginState = useSharedPluginState(api, ['width']),
|
|
189
189
|
widthState = _useSharedPluginState.widthState;
|
|
190
190
|
var isNestedDropTarget = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name) !== 'doc';
|
|
191
|
+
var _ref2 = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
192
|
+
activeNode = _ref2.activeNode;
|
|
191
193
|
var onDrop = function onDrop() {
|
|
192
|
-
var _api$blockControls;
|
|
193
|
-
var _ref2 = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
194
|
-
activeNode = _ref2.activeNode;
|
|
195
194
|
if (!activeNode) {
|
|
196
195
|
return;
|
|
197
196
|
}
|
|
@@ -247,7 +246,7 @@ export var DropTargetV2 = function DropTargetV2(props) {
|
|
|
247
246
|
anchorRectCache: anchorRectCache,
|
|
248
247
|
position: "lower",
|
|
249
248
|
isNestedDropTarget: isNestedDropTarget
|
|
250
|
-
}), shouldAllowInlineDropTarget(isNestedDropTarget, nextNode, isSameLayout) && jsx(Fragment, null, jsx(InlineDropTarget, _extends({}, props, {
|
|
249
|
+
}), shouldAllowInlineDropTarget(isNestedDropTarget, nextNode, isSameLayout, activeNode) && jsx(Fragment, null, jsx(InlineDropTarget, _extends({}, props, {
|
|
251
250
|
position: "left"
|
|
252
251
|
})), jsx(InlineDropTarget, _extends({}, props, {
|
|
253
252
|
position: "right"
|
|
@@ -4,12 +4,16 @@ import { isPreRelease1, isPreRelease2 } from './advanced-layouts-flags';
|
|
|
4
4
|
import { isWrappedMedia } from './check-media-layout';
|
|
5
5
|
export var shouldAllowInlineDropTarget = function shouldAllowInlineDropTarget(isNested, node) {
|
|
6
6
|
var isSameLayout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7
|
+
var activeNode = arguments.length > 3 ? arguments[3] : undefined;
|
|
7
8
|
if (!isPreRelease1() || isNested) {
|
|
8
9
|
return false;
|
|
9
10
|
}
|
|
10
11
|
if (isWrappedMedia(node)) {
|
|
11
12
|
return false;
|
|
12
13
|
}
|
|
14
|
+
if (isPreRelease2() && (activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) === 'layoutSection') {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
13
17
|
if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutSection') {
|
|
14
18
|
return node.childCount < maxLayoutColumnSupported() || isPreRelease2() && isSameLayout;
|
|
15
19
|
}
|
|
@@ -9,4 +9,4 @@ export type DropTargetLayoutProps = {
|
|
|
9
9
|
parent: PMNode;
|
|
10
10
|
formatMessage?: IntlShape['formatMessage'];
|
|
11
11
|
};
|
|
12
|
-
export declare const DropTargetLayout: (props: DropTargetLayoutProps) => jsx.JSX.Element;
|
|
12
|
+
export declare const DropTargetLayout: (props: DropTargetLayoutProps) => jsx.JSX.Element | null;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
|
|
2
|
+
import { type ActiveNode } from '../types';
|
|
3
|
+
export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode, isSameLayout?: boolean, activeNode?: ActiveNode) => boolean;
|
|
@@ -9,4 +9,4 @@ export type DropTargetLayoutProps = {
|
|
|
9
9
|
parent: PMNode;
|
|
10
10
|
formatMessage?: IntlShape['formatMessage'];
|
|
11
11
|
};
|
|
12
|
-
export declare const DropTargetLayout: (props: DropTargetLayoutProps) => jsx.JSX.Element;
|
|
12
|
+
export declare const DropTargetLayout: (props: DropTargetLayoutProps) => jsx.JSX.Element | null;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
|
|
2
|
+
import { type ActiveNode } from '../types';
|
|
3
|
+
export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode, isSameLayout?: boolean, activeNode?: ActiveNode) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.14",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
49
49
|
"@atlaskit/primitives": "^13.2.0",
|
|
50
50
|
"@atlaskit/theme": "^14.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^2.16.0",
|
|
52
52
|
"@atlaskit/tokens": "^2.2.0",
|
|
53
53
|
"@atlaskit/tooltip": "^18.9.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|