@atlaskit/editor-plugin-block-controls 1.5.8 → 1.5.10
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/global-styles.js +5 -1
- package/dist/cjs/utils/getSelection.js +20 -8
- package/dist/es2019/ui/global-styles.js +9 -2
- package/dist/es2019/utils/getSelection.js +20 -8
- package/dist/esm/ui/global-styles.js +6 -2
- package/dist/esm/utils/getSelection.js +20 -8
- package/package.json +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 1.5.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#116393](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116393)
|
|
8
|
+
[`30fa8a58b9dc8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/30fa8a58b9dc8) -
|
|
9
|
+
Fix drag handle overlaps with the content when deleting text across lines
|
|
10
|
+
|
|
11
|
+
## 1.5.9
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#116092](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116092)
|
|
16
|
+
[`2d7842663b057`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2d7842663b057) -
|
|
17
|
+
ED-23905 Fix selection on click for nested lists and task lists
|
|
18
|
+
|
|
3
19
|
## 1.5.8
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -53,8 +53,12 @@ var globalStyles = (0, _react.css)({
|
|
|
53
53
|
marginTop: '0 !important'
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
+
var withDeleteLinesStyleFix = (0, _react.css)((0, _defineProperty2.default)({}, "p[data-drag-handler-anchor-name] .ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]", {
|
|
57
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
58
|
+
display: 'none !important'
|
|
59
|
+
}));
|
|
56
60
|
var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper() {
|
|
57
61
|
return (0, _react.jsx)(_react.Global, {
|
|
58
|
-
styles: [globalStyles, (0, _platformFeatureFlags.
|
|
62
|
+
styles: [globalStyles, (0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') && extendedHoverZone, (0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-ed-23868') ? withInlineNodeStyleFix : withoutInlineNodeStyleFix, (0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-ed-23932') && withDeleteLinesStyleFix]
|
|
59
63
|
});
|
|
60
64
|
};
|
|
@@ -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) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
3
|
import { css, Global, jsx } from '@emotion/react';
|
|
4
|
-
import {
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
const extendedHoverZone = css({
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
7
7
|
'.block-ctrl-drag-preview [data-drag-handler-anchor-name]::after': {
|
|
@@ -52,8 +52,15 @@ const globalStyles = css({
|
|
|
52
52
|
marginTop: '0 !important'
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
|
+
const withDeleteLinesStyleFix = css({
|
|
56
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
57
|
+
[`p[data-drag-handler-anchor-name] .ProseMirror-widget[data-blocks-drag-handle-container="true"]`]: {
|
|
58
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
59
|
+
display: 'none !important'
|
|
60
|
+
}
|
|
61
|
+
});
|
|
55
62
|
export const GlobalStylesWrapper = () => {
|
|
56
63
|
return jsx(Global, {
|
|
57
|
-
styles: [globalStyles,
|
|
64
|
+
styles: [globalStyles, fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') && extendedHoverZone, fg('platform.editor.elements.drag-and-drop-ed-23868') ? withInlineNodeStyleFix : withoutInlineNodeStyleFix, fg('platform.editor.elements.drag-and-drop-ed-23932') && withDeleteLinesStyleFix]
|
|
58
65
|
});
|
|
59
66
|
};
|
|
@@ -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) => {
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
4
|
import { css, Global, jsx } from '@emotion/react';
|
|
5
|
-
import {
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
var extendedHoverZone = css({
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
8
8
|
'.block-ctrl-drag-preview [data-drag-handler-anchor-name]::after': {
|
|
@@ -45,8 +45,12 @@ var globalStyles = css({
|
|
|
45
45
|
marginTop: '0 !important'
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
+
var withDeleteLinesStyleFix = css(_defineProperty({}, "p[data-drag-handler-anchor-name] .ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]", {
|
|
49
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
50
|
+
display: 'none !important'
|
|
51
|
+
}));
|
|
48
52
|
export var GlobalStylesWrapper = function GlobalStylesWrapper() {
|
|
49
53
|
return jsx(Global, {
|
|
50
|
-
styles: [globalStyles,
|
|
54
|
+
styles: [globalStyles, fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') && extendedHoverZone, fg('platform.editor.elements.drag-and-drop-ed-23868') ? withInlineNodeStyleFix : withoutInlineNodeStyleFix, fg('platform.editor.elements.drag-and-drop-ed-23932') && withDeleteLinesStyleFix]
|
|
51
55
|
});
|
|
52
56
|
};
|
|
@@ -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.10",
|
|
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": "^39.0.3",
|
|
35
|
-
"@atlaskit/editor-common": "^83.
|
|
35
|
+
"@atlaskit/editor-common": "^83.6.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.4.0",
|
|
37
37
|
"@atlaskit/editor-plugin-editor-disabled": "^1.1.5",
|
|
38
38
|
"@atlaskit/editor-plugin-feature-flags": "^1.1.0",
|
|
@@ -113,6 +113,12 @@
|
|
|
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"
|
|
119
|
+
},
|
|
120
|
+
"platform.editor.elements.drag-and-drop-ed-23932": {
|
|
121
|
+
"type": "boolean"
|
|
116
122
|
}
|
|
117
123
|
}
|
|
118
124
|
}
|