@atlaskit/editor-plugin-block-controls 1.5.3 → 1.5.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,20 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 1.5.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.5.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [#114530](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/114530)
14
+ [`fac9f4b0e5a45`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fac9f4b0e5a45) -
15
+ [ED-23892] Fix action list duplicates itself when dropping on itself, update how dropping at node
16
+ itself is detected so it works when mouse move wrapper is removed
17
+
3
18
  ## 1.5.3
4
19
 
5
20
  ### Patch Changes
@@ -294,7 +294,17 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
294
294
  // so we only need to check first child
295
295
  var draggable = dragging === null || dragging === void 0 ? void 0 : dragging.slice.content.firstChild;
296
296
  var activeNode = state.tr.doc.nodeAt(pluginState.activeNode.pos);
297
- if (draggable === activeNode) {
297
+ var isSameNode = draggable === activeNode;
298
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.elements.drag-and-drop-ed-23892')) {
299
+ var _event$target;
300
+ var nodeElement = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.closest('[data-drag-handler-anchor-name]');
301
+ if (!nodeElement) {
302
+ return false;
303
+ }
304
+ var nodeTarget = state.doc.nodeAt(view.posAtDOM(nodeElement, 0) - 1);
305
+ isSameNode = !!(nodeTarget && draggable !== null && draggable !== void 0 && draggable.eq(nodeTarget));
306
+ }
307
+ if (isSameNode) {
298
308
  // Prevent the default drop behavior if the position is within the activeNode
299
309
  event.preventDefault();
300
310
  return true;
@@ -286,7 +286,17 @@ export const createPlugin = api => {
286
286
  // so we only need to check first child
287
287
  const draggable = dragging === null || dragging === void 0 ? void 0 : dragging.slice.content.firstChild;
288
288
  const activeNode = state.tr.doc.nodeAt(pluginState.activeNode.pos);
289
- if (draggable === activeNode) {
289
+ let isSameNode = draggable === activeNode;
290
+ if (getBooleanFF('platform.editor.elements.drag-and-drop-ed-23892')) {
291
+ var _event$target;
292
+ const nodeElement = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.closest('[data-drag-handler-anchor-name]');
293
+ if (!nodeElement) {
294
+ return false;
295
+ }
296
+ const nodeTarget = state.doc.nodeAt(view.posAtDOM(nodeElement, 0) - 1);
297
+ isSameNode = !!(nodeTarget && draggable !== null && draggable !== void 0 && draggable.eq(nodeTarget));
298
+ }
299
+ if (isSameNode) {
290
300
  // Prevent the default drop behavior if the position is within the activeNode
291
301
  event.preventDefault();
292
302
  return true;
@@ -287,7 +287,17 @@ export var createPlugin = function createPlugin(api) {
287
287
  // so we only need to check first child
288
288
  var draggable = dragging === null || dragging === void 0 ? void 0 : dragging.slice.content.firstChild;
289
289
  var activeNode = state.tr.doc.nodeAt(pluginState.activeNode.pos);
290
- if (draggable === activeNode) {
290
+ var isSameNode = draggable === activeNode;
291
+ if (getBooleanFF('platform.editor.elements.drag-and-drop-ed-23892')) {
292
+ var _event$target;
293
+ var nodeElement = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.closest('[data-drag-handler-anchor-name]');
294
+ if (!nodeElement) {
295
+ return false;
296
+ }
297
+ var nodeTarget = state.doc.nodeAt(view.posAtDOM(nodeElement, 0) - 1);
298
+ isSameNode = !!(nodeTarget && draggable !== null && draggable !== void 0 && draggable.eq(nodeTarget));
299
+ }
300
+ if (isSameNode) {
291
301
  // Prevent the default drop behavior if the position is within the activeNode
292
302
  event.preventDefault();
293
303
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -41,7 +41,7 @@
41
41
  "@atlaskit/editor-shared-styles": "^2.12.0",
42
42
  "@atlaskit/editor-tables": "^2.7.0",
43
43
  "@atlaskit/icon": "^22.5.0",
44
- "@atlaskit/platform-feature-flags": "^0.2.0",
44
+ "@atlaskit/platform-feature-flags": "^0.3.0",
45
45
  "@atlaskit/pragmatic-drag-and-drop": "^1.1.0",
46
46
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.3.0",
47
47
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
@@ -104,6 +104,9 @@
104
104
  "platform.editor.media.extended-resize-experience": {
105
105
  "type": "boolean",
106
106
  "referenceOnly": true
107
+ },
108
+ "platform.editor.elements.drag-and-drop-ed-23892": {
109
+ "type": "boolean"
107
110
  }
108
111
  }
109
112
  }