@atlaskit/editor-plugin-block-controls 2.13.30 → 2.14.0
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 +26 -0
- package/dist/cjs/editor-commands/move-node.js +1 -1
- package/dist/cjs/pm-plugins/decorations-drop-target.js +1 -1
- package/dist/cjs/pm-plugins/handle-mouse-over.js +0 -25
- package/dist/cjs/pm-plugins/utils/validation.js +17 -1
- package/dist/cjs/ui/inline-drop-target.js +33 -19
- package/dist/es2019/editor-commands/move-node.js +1 -1
- package/dist/es2019/pm-plugins/decorations-drop-target.js +1 -1
- package/dist/es2019/pm-plugins/handle-mouse-over.js +0 -25
- package/dist/es2019/pm-plugins/utils/validation.js +17 -1
- package/dist/es2019/ui/inline-drop-target.js +37 -19
- package/dist/esm/editor-commands/move-node.js +1 -1
- package/dist/esm/pm-plugins/decorations-drop-target.js +1 -1
- package/dist/esm/pm-plugins/handle-mouse-over.js +0 -25
- package/dist/esm/pm-plugins/utils/validation.js +17 -1
- package/dist/esm/ui/inline-drop-target.js +33 -19
- package/dist/types/pm-plugins/utils/validation.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/utils/validation.d.ts +1 -1
- package/package.json +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 2.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#168172](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/168172)
|
|
8
|
+
[`fa404ae4155f2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fa404ae4155f2) -
|
|
9
|
+
[ux] [ED-25523] This change is adding experiment based gating to the drag and drop logic for
|
|
10
|
+
nested tables. We only allow nesting tables one level deep via drag and drop if the experiment is
|
|
11
|
+
active. Else, you cannot drag and drop a table into another table.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
17
|
+
## 2.13.31
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#171553](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/171553)
|
|
22
|
+
[`ef0f90dd048d8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ef0f90dd048d8) -
|
|
23
|
+
[ED-25917] Replace dynamic styles for inline hover zone with css var
|
|
24
|
+
- [#171077](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/171077)
|
|
25
|
+
[`0a92cf56671ac`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0a92cf56671ac) -
|
|
26
|
+
ED-25867 always show drag handler for layout columns
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 2.13.30
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -187,7 +187,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
187
187
|
tr.insert(_mappedTo, fragment).setSelection(_state.Selection.near(tr.doc.resolve(_mappedTo))).scrollIntoView();
|
|
188
188
|
return tr;
|
|
189
189
|
}
|
|
190
|
-
if (!(0, _validation.canMoveNodeToIndex)(destParent, $to.index(), $from.node().child($from.index()))) {
|
|
190
|
+
if (!(0, _validation.canMoveNodeToIndex)(destParent, $to.index(), $from.node().child($from.index()), $to)) {
|
|
191
191
|
return tr;
|
|
192
192
|
}
|
|
193
193
|
var convertedNodeSlice = transformSourceSlice(nodeCopy, destType);
|
|
@@ -225,7 +225,7 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
|
|
|
225
225
|
}
|
|
226
226
|
return shouldDescend(node); //skip over, don't consider it a valid depth
|
|
227
227
|
}
|
|
228
|
-
var canDrop = activePMNode && (0, _validation.canMoveNodeToIndex)(parent, index, activePMNode, node);
|
|
228
|
+
var canDrop = activePMNode && (0, _validation.canMoveNodeToIndex)(parent, index, activePMNode, $pos, node);
|
|
229
229
|
|
|
230
230
|
//NOTE: This will block drop targets showing for nodes that are valid after transformation (i.e. expand -> nestedExpand)
|
|
231
231
|
if (!canDrop && !(0, _dragTargetDebug.isBlocksDragTargetDebug)()) {
|
|
@@ -13,26 +13,6 @@ var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(t
|
|
|
13
13
|
}
|
|
14
14
|
return false;
|
|
15
15
|
};
|
|
16
|
-
var isEmptyParagraphOrPlaceholder = function isEmptyParagraphOrPlaceholder(node) {
|
|
17
|
-
if (node && node.type.name === 'paragraph') {
|
|
18
|
-
var _node$firstChild;
|
|
19
|
-
return node.childCount === 0 || node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'placeholder';
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
22
|
-
};
|
|
23
|
-
var isLayoutColumnWithoutContent = function isLayoutColumnWithoutContent(node) {
|
|
24
|
-
if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutColumn') {
|
|
25
|
-
var foundNonEmptyNode = false;
|
|
26
|
-
for (var i = 0; i < node.childCount; i++) {
|
|
27
|
-
var child = node.child(i);
|
|
28
|
-
if (!isEmptyParagraphOrPlaceholder(child)) {
|
|
29
|
-
foundNonEmptyNode = true;
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return !foundNonEmptyNode;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
16
|
var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, event, api) {
|
|
37
17
|
var _api$blockControls, _target$classList;
|
|
38
18
|
var _ref = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
@@ -98,11 +78,6 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
98
78
|
} else {
|
|
99
79
|
pos = view.posAtDOM(rootElement, 0);
|
|
100
80
|
}
|
|
101
|
-
var node = view.state.doc.nodeAt(pos);
|
|
102
|
-
if ((0, _experiments.editorExperiment)('advanced_layouts', true) && node && isLayoutColumnWithoutContent(node)) {
|
|
103
|
-
// Don't show drag handle when there is no content/only placeholder in layout column
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
81
|
var rootPos;
|
|
107
82
|
if ((0, _experiments.editorExperiment)('nested-dnd', true)) {
|
|
108
83
|
rootPos = view.state.doc.resolve(pos).pos;
|
|
@@ -7,7 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.canMoveNodeToIndex = canMoveNodeToIndex;
|
|
8
8
|
exports.transformSliceExpandToNestedExpand = exports.transformExpandToNestedExpand = exports.memoizedTransformExpandToNestedExpand = exports.isNestedExpand = exports.isLayoutColumn = exports.isInsideTable = exports.isInSameLayout = exports.isExpand = exports.isDoc = void 0;
|
|
9
9
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
10
|
+
var _nesting = require("@atlaskit/editor-common/nesting");
|
|
10
11
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
13
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
14
|
var isInsideTable = exports.isInsideTable = function isInsideTable(nodeType) {
|
|
13
15
|
var _nodeType$schema$node = nodeType.schema.nodes,
|
|
@@ -76,7 +78,7 @@ var memoizedTransformExpandToNestedExpand = exports.memoizedTransformExpandToNes
|
|
|
76
78
|
return null;
|
|
77
79
|
}
|
|
78
80
|
});
|
|
79
|
-
function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, destNode) {
|
|
81
|
+
function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNodePos, destNode) {
|
|
80
82
|
var srcNodeType = srcNode.type;
|
|
81
83
|
var parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
|
|
82
84
|
var activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.name;
|
|
@@ -100,6 +102,20 @@ function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, destNode) {
|
|
|
100
102
|
return false;
|
|
101
103
|
}
|
|
102
104
|
}
|
|
105
|
+
|
|
106
|
+
// Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
|
|
107
|
+
var isNestingTablesSupported = (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes') && (0, _experiments.editorExperiment)('nested-tables-in-tables', true, {
|
|
108
|
+
exposure: true
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// NOTE: this will block drop targets from showing for dragging a table into another table
|
|
112
|
+
// unless nested tables are supported and the nesting depth does not exceed 1
|
|
113
|
+
if ((parentNodeType === 'tableCell' || parentNodeType === 'tableHeader') && activeNodeType === 'table') {
|
|
114
|
+
var nestingDepth = (0, _nesting.getParentOfTypeCount)(srcNode === null || srcNode === void 0 ? void 0 : srcNode.type)($destNodePos);
|
|
115
|
+
if (!isNestingTablesSupported || isNestingTablesSupported && nestingDepth > 1) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
103
119
|
if (isInsideTable(destParent.type) && isExpand(srcNodeType)) {
|
|
104
120
|
if (memoizedTransformExpandToNestedExpand(srcNode)) {
|
|
105
121
|
srcNodeType = srcNodeType.schema.nodes.nestedExpand;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.InlineDropTarget = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
10
|
var _react = require("react");
|
|
10
11
|
var _react2 = require("@emotion/react");
|
|
@@ -12,7 +13,6 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
12
13
|
var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
|
|
13
14
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
14
15
|
var _colors = require("@atlaskit/theme/colors");
|
|
15
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
16
|
var _decorationsCommon = require("../pm-plugins/decorations-common");
|
|
17
17
|
var _activeAnchorTracker = require("../pm-plugins/utils/active-anchor-tracker");
|
|
18
18
|
var _anchorUtils = require("../pm-plugins/utils/anchor-utils");
|
|
@@ -26,10 +26,31 @@ var _dragTargetDebug = require("../pm-plugins/utils/drag-target-debug");
|
|
|
26
26
|
|
|
27
27
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
28
28
|
|
|
29
|
+
var HOVER_ZONE_WIDTH = '--editor-blocks-inline-hover-zone-width';
|
|
30
|
+
var HOVER_ZONE_HEIGHT = '--editor-blocks-inline-hover-zone-height';
|
|
31
|
+
var HOVER_ZONE_TOP = '--editor-blocks-inline-hover-zone-top';
|
|
32
|
+
var HOVER_ZONE_BOTTOM = '--editor-blocks-inline-hover-zone-bottom';
|
|
33
|
+
var HOVER_ZONE_ANCHOR_NAME = '--editor-blocks-inline-hover-zone-anchor-name';
|
|
29
34
|
var hoverZoneCommonStyle = (0, _react2.css)({
|
|
30
35
|
position: 'absolute',
|
|
31
36
|
// above the top and bottom drop zone as block hover zone
|
|
32
|
-
zIndex: 120
|
|
37
|
+
zIndex: 120,
|
|
38
|
+
positionAnchor: "var(".concat(HOVER_ZONE_ANCHOR_NAME, ")"),
|
|
39
|
+
minWidth: "var(--ds-space-100, 8px)",
|
|
40
|
+
left: 0,
|
|
41
|
+
right: 0,
|
|
42
|
+
width: "var(".concat(HOVER_ZONE_WIDTH, ")"),
|
|
43
|
+
height: "var(".concat(HOVER_ZONE_HEIGHT, ")")
|
|
44
|
+
});
|
|
45
|
+
var leftHoverZoneStyle = (0, _react2.css)({
|
|
46
|
+
right: "unset",
|
|
47
|
+
top: "var(".concat(HOVER_ZONE_TOP, ")"),
|
|
48
|
+
bottom: 'unset'
|
|
49
|
+
});
|
|
50
|
+
var rightHoverZoneStyle = (0, _react2.css)({
|
|
51
|
+
left: "unset",
|
|
52
|
+
top: 'unset',
|
|
53
|
+
bottom: "var(".concat(HOVER_ZONE_BOTTOM, ")")
|
|
33
54
|
});
|
|
34
55
|
|
|
35
56
|
// gap between node boundary and drop indicator/drop zone
|
|
@@ -125,7 +146,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
125
146
|
|
|
126
147
|
// Set the height target anchor name to the first or last column of the layout section so that it also works for stacked layout
|
|
127
148
|
var heightTargetAnchorName = targetAnchorName;
|
|
128
|
-
if (
|
|
149
|
+
if (nextNode.type.name === 'layoutSection' && nextNode.firstChild && nextNode.lastChild) {
|
|
129
150
|
heightTargetAnchorName = isLeftPosition ? (0, _decorationsCommon.getNodeAnchor)(nextNode.firstChild) : (0, _decorationsCommon.getNodeAnchor)(nextNode.lastChild);
|
|
130
151
|
}
|
|
131
152
|
if ((0, _anchorUtils.isAnchorSupported)()) {
|
|
@@ -175,27 +196,17 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
175
196
|
}));
|
|
176
197
|
}
|
|
177
198
|
}, [api, getPos, position]);
|
|
178
|
-
var
|
|
179
|
-
var
|
|
199
|
+
var hoverZoneRectStyle = (0, _react.useMemo)(function () {
|
|
200
|
+
var _ref3;
|
|
201
|
+
var isLayoutNode = (nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name) === 'layoutSection';
|
|
180
202
|
var layoutAdjustment = isLayoutNode ? {
|
|
181
203
|
width: 11,
|
|
182
204
|
height: 4,
|
|
183
205
|
top: 6,
|
|
184
206
|
bottom: 2
|
|
185
207
|
} : undefined;
|
|
186
|
-
return (0,
|
|
187
|
-
|
|
188
|
-
minWidth: "var(--ds-space-100, 8px)",
|
|
189
|
-
left: isLeftPosition ? 0 : 'unset',
|
|
190
|
-
right: isLeftPosition ? 'unset' : 0,
|
|
191
|
-
top: "calc(anchor(top))",
|
|
192
|
-
width: nodeDimension.widthOffset ? "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px + ").concat(nodeDimension.widthOffset, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)") : "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)"),
|
|
193
|
-
height: "calc(".concat(nodeDimension.height, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.height) || 0, "px)")
|
|
194
|
-
}, isLayoutNode && {
|
|
195
|
-
top: isLeftPosition ? "calc(".concat(nodeDimension.top, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.top) || 0, "px)") : 'unset',
|
|
196
|
-
bottom: isLeftPosition ? 'unset' : "calc(".concat(nodeDimension.bottom, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.bottom) || 0, "px)")
|
|
197
|
-
});
|
|
198
|
-
}, [nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name, anchorName, isLeftPosition, nodeDimension]);
|
|
208
|
+
return _ref3 = {}, (0, _defineProperty2.default)(_ref3, HOVER_ZONE_WIDTH, nodeDimension.widthOffset ? "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px + ").concat(nodeDimension.widthOffset, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)") : "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)")), (0, _defineProperty2.default)(_ref3, HOVER_ZONE_HEIGHT, "calc(".concat(nodeDimension.height, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.height) || 0, "px)")), (0, _defineProperty2.default)(_ref3, HOVER_ZONE_TOP, "calc(".concat(nodeDimension.top, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.top) || 0, "px)")), (0, _defineProperty2.default)(_ref3, HOVER_ZONE_BOTTOM, "calc(".concat(nodeDimension.bottom, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.bottom) || 0, "px)")), (0, _defineProperty2.default)(_ref3, HOVER_ZONE_ANCHOR_NAME, anchorName), _ref3;
|
|
209
|
+
}, [nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name, nodeDimension, anchorName]);
|
|
199
210
|
var dropIndicatorPos = (0, _react.useMemo)(function () {
|
|
200
211
|
return isLeftPosition ? 'right' : 'left';
|
|
201
212
|
}, [isLeftPosition]);
|
|
@@ -216,7 +227,10 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
216
227
|
return (0, _react2.jsx)("div", {
|
|
217
228
|
ref: ref,
|
|
218
229
|
"data-testid": "drop-target-hover-zone-".concat(position),
|
|
219
|
-
css: [hoverZoneCommonStyle,
|
|
230
|
+
css: [hoverZoneCommonStyle, isLeftPosition ? leftHoverZoneStyle : rightHoverZoneStyle]
|
|
231
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
232
|
+
,
|
|
233
|
+
style: hoverZoneRectStyle
|
|
220
234
|
}, isDraggedOver || (0, _dragTargetDebug.isBlocksDragTargetDebug)() ? (0, _react2.jsx)(_box.DropIndicator, {
|
|
221
235
|
edge: dropIndicatorPos
|
|
222
236
|
}) : isActiveAnchor && (0, _react2.jsx)("div", {
|
|
@@ -181,7 +181,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
|
|
|
181
181
|
tr.insert(mappedTo, fragment).setSelection(Selection.near(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
182
182
|
return tr;
|
|
183
183
|
}
|
|
184
|
-
if (!canMoveNodeToIndex(destParent, $to.index(), $from.node().child($from.index()))) {
|
|
184
|
+
if (!canMoveNodeToIndex(destParent, $to.index(), $from.node().child($from.index()), $to)) {
|
|
185
185
|
return tr;
|
|
186
186
|
}
|
|
187
187
|
const convertedNodeSlice = transformSourceSlice(nodeCopy, destType);
|
|
@@ -214,7 +214,7 @@ export const dropTargetDecorations = (newState, api, formatMessage, nodeViewPort
|
|
|
214
214
|
}
|
|
215
215
|
return shouldDescend(node); //skip over, don't consider it a valid depth
|
|
216
216
|
}
|
|
217
|
-
const canDrop = activePMNode && canMoveNodeToIndex(parent, index, activePMNode, node);
|
|
217
|
+
const canDrop = activePMNode && canMoveNodeToIndex(parent, index, activePMNode, $pos, node);
|
|
218
218
|
|
|
219
219
|
//NOTE: This will block drop targets showing for nodes that are valid after transformation (i.e. expand -> nestedExpand)
|
|
220
220
|
if (!canDrop && !isBlocksDragTargetDebug()) {
|
|
@@ -7,26 +7,6 @@ const isEmptyNestedParagraphOrHeading = target => {
|
|
|
7
7
|
}
|
|
8
8
|
return false;
|
|
9
9
|
};
|
|
10
|
-
const isEmptyParagraphOrPlaceholder = node => {
|
|
11
|
-
if (node && node.type.name === 'paragraph') {
|
|
12
|
-
var _node$firstChild;
|
|
13
|
-
return node.childCount === 0 || node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'placeholder';
|
|
14
|
-
}
|
|
15
|
-
return false;
|
|
16
|
-
};
|
|
17
|
-
const isLayoutColumnWithoutContent = node => {
|
|
18
|
-
if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutColumn') {
|
|
19
|
-
let foundNonEmptyNode = false;
|
|
20
|
-
for (let i = 0; i < node.childCount; i++) {
|
|
21
|
-
const child = node.child(i);
|
|
22
|
-
if (!isEmptyParagraphOrPlaceholder(child)) {
|
|
23
|
-
foundNonEmptyNode = true;
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return !foundNonEmptyNode;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
10
|
export const handleMouseOver = (view, event, api) => {
|
|
31
11
|
var _api$blockControls, _target$classList;
|
|
32
12
|
const {
|
|
@@ -93,11 +73,6 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
93
73
|
} else {
|
|
94
74
|
pos = view.posAtDOM(rootElement, 0);
|
|
95
75
|
}
|
|
96
|
-
const node = view.state.doc.nodeAt(pos);
|
|
97
|
-
if (editorExperiment('advanced_layouts', true) && node && isLayoutColumnWithoutContent(node)) {
|
|
98
|
-
// Don't show drag handle when there is no content/only placeholder in layout column
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
76
|
let rootPos;
|
|
102
77
|
if (editorExperiment('nested-dnd', true)) {
|
|
103
78
|
rootPos = view.state.doc.resolve(pos).pos;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import memoizeOne from 'memoize-one';
|
|
2
|
+
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
2
3
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
6
|
export const isInsideTable = nodeType => {
|
|
5
7
|
const {
|
|
@@ -70,7 +72,7 @@ export const memoizedTransformExpandToNestedExpand = memoizeOne(node => {
|
|
|
70
72
|
return null;
|
|
71
73
|
}
|
|
72
74
|
});
|
|
73
|
-
export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, destNode) {
|
|
75
|
+
export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNodePos, destNode) {
|
|
74
76
|
let srcNodeType = srcNode.type;
|
|
75
77
|
const parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
|
|
76
78
|
const activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.name;
|
|
@@ -94,6 +96,20 @@ export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, destNod
|
|
|
94
96
|
return false;
|
|
95
97
|
}
|
|
96
98
|
}
|
|
99
|
+
|
|
100
|
+
// Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
|
|
101
|
+
const isNestingTablesSupported = fg('platform_editor_use_nested_table_pm_nodes') && editorExperiment('nested-tables-in-tables', true, {
|
|
102
|
+
exposure: true
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// NOTE: this will block drop targets from showing for dragging a table into another table
|
|
106
|
+
// unless nested tables are supported and the nesting depth does not exceed 1
|
|
107
|
+
if ((parentNodeType === 'tableCell' || parentNodeType === 'tableHeader') && activeNodeType === 'table') {
|
|
108
|
+
const nestingDepth = getParentOfTypeCount(srcNode === null || srcNode === void 0 ? void 0 : srcNode.type)($destNodePos);
|
|
109
|
+
if (!isNestingTablesSupported || isNestingTablesSupported && nestingDepth > 1) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
97
113
|
if (isInsideTable(destParent.type) && isExpand(srcNodeType)) {
|
|
98
114
|
if (memoizedTransformExpandToNestedExpand(srcNode)) {
|
|
99
115
|
srcNodeType = srcNodeType.schema.nodes.nestedExpand;
|
|
@@ -12,15 +12,35 @@ import { akEditorBreakoutPadding } from '@atlaskit/editor-shared-styles';
|
|
|
12
12
|
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
|
|
13
13
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
14
14
|
import { B200 } from '@atlaskit/theme/colors';
|
|
15
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
16
15
|
import { getNodeAnchor } from '../pm-plugins/decorations-common';
|
|
17
16
|
import { useActiveAnchorTracker } from '../pm-plugins/utils/active-anchor-tracker';
|
|
18
17
|
import { isAnchorSupported } from '../pm-plugins/utils/anchor-utils';
|
|
19
18
|
import { isBlocksDragTargetDebug } from '../pm-plugins/utils/drag-target-debug';
|
|
19
|
+
const HOVER_ZONE_WIDTH = '--editor-blocks-inline-hover-zone-width';
|
|
20
|
+
const HOVER_ZONE_HEIGHT = '--editor-blocks-inline-hover-zone-height';
|
|
21
|
+
const HOVER_ZONE_TOP = '--editor-blocks-inline-hover-zone-top';
|
|
22
|
+
const HOVER_ZONE_BOTTOM = '--editor-blocks-inline-hover-zone-bottom';
|
|
23
|
+
const HOVER_ZONE_ANCHOR_NAME = '--editor-blocks-inline-hover-zone-anchor-name';
|
|
20
24
|
const hoverZoneCommonStyle = css({
|
|
21
25
|
position: 'absolute',
|
|
22
26
|
// above the top and bottom drop zone as block hover zone
|
|
23
|
-
zIndex: 120
|
|
27
|
+
zIndex: 120,
|
|
28
|
+
positionAnchor: `var(${HOVER_ZONE_ANCHOR_NAME})`,
|
|
29
|
+
minWidth: "var(--ds-space-100, 8px)",
|
|
30
|
+
left: 0,
|
|
31
|
+
right: 0,
|
|
32
|
+
width: `var(${HOVER_ZONE_WIDTH})`,
|
|
33
|
+
height: `var(${HOVER_ZONE_HEIGHT})`
|
|
34
|
+
});
|
|
35
|
+
const leftHoverZoneStyle = css({
|
|
36
|
+
right: `unset`,
|
|
37
|
+
top: `var(${HOVER_ZONE_TOP})`,
|
|
38
|
+
bottom: 'unset'
|
|
39
|
+
});
|
|
40
|
+
const rightHoverZoneStyle = css({
|
|
41
|
+
left: `unset`,
|
|
42
|
+
top: 'unset',
|
|
43
|
+
bottom: `var(${HOVER_ZONE_BOTTOM})`
|
|
24
44
|
});
|
|
25
45
|
|
|
26
46
|
// gap between node boundary and drop indicator/drop zone
|
|
@@ -112,7 +132,7 @@ export const InlineDropTarget = ({
|
|
|
112
132
|
|
|
113
133
|
// Set the height target anchor name to the first or last column of the layout section so that it also works for stacked layout
|
|
114
134
|
let heightTargetAnchorName = targetAnchorName;
|
|
115
|
-
if (
|
|
135
|
+
if (nextNode.type.name === 'layoutSection' && nextNode.firstChild && nextNode.lastChild) {
|
|
116
136
|
heightTargetAnchorName = isLeftPosition ? getNodeAnchor(nextNode.firstChild) : getNodeAnchor(nextNode.lastChild);
|
|
117
137
|
}
|
|
118
138
|
if (isAnchorSupported()) {
|
|
@@ -165,27 +185,22 @@ export const InlineDropTarget = ({
|
|
|
165
185
|
}));
|
|
166
186
|
}
|
|
167
187
|
}, [api, getPos, position]);
|
|
168
|
-
const
|
|
169
|
-
const isLayoutNode =
|
|
188
|
+
const hoverZoneRectStyle = useMemo(() => {
|
|
189
|
+
const isLayoutNode = (nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name) === 'layoutSection';
|
|
170
190
|
const layoutAdjustment = isLayoutNode ? {
|
|
171
191
|
width: 11,
|
|
172
192
|
height: 4,
|
|
173
193
|
top: 6,
|
|
174
194
|
bottom: 2
|
|
175
195
|
} : undefined;
|
|
176
|
-
return
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}, isLayoutNode && {
|
|
185
|
-
top: isLeftPosition ? `calc(${nodeDimension.top} + ${(layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.top) || 0}px)` : 'unset',
|
|
186
|
-
bottom: isLeftPosition ? 'unset' : `calc(${nodeDimension.bottom} - ${(layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.bottom) || 0}px)`
|
|
187
|
-
});
|
|
188
|
-
}, [nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name, anchorName, isLeftPosition, nodeDimension]);
|
|
196
|
+
return {
|
|
197
|
+
[HOVER_ZONE_WIDTH]: nodeDimension.widthOffset ? `calc((100% - ${nodeDimension.width})/2 - ${GAP}px + ${nodeDimension.widthOffset} - ${(layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0}px)` : `calc((100% - ${nodeDimension.width})/2 - ${GAP}px - ${(layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0}px)`,
|
|
198
|
+
[HOVER_ZONE_HEIGHT]: `calc(${nodeDimension.height} + ${(layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.height) || 0}px)`,
|
|
199
|
+
[HOVER_ZONE_TOP]: `calc(${nodeDimension.top} + ${(layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.top) || 0}px)`,
|
|
200
|
+
[HOVER_ZONE_BOTTOM]: `calc(${nodeDimension.bottom} - ${(layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.bottom) || 0}px)`,
|
|
201
|
+
[HOVER_ZONE_ANCHOR_NAME]: anchorName
|
|
202
|
+
};
|
|
203
|
+
}, [nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name, nodeDimension, anchorName]);
|
|
189
204
|
const dropIndicatorPos = useMemo(() => {
|
|
190
205
|
return isLeftPosition ? 'right' : 'left';
|
|
191
206
|
}, [isLeftPosition]);
|
|
@@ -206,7 +221,10 @@ export const InlineDropTarget = ({
|
|
|
206
221
|
return jsx("div", {
|
|
207
222
|
ref: ref,
|
|
208
223
|
"data-testid": `drop-target-hover-zone-${position}`,
|
|
209
|
-
css: [hoverZoneCommonStyle,
|
|
224
|
+
css: [hoverZoneCommonStyle, isLeftPosition ? leftHoverZoneStyle : rightHoverZoneStyle]
|
|
225
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
226
|
+
,
|
|
227
|
+
style: hoverZoneRectStyle
|
|
210
228
|
}, isDraggedOver || isBlocksDragTargetDebug() ? jsx(DropIndicator, {
|
|
211
229
|
edge: dropIndicatorPos
|
|
212
230
|
}) : isActiveAnchor && jsx("div", {
|
|
@@ -181,7 +181,7 @@ export var moveNode = function moveNode(api) {
|
|
|
181
181
|
tr.insert(_mappedTo, fragment).setSelection(Selection.near(tr.doc.resolve(_mappedTo))).scrollIntoView();
|
|
182
182
|
return tr;
|
|
183
183
|
}
|
|
184
|
-
if (!canMoveNodeToIndex(destParent, $to.index(), $from.node().child($from.index()))) {
|
|
184
|
+
if (!canMoveNodeToIndex(destParent, $to.index(), $from.node().child($from.index()), $to)) {
|
|
185
185
|
return tr;
|
|
186
186
|
}
|
|
187
187
|
var convertedNodeSlice = transformSourceSlice(nodeCopy, destType);
|
|
@@ -218,7 +218,7 @@ export var dropTargetDecorations = function dropTargetDecorations(newState, api,
|
|
|
218
218
|
}
|
|
219
219
|
return shouldDescend(node); //skip over, don't consider it a valid depth
|
|
220
220
|
}
|
|
221
|
-
var canDrop = activePMNode && canMoveNodeToIndex(parent, index, activePMNode, node);
|
|
221
|
+
var canDrop = activePMNode && canMoveNodeToIndex(parent, index, activePMNode, $pos, node);
|
|
222
222
|
|
|
223
223
|
//NOTE: This will block drop targets showing for nodes that are valid after transformation (i.e. expand -> nestedExpand)
|
|
224
224
|
if (!canDrop && !isBlocksDragTargetDebug()) {
|
|
@@ -7,26 +7,6 @@ var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(t
|
|
|
7
7
|
}
|
|
8
8
|
return false;
|
|
9
9
|
};
|
|
10
|
-
var isEmptyParagraphOrPlaceholder = function isEmptyParagraphOrPlaceholder(node) {
|
|
11
|
-
if (node && node.type.name === 'paragraph') {
|
|
12
|
-
var _node$firstChild;
|
|
13
|
-
return node.childCount === 0 || node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'placeholder';
|
|
14
|
-
}
|
|
15
|
-
return false;
|
|
16
|
-
};
|
|
17
|
-
var isLayoutColumnWithoutContent = function isLayoutColumnWithoutContent(node) {
|
|
18
|
-
if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutColumn') {
|
|
19
|
-
var foundNonEmptyNode = false;
|
|
20
|
-
for (var i = 0; i < node.childCount; i++) {
|
|
21
|
-
var child = node.child(i);
|
|
22
|
-
if (!isEmptyParagraphOrPlaceholder(child)) {
|
|
23
|
-
foundNonEmptyNode = true;
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return !foundNonEmptyNode;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
10
|
export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
31
11
|
var _api$blockControls, _target$classList;
|
|
32
12
|
var _ref = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
@@ -92,11 +72,6 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
92
72
|
} else {
|
|
93
73
|
pos = view.posAtDOM(rootElement, 0);
|
|
94
74
|
}
|
|
95
|
-
var node = view.state.doc.nodeAt(pos);
|
|
96
|
-
if (editorExperiment('advanced_layouts', true) && node && isLayoutColumnWithoutContent(node)) {
|
|
97
|
-
// Don't show drag handle when there is no content/only placeholder in layout column
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
75
|
var rootPos;
|
|
101
76
|
if (editorExperiment('nested-dnd', true)) {
|
|
102
77
|
rootPos = view.state.doc.resolve(pos).pos;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import memoizeOne from 'memoize-one';
|
|
2
|
+
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
2
3
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
6
|
export var isInsideTable = function isInsideTable(nodeType) {
|
|
5
7
|
var _nodeType$schema$node = nodeType.schema.nodes,
|
|
@@ -68,7 +70,7 @@ export var memoizedTransformExpandToNestedExpand = memoizeOne(function (node) {
|
|
|
68
70
|
return null;
|
|
69
71
|
}
|
|
70
72
|
});
|
|
71
|
-
export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, destNode) {
|
|
73
|
+
export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNodePos, destNode) {
|
|
72
74
|
var srcNodeType = srcNode.type;
|
|
73
75
|
var parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
|
|
74
76
|
var activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.name;
|
|
@@ -92,6 +94,20 @@ export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, destNod
|
|
|
92
94
|
return false;
|
|
93
95
|
}
|
|
94
96
|
}
|
|
97
|
+
|
|
98
|
+
// Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
|
|
99
|
+
var isNestingTablesSupported = fg('platform_editor_use_nested_table_pm_nodes') && editorExperiment('nested-tables-in-tables', true, {
|
|
100
|
+
exposure: true
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// NOTE: this will block drop targets from showing for dragging a table into another table
|
|
104
|
+
// unless nested tables are supported and the nesting depth does not exceed 1
|
|
105
|
+
if ((parentNodeType === 'tableCell' || parentNodeType === 'tableHeader') && activeNodeType === 'table') {
|
|
106
|
+
var nestingDepth = getParentOfTypeCount(srcNode === null || srcNode === void 0 ? void 0 : srcNode.type)($destNodePos);
|
|
107
|
+
if (!isNestingTablesSupported || isNestingTablesSupported && nestingDepth > 1) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
95
111
|
if (isInsideTable(destParent.type) && isExpand(srcNodeType)) {
|
|
96
112
|
if (memoizedTransformExpandToNestedExpand(srcNode)) {
|
|
97
113
|
srcNodeType = srcNodeType.schema.nodes.nestedExpand;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
/* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
|
|
3
4
|
/* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */
|
|
@@ -13,15 +14,35 @@ import { akEditorBreakoutPadding } from '@atlaskit/editor-shared-styles';
|
|
|
13
14
|
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
|
|
14
15
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
15
16
|
import { B200 } from '@atlaskit/theme/colors';
|
|
16
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
17
17
|
import { getNodeAnchor } from '../pm-plugins/decorations-common';
|
|
18
18
|
import { useActiveAnchorTracker } from '../pm-plugins/utils/active-anchor-tracker';
|
|
19
19
|
import { isAnchorSupported } from '../pm-plugins/utils/anchor-utils';
|
|
20
20
|
import { isBlocksDragTargetDebug } from '../pm-plugins/utils/drag-target-debug';
|
|
21
|
+
var HOVER_ZONE_WIDTH = '--editor-blocks-inline-hover-zone-width';
|
|
22
|
+
var HOVER_ZONE_HEIGHT = '--editor-blocks-inline-hover-zone-height';
|
|
23
|
+
var HOVER_ZONE_TOP = '--editor-blocks-inline-hover-zone-top';
|
|
24
|
+
var HOVER_ZONE_BOTTOM = '--editor-blocks-inline-hover-zone-bottom';
|
|
25
|
+
var HOVER_ZONE_ANCHOR_NAME = '--editor-blocks-inline-hover-zone-anchor-name';
|
|
21
26
|
var hoverZoneCommonStyle = css({
|
|
22
27
|
position: 'absolute',
|
|
23
28
|
// above the top and bottom drop zone as block hover zone
|
|
24
|
-
zIndex: 120
|
|
29
|
+
zIndex: 120,
|
|
30
|
+
positionAnchor: "var(".concat(HOVER_ZONE_ANCHOR_NAME, ")"),
|
|
31
|
+
minWidth: "var(--ds-space-100, 8px)",
|
|
32
|
+
left: 0,
|
|
33
|
+
right: 0,
|
|
34
|
+
width: "var(".concat(HOVER_ZONE_WIDTH, ")"),
|
|
35
|
+
height: "var(".concat(HOVER_ZONE_HEIGHT, ")")
|
|
36
|
+
});
|
|
37
|
+
var leftHoverZoneStyle = css({
|
|
38
|
+
right: "unset",
|
|
39
|
+
top: "var(".concat(HOVER_ZONE_TOP, ")"),
|
|
40
|
+
bottom: 'unset'
|
|
41
|
+
});
|
|
42
|
+
var rightHoverZoneStyle = css({
|
|
43
|
+
left: "unset",
|
|
44
|
+
top: 'unset',
|
|
45
|
+
bottom: "var(".concat(HOVER_ZONE_BOTTOM, ")")
|
|
25
46
|
});
|
|
26
47
|
|
|
27
48
|
// gap between node boundary and drop indicator/drop zone
|
|
@@ -117,7 +138,7 @@ export var InlineDropTarget = function InlineDropTarget(_ref) {
|
|
|
117
138
|
|
|
118
139
|
// Set the height target anchor name to the first or last column of the layout section so that it also works for stacked layout
|
|
119
140
|
var heightTargetAnchorName = targetAnchorName;
|
|
120
|
-
if (
|
|
141
|
+
if (nextNode.type.name === 'layoutSection' && nextNode.firstChild && nextNode.lastChild) {
|
|
121
142
|
heightTargetAnchorName = isLeftPosition ? getNodeAnchor(nextNode.firstChild) : getNodeAnchor(nextNode.lastChild);
|
|
122
143
|
}
|
|
123
144
|
if (isAnchorSupported()) {
|
|
@@ -167,27 +188,17 @@ export var InlineDropTarget = function InlineDropTarget(_ref) {
|
|
|
167
188
|
}));
|
|
168
189
|
}
|
|
169
190
|
}, [api, getPos, position]);
|
|
170
|
-
var
|
|
171
|
-
var
|
|
191
|
+
var hoverZoneRectStyle = useMemo(function () {
|
|
192
|
+
var _ref3;
|
|
193
|
+
var isLayoutNode = (nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name) === 'layoutSection';
|
|
172
194
|
var layoutAdjustment = isLayoutNode ? {
|
|
173
195
|
width: 11,
|
|
174
196
|
height: 4,
|
|
175
197
|
top: 6,
|
|
176
198
|
bottom: 2
|
|
177
199
|
} : undefined;
|
|
178
|
-
return
|
|
179
|
-
|
|
180
|
-
minWidth: "var(--ds-space-100, 8px)",
|
|
181
|
-
left: isLeftPosition ? 0 : 'unset',
|
|
182
|
-
right: isLeftPosition ? 'unset' : 0,
|
|
183
|
-
top: "calc(anchor(top))",
|
|
184
|
-
width: nodeDimension.widthOffset ? "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px + ").concat(nodeDimension.widthOffset, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)") : "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)"),
|
|
185
|
-
height: "calc(".concat(nodeDimension.height, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.height) || 0, "px)")
|
|
186
|
-
}, isLayoutNode && {
|
|
187
|
-
top: isLeftPosition ? "calc(".concat(nodeDimension.top, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.top) || 0, "px)") : 'unset',
|
|
188
|
-
bottom: isLeftPosition ? 'unset' : "calc(".concat(nodeDimension.bottom, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.bottom) || 0, "px)")
|
|
189
|
-
});
|
|
190
|
-
}, [nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name, anchorName, isLeftPosition, nodeDimension]);
|
|
200
|
+
return _ref3 = {}, _defineProperty(_ref3, HOVER_ZONE_WIDTH, nodeDimension.widthOffset ? "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px + ").concat(nodeDimension.widthOffset, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)") : "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)")), _defineProperty(_ref3, HOVER_ZONE_HEIGHT, "calc(".concat(nodeDimension.height, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.height) || 0, "px)")), _defineProperty(_ref3, HOVER_ZONE_TOP, "calc(".concat(nodeDimension.top, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.top) || 0, "px)")), _defineProperty(_ref3, HOVER_ZONE_BOTTOM, "calc(".concat(nodeDimension.bottom, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.bottom) || 0, "px)")), _defineProperty(_ref3, HOVER_ZONE_ANCHOR_NAME, anchorName), _ref3;
|
|
201
|
+
}, [nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name, nodeDimension, anchorName]);
|
|
191
202
|
var dropIndicatorPos = useMemo(function () {
|
|
192
203
|
return isLeftPosition ? 'right' : 'left';
|
|
193
204
|
}, [isLeftPosition]);
|
|
@@ -208,7 +219,10 @@ export var InlineDropTarget = function InlineDropTarget(_ref) {
|
|
|
208
219
|
return jsx("div", {
|
|
209
220
|
ref: ref,
|
|
210
221
|
"data-testid": "drop-target-hover-zone-".concat(position),
|
|
211
|
-
css: [hoverZoneCommonStyle,
|
|
222
|
+
css: [hoverZoneCommonStyle, isLeftPosition ? leftHoverZoneStyle : rightHoverZoneStyle]
|
|
223
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
224
|
+
,
|
|
225
|
+
style: hoverZoneRectStyle
|
|
212
226
|
}, isDraggedOver || isBlocksDragTargetDebug() ? jsx(DropIndicator, {
|
|
213
227
|
edge: dropIndicatorPos
|
|
214
228
|
}) : isActiveAnchor && jsx("div", {
|
|
@@ -16,4 +16,4 @@ export declare const isInSameLayout: ($from: ResolvedPos, $to: ResolvedPos) => b
|
|
|
16
16
|
export declare const transformExpandToNestedExpand: (expandNode: PMNode) => PMNode | null;
|
|
17
17
|
export declare const transformSliceExpandToNestedExpand: (slice: Slice) => Slice | null;
|
|
18
18
|
export declare const memoizedTransformExpandToNestedExpand: import("memoize-one").MemoizedFn<(node: PMNode) => PMNode | null>;
|
|
19
|
-
export declare function canMoveNodeToIndex(destParent: PMNode, indexIntoParent: number, srcNode: PMNode, destNode?: PMNode): boolean;
|
|
19
|
+
export declare function canMoveNodeToIndex(destParent: PMNode, indexIntoParent: number, srcNode: PMNode, $destNodePos: ResolvedPos, destNode?: PMNode): boolean;
|
|
@@ -16,4 +16,4 @@ export declare const isInSameLayout: ($from: ResolvedPos, $to: ResolvedPos) => b
|
|
|
16
16
|
export declare const transformExpandToNestedExpand: (expandNode: PMNode) => PMNode | null;
|
|
17
17
|
export declare const transformSliceExpandToNestedExpand: (slice: Slice) => Slice | null;
|
|
18
18
|
export declare const memoizedTransformExpandToNestedExpand: import("memoize-one").MemoizedFn<(node: PMNode) => PMNode | null>;
|
|
19
|
-
export declare function canMoveNodeToIndex(destParent: PMNode, indexIntoParent: number, srcNode: PMNode, destNode?: PMNode): boolean;
|
|
19
|
+
export declare function canMoveNodeToIndex(destParent: PMNode, indexIntoParent: number, srcNode: PMNode, $destNodePos: ResolvedPos, destNode?: PMNode): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
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,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
34
|
-
"@atlaskit/editor-common": "^95.
|
|
34
|
+
"@atlaskit/editor-common": "^95.11.0",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
42
42
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
43
43
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
44
|
-
"@atlaskit/icon": "^
|
|
44
|
+
"@atlaskit/icon": "^23.0.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
46
46
|
"@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
|
|
47
|
-
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^
|
|
47
|
+
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.0.0",
|
|
48
48
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
49
49
|
"@atlaskit/primitives": "^13.3.0",
|
|
50
50
|
"@atlaskit/theme": "^14.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^2.22.0",
|
|
52
52
|
"@atlaskit/tokens": "^2.4.0",
|
|
53
53
|
"@atlaskit/tooltip": "^18.9.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
@@ -162,6 +162,9 @@
|
|
|
162
162
|
},
|
|
163
163
|
"platform_editor_react18_plugin_portalprovider": {
|
|
164
164
|
"type": "boolean"
|
|
165
|
+
},
|
|
166
|
+
"platform_editor_use_nested_table_pm_nodes": {
|
|
167
|
+
"type": "boolean"
|
|
165
168
|
}
|
|
166
169
|
}
|
|
167
170
|
}
|