@atlaskit/editor-plugin-block-controls 1.4.25 → 1.4.27
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 +21 -0
- package/dist/cjs/pm-plugins/decorations.js +2 -0
- package/dist/cjs/ui/drag-preview.js +17 -14
- package/dist/cjs/utils/getSelection.js +10 -10
- package/dist/es2019/pm-plugins/decorations.js +2 -0
- package/dist/es2019/ui/drag-preview.js +17 -14
- package/dist/es2019/utils/getSelection.js +10 -10
- package/dist/esm/pm-plugins/decorations.js +2 -0
- package/dist/esm/ui/drag-preview.js +17 -14
- package/dist/esm/utils/getSelection.js +10 -10
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 1.4.27
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#113232](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/113232)
|
|
8
|
+
[`0a1d7a1348305`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0a1d7a1348305) -
|
|
9
|
+
[ux] Fix drag previews when media is nested in the node
|
|
10
|
+
- [#113423](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/113423)
|
|
11
|
+
[`e22e9f7eadce7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e22e9f7eadce7) -
|
|
12
|
+
Fix text spliting when deleting paragraph
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 1.4.26
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#113192](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/113192)
|
|
20
|
+
[`e30355e61e571`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e30355e61e571) -
|
|
21
|
+
[ED-23770] Fix the bug where clicking drag handle does not select inline nodes
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 1.4.25
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -113,6 +113,8 @@ var mouseMoveWrapperDecorations = exports.mouseMoveWrapperDecorations = function
|
|
|
113
113
|
var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDecoration(pos, anchorName, nodeType, api) {
|
|
114
114
|
return _view.Decoration.widget(pos, function (view, getPos) {
|
|
115
115
|
var element = document.createElement('div');
|
|
116
|
+
// Need to set it to inline to avoid text being split when merging two paragraphs
|
|
117
|
+
element.style.display = 'inline';
|
|
116
118
|
element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
|
|
117
119
|
element.setAttribute('data-blocks-drag-handle-container', 'true');
|
|
118
120
|
_reactDom.default.render( /*#__PURE__*/(0, _react.createElement)(_dragHandle.DragHandle, {
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.dragPreview = void 0;
|
|
7
|
-
|
|
7
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
8
8
|
var previewStyle = {
|
|
9
|
-
borderColor: "var(--ds-border-focused,
|
|
9
|
+
borderColor: "var(--ds-border-focused, ".concat(_colors.B200, ")"),
|
|
10
10
|
borderStyle: 'solid',
|
|
11
|
-
borderRadius: "var(--ds-border-radius-100,
|
|
11
|
+
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
12
12
|
borderWidth: "var(--ds-border-width-outline, 2px)",
|
|
13
13
|
backgroundColor: "var(--ds-blanket-selected, #388BFF14)"
|
|
14
14
|
};
|
|
@@ -21,23 +21,26 @@ var dragPreview = exports.dragPreview = function dragPreview(container, dom, nod
|
|
|
21
21
|
// ProseMirror class is required to make sure the cloned dom is styled correctly
|
|
22
22
|
parent.classList.add('ProseMirror');
|
|
23
23
|
var shouldBeGenericPreview = nodeType === 'embedCard' || nodeType === 'extension';
|
|
24
|
-
|
|
24
|
+
var embedCard = dom.querySelector('.embedCardView-content-wrap');
|
|
25
|
+
if (shouldBeGenericPreview || embedCard) {
|
|
25
26
|
parent.style.border = "".concat(previewStyle.borderWidth, " ").concat(previewStyle.borderStyle, " ").concat(previewStyle.borderColor);
|
|
26
27
|
parent.style.borderRadius = previewStyle.borderRadius;
|
|
27
28
|
parent.style.backgroundColor = previewStyle.backgroundColor;
|
|
28
29
|
parent.style.height = '100%';
|
|
29
30
|
parent.setAttribute('data-testid', 'block-ctrl-generic-drag-preview');
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
} else {
|
|
32
|
+
var resizer = dom.querySelector('.resizer-item');
|
|
33
|
+
var clonedDom = resizer && ['mediaSingle', 'table'].includes(nodeType) ? resizer.cloneNode(true) : dom.cloneNode(true);
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
// Remove any margin from the cloned element to ensure is doesn't position incorrectly
|
|
36
|
+
clonedDom.style.marginLeft = '0';
|
|
37
|
+
clonedDom.style.marginTop = '0';
|
|
38
|
+
clonedDom.style.marginRight = '0';
|
|
39
|
+
clonedDom.style.marginBottom = '0';
|
|
40
|
+
clonedDom.style.opacity = '0.4';
|
|
41
|
+
clonedDom.style.boxShadow = 'none';
|
|
42
|
+
parent.appendChild(clonedDom);
|
|
43
|
+
}
|
|
41
44
|
container.appendChild(parent);
|
|
42
45
|
var scrollParent = document.querySelector('.fabric-editor-popup-scroll-parent');
|
|
43
46
|
var scrollParentClassNames = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.className;
|
|
@@ -14,23 +14,23 @@ var getSelection = exports.getSelection = function getSelection(tr, start) {
|
|
|
14
14
|
if (isNodeSelection) {
|
|
15
15
|
return new _state.NodeSelection($startPos);
|
|
16
16
|
} else {
|
|
17
|
-
// To trigger the annotation floating toolbar for non-selectable node, we need to select
|
|
18
|
-
// Find the first
|
|
19
|
-
var
|
|
20
|
-
var
|
|
17
|
+
// To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
|
|
18
|
+
// Find the first inline node in the node
|
|
19
|
+
var inlineNodePos = start;
|
|
20
|
+
var foundInlineNode = false;
|
|
21
21
|
tr.doc.nodesBetween($startPos.pos, $startPos.pos + nodeSize, function (n, pos) {
|
|
22
|
-
if (
|
|
22
|
+
if (foundInlineNode) {
|
|
23
23
|
return false;
|
|
24
24
|
}
|
|
25
|
-
if (n.
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
if (n.isInline) {
|
|
26
|
+
inlineNodePos = pos;
|
|
27
|
+
foundInlineNode = true;
|
|
28
28
|
return false;
|
|
29
29
|
}
|
|
30
30
|
return true;
|
|
31
31
|
});
|
|
32
|
-
var
|
|
33
|
-
return new _state.TextSelection(tr.doc.resolve(
|
|
32
|
+
var inlineNodeDepth = inlineNodePos - start;
|
|
33
|
+
return new _state.TextSelection(tr.doc.resolve(inlineNodePos), tr.doc.resolve(start + nodeSize - inlineNodeDepth));
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
var selectNode = exports.selectNode = function selectNode(tr, start, nodeType) {
|
|
@@ -106,6 +106,8 @@ export const mouseMoveWrapperDecorations = (newState, api) => {
|
|
|
106
106
|
export const dragHandleDecoration = (pos, anchorName, nodeType, api) => {
|
|
107
107
|
return Decoration.widget(pos, (view, getPos) => {
|
|
108
108
|
const element = document.createElement('div');
|
|
109
|
+
// Need to set it to inline to avoid text being split when merging two paragraphs
|
|
110
|
+
element.style.display = 'inline';
|
|
109
111
|
element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
|
|
110
112
|
element.setAttribute('data-blocks-drag-handle-container', 'true');
|
|
111
113
|
ReactDOM.render( /*#__PURE__*/createElement(DragHandle, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { B200 } from '@atlaskit/theme/colors';
|
|
2
2
|
const previewStyle = {
|
|
3
|
-
borderColor:
|
|
3
|
+
borderColor: `var(--ds-border-focused, ${B200})`,
|
|
4
4
|
borderStyle: 'solid',
|
|
5
|
-
borderRadius: "var(--ds-border-radius-100,
|
|
5
|
+
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
6
6
|
borderWidth: "var(--ds-border-width-outline, 2px)",
|
|
7
7
|
backgroundColor: "var(--ds-blanket-selected, #388BFF14)"
|
|
8
8
|
};
|
|
@@ -15,23 +15,26 @@ export const dragPreview = (container, dom, nodeType) => {
|
|
|
15
15
|
// ProseMirror class is required to make sure the cloned dom is styled correctly
|
|
16
16
|
parent.classList.add('ProseMirror');
|
|
17
17
|
const shouldBeGenericPreview = nodeType === 'embedCard' || nodeType === 'extension';
|
|
18
|
-
|
|
18
|
+
const embedCard = dom.querySelector('.embedCardView-content-wrap');
|
|
19
|
+
if (shouldBeGenericPreview || embedCard) {
|
|
19
20
|
parent.style.border = `${previewStyle.borderWidth} ${previewStyle.borderStyle} ${previewStyle.borderColor}`;
|
|
20
21
|
parent.style.borderRadius = previewStyle.borderRadius;
|
|
21
22
|
parent.style.backgroundColor = previewStyle.backgroundColor;
|
|
22
23
|
parent.style.height = '100%';
|
|
23
24
|
parent.setAttribute('data-testid', 'block-ctrl-generic-drag-preview');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
} else {
|
|
26
|
+
const resizer = dom.querySelector('.resizer-item');
|
|
27
|
+
const clonedDom = resizer && ['mediaSingle', 'table'].includes(nodeType) ? resizer.cloneNode(true) : dom.cloneNode(true);
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
// Remove any margin from the cloned element to ensure is doesn't position incorrectly
|
|
30
|
+
clonedDom.style.marginLeft = '0';
|
|
31
|
+
clonedDom.style.marginTop = '0';
|
|
32
|
+
clonedDom.style.marginRight = '0';
|
|
33
|
+
clonedDom.style.marginBottom = '0';
|
|
34
|
+
clonedDom.style.opacity = '0.4';
|
|
35
|
+
clonedDom.style.boxShadow = 'none';
|
|
36
|
+
parent.appendChild(clonedDom);
|
|
37
|
+
}
|
|
35
38
|
container.appendChild(parent);
|
|
36
39
|
const scrollParent = document.querySelector('.fabric-editor-popup-scroll-parent');
|
|
37
40
|
const scrollParentClassNames = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.className;
|
|
@@ -8,23 +8,23 @@ export const getSelection = (tr, start) => {
|
|
|
8
8
|
if (isNodeSelection) {
|
|
9
9
|
return new NodeSelection($startPos);
|
|
10
10
|
} else {
|
|
11
|
-
// To trigger the annotation floating toolbar for non-selectable node, we need to select
|
|
12
|
-
// Find the first
|
|
13
|
-
let
|
|
14
|
-
let
|
|
11
|
+
// To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
|
|
12
|
+
// Find the first inline node in the node
|
|
13
|
+
let inlineNodePos = start;
|
|
14
|
+
let foundInlineNode = false;
|
|
15
15
|
tr.doc.nodesBetween($startPos.pos, $startPos.pos + nodeSize, (n, pos) => {
|
|
16
|
-
if (
|
|
16
|
+
if (foundInlineNode) {
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
19
|
-
if (n.
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
if (n.isInline) {
|
|
20
|
+
inlineNodePos = pos;
|
|
21
|
+
foundInlineNode = true;
|
|
22
22
|
return false;
|
|
23
23
|
}
|
|
24
24
|
return true;
|
|
25
25
|
});
|
|
26
|
-
const
|
|
27
|
-
return new TextSelection(tr.doc.resolve(
|
|
26
|
+
const inlineNodeDepth = inlineNodePos - start;
|
|
27
|
+
return new TextSelection(tr.doc.resolve(inlineNodePos), tr.doc.resolve(start + nodeSize - inlineNodeDepth));
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
export const selectNode = (tr, start, nodeType) => {
|
|
@@ -106,6 +106,8 @@ export var mouseMoveWrapperDecorations = function mouseMoveWrapperDecorations(ne
|
|
|
106
106
|
export var dragHandleDecoration = function dragHandleDecoration(pos, anchorName, nodeType, api) {
|
|
107
107
|
return Decoration.widget(pos, function (view, getPos) {
|
|
108
108
|
var element = document.createElement('div');
|
|
109
|
+
// Need to set it to inline to avoid text being split when merging two paragraphs
|
|
110
|
+
element.style.display = 'inline';
|
|
109
111
|
element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
|
|
110
112
|
element.setAttribute('data-blocks-drag-handle-container', 'true');
|
|
111
113
|
ReactDOM.render( /*#__PURE__*/createElement(DragHandle, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { B200 } from '@atlaskit/theme/colors';
|
|
2
2
|
var previewStyle = {
|
|
3
|
-
borderColor: "var(--ds-border-focused,
|
|
3
|
+
borderColor: "var(--ds-border-focused, ".concat(B200, ")"),
|
|
4
4
|
borderStyle: 'solid',
|
|
5
|
-
borderRadius: "var(--ds-border-radius-100,
|
|
5
|
+
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
6
6
|
borderWidth: "var(--ds-border-width-outline, 2px)",
|
|
7
7
|
backgroundColor: "var(--ds-blanket-selected, #388BFF14)"
|
|
8
8
|
};
|
|
@@ -15,23 +15,26 @@ export var dragPreview = function dragPreview(container, dom, nodeType) {
|
|
|
15
15
|
// ProseMirror class is required to make sure the cloned dom is styled correctly
|
|
16
16
|
parent.classList.add('ProseMirror');
|
|
17
17
|
var shouldBeGenericPreview = nodeType === 'embedCard' || nodeType === 'extension';
|
|
18
|
-
|
|
18
|
+
var embedCard = dom.querySelector('.embedCardView-content-wrap');
|
|
19
|
+
if (shouldBeGenericPreview || embedCard) {
|
|
19
20
|
parent.style.border = "".concat(previewStyle.borderWidth, " ").concat(previewStyle.borderStyle, " ").concat(previewStyle.borderColor);
|
|
20
21
|
parent.style.borderRadius = previewStyle.borderRadius;
|
|
21
22
|
parent.style.backgroundColor = previewStyle.backgroundColor;
|
|
22
23
|
parent.style.height = '100%';
|
|
23
24
|
parent.setAttribute('data-testid', 'block-ctrl-generic-drag-preview');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
} else {
|
|
26
|
+
var resizer = dom.querySelector('.resizer-item');
|
|
27
|
+
var clonedDom = resizer && ['mediaSingle', 'table'].includes(nodeType) ? resizer.cloneNode(true) : dom.cloneNode(true);
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
// Remove any margin from the cloned element to ensure is doesn't position incorrectly
|
|
30
|
+
clonedDom.style.marginLeft = '0';
|
|
31
|
+
clonedDom.style.marginTop = '0';
|
|
32
|
+
clonedDom.style.marginRight = '0';
|
|
33
|
+
clonedDom.style.marginBottom = '0';
|
|
34
|
+
clonedDom.style.opacity = '0.4';
|
|
35
|
+
clonedDom.style.boxShadow = 'none';
|
|
36
|
+
parent.appendChild(clonedDom);
|
|
37
|
+
}
|
|
35
38
|
container.appendChild(parent);
|
|
36
39
|
var scrollParent = document.querySelector('.fabric-editor-popup-scroll-parent');
|
|
37
40
|
var scrollParentClassNames = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.className;
|
|
@@ -8,23 +8,23 @@ export var getSelection = function getSelection(tr, start) {
|
|
|
8
8
|
if (isNodeSelection) {
|
|
9
9
|
return new NodeSelection($startPos);
|
|
10
10
|
} else {
|
|
11
|
-
// To trigger the annotation floating toolbar for non-selectable node, we need to select
|
|
12
|
-
// Find the first
|
|
13
|
-
var
|
|
14
|
-
var
|
|
11
|
+
// To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
|
|
12
|
+
// Find the first inline node in the node
|
|
13
|
+
var inlineNodePos = start;
|
|
14
|
+
var foundInlineNode = false;
|
|
15
15
|
tr.doc.nodesBetween($startPos.pos, $startPos.pos + nodeSize, function (n, pos) {
|
|
16
|
-
if (
|
|
16
|
+
if (foundInlineNode) {
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
19
|
-
if (n.
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
if (n.isInline) {
|
|
20
|
+
inlineNodePos = pos;
|
|
21
|
+
foundInlineNode = true;
|
|
22
22
|
return false;
|
|
23
23
|
}
|
|
24
24
|
return true;
|
|
25
25
|
});
|
|
26
|
-
var
|
|
27
|
-
return new TextSelection(tr.doc.resolve(
|
|
26
|
+
var inlineNodeDepth = inlineNodePos - start;
|
|
27
|
+
return new TextSelection(tr.doc.resolve(inlineNodePos), tr.doc.resolve(start + nodeSize - inlineNodeDepth));
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
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.4.
|
|
3
|
+
"version": "1.4.27",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^36.10.7",
|
|
35
|
-
"@atlaskit/editor-common": "^82.
|
|
35
|
+
"@atlaskit/editor-common": "^82.10.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.2.3",
|
|
37
37
|
"@atlaskit/editor-plugin-editor-disabled": "^1.1.5",
|
|
38
38
|
"@atlaskit/editor-plugin-feature-flags": "^1.1.0",
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"@atlaskit/pragmatic-drag-and-drop": "^1.1.0",
|
|
45
45
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.3.0",
|
|
46
46
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
47
|
-
"@atlaskit/
|
|
47
|
+
"@atlaskit/theme": "^12.11.0",
|
|
48
|
+
"@atlaskit/tokens": "^1.52.0",
|
|
48
49
|
"@babel/runtime": "^7.0.0",
|
|
49
50
|
"@emotion/react": "^11.7.1",
|
|
50
51
|
"bind-event-listener": "^3.0.0",
|