@atlaskit/editor-plugin-block-controls 1.13.4 → 1.13.5
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
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 1.13.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#138973](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/138973)
|
|
8
|
+
[`8d99278240f49`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d99278240f49) -
|
|
9
|
+
ED-24407 hide drag handle for empty heading paragrah
|
|
10
|
+
|
|
3
11
|
## 1.13.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -6,11 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.handleMouseOver = void 0;
|
|
7
7
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
8
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
9
|
+
var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(target) {
|
|
10
|
+
if (target instanceof HTMLHeadingElement || target instanceof HTMLParagraphElement) {
|
|
11
|
+
var _target$parentElement;
|
|
12
|
+
return !((_target$parentElement = target.parentElement) !== null && _target$parentElement !== void 0 && _target$parentElement.classList.contains('ProseMirror')) && target.textContent === '';
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
};
|
|
9
16
|
var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, event, api) {
|
|
10
17
|
var _api$blockControls;
|
|
11
18
|
var _ref = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
12
19
|
isDragging = _ref.isDragging,
|
|
13
20
|
activeNode = _ref.activeNode;
|
|
21
|
+
|
|
14
22
|
// Most mouseover events don't fire during drag but some can slip through
|
|
15
23
|
// when the drag begins. This prevents those.
|
|
16
24
|
if (isDragging) {
|
|
@@ -23,6 +31,11 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
23
31
|
var rootElement = target === null || target === void 0 ? void 0 : target.closest('[data-drag-handler-anchor-name]');
|
|
24
32
|
if (rootElement) {
|
|
25
33
|
var _rootElement$parentEl;
|
|
34
|
+
if ((0, _experiments.editorExperiment)('nested-dnd', true, {
|
|
35
|
+
exposure: true
|
|
36
|
+
}) && isEmptyNestedParagraphOrHeading(rootElement)) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
26
39
|
var parentElement = (_rootElement$parentEl = rootElement.parentElement) === null || _rootElement$parentEl === void 0 ? void 0 : _rootElement$parentEl.closest('[data-drag-handler-anchor-name]');
|
|
27
40
|
if (parentElement && parentElement.getAttribute('data-drag-handler-node-type') === 'table' && (0, _experiments.editorExperiment)('nested-dnd', true) && (0, _experiments.editorExperiment)('table-nested-dnd', false, {
|
|
28
41
|
exposure: true
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
|
+
const isEmptyNestedParagraphOrHeading = target => {
|
|
4
|
+
if (target instanceof HTMLHeadingElement || target instanceof HTMLParagraphElement) {
|
|
5
|
+
var _target$parentElement;
|
|
6
|
+
return !((_target$parentElement = target.parentElement) !== null && _target$parentElement !== void 0 && _target$parentElement.classList.contains('ProseMirror')) && target.textContent === '';
|
|
7
|
+
}
|
|
8
|
+
return false;
|
|
9
|
+
};
|
|
3
10
|
export const handleMouseOver = (view, event, api) => {
|
|
4
11
|
var _api$blockControls;
|
|
5
12
|
const {
|
|
6
13
|
isDragging,
|
|
7
14
|
activeNode
|
|
8
15
|
} = (api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {};
|
|
16
|
+
|
|
9
17
|
// Most mouseover events don't fire during drag but some can slip through
|
|
10
18
|
// when the drag begins. This prevents those.
|
|
11
19
|
if (isDragging) {
|
|
@@ -18,6 +26,11 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
18
26
|
let rootElement = target === null || target === void 0 ? void 0 : target.closest('[data-drag-handler-anchor-name]');
|
|
19
27
|
if (rootElement) {
|
|
20
28
|
var _rootElement$parentEl;
|
|
29
|
+
if (editorExperiment('nested-dnd', true, {
|
|
30
|
+
exposure: true
|
|
31
|
+
}) && isEmptyNestedParagraphOrHeading(rootElement)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
21
34
|
const parentElement = (_rootElement$parentEl = rootElement.parentElement) === null || _rootElement$parentEl === void 0 ? void 0 : _rootElement$parentEl.closest('[data-drag-handler-anchor-name]');
|
|
22
35
|
if (parentElement && parentElement.getAttribute('data-drag-handler-node-type') === 'table' && editorExperiment('nested-dnd', true) && editorExperiment('table-nested-dnd', false, {
|
|
23
36
|
exposure: true
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
|
+
var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(target) {
|
|
4
|
+
if (target instanceof HTMLHeadingElement || target instanceof HTMLParagraphElement) {
|
|
5
|
+
var _target$parentElement;
|
|
6
|
+
return !((_target$parentElement = target.parentElement) !== null && _target$parentElement !== void 0 && _target$parentElement.classList.contains('ProseMirror')) && target.textContent === '';
|
|
7
|
+
}
|
|
8
|
+
return false;
|
|
9
|
+
};
|
|
3
10
|
export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
4
11
|
var _api$blockControls;
|
|
5
12
|
var _ref = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
6
13
|
isDragging = _ref.isDragging,
|
|
7
14
|
activeNode = _ref.activeNode;
|
|
15
|
+
|
|
8
16
|
// Most mouseover events don't fire during drag but some can slip through
|
|
9
17
|
// when the drag begins. This prevents those.
|
|
10
18
|
if (isDragging) {
|
|
@@ -17,6 +25,11 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
17
25
|
var rootElement = target === null || target === void 0 ? void 0 : target.closest('[data-drag-handler-anchor-name]');
|
|
18
26
|
if (rootElement) {
|
|
19
27
|
var _rootElement$parentEl;
|
|
28
|
+
if (editorExperiment('nested-dnd', true, {
|
|
29
|
+
exposure: true
|
|
30
|
+
}) && isEmptyNestedParagraphOrHeading(rootElement)) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
20
33
|
var parentElement = (_rootElement$parentEl = rootElement.parentElement) === null || _rootElement$parentEl === void 0 ? void 0 : _rootElement$parentEl.closest('[data-drag-handler-anchor-name]');
|
|
21
34
|
if (parentElement && parentElement.getAttribute('data-drag-handler-node-type') === 'table' && editorExperiment('nested-dnd', true) && editorExperiment('table-nested-dnd', false, {
|
|
22
35
|
exposure: true
|