@atlaskit/editor-plugin-block-controls 1.12.1 → 1.12.3
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 +16 -0
- package/dist/cjs/pm-plugins/decorations.js +1 -1
- package/dist/cjs/pm-plugins/handle-mouse-over.js +12 -1
- package/dist/cjs/ui/drag-handle.js +2 -2
- package/dist/es2019/pm-plugins/decorations.js +1 -1
- package/dist/es2019/pm-plugins/handle-mouse-over.js +12 -1
- package/dist/es2019/ui/drag-handle.js +2 -2
- package/dist/esm/pm-plugins/decorations.js +1 -1
- package/dist/esm/pm-plugins/handle-mouse-over.js +12 -1
- package/dist/esm/ui/drag-handle.js +2 -2
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 1.12.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#131601](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/131601)
|
|
8
|
+
[`80035567d3d2e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/80035567d3d2e) -
|
|
9
|
+
ED-24614 fix cards flickering inside a table cell
|
|
10
|
+
|
|
11
|
+
## 1.12.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#131777](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/131777)
|
|
16
|
+
[`3c12389d16342`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3c12389d16342) -
|
|
17
|
+
[ux] ED-24410 Fix drag handle position for nested nodes
|
|
18
|
+
|
|
3
19
|
## 1.12.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -17,7 +17,7 @@ var _dropTarget = require("../ui/drop-target");
|
|
|
17
17
|
var _dragTargetDebug = require("../utils/drag-target-debug");
|
|
18
18
|
var _validation = require("../utils/validation");
|
|
19
19
|
var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
|
|
20
|
-
var IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList'];
|
|
20
|
+
var IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList', 'mediaSingle'];
|
|
21
21
|
var PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand'];
|
|
22
22
|
var getNestedDepth = function getNestedDepth() {
|
|
23
23
|
return (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested') ? 100 : 0;
|
|
@@ -31,9 +31,20 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
31
31
|
var pos = view.posAtDOM(rootElement, 0, 0);
|
|
32
32
|
var rootPos;
|
|
33
33
|
if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
|
|
34
|
+
var _$rootPos$parent, _$rootPos$parent2, _$rootPos$nodeAfter;
|
|
34
35
|
var $rootPos = view.state.doc.resolve(pos);
|
|
35
36
|
var depth = $rootPos.depth;
|
|
36
|
-
rootPos =
|
|
37
|
+
var isParentAnIsolatingNode = ((_$rootPos$parent = $rootPos.parent) === null || _$rootPos$parent === void 0 ? void 0 : _$rootPos$parent.type.name) !== 'doc' && ((_$rootPos$parent2 = $rootPos.parent) === null || _$rootPos$parent2 === void 0 ? void 0 : _$rootPos$parent2.type.spec.isolating);
|
|
38
|
+
var isCurrentNodeAtom = (_$rootPos$nodeAfter = $rootPos.nodeAfter) === null || _$rootPos$nodeAfter === void 0 ? void 0 : _$rootPos$nodeAfter.isAtom;
|
|
39
|
+
/**
|
|
40
|
+
* If the parent node is an isolating node, the sides of nodes of this type are considered boundaries, such as a table cell.
|
|
41
|
+
* And the current node, as a direct child, is an atom node, meaning it does not have directly editable content.
|
|
42
|
+
* e.g. a card or an extension
|
|
43
|
+
* We maintain the original position by adding 1 to the depth.
|
|
44
|
+
* This prevents the decoration from being inserted in the wrong position, like between table cells.
|
|
45
|
+
*/
|
|
46
|
+
var posDepth = isParentAnIsolatingNode && isCurrentNodeAtom ? depth + 1 : depth;
|
|
47
|
+
rootPos = depth ? $rootPos.before(posDepth) : $rootPos.pos;
|
|
37
48
|
} else {
|
|
38
49
|
rootPos = view.state.doc.resolve(pos).start(1) - 1;
|
|
39
50
|
}
|
|
@@ -282,12 +282,12 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
|
|
|
282
282
|
}
|
|
283
283
|
if (supportsAnchor) {
|
|
284
284
|
return {
|
|
285
|
-
left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType, parentNodeType), "px)"),
|
|
285
|
+
left: (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType, parentNodeType), "px)"),
|
|
286
286
|
top: (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_ed_23674') ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _consts.topPositionAdjustment)(nodeType), "px)") : anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(_consts.DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
289
|
return {
|
|
290
|
-
left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : (0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType),
|
|
290
|
+
left: (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : (0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType),
|
|
291
291
|
top: (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_ed_23674') ? (0, _dragHandlePositions.getTopPosition)(dom, nodeType) : (0, _dragHandlePositions.getTopPosition)(dom)
|
|
292
292
|
};
|
|
293
293
|
}, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates, getPos]);
|
|
@@ -9,7 +9,7 @@ import { DropTarget } from '../ui/drop-target';
|
|
|
9
9
|
import { isBlocksDragTargetDebug } from '../utils/drag-target-debug';
|
|
10
10
|
import { canMoveNodeToIndex } from '../utils/validation';
|
|
11
11
|
const IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
|
|
12
|
-
const IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList'];
|
|
12
|
+
const IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList', 'mediaSingle'];
|
|
13
13
|
const PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand'];
|
|
14
14
|
const getNestedDepth = () => fg('platform_editor_elements_dnd_nested') ? 100 : 0;
|
|
15
15
|
const createDropTargetDecoration = (pos, dropTargetDec) => {
|
|
@@ -26,9 +26,20 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
26
26
|
const pos = view.posAtDOM(rootElement, 0, 0);
|
|
27
27
|
let rootPos;
|
|
28
28
|
if (fg('platform_editor_elements_dnd_nested')) {
|
|
29
|
+
var _$rootPos$parent, _$rootPos$parent2, _$rootPos$nodeAfter;
|
|
29
30
|
const $rootPos = view.state.doc.resolve(pos);
|
|
30
31
|
const depth = $rootPos.depth;
|
|
31
|
-
rootPos =
|
|
32
|
+
const isParentAnIsolatingNode = ((_$rootPos$parent = $rootPos.parent) === null || _$rootPos$parent === void 0 ? void 0 : _$rootPos$parent.type.name) !== 'doc' && ((_$rootPos$parent2 = $rootPos.parent) === null || _$rootPos$parent2 === void 0 ? void 0 : _$rootPos$parent2.type.spec.isolating);
|
|
33
|
+
const isCurrentNodeAtom = (_$rootPos$nodeAfter = $rootPos.nodeAfter) === null || _$rootPos$nodeAfter === void 0 ? void 0 : _$rootPos$nodeAfter.isAtom;
|
|
34
|
+
/**
|
|
35
|
+
* If the parent node is an isolating node, the sides of nodes of this type are considered boundaries, such as a table cell.
|
|
36
|
+
* And the current node, as a direct child, is an atom node, meaning it does not have directly editable content.
|
|
37
|
+
* e.g. a card or an extension
|
|
38
|
+
* We maintain the original position by adding 1 to the depth.
|
|
39
|
+
* This prevents the decoration from being inserted in the wrong position, like between table cells.
|
|
40
|
+
*/
|
|
41
|
+
const posDepth = isParentAnIsolatingNode && isCurrentNodeAtom ? depth + 1 : depth;
|
|
42
|
+
rootPos = depth ? $rootPos.before(posDepth) : $rootPos.pos;
|
|
32
43
|
} else {
|
|
33
44
|
rootPos = view.state.doc.resolve(pos).start(1) - 1;
|
|
34
45
|
}
|
|
@@ -270,12 +270,12 @@ const DragHandleInternal = ({
|
|
|
270
270
|
}
|
|
271
271
|
if (supportsAnchor) {
|
|
272
272
|
return {
|
|
273
|
-
left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? `calc(anchor(${anchorName} start) + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType)})` : `calc(anchor(${anchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType, parentNodeType)}px)`,
|
|
273
|
+
left: (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer ? `calc(anchor(${anchorName} start) + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType)})` : `calc(anchor(${anchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType, parentNodeType)}px)`,
|
|
274
274
|
top: fg('platform_editor_elements_dnd_ed_23674') ? `calc(anchor(${anchorName} start) + ${topPositionAdjustment(nodeType)}px)` : anchorName.includes('table') ? `calc(anchor(${anchorName} start) + ${DRAG_HANDLE_HEIGHT}px)` : `anchor(${anchorName} start)`
|
|
275
275
|
};
|
|
276
276
|
}
|
|
277
277
|
return {
|
|
278
|
-
left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? `calc(${(dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0}px + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType)})` : getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType),
|
|
278
|
+
left: (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer ? `calc(${(dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0}px + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType)})` : getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType),
|
|
279
279
|
top: fg('platform_editor_elements_dnd_ed_23674') ? getTopPosition(dom, nodeType) : getTopPosition(dom)
|
|
280
280
|
};
|
|
281
281
|
}, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates, getPos]);
|
|
@@ -10,7 +10,7 @@ import { DropTarget } from '../ui/drop-target';
|
|
|
10
10
|
import { isBlocksDragTargetDebug } from '../utils/drag-target-debug';
|
|
11
11
|
import { canMoveNodeToIndex } from '../utils/validation';
|
|
12
12
|
var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
|
|
13
|
-
var IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList'];
|
|
13
|
+
var IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList', 'mediaSingle'];
|
|
14
14
|
var PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand'];
|
|
15
15
|
var getNestedDepth = function getNestedDepth() {
|
|
16
16
|
return fg('platform_editor_elements_dnd_nested') ? 100 : 0;
|
|
@@ -25,9 +25,20 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
25
25
|
var pos = view.posAtDOM(rootElement, 0, 0);
|
|
26
26
|
var rootPos;
|
|
27
27
|
if (fg('platform_editor_elements_dnd_nested')) {
|
|
28
|
+
var _$rootPos$parent, _$rootPos$parent2, _$rootPos$nodeAfter;
|
|
28
29
|
var $rootPos = view.state.doc.resolve(pos);
|
|
29
30
|
var depth = $rootPos.depth;
|
|
30
|
-
rootPos =
|
|
31
|
+
var isParentAnIsolatingNode = ((_$rootPos$parent = $rootPos.parent) === null || _$rootPos$parent === void 0 ? void 0 : _$rootPos$parent.type.name) !== 'doc' && ((_$rootPos$parent2 = $rootPos.parent) === null || _$rootPos$parent2 === void 0 ? void 0 : _$rootPos$parent2.type.spec.isolating);
|
|
32
|
+
var isCurrentNodeAtom = (_$rootPos$nodeAfter = $rootPos.nodeAfter) === null || _$rootPos$nodeAfter === void 0 ? void 0 : _$rootPos$nodeAfter.isAtom;
|
|
33
|
+
/**
|
|
34
|
+
* If the parent node is an isolating node, the sides of nodes of this type are considered boundaries, such as a table cell.
|
|
35
|
+
* And the current node, as a direct child, is an atom node, meaning it does not have directly editable content.
|
|
36
|
+
* e.g. a card or an extension
|
|
37
|
+
* We maintain the original position by adding 1 to the depth.
|
|
38
|
+
* This prevents the decoration from being inserted in the wrong position, like between table cells.
|
|
39
|
+
*/
|
|
40
|
+
var posDepth = isParentAnIsolatingNode && isCurrentNodeAtom ? depth + 1 : depth;
|
|
41
|
+
rootPos = depth ? $rootPos.before(posDepth) : $rootPos.pos;
|
|
31
42
|
} else {
|
|
32
43
|
rootPos = view.state.doc.resolve(pos).start(1) - 1;
|
|
33
44
|
}
|
|
@@ -273,12 +273,12 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
|
|
|
273
273
|
}
|
|
274
274
|
if (supportsAnchor) {
|
|
275
275
|
return {
|
|
276
|
-
left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? "calc(anchor(".concat(anchorName, " start) + ").concat(getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType, parentNodeType), "px)"),
|
|
276
|
+
left: (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer ? "calc(anchor(".concat(anchorName, " start) + ").concat(getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType, parentNodeType), "px)"),
|
|
277
277
|
top: fg('platform_editor_elements_dnd_ed_23674') ? "calc(anchor(".concat(anchorName, " start) + ").concat(topPositionAdjustment(nodeType), "px)") : anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
|
|
278
278
|
};
|
|
279
279
|
}
|
|
280
280
|
return {
|
|
281
|
-
left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat(getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType),
|
|
281
|
+
left: (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat(getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType),
|
|
282
282
|
top: fg('platform_editor_elements_dnd_ed_23674') ? getTopPosition(dom, nodeType) : getTopPosition(dom)
|
|
283
283
|
};
|
|
284
284
|
}, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates, getPos]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.3",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,22 +31,22 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/editor-common": "^87.
|
|
34
|
+
"@atlaskit/editor-common": "^87.13.0",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.7.0",
|
|
37
|
-
"@atlaskit/editor-plugin-editor-disabled": "^1.
|
|
37
|
+
"@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
|
|
38
38
|
"@atlaskit/editor-plugin-feature-flags": "^1.2.0",
|
|
39
|
-
"@atlaskit/editor-plugin-width": "^1.
|
|
39
|
+
"@atlaskit/editor-plugin-width": "^1.3.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "5.0.1",
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^2.13.0",
|
|
42
42
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
43
|
-
"@atlaskit/icon": "^22.
|
|
43
|
+
"@atlaskit/icon": "^22.14.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
45
45
|
"@atlaskit/pragmatic-drag-and-drop": "^1.3.0",
|
|
46
46
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.4.0",
|
|
47
47
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
48
48
|
"@atlaskit/theme": "^13.0.0",
|
|
49
|
-
"@atlaskit/tokens": "^1.
|
|
49
|
+
"@atlaskit/tokens": "^1.59.0",
|
|
50
50
|
"@atlaskit/tooltip": "^18.7.0",
|
|
51
51
|
"@babel/runtime": "^7.0.0",
|
|
52
52
|
"@emotion/react": "^11.7.1",
|