@atlaskit/editor-plugin-block-controls 1.10.6 → 1.11.0

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,35 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 1.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#128347](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/128347)
8
+ [`e33566cebd5d1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e33566cebd5d1) -
9
+ [ED-24175] bump @atlaskit/adf-schema to 40.8.1 and @atlassian/adf-schema-json to 1.22.0 to
10
+ promotecodeblocks & media in quotes, and nested expands in expands to full schema, and allow
11
+ quotes in panels and decisions in lists in stage0 schema, and a validator spec change
12
+
13
+ ### Patch Changes
14
+
15
+ - [#128138](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/128138)
16
+ [`5c7bc23671459`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5c7bc23671459) -
17
+ ED-24471 Clean up feature flags in main.ts apply and long scroll FF
18
+ - [#127946](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/127946)
19
+ [`93f225e326474`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/93f225e326474) -
20
+ ED-24405 fix drop target not showing at last pos
21
+ - Updated dependencies
22
+
23
+ ## 1.10.7
24
+
25
+ ### Patch Changes
26
+
27
+ - [`7c744eaad4fb6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7c744eaad4fb6) -
28
+ ED-24473 Clean up FF in drag-handle and drop-targets
29
+ - [#127997](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/127997)
30
+ [`3d47f12053750`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3d47f12053750) -
31
+ ED-24404 ignore list items in Element DnD
32
+
3
33
  ## 1.10.6
4
34
 
5
35
  ### Patch Changes
@@ -14,9 +14,26 @@ var _view = require("@atlaskit/editor-prosemirror/view");
14
14
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
15
  var _dragHandle = require("../ui/drag-handle");
16
16
  var _dropTarget = require("../ui/drop-target");
17
+ var _dragTargetDebug = require("../utils/drag-target-debug");
17
18
  var _validation = require("../utils/validation");
18
- var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn'];
19
- var NESTED_DEPTH = (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested') ? 100 : 0;
19
+ var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem'];
20
+ var IGNORE_NODES_AND_DESCENDANTS = ['listItem'];
21
+ var PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand'];
22
+ var getNestedDepth = function getNestedDepth() {
23
+ return (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested') ? 100 : 0;
24
+ };
25
+ var createDropTargetDecoration = function createDropTargetDecoration(pos, dropTargetDec) {
26
+ return _view.Decoration.widget(pos, function () {
27
+ var element = document.createElement('div');
28
+ element.setAttribute('data-blocks-drop-target-container', 'true');
29
+ element.style.clear = 'unset';
30
+ _reactDom.default.render(dropTargetDec, element);
31
+ return element;
32
+ }, {
33
+ type: 'drop-target-decoration',
34
+ side: -1
35
+ });
36
+ };
20
37
  var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetDecorations(oldState, newState, api, formatMessage, activeNodeType) {
21
38
  var decs = [];
22
39
  unmountDecorations('data-blocks-drop-target-container');
@@ -24,53 +41,61 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
24
41
  // and allows us to easily map the updated position in the plugin apply method.
25
42
  var decorationState = [];
26
43
  var prevNode;
27
- var state = (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24372') ? newState : oldState;
28
- state.doc.nodesBetween(0, newState.doc.nodeSize - 2, function (node, pos, parent, index) {
44
+ newState.doc.nodesBetween(0, newState.doc.nodeSize - 2, function (node, pos, parent, index) {
29
45
  var depth = 0;
30
46
  var nodeType = newState.doc.type.schema.nodes[activeNodeType];
47
+ var endDec = null;
31
48
  if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
32
49
  depth = newState.doc.resolve(pos).depth;
33
- if (node.isInline) {
50
+ if (node.isInline || !parent) {
34
51
  return false;
35
52
  }
36
53
  if (IGNORE_NODES.includes(node.type.name)) {
37
54
  return true; //skip over, don't consider it a valid depth
38
55
  }
39
- var canDrop = parent && activeNodeType && (0, _validation.canMoveToIndex)(parent, index, nodeType);
56
+ var canDrop = activeNodeType && (0, _validation.canMoveToIndex)(parent, index, nodeType);
40
57
 
41
58
  //NOTE: This will block drop targets showing for nodes that are valid after transformation (i.e. expand -> nestedExpand)
42
- if (!canDrop) {
59
+ if (!canDrop && !(0, _dragTargetDebug.isBlocksDragTargetDebug)()) {
43
60
  return false; //not valid pos, so nested not valid either
44
61
  }
45
62
  decorationState.push({
46
63
  id: pos,
47
64
  pos: pos
48
65
  });
66
+ if (parent.lastChild === node && PARENT_WITH_END_DROP_TARGET.includes(parent.type.name)) {
67
+ var endpos = pos + node.nodeSize;
68
+ endDec = {
69
+ id: endpos,
70
+ pos: endpos
71
+ };
72
+ decorationState.push({
73
+ id: endpos,
74
+ pos: endpos
75
+ });
76
+ }
49
77
  } else {
50
78
  decorationState.push({
51
79
  id: index,
52
80
  pos: pos
53
81
  });
54
82
  }
55
- var dropTargetDec = /*#__PURE__*/(0, _react.createElement)(_dropTarget.DropTarget, {
83
+ decs.push(createDropTargetDecoration(pos, /*#__PURE__*/(0, _react.createElement)(_dropTarget.DropTarget, {
56
84
  api: api,
57
85
  id: (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested') ? pos : index,
58
86
  formatMessage: formatMessage,
59
87
  prevNode: prevNode,
60
88
  nextNode: node
61
- });
62
- decs.push(_view.Decoration.widget(pos, function () {
63
- var element = document.createElement('div');
64
- element.setAttribute('data-blocks-drop-target-container', 'true');
65
- element.style.clear = 'unset';
66
- _reactDom.default.render(dropTargetDec, element);
67
- return element;
68
- }, {
69
- type: 'drop-target-decoration',
70
- side: -1
71
- }));
89
+ })));
90
+ if (endDec) {
91
+ decs.push(createDropTargetDecoration(endDec.pos, /*#__PURE__*/(0, _react.createElement)(_dropTarget.DropTarget, {
92
+ api: api,
93
+ id: endDec.id,
94
+ formatMessage: formatMessage
95
+ })));
96
+ }
72
97
  prevNode = node;
73
- return depth < NESTED_DEPTH;
98
+ return depth < getNestedDepth();
74
99
  });
75
100
 
76
101
  /**
@@ -80,7 +105,6 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
80
105
  * node and not its size.
81
106
  *
82
107
  */
83
-
84
108
  var lastPos = newState.doc.content.size;
85
109
  if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
86
110
  decorationState.push({
@@ -121,12 +145,13 @@ var emptyParagraphNodeDecorations = exports.emptyParagraphNodeDecorations = func
121
145
  };
122
146
  var nodeDecorations = exports.nodeDecorations = function nodeDecorations(newState) {
123
147
  var decs = [];
124
- newState.doc.descendants(function (node, pos, _parent, index) {
148
+ newState.doc.descendants(function (node, pos, parent, index) {
125
149
  var _Decoration$node2;
126
150
  var depth = 0;
127
151
  var anchorName;
128
152
  if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
129
- if (node.isInline) {
153
+ // Doesn't descend into a node
154
+ if (node.isInline || IGNORE_NODES_AND_DESCENDANTS.includes((parent === null || parent === void 0 ? void 0 : parent.type.name) || '')) {
130
155
  return false;
131
156
  }
132
157
  if (IGNORE_NODES.includes(node.type.name)) {
@@ -142,15 +167,14 @@ var nodeDecorations = exports.nodeDecorations = function nodeDecorations(newStat
142
167
  }, (0, _defineProperty2.default)(_Decoration$node2, 'data-drag-handler-anchor-name', anchorName), (0, _defineProperty2.default)(_Decoration$node2, 'data-drag-handler-node-type', node.type.name), (0, _defineProperty2.default)(_Decoration$node2, 'data-drag-handler-anchor-depth', "".concat(depth)), _Decoration$node2), {
143
168
  type: 'node-decoration'
144
169
  }));
145
- return depth < NESTED_DEPTH;
170
+ return depth < getNestedDepth();
146
171
  });
147
172
  return decs;
148
173
  };
149
174
  var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDecoration(api, getIntl, pos, anchorName, nodeType, handleOptions) {
150
175
  var unbind;
151
- var elementType = (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24150') ? 'span' : 'div';
152
176
  return _view.Decoration.widget(pos, function (view, getPos) {
153
- var element = document.createElement(elementType);
177
+ var element = document.createElement('span');
154
178
  // Need to set it to inline to avoid text being split when merging two paragraphs
155
179
  element.style.display = 'inline';
156
180
  element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
@@ -163,9 +187,7 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
163
187
  }
164
188
  });
165
189
  }
166
- if ((0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896')) {
167
- unmountDecorations('data-blocks-drag-handle-container');
168
- }
190
+ unmountDecorations('data-blocks-drag-handle-container');
169
191
 
170
192
  // There are times when global clear: "both" styles are applied to this decoration causing jumpiness
171
193
  // due to margins applied to other nodes eg. Headings
@@ -184,13 +206,10 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
184
206
  }, {
185
207
  side: -1,
186
208
  id: 'drag-handle',
187
- destroy: function destroy(node) {
209
+ destroy: function destroy() {
188
210
  if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
189
211
  unbind && unbind();
190
212
  }
191
- if (!(0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896')) {
192
- _reactDom.default.unmountComponentAtNode(node);
193
- }
194
213
  }
195
214
  });
196
215
  };
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.key = exports.createPlugin = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
10
- var _steps = require("@atlaskit/adf-schema/steps");
11
10
  var _analytics = require("@atlaskit/editor-common/analytics");
12
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
12
  var _utils = require("@atlaskit/editor-common/utils");
@@ -93,7 +92,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
93
92
  return initialState;
94
93
  },
95
94
  apply: function apply(tr, currentState, oldState, newState) {
96
- var _meta$activeNode, _meta$activeNode$hand, _meta$activeNode4, _meta$isDragging, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging;
95
+ var _meta$activeNode, _meta$activeNode$hand, _activeNodeWithNewNod, _meta$activeNode3, _meta$isDragging, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging;
97
96
  var activeNode = currentState.activeNode,
98
97
  decorations = currentState.decorations,
99
98
  isMenuOpen = currentState.isMenuOpen,
@@ -106,20 +105,12 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
106
105
  isPMDragging = currentState.isPMDragging;
107
106
  var activeNodeWithNewNodeType = null;
108
107
  var meta = tr.getMeta(key);
109
- // when creating analytics during drag/drop events, PM thinks the doc has changed
110
- // so tr.docChange is true and causes some decorations to not render
111
- var isAnalyticTr = tr.steps.every(function (step) {
112
- return step instanceof _steps.AnalyticsStep;
113
- });
114
108
 
115
109
  // If tables or media are being resized, we want to hide the drag handle
116
110
  var resizerMeta = tr.getMeta('is-resizer-resizing');
117
111
  isResizerResizing = resizerMeta !== null && resizerMeta !== void 0 ? resizerMeta : isResizerResizing;
118
112
  var nodeCountChanged = oldState.doc.childCount !== newState.doc.childCount;
119
- var shouldRemoveHandle = true;
120
- if ((0, _platformFeatureFlags.fg)('platform_editor_elements_drag_and_drop_ed_24000')) {
121
- shouldRemoveHandle = !tr.getMeta('isRemote');
122
- }
113
+ var shouldRemoveHandle = !tr.getMeta('isRemote');
123
114
 
124
115
  // During resize, remove the drag handle widget so its dom positioning doesn't need to be maintained
125
116
  // Also remove the handle when the node is moved or the node count changes. This helps prevent incorrect positioning
@@ -147,16 +138,14 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
147
138
  if (!(0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
148
139
  isDecsMissing = !(isDragging || meta !== null && meta !== void 0 && meta.isDragging) && decsLength !== newState.doc.childCount;
149
140
  }
150
- if ((0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24372')) {
151
- var dropTargetLen = decorations.find().filter(function (_ref8) {
152
- var spec = _ref8.spec;
153
- return spec.type === 'drop-target-decoration';
154
- }).length;
141
+ var dropTargetLen = decorations.find().filter(function (_ref8) {
142
+ var spec = _ref8.spec;
143
+ return spec.type === 'drop-target-decoration';
144
+ }).length;
155
145
 
156
- //TODO: Fix this logic for nested scenarios
157
- if (!(0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
158
- isDropTargetsMissing = isDragging && (meta === null || meta === void 0 ? void 0 : meta.isDragging) !== false && dropTargetLen !== newState.doc.childCount + 1;
159
- }
146
+ //TODO: Fix this logic for nested scenarios
147
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested')) {
148
+ isDropTargetsMissing = isDragging && (meta === null || meta === void 0 ? void 0 : meta.isDragging) !== false && dropTargetLen !== newState.doc.childCount + 1;
160
149
  }
161
150
 
162
151
  // This is not targeted enough - it's trying to catch events like expand being set to breakout
@@ -175,15 +164,11 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
175
164
 
176
165
  // Draw node and mouseWrapper decorations at top level node if decorations is empty, editor height changes or node is moved
177
166
  if (redrawDecorations && !isResizerResizing && api) {
178
- if ((0, _platformFeatureFlags.fg)('platform_editor_elements_drag_and_drop_ed_24000')) {
179
- var oldNodeDecs = decorations.find().filter(function (_ref9) {
180
- var spec = _ref9.spec;
181
- return spec.type !== 'drop-target-decoration';
182
- });
183
- decorations = decorations.remove(oldNodeDecs);
184
- } else {
185
- decorations = _view.DecorationSet.create(newState.doc, []);
186
- }
167
+ var oldNodeDecs = decorations.find().filter(function (_ref9) {
168
+ var spec = _ref9.spec;
169
+ return spec.type !== 'drop-target-decoration';
170
+ });
171
+ decorations = decorations.remove(oldNodeDecs);
187
172
  var nodeDecs = (0, _decorations.nodeDecorations)(newState);
188
173
  decorations = decorations.add(newState.doc, (0, _toConsumableArray2.default)(nodeDecs));
189
174
 
@@ -195,9 +180,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
195
180
 
196
181
  // When a node type changed to be nested inside another node, the position of the active node is off by 1
197
182
  // This is a workaround to fix the position of the active node when it is nested
198
-
199
- var shouldUpdateNestedPosition = (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24049') ? tr.docChanged && !nodeCountChanged : true;
200
- if (shouldUpdateNestedPosition && mappedPosisiton === prevMappedPos + 1) {
183
+ if (tr.docChanged && !nodeCountChanged && mappedPosisiton === prevMappedPos + 1) {
201
184
  mappedPosisiton = prevMappedPos;
202
185
  }
203
186
  var newActiveNode = tr.doc.nodeAt(mappedPosisiton);
@@ -227,90 +210,50 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
227
210
  var decs = (0, _decorations.dragHandleDecoration)(api, getIntl, meta.activeNode.pos, meta.activeNode.anchorName, meta.activeNode.nodeType, meta.activeNode.handleOptions);
228
211
  decorations = decorations.add(newState.doc, [decs]);
229
212
  }
230
- if ((0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-ed-23816')) {
231
- var _activeNodeWithNewNod;
232
- // Remove previous drag handle widget and draw new drag handle widget when node type changes
233
- if (activeNodeWithNewNodeType && ((_activeNodeWithNewNod = activeNodeWithNewNodeType) === null || _activeNodeWithNewNod === void 0 ? void 0 : _activeNodeWithNewNod.nodeType) !== (activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) && api) {
234
- var _oldHandle2 = decorations.find().filter(function (_ref11) {
235
- var spec = _ref11.spec;
236
- return spec.id === 'drag-handle';
237
- });
238
- decorations = decorations.remove(_oldHandle2);
239
- var _decs = (0, _decorations.dragHandleDecoration)(api, getIntl, activeNodeWithNewNodeType.pos, activeNodeWithNewNodeType.anchorName, activeNodeWithNewNodeType.nodeType);
240
- decorations = decorations.add(newState.doc, [_decs]);
241
- }
213
+
214
+ // Remove previous drag handle widget and draw new drag handle widget when node type changes
215
+ if (activeNodeWithNewNodeType && ((_activeNodeWithNewNod = activeNodeWithNewNodeType) === null || _activeNodeWithNewNod === void 0 ? void 0 : _activeNodeWithNewNod.nodeType) !== (activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) && api) {
216
+ var _oldHandle2 = decorations.find().filter(function (_ref11) {
217
+ var spec = _ref11.spec;
218
+ return spec.id === 'drag-handle';
219
+ });
220
+ decorations = decorations.remove(_oldHandle2);
221
+ var _decs = (0, _decorations.dragHandleDecoration)(api, getIntl, activeNodeWithNewNodeType.pos, activeNodeWithNewNodeType.anchorName, activeNodeWithNewNodeType.nodeType);
222
+ decorations = decorations.add(newState.doc, [_decs]);
242
223
  }
243
224
  var shouldUpdateDropTargets = (meta === null || meta === void 0 ? void 0 : meta.isDragging) || isDropTargetsMissing;
244
- var shouldMapDropTargets = false;
245
- if ((0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24372')) {
246
- shouldMapDropTargets = !shouldUpdateDropTargets && tr.docChanged && isDragging && (meta === null || meta === void 0 ? void 0 : meta.isDragging) !== false && !(meta !== null && meta !== void 0 && meta.nodeMoved);
247
- if ((meta === null || meta === void 0 ? void 0 : meta.isDragging) === false || isDropTargetsMissing) {
248
- // Remove drop target decoration when dragging stops
249
- var dropTargetDecs = decorations.find().filter(function (_ref12) {
250
- var spec = _ref12.spec;
251
- return spec.type === 'drop-target-decoration';
252
- });
253
- decorations = decorations.remove(dropTargetDecs);
254
- }
255
- if (api) {
256
- // Add drop targets when node is being dragged
257
- // if the transaction is only for analytics and user is dragging, continue to draw drop targets
258
- if (shouldUpdateDropTargets || (0, _dragTargetDebug.isBlocksDragTargetDebug)()) {
259
- var _meta$activeNode2;
260
- var _dropTargetDecoration = (0, _decorations.dropTargetDecorations)(oldState, newState, api, formatMessage, meta === null || meta === void 0 || (_meta$activeNode2 = meta.activeNode) === null || _meta$activeNode2 === void 0 ? void 0 : _meta$activeNode2.nodeType),
261
- _decs2 = _dropTargetDecoration.decs,
262
- updatedDecorationState = _dropTargetDecoration.decorationState;
263
- decorationState = updatedDecorationState;
264
- decorations = decorations.add(newState.doc, _decs2);
265
- }
266
- }
267
-
268
- //Map drop target decoration positions when the document changes
269
- if (shouldMapDropTargets) {
270
- decorationState = decorationState.map(function (_ref13) {
271
- var id = _ref13.id,
272
- pos = _ref13.pos;
273
- return {
274
- id: id,
275
- pos: tr.mapping.map(pos)
276
- };
277
- });
278
- }
279
- } else {
280
- if (api) {
281
- // Add drop targets when node is being dragged
282
- // if the transaction is only for analytics and user is dragging, continue to draw drop targets
283
- var shouldShowDragTarget = (meta === null || meta === void 0 ? void 0 : meta.isDragging) && (!tr.docChanged || tr.docChanged && isAnalyticTr);
284
- if (shouldShowDragTarget || (0, _dragTargetDebug.isBlocksDragTargetDebug)()) {
285
- var _meta$activeNode3;
286
- var _dropTargetDecoration2 = (0, _decorations.dropTargetDecorations)(oldState, newState, api, formatMessage, meta === null || meta === void 0 || (_meta$activeNode3 = meta.activeNode) === null || _meta$activeNode3 === void 0 ? void 0 : _meta$activeNode3.nodeType),
287
- _decs3 = _dropTargetDecoration2.decs,
288
- _updatedDecorationState = _dropTargetDecoration2.decorationState;
289
- decorationState = _updatedDecorationState;
290
- decorations = decorations.add(newState.doc, _decs3);
291
- }
292
- }
293
-
225
+ var shouldMapDropTargets = !shouldUpdateDropTargets && tr.docChanged && isDragging && (meta === null || meta === void 0 ? void 0 : meta.isDragging) !== false && !(meta !== null && meta !== void 0 && meta.nodeMoved);
226
+ if ((meta === null || meta === void 0 ? void 0 : meta.isDragging) === false || isDropTargetsMissing) {
294
227
  // Remove drop target decoration when dragging stops
295
- if ((meta === null || meta === void 0 ? void 0 : meta.isDragging) === false && ((0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24330') ? true : !tr.docChanged)) {
296
- var _dropTargetDecs = decorations.find().filter(function (_ref14) {
297
- var spec = _ref14.spec;
298
- return spec.type === 'drop-target-decoration';
299
- });
300
- decorations = decorations.remove(_dropTargetDecs);
228
+ var dropTargetDecs = decorations.find().filter(function (_ref12) {
229
+ var spec = _ref12.spec;
230
+ return spec.type === 'drop-target-decoration';
231
+ });
232
+ decorations = decorations.remove(dropTargetDecs);
233
+ }
234
+ if (api) {
235
+ // Add drop targets when node is being dragged
236
+ // if the transaction is only for analytics and user is dragging, continue to draw drop targets
237
+ if (shouldUpdateDropTargets || (0, _dragTargetDebug.isBlocksDragTargetDebug)()) {
238
+ var _meta$activeNode2;
239
+ var _dropTargetDecoration = (0, _decorations.dropTargetDecorations)(oldState, newState, api, formatMessage, meta === null || meta === void 0 || (_meta$activeNode2 = meta.activeNode) === null || _meta$activeNode2 === void 0 ? void 0 : _meta$activeNode2.nodeType),
240
+ _decs2 = _dropTargetDecoration.decs,
241
+ updatedDecorationState = _dropTargetDecoration.decorationState;
242
+ decorationState = updatedDecorationState;
243
+ decorations = decorations.add(newState.doc, _decs2);
301
244
  }
245
+ }
302
246
 
303
- // Map drop target decoration positions when the document changes
304
- if (tr.docChanged && isDragging) {
305
- decorationState = decorationState.map(function (_ref15) {
306
- var id = _ref15.id,
307
- pos = _ref15.pos;
308
- return {
309
- id: id,
310
- pos: tr.mapping.map(pos)
311
- };
312
- });
313
- }
247
+ //Map drop target decoration positions when the document changes
248
+ if (shouldMapDropTargets) {
249
+ decorationState = decorationState.map(function (_ref13) {
250
+ var id = _ref13.id,
251
+ pos = _ref13.pos;
252
+ return {
253
+ id: id,
254
+ pos: tr.mapping.map(pos)
255
+ };
256
+ });
314
257
  }
315
258
 
316
259
  // Map decorations if document changes and node decorations do not need to be redrawn
@@ -318,8 +261,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
318
261
  decorations = decorations.map(tr.mapping, tr.doc);
319
262
  }
320
263
  var isEmptyDoc = newState.doc.childCount === 1 && newState.doc.nodeSize <= 4;
321
- var hasNodeDecoration = decorations.find().some(function (_ref16) {
322
- var spec = _ref16.spec;
264
+ var hasNodeDecoration = decorations.find().some(function (_ref14) {
265
+ var spec = _ref14.spec;
323
266
  return spec.type === 'node-decoration';
324
267
  });
325
268
  if (!hasNodeDecoration && isEmptyDoc) {
@@ -327,24 +270,15 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
327
270
  }
328
271
 
329
272
  // Map active node position when the document changes
330
- var mappedActiveNodePos;
331
- if ((0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-ed-23816')) {
332
- mappedActiveNodePos = tr.docChanged && activeNode ? activeNodeWithNewNodeType || {
333
- pos: tr.mapping.map(activeNode.pos),
334
- anchorName: activeNode.anchorName,
335
- nodeType: activeNode.nodeType
336
- } : activeNode;
337
- } else {
338
- mappedActiveNodePos = tr.docChanged && activeNode ? {
339
- pos: tr.mapping.map(activeNode.pos),
340
- anchorName: activeNode.anchorName,
341
- nodeType: activeNode.nodeType
342
- } : activeNode;
343
- }
273
+ var mappedActiveNodePos = tr.docChanged && activeNode ? activeNodeWithNewNodeType || {
274
+ pos: tr.mapping.map(activeNode.pos),
275
+ anchorName: activeNode.anchorName,
276
+ nodeType: activeNode.nodeType
277
+ } : activeNode;
344
278
  return {
345
279
  decorations: decorations,
346
280
  decorationState: decorationState,
347
- activeNode: isEmptyDoc || isHandleMissing ? null : (_meta$activeNode4 = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode4 !== void 0 ? _meta$activeNode4 : mappedActiveNodePos,
281
+ activeNode: isEmptyDoc || isHandleMissing ? null : (_meta$activeNode3 = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode3 !== void 0 ? _meta$activeNode3 : mappedActiveNodePos,
348
282
  isDragging: (_meta$isDragging = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging !== void 0 ? _meta$isDragging : isDragging,
349
283
  isMenuOpen: meta !== null && meta !== void 0 && meta.toggleMenu ? !isMenuOpen : isMenuOpen,
350
284
  editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : currentState.editorHeight,
@@ -121,7 +121,7 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
121
121
  });
122
122
  var resolvedMovingNode = tr.doc.resolve(startPos);
123
123
  var maybeNode = resolvedMovingNode.nodeAfter;
124
- (0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-long-node-scroll') && tr.setMeta('scrollIntoView', false);
124
+ tr.setMeta('scrollIntoView', false);
125
125
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
126
126
  eventType: _analytics.EVENT_TYPE.UI,
127
127
  action: _analytics.ACTION.CLICKED,
@@ -287,12 +287,9 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
287
287
  display: 'none'
288
288
  }),
289
289
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
290
- newPositionStyles = _useState6[0],
291
- setNewPositionStyles = _useState6[1];
290
+ positionStyles = _useState6[0],
291
+ setPositionStyles = _useState6[1];
292
292
  (0, _react.useEffect)(function () {
293
- if (!(0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896')) {
294
- return;
295
- }
296
293
  var cleanUpTransitionListener;
297
294
  if (nodeType === 'extension' || nodeType === 'embedCard') {
298
295
  var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(anchorName, "\"]"));
@@ -302,12 +299,12 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
302
299
  cleanUpTransitionListener = (0, _bindEventListener.bind)(dom, {
303
300
  type: 'transitionend',
304
301
  listener: function listener() {
305
- setNewPositionStyles(calculatePosition());
302
+ setPositionStyles(calculatePosition());
306
303
  }
307
304
  });
308
305
  }
309
306
  var calcPos = requestAnimationFrame(function () {
310
- setNewPositionStyles(calculatePosition());
307
+ setPositionStyles(calculatePosition());
311
308
  });
312
309
  return function () {
313
310
  var _cleanUpTransitionLis;
@@ -315,12 +312,6 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
315
312
  (_cleanUpTransitionLis = cleanUpTransitionListener) === null || _cleanUpTransitionLis === void 0 || _cleanUpTransitionLis();
316
313
  };
317
314
  }, [calculatePosition, view.dom, anchorName, nodeType]);
318
- var positionStyles = (0, _react.useMemo)(function () {
319
- if ((0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896')) {
320
- return newPositionStyles;
321
- }
322
- return calculatePosition();
323
- }, [calculatePosition, newPositionStyles]);
324
315
  (0, _react.useEffect)(function () {
325
316
  if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current && (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23873')) {
326
317
  var id = requestAnimationFrame(function () {
@@ -354,7 +345,7 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
354
345
  ref: buttonRef
355
346
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
356
347
  ,
357
- style: (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896') ? newPositionStyles : positionStyles,
348
+ style: positionStyles,
358
349
  onClick: handleOnClick,
359
350
  onMouseDown: handleMouseDown,
360
351
  onKeyDown: handleKeyDown,
@@ -9,7 +9,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
9
9
  var _react = require("react");
10
10
  var _react2 = require("@emotion/react");
11
11
  var _hooks = require("@atlaskit/editor-common/hooks");
12
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
12
  var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
14
13
  var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
15
14
  var _constants = require("@atlaskit/theme/constants");
@@ -54,9 +53,6 @@ var getNodeMargins = function getNodeMargins(node) {
54
53
  return _consts.nodeMargins[nodeTypeName] || _consts.nodeMargins['default'];
55
54
  };
56
55
  var getDropTargetPositionStyle = function getDropTargetPositionStyle(prevNode, nextNode) {
57
- if (!(0, _platformFeatureFlags.fg)('platform_editor_drag_and_drop_target_gap_fix')) {
58
- return null;
59
- }
60
56
  if (!prevNode || !nextNode) {
61
57
  return null;
62
58
  }
@@ -7,5 +7,5 @@ exports.isBlocksDragTargetDebug = void 0;
7
7
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
8
  var IS_GEMINI_TEST_ENV = Boolean(process.env.NODE_ENV === 'development') && Boolean(window.__gemini_set_feature_flag__);
9
9
  var isBlocksDragTargetDebug = exports.isBlocksDragTargetDebug = function isBlocksDragTargetDebug() {
10
- return IS_GEMINI_TEST_ENV && (0, _platformFeatureFlags.fg)('platform_editor_drag_and_drop_target_gap_fix');
10
+ return IS_GEMINI_TEST_ENV && (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_debug');
11
11
  };