@atlaskit/editor-plugin-block-controls 1.5.18 → 1.5.20

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.20
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.5.19
10
+
11
+ ### Patch Changes
12
+
13
+ - [#119849](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/119849)
14
+ [`5178d3ebdd7db`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5178d3ebdd7db) -
15
+ ED-23896 Fix responsiveness of extensions, macros, table alignment
16
+ - Updated dependencies
17
+
3
18
  ## 1.5.18
4
19
 
5
20
  ### Patch Changes
@@ -143,6 +143,9 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
143
143
  element.style.display = 'inline';
144
144
  element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
145
145
  element.setAttribute('data-blocks-drag-handle-container', 'true');
146
+ if ((0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896')) {
147
+ unmountDecorations('data-blocks-drag-handle-container');
148
+ }
146
149
  if ((0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2')) {
147
150
  // There are times when global clear: "both" styles are applied to this decoration causing jumpiness
148
151
  // due to margins applied to other nodes eg. Headings
@@ -163,7 +166,9 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
163
166
  side: -1,
164
167
  id: 'drag-handle',
165
168
  destroy: function destroy(node) {
166
- _reactDom.default.unmountComponentAtNode(node);
169
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896')) {
170
+ _reactDom.default.unmountComponentAtNode(node);
171
+ }
167
172
  }
168
173
  });
169
174
  };
@@ -8,6 +8,7 @@ exports.DragHandle = void 0;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _react = require("react");
10
10
  var _react2 = require("@emotion/react");
11
+ var _bindEventListener = require("bind-event-listener");
11
12
  var _reactIntlNext = require("react-intl-next");
12
13
  var _analytics = require("@atlaskit/editor-common/analytics");
13
14
  var _hooks = require("@atlaskit/editor-common/hooks");
@@ -259,7 +260,7 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
259
260
  });
260
261
  }, [anchorName, api, nodeType, view, start]);
261
262
  var macroInteractionUpdates = featureFlagsState === null || featureFlagsState === void 0 ? void 0 : featureFlagsState.macroInteractionUpdates;
262
- var positionStyles = (0, _react.useMemo)(function () {
263
+ var calculatePosition = (0, _react.useCallback)(function () {
263
264
  var supportsAnchor = CSS.supports('top', "anchor(".concat(anchorName, " start)")) && CSS.supports('left', "anchor(".concat(anchorName, " start)"));
264
265
  var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(anchorName, "\"]"));
265
266
  var hasResizer = nodeType === 'table' || nodeType === 'mediaSingle';
@@ -281,18 +282,59 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
281
282
  }
282
283
  if (supportsAnchor) {
283
284
  return (0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? {
284
- left: hasResizer || isExtension || isEmbedCard ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType), "px)"),
285
+ left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType), "px)"),
285
286
  top: (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_ed_23674') ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _consts.topPositionAdjustment)(nodeType), "px)") : anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(_consts.DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
286
287
  } : {
287
288
  left: hasResizer || isExtension || isBlockCard || isEmbedCard ? (0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates) : "calc(anchor(".concat(anchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType), "px)"),
288
289
  top: (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_ed_23674') ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _consts.topPositionAdjustment)(nodeType), "px)") : anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(_consts.DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
289
290
  };
290
291
  }
291
- return {
292
+ return (0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? {
293
+ left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates), ")") : (0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates),
294
+ top: (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_ed_23674') ? (0, _dragHandlePositions.getTopPosition)(dom, nodeType) : (0, _dragHandlePositions.getTopPosition)(dom)
295
+ } : {
292
296
  left: (0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates),
293
297
  top: (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_ed_23674') ? (0, _dragHandlePositions.getTopPosition)(dom, nodeType) : (0, _dragHandlePositions.getTopPosition)(dom)
294
298
  };
295
299
  }, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates]);
300
+ var _useState5 = (0, _react.useState)({
301
+ display: 'none'
302
+ }),
303
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
304
+ newPositionStyles = _useState6[0],
305
+ setNewPositionStyles = _useState6[1];
306
+ (0, _react.useEffect)(function () {
307
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896')) {
308
+ return;
309
+ }
310
+ var cleanUpTransitionListener;
311
+ if (nodeType === 'extension' || nodeType === 'embedCard') {
312
+ var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(anchorName, "\"]"));
313
+ if (!dom) {
314
+ return;
315
+ }
316
+ cleanUpTransitionListener = (0, _bindEventListener.bind)(dom, {
317
+ type: 'transitionend',
318
+ listener: function listener() {
319
+ setNewPositionStyles(calculatePosition());
320
+ }
321
+ });
322
+ }
323
+ var calcPos = requestAnimationFrame(function () {
324
+ setNewPositionStyles(calculatePosition());
325
+ });
326
+ return function () {
327
+ var _cleanUpTransitionLis;
328
+ cancelAnimationFrame(calcPos);
329
+ (_cleanUpTransitionLis = cleanUpTransitionListener) === null || _cleanUpTransitionLis === void 0 || _cleanUpTransitionLis();
330
+ };
331
+ }, [calculatePosition, view.dom, anchorName, nodeType]);
332
+ var positionStyles = (0, _react.useMemo)(function () {
333
+ if ((0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896')) {
334
+ return newPositionStyles;
335
+ }
336
+ return calculatePosition();
337
+ }, [calculatePosition, newPositionStyles]);
296
338
  (0, _react.useEffect)(function () {
297
339
  if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current && (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23873')) {
298
340
  var id = requestAnimationFrame(function () {
@@ -321,7 +363,7 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
321
363
  ref: buttonRef
322
364
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
323
365
  ,
324
- style: positionStyles,
366
+ style: (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896') ? newPositionStyles : positionStyles,
325
367
  onClick: handleOnClick,
326
368
  onMouseDown: (0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? handleMouseDownWrapperRemoved : handleMouseDown,
327
369
  onKeyDown: handleKeyDown,
@@ -137,6 +137,9 @@ export const dragHandleDecoration = (api, getIntl, pos, anchorName, nodeType, ha
137
137
  element.style.display = 'inline';
138
138
  element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
139
139
  element.setAttribute('data-blocks-drag-handle-container', 'true');
140
+ if (fg('platform_editor_element_drag_and_drop_ed_23896')) {
141
+ unmountDecorations('data-blocks-drag-handle-container');
142
+ }
140
143
  if (fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2')) {
141
144
  // There are times when global clear: "both" styles are applied to this decoration causing jumpiness
142
145
  // due to margins applied to other nodes eg. Headings
@@ -157,7 +160,9 @@ export const dragHandleDecoration = (api, getIntl, pos, anchorName, nodeType, ha
157
160
  side: -1,
158
161
  id: 'drag-handle',
159
162
  destroy: node => {
160
- ReactDOM.unmountComponentAtNode(node);
163
+ if (!fg('platform_editor_element_drag_and_drop_ed_23896')) {
164
+ ReactDOM.unmountComponentAtNode(node);
165
+ }
161
166
  }
162
167
  });
163
168
  };
@@ -2,6 +2,7 @@
2
2
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
4
4
  import { css, jsx } from '@emotion/react';
5
+ import { bind } from 'bind-event-listener';
5
6
  import { injectIntl } from 'react-intl-next';
6
7
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
7
8
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
@@ -250,7 +251,7 @@ const DragHandleInternal = ({
250
251
  });
251
252
  }, [anchorName, api, nodeType, view, start]);
252
253
  const macroInteractionUpdates = featureFlagsState === null || featureFlagsState === void 0 ? void 0 : featureFlagsState.macroInteractionUpdates;
253
- const positionStyles = useMemo(() => {
254
+ const calculatePosition = useCallback(() => {
254
255
  const supportsAnchor = CSS.supports('top', `anchor(${anchorName} start)`) && CSS.supports('left', `anchor(${anchorName} start)`);
255
256
  const dom = view.dom.querySelector(`[data-drag-handler-anchor-name="${anchorName}"]`);
256
257
  const hasResizer = nodeType === 'table' || nodeType === 'mediaSingle';
@@ -272,18 +273,56 @@ const DragHandleInternal = ({
272
273
  }
273
274
  if (supportsAnchor) {
274
275
  return fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? {
275
- left: hasResizer || isExtension || isEmbedCard ? `calc(anchor(${anchorName} start) + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates)})` : `calc(anchor(${anchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType)}px)`,
276
+ left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? `calc(anchor(${anchorName} start) + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates)})` : `calc(anchor(${anchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType)}px)`,
276
277
  top: fg('platform_editor_elements_dnd_ed_23674') ? `calc(anchor(${anchorName} start) + ${topPositionAdjustment(nodeType)}px)` : anchorName.includes('table') ? `calc(anchor(${anchorName} start) + ${DRAG_HANDLE_HEIGHT}px)` : `anchor(${anchorName} start)`
277
278
  } : {
278
279
  left: hasResizer || isExtension || isBlockCard || isEmbedCard ? getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates) : `calc(anchor(${anchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType)}px)`,
279
280
  top: fg('platform_editor_elements_dnd_ed_23674') ? `calc(anchor(${anchorName} start) + ${topPositionAdjustment(nodeType)}px)` : anchorName.includes('table') ? `calc(anchor(${anchorName} start) + ${DRAG_HANDLE_HEIGHT}px)` : `anchor(${anchorName} start)`
280
281
  };
281
282
  }
282
- return {
283
+ return fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? {
284
+ left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? `calc(${(dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0}px + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates)})` : getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates),
285
+ top: fg('platform_editor_elements_dnd_ed_23674') ? getTopPosition(dom, nodeType) : getTopPosition(dom)
286
+ } : {
283
287
  left: getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates),
284
288
  top: fg('platform_editor_elements_dnd_ed_23674') ? getTopPosition(dom, nodeType) : getTopPosition(dom)
285
289
  };
286
290
  }, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates]);
291
+ const [newPositionStyles, setNewPositionStyles] = useState({
292
+ display: 'none'
293
+ });
294
+ useEffect(() => {
295
+ if (!fg('platform_editor_element_drag_and_drop_ed_23896')) {
296
+ return;
297
+ }
298
+ let cleanUpTransitionListener;
299
+ if (nodeType === 'extension' || nodeType === 'embedCard') {
300
+ const dom = view.dom.querySelector(`[data-drag-handler-anchor-name="${anchorName}"]`);
301
+ if (!dom) {
302
+ return;
303
+ }
304
+ cleanUpTransitionListener = bind(dom, {
305
+ type: 'transitionend',
306
+ listener: () => {
307
+ setNewPositionStyles(calculatePosition());
308
+ }
309
+ });
310
+ }
311
+ const calcPos = requestAnimationFrame(() => {
312
+ setNewPositionStyles(calculatePosition());
313
+ });
314
+ return () => {
315
+ var _cleanUpTransitionLis;
316
+ cancelAnimationFrame(calcPos);
317
+ (_cleanUpTransitionLis = cleanUpTransitionListener) === null || _cleanUpTransitionLis === void 0 ? void 0 : _cleanUpTransitionLis();
318
+ };
319
+ }, [calculatePosition, view.dom, anchorName, nodeType]);
320
+ const positionStyles = useMemo(() => {
321
+ if (fg('platform_editor_element_drag_and_drop_ed_23896')) {
322
+ return newPositionStyles;
323
+ }
324
+ return calculatePosition();
325
+ }, [calculatePosition, newPositionStyles]);
287
326
  useEffect(() => {
288
327
  if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current && fg('platform_editor_element_drag_and_drop_ed_23873')) {
289
328
  const id = requestAnimationFrame(() => {
@@ -311,7 +350,7 @@ const DragHandleInternal = ({
311
350
  ref: buttonRef
312
351
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
313
352
  ,
314
- style: positionStyles,
353
+ style: fg('platform_editor_element_drag_and_drop_ed_23896') ? newPositionStyles : positionStyles,
315
354
  onClick: handleOnClick,
316
355
  onMouseDown: fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? handleMouseDownWrapperRemoved : handleMouseDown,
317
356
  onKeyDown: handleKeyDown,
@@ -136,6 +136,9 @@ export var dragHandleDecoration = function dragHandleDecoration(api, getIntl, po
136
136
  element.style.display = 'inline';
137
137
  element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
138
138
  element.setAttribute('data-blocks-drag-handle-container', 'true');
139
+ if (fg('platform_editor_element_drag_and_drop_ed_23896')) {
140
+ unmountDecorations('data-blocks-drag-handle-container');
141
+ }
139
142
  if (fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2')) {
140
143
  // There are times when global clear: "both" styles are applied to this decoration causing jumpiness
141
144
  // due to margins applied to other nodes eg. Headings
@@ -156,7 +159,9 @@ export var dragHandleDecoration = function dragHandleDecoration(api, getIntl, po
156
159
  side: -1,
157
160
  id: 'drag-handle',
158
161
  destroy: function destroy(node) {
159
- ReactDOM.unmountComponentAtNode(node);
162
+ if (!fg('platform_editor_element_drag_and_drop_ed_23896')) {
163
+ ReactDOM.unmountComponentAtNode(node);
164
+ }
160
165
  }
161
166
  });
162
167
  };
@@ -3,6 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
4
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
5
5
  import { css, jsx } from '@emotion/react';
6
+ import { bind } from 'bind-event-listener';
6
7
  import { injectIntl } from 'react-intl-next';
7
8
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
8
9
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
@@ -250,7 +251,7 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
250
251
  });
251
252
  }, [anchorName, api, nodeType, view, start]);
252
253
  var macroInteractionUpdates = featureFlagsState === null || featureFlagsState === void 0 ? void 0 : featureFlagsState.macroInteractionUpdates;
253
- var positionStyles = useMemo(function () {
254
+ var calculatePosition = useCallback(function () {
254
255
  var supportsAnchor = CSS.supports('top', "anchor(".concat(anchorName, " start)")) && CSS.supports('left', "anchor(".concat(anchorName, " start)"));
255
256
  var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(anchorName, "\"]"));
256
257
  var hasResizer = nodeType === 'table' || nodeType === 'mediaSingle';
@@ -272,18 +273,59 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
272
273
  }
273
274
  if (supportsAnchor) {
274
275
  return fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? {
275
- left: hasResizer || isExtension || isEmbedCard ? "calc(anchor(".concat(anchorName, " start) + ").concat(getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType), "px)"),
276
+ left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? "calc(anchor(".concat(anchorName, " start) + ").concat(getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType), "px)"),
276
277
  top: fg('platform_editor_elements_dnd_ed_23674') ? "calc(anchor(".concat(anchorName, " start) + ").concat(topPositionAdjustment(nodeType), "px)") : anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
277
278
  } : {
278
279
  left: hasResizer || isExtension || isBlockCard || isEmbedCard ? getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates) : "calc(anchor(".concat(anchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType), "px)"),
279
280
  top: fg('platform_editor_elements_dnd_ed_23674') ? "calc(anchor(".concat(anchorName, " start) + ").concat(topPositionAdjustment(nodeType), "px)") : anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
280
281
  };
281
282
  }
282
- return {
283
+ return fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? {
284
+ left: hasResizer || isExtension || isEmbedCard || isBlockCard && innerContainer ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat(getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates), ")") : getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates),
285
+ top: fg('platform_editor_elements_dnd_ed_23674') ? getTopPosition(dom, nodeType) : getTopPosition(dom)
286
+ } : {
283
287
  left: getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates),
284
288
  top: fg('platform_editor_elements_dnd_ed_23674') ? getTopPosition(dom, nodeType) : getTopPosition(dom)
285
289
  };
286
290
  }, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates]);
291
+ var _useState5 = useState({
292
+ display: 'none'
293
+ }),
294
+ _useState6 = _slicedToArray(_useState5, 2),
295
+ newPositionStyles = _useState6[0],
296
+ setNewPositionStyles = _useState6[1];
297
+ useEffect(function () {
298
+ if (!fg('platform_editor_element_drag_and_drop_ed_23896')) {
299
+ return;
300
+ }
301
+ var cleanUpTransitionListener;
302
+ if (nodeType === 'extension' || nodeType === 'embedCard') {
303
+ var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(anchorName, "\"]"));
304
+ if (!dom) {
305
+ return;
306
+ }
307
+ cleanUpTransitionListener = bind(dom, {
308
+ type: 'transitionend',
309
+ listener: function listener() {
310
+ setNewPositionStyles(calculatePosition());
311
+ }
312
+ });
313
+ }
314
+ var calcPos = requestAnimationFrame(function () {
315
+ setNewPositionStyles(calculatePosition());
316
+ });
317
+ return function () {
318
+ var _cleanUpTransitionLis;
319
+ cancelAnimationFrame(calcPos);
320
+ (_cleanUpTransitionLis = cleanUpTransitionListener) === null || _cleanUpTransitionLis === void 0 || _cleanUpTransitionLis();
321
+ };
322
+ }, [calculatePosition, view.dom, anchorName, nodeType]);
323
+ var positionStyles = useMemo(function () {
324
+ if (fg('platform_editor_element_drag_and_drop_ed_23896')) {
325
+ return newPositionStyles;
326
+ }
327
+ return calculatePosition();
328
+ }, [calculatePosition, newPositionStyles]);
287
329
  useEffect(function () {
288
330
  if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current && fg('platform_editor_element_drag_and_drop_ed_23873')) {
289
331
  var id = requestAnimationFrame(function () {
@@ -312,7 +354,7 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
312
354
  ref: buttonRef
313
355
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
314
356
  ,
315
- style: positionStyles,
357
+ style: fg('platform_editor_element_drag_and_drop_ed_23896') ? newPositionStyles : positionStyles,
316
358
  onClick: handleOnClick,
317
359
  onMouseDown: fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? handleMouseDownWrapperRemoved : handleMouseDown,
318
360
  onKeyDown: handleKeyDown,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "1.5.18",
3
+ "version": "1.5.20",
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": "^85.1.0",
35
+ "@atlaskit/editor-common": "^86.0.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",
@@ -46,7 +46,7 @@
46
46
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.4.0",
47
47
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
48
48
  "@atlaskit/theme": "^12.11.0",
49
- "@atlaskit/tokens": "^1.54.0",
49
+ "@atlaskit/tokens": "^1.55.0",
50
50
  "@atlaskit/tooltip": "^18.5.0",
51
51
  "@babel/runtime": "^7.0.0",
52
52
  "@emotion/react": "^11.7.1",
@@ -142,6 +142,9 @@
142
142
  },
143
143
  "platform_editor_element_drag_and_drop_ed_24049": {
144
144
  "type": "boolean"
145
+ },
146
+ "platform_editor_element_drag_and_drop_ed_23896": {
147
+ "type": "boolean"
145
148
  }
146
149
  }
147
150
  }