@atlaskit/editor-plugin-block-controls 1.5.7 → 1.5.9
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/ui/drag-handle.js +5 -2
- package/dist/cjs/utils/getSelection.js +20 -8
- package/dist/es2019/ui/drag-handle.js +5 -2
- package/dist/es2019/utils/getSelection.js +20 -8
- package/dist/esm/ui/drag-handle.js +5 -2
- package/dist/esm/utils/getSelection.js +20 -8
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 1.5.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#116092](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116092)
|
|
8
|
+
[`2d7842663b057`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2d7842663b057) -
|
|
9
|
+
ED-23905 Fix selection on click for nested lists and task lists
|
|
10
|
+
|
|
11
|
+
## 1.5.8
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#116058](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116058)
|
|
16
|
+
[`1a8435d9dbaf0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1a8435d9dbaf0) -
|
|
17
|
+
fix position of drag handle on block card nodes
|
|
18
|
+
|
|
3
19
|
## 1.5.7
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -242,8 +242,11 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
if (supportsAnchor) {
|
|
245
|
-
return {
|
|
246
|
-
left: hasResizer || isExtension ||
|
|
245
|
+
return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? {
|
|
246
|
+
left: hasResizer || isExtension || isEmbedCard ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType), "px)"),
|
|
247
|
+
top: anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(_consts.DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
|
|
248
|
+
} : {
|
|
249
|
+
left: hasResizer || isExtension || isBlockCard || isEmbedCard ? (0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates) : "calc(anchor(".concat(anchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType), "px)"),
|
|
247
250
|
top: anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(_consts.DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
|
|
248
251
|
};
|
|
249
252
|
}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.selectNode = exports.getSelection = void 0;
|
|
7
7
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
8
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
10
|
var getSelection = exports.getSelection = function getSelection(tr, start) {
|
|
10
11
|
var node = tr.doc.nodeAt(start);
|
|
11
12
|
var isNodeSelection = node && _state.NodeSelection.isSelectable(node);
|
|
@@ -24,19 +25,30 @@ var getSelection = exports.getSelection = function getSelection(tr, start) {
|
|
|
24
25
|
// Find the first inline node in the node
|
|
25
26
|
var inlineNodePos = start;
|
|
26
27
|
var foundInlineNode = false;
|
|
28
|
+
var inlineNodeEndPos = 0;
|
|
27
29
|
tr.doc.nodesBetween($startPos.pos, $startPos.pos + nodeSize, function (n, pos) {
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
if ((0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-ed-23905')) {
|
|
31
|
+
if (n.isInline) {
|
|
32
|
+
inlineNodeEndPos = pos + n.nodeSize;
|
|
33
|
+
}
|
|
34
|
+
if (n.isInline && !foundInlineNode) {
|
|
35
|
+
inlineNodePos = pos;
|
|
36
|
+
foundInlineNode = true;
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
if (foundInlineNode) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (n.isInline) {
|
|
43
|
+
inlineNodePos = pos;
|
|
44
|
+
foundInlineNode = true;
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
35
47
|
}
|
|
36
48
|
return true;
|
|
37
49
|
});
|
|
38
50
|
var inlineNodeDepth = inlineNodePos - start;
|
|
39
|
-
return new _state.TextSelection(tr.doc.resolve(start + nodeSize - inlineNodeDepth), tr.doc.resolve(inlineNodePos));
|
|
51
|
+
return new _state.TextSelection(tr.doc.resolve((0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-ed-23905') ? inlineNodeEndPos : start + nodeSize - inlineNodeDepth), tr.doc.resolve(inlineNodePos));
|
|
40
52
|
}
|
|
41
53
|
};
|
|
42
54
|
var selectNode = exports.selectNode = function selectNode(tr, start, nodeType) {
|
|
@@ -231,8 +231,11 @@ export const DragHandle = ({
|
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
if (supportsAnchor) {
|
|
234
|
-
return {
|
|
235
|
-
left: hasResizer || isExtension ||
|
|
234
|
+
return getBooleanFF('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? {
|
|
235
|
+
left: hasResizer || isExtension || isEmbedCard ? `calc(anchor(${anchorName} start) + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates)})` : `calc(anchor(${anchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType)}px)`,
|
|
236
|
+
top: anchorName.includes('table') ? `calc(anchor(${anchorName} start) + ${DRAG_HANDLE_HEIGHT}px)` : `anchor(${anchorName} start)`
|
|
237
|
+
} : {
|
|
238
|
+
left: hasResizer || isExtension || isBlockCard || isEmbedCard ? getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates) : `calc(anchor(${anchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType)}px)`,
|
|
236
239
|
top: anchorName.includes('table') ? `calc(anchor(${anchorName} start) + ${DRAG_HANDLE_HEIGHT}px)` : `anchor(${anchorName} start)`
|
|
237
240
|
};
|
|
238
241
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { selectTableClosestToPos } from '@atlaskit/editor-tables/utils';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
export const getSelection = (tr, start) => {
|
|
4
5
|
const node = tr.doc.nodeAt(start);
|
|
5
6
|
const isNodeSelection = node && NodeSelection.isSelectable(node);
|
|
@@ -18,19 +19,30 @@ export const getSelection = (tr, start) => {
|
|
|
18
19
|
// Find the first inline node in the node
|
|
19
20
|
let inlineNodePos = start;
|
|
20
21
|
let foundInlineNode = false;
|
|
22
|
+
let inlineNodeEndPos = 0;
|
|
21
23
|
tr.doc.nodesBetween($startPos.pos, $startPos.pos + nodeSize, (n, pos) => {
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
if (fg('platform.editor.elements.drag-and-drop-ed-23905')) {
|
|
25
|
+
if (n.isInline) {
|
|
26
|
+
inlineNodeEndPos = pos + n.nodeSize;
|
|
27
|
+
}
|
|
28
|
+
if (n.isInline && !foundInlineNode) {
|
|
29
|
+
inlineNodePos = pos;
|
|
30
|
+
foundInlineNode = true;
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
if (foundInlineNode) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
if (n.isInline) {
|
|
37
|
+
inlineNodePos = pos;
|
|
38
|
+
foundInlineNode = true;
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
29
41
|
}
|
|
30
42
|
return true;
|
|
31
43
|
});
|
|
32
44
|
const inlineNodeDepth = inlineNodePos - start;
|
|
33
|
-
return new TextSelection(tr.doc.resolve(start + nodeSize - inlineNodeDepth), tr.doc.resolve(inlineNodePos));
|
|
45
|
+
return new TextSelection(tr.doc.resolve(fg('platform.editor.elements.drag-and-drop-ed-23905') ? inlineNodeEndPos : start + nodeSize - inlineNodeDepth), tr.doc.resolve(inlineNodePos));
|
|
34
46
|
}
|
|
35
47
|
};
|
|
36
48
|
export const selectNode = (tr, start, nodeType) => {
|
|
@@ -234,8 +234,11 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
if (supportsAnchor) {
|
|
237
|
-
return {
|
|
238
|
-
left: hasResizer || isExtension ||
|
|
237
|
+
return getBooleanFF('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? {
|
|
238
|
+
left: hasResizer || isExtension || isEmbedCard ? "calc(anchor(".concat(anchorName, " start) + ").concat(getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType), "px)"),
|
|
239
|
+
top: anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
|
|
240
|
+
} : {
|
|
241
|
+
left: hasResizer || isExtension || isBlockCard || isEmbedCard ? getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates) : "calc(anchor(".concat(anchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType), "px)"),
|
|
239
242
|
top: anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
|
|
240
243
|
};
|
|
241
244
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { selectTableClosestToPos } from '@atlaskit/editor-tables/utils';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
export var getSelection = function getSelection(tr, start) {
|
|
4
5
|
var node = tr.doc.nodeAt(start);
|
|
5
6
|
var isNodeSelection = node && NodeSelection.isSelectable(node);
|
|
@@ -18,19 +19,30 @@ export var getSelection = function getSelection(tr, start) {
|
|
|
18
19
|
// Find the first inline node in the node
|
|
19
20
|
var inlineNodePos = start;
|
|
20
21
|
var foundInlineNode = false;
|
|
22
|
+
var inlineNodeEndPos = 0;
|
|
21
23
|
tr.doc.nodesBetween($startPos.pos, $startPos.pos + nodeSize, function (n, pos) {
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
if (fg('platform.editor.elements.drag-and-drop-ed-23905')) {
|
|
25
|
+
if (n.isInline) {
|
|
26
|
+
inlineNodeEndPos = pos + n.nodeSize;
|
|
27
|
+
}
|
|
28
|
+
if (n.isInline && !foundInlineNode) {
|
|
29
|
+
inlineNodePos = pos;
|
|
30
|
+
foundInlineNode = true;
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
if (foundInlineNode) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
if (n.isInline) {
|
|
37
|
+
inlineNodePos = pos;
|
|
38
|
+
foundInlineNode = true;
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
29
41
|
}
|
|
30
42
|
return true;
|
|
31
43
|
});
|
|
32
44
|
var inlineNodeDepth = inlineNodePos - start;
|
|
33
|
-
return new TextSelection(tr.doc.resolve(start + nodeSize - inlineNodeDepth), tr.doc.resolve(inlineNodePos));
|
|
45
|
+
return new TextSelection(tr.doc.resolve(fg('platform.editor.elements.drag-and-drop-ed-23905') ? inlineNodeEndPos : start + nodeSize - inlineNodeDepth), tr.doc.resolve(inlineNodePos));
|
|
34
46
|
}
|
|
35
47
|
};
|
|
36
48
|
export var selectNode = function selectNode(tr, start, nodeType) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.9",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -113,6 +113,9 @@
|
|
|
113
113
|
},
|
|
114
114
|
"platform.editor.elements.drag-and-drop-ed-23816": {
|
|
115
115
|
"type": "boolean"
|
|
116
|
+
},
|
|
117
|
+
"platform.editor.elements.drag-and-drop-ed-23905": {
|
|
118
|
+
"type": "boolean"
|
|
116
119
|
}
|
|
117
120
|
}
|
|
118
121
|
}
|