@atlaskit/editor-plugin-block-controls 2.1.7 → 2.1.9

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,23 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 2.1.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#147660](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/147660)
8
+ [`bc7f5f6bfe9ff`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bc7f5f6bfe9ff) -
9
+ Remove nested dnd gating from analytics events
10
+ - Updated dependencies
11
+
12
+ ## 2.1.8
13
+
14
+ ### Patch Changes
15
+
16
+ - [#147103](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/147103)
17
+ [`c550545f3551e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c550545f3551e) -
18
+ ED-24305 Try to fix type error from getPos in drag handle
19
+ - Updated dependencies
20
+
3
21
  ## 2.1.7
4
22
 
5
23
  ### Patch Changes
@@ -175,12 +175,11 @@ var moveNode = exports.moveNode = function moveNode(api) {
175
175
  action: _analytics.ACTION.MOVED,
176
176
  actionSubject: _analytics.ACTION_SUBJECT.ELEMENT,
177
177
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.ELEMENT_DRAG_HANDLE,
178
- attributes: _objectSpread(_objectSpread({
178
+ attributes: _objectSpread({
179
179
  nodeDepth: resolvedNode.depth,
180
- nodeType: node.type.name
181
- }, (0, _experiments.editorExperiment)('nested-dnd', true) && {
180
+ nodeType: node.type.name,
182
181
  destinationNodeDepth: $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.depth
183
- }), (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23873') && {
182
+ }, (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23873') && {
184
183
  inputMethod: inputMethod
185
184
  })
186
185
  })(tr);
@@ -295,6 +295,9 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
295
295
  positionStyles = _useState6[0],
296
296
  setPositionStyles = _useState6[1];
297
297
  (0, _react.useEffect)(function () {
298
+ if ((0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_type_error_fix')) {
299
+ return;
300
+ }
298
301
  var cleanUpTransitionListener;
299
302
  if (nodeType === 'extension' || nodeType === 'embedCard') {
300
303
  var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(anchorName, "\"]"));
@@ -317,6 +320,32 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
317
320
  (_cleanUpTransitionLis = cleanUpTransitionListener) === null || _cleanUpTransitionLis === void 0 || _cleanUpTransitionLis();
318
321
  };
319
322
  }, [calculatePosition, view.dom, anchorName, nodeType]);
323
+ (0, _react.useLayoutEffect)(function () {
324
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_type_error_fix')) {
325
+ return;
326
+ }
327
+ var cleanUpTransitionListener;
328
+ if (nodeType === 'extension' || nodeType === 'embedCard') {
329
+ var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(anchorName, "\"]"));
330
+ if (!dom) {
331
+ return;
332
+ }
333
+ cleanUpTransitionListener = (0, _bindEventListener.bind)(dom, {
334
+ type: 'transitionend',
335
+ listener: function listener() {
336
+ setPositionStyles(calculatePosition());
337
+ }
338
+ });
339
+ }
340
+ var calcPos = requestAnimationFrame(function () {
341
+ setPositionStyles(calculatePosition());
342
+ });
343
+ return function () {
344
+ var _cleanUpTransitionLis2;
345
+ cancelAnimationFrame(calcPos);
346
+ (_cleanUpTransitionLis2 = cleanUpTransitionListener) === null || _cleanUpTransitionLis2 === void 0 || _cleanUpTransitionLis2();
347
+ };
348
+ }, [calculatePosition, view.dom, anchorName, nodeType]);
320
349
  (0, _react.useEffect)(function () {
321
350
  if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current && (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23873')) {
322
351
  var id = requestAnimationFrame(function () {
@@ -172,9 +172,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
172
172
  attributes: {
173
173
  nodeDepth: resolvedNode.depth,
174
174
  nodeType: node.type.name,
175
- ...(editorExperiment('nested-dnd', true) && {
176
- destinationNodeDepth: $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.depth
177
- }),
175
+ destinationNodeDepth: $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.depth,
178
176
  ...(fg('platform_editor_element_drag_and_drop_ed_23873') && {
179
177
  inputMethod
180
178
  })
@@ -2,7 +2,7 @@
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
4
  */
5
- import { useCallback, useEffect, useRef, useState } from 'react';
5
+ import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
6
6
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
7
  import { css, jsx } from '@emotion/react';
8
8
  import { bind } from 'bind-event-listener';
@@ -279,6 +279,9 @@ const DragHandleInternal = ({
279
279
  display: 'none'
280
280
  });
281
281
  useEffect(() => {
282
+ if (fg('platform_editor_element_dnd_nested_type_error_fix')) {
283
+ return;
284
+ }
282
285
  let cleanUpTransitionListener;
283
286
  if (nodeType === 'extension' || nodeType === 'embedCard') {
284
287
  const dom = view.dom.querySelector(`[data-drag-handler-anchor-name="${anchorName}"]`);
@@ -301,6 +304,32 @@ const DragHandleInternal = ({
301
304
  (_cleanUpTransitionLis = cleanUpTransitionListener) === null || _cleanUpTransitionLis === void 0 ? void 0 : _cleanUpTransitionLis();
302
305
  };
303
306
  }, [calculatePosition, view.dom, anchorName, nodeType]);
307
+ useLayoutEffect(() => {
308
+ if (!fg('platform_editor_element_dnd_nested_type_error_fix')) {
309
+ return;
310
+ }
311
+ let cleanUpTransitionListener;
312
+ if (nodeType === 'extension' || nodeType === 'embedCard') {
313
+ const dom = view.dom.querySelector(`[data-drag-handler-anchor-name="${anchorName}"]`);
314
+ if (!dom) {
315
+ return;
316
+ }
317
+ cleanUpTransitionListener = bind(dom, {
318
+ type: 'transitionend',
319
+ listener: () => {
320
+ setPositionStyles(calculatePosition());
321
+ }
322
+ });
323
+ }
324
+ const calcPos = requestAnimationFrame(() => {
325
+ setPositionStyles(calculatePosition());
326
+ });
327
+ return () => {
328
+ var _cleanUpTransitionLis2;
329
+ cancelAnimationFrame(calcPos);
330
+ (_cleanUpTransitionLis2 = cleanUpTransitionListener) === null || _cleanUpTransitionLis2 === void 0 ? void 0 : _cleanUpTransitionLis2();
331
+ };
332
+ }, [calculatePosition, view.dom, anchorName, nodeType]);
304
333
  useEffect(() => {
305
334
  if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current && fg('platform_editor_element_drag_and_drop_ed_23873')) {
306
335
  const id = requestAnimationFrame(() => {
@@ -169,12 +169,11 @@ export var moveNode = function moveNode(api) {
169
169
  action: ACTION.MOVED,
170
170
  actionSubject: ACTION_SUBJECT.ELEMENT,
171
171
  actionSubjectId: ACTION_SUBJECT_ID.ELEMENT_DRAG_HANDLE,
172
- attributes: _objectSpread(_objectSpread({
172
+ attributes: _objectSpread({
173
173
  nodeDepth: resolvedNode.depth,
174
- nodeType: node.type.name
175
- }, editorExperiment('nested-dnd', true) && {
174
+ nodeType: node.type.name,
176
175
  destinationNodeDepth: $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.depth
177
- }), fg('platform_editor_element_drag_and_drop_ed_23873') && {
176
+ }, fg('platform_editor_element_drag_and_drop_ed_23873') && {
178
177
  inputMethod: inputMethod
179
178
  })
180
179
  })(tr);
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  * @jsxRuntime classic
4
4
  * @jsx jsx
5
5
  */
6
- import { useCallback, useEffect, useRef, useState } from 'react';
6
+ import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { bind } from 'bind-event-listener';
@@ -286,6 +286,9 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
286
286
  positionStyles = _useState6[0],
287
287
  setPositionStyles = _useState6[1];
288
288
  useEffect(function () {
289
+ if (fg('platform_editor_element_dnd_nested_type_error_fix')) {
290
+ return;
291
+ }
289
292
  var cleanUpTransitionListener;
290
293
  if (nodeType === 'extension' || nodeType === 'embedCard') {
291
294
  var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(anchorName, "\"]"));
@@ -308,6 +311,32 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
308
311
  (_cleanUpTransitionLis = cleanUpTransitionListener) === null || _cleanUpTransitionLis === void 0 || _cleanUpTransitionLis();
309
312
  };
310
313
  }, [calculatePosition, view.dom, anchorName, nodeType]);
314
+ useLayoutEffect(function () {
315
+ if (!fg('platform_editor_element_dnd_nested_type_error_fix')) {
316
+ return;
317
+ }
318
+ var cleanUpTransitionListener;
319
+ if (nodeType === 'extension' || nodeType === 'embedCard') {
320
+ var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(anchorName, "\"]"));
321
+ if (!dom) {
322
+ return;
323
+ }
324
+ cleanUpTransitionListener = bind(dom, {
325
+ type: 'transitionend',
326
+ listener: function listener() {
327
+ setPositionStyles(calculatePosition());
328
+ }
329
+ });
330
+ }
331
+ var calcPos = requestAnimationFrame(function () {
332
+ setPositionStyles(calculatePosition());
333
+ });
334
+ return function () {
335
+ var _cleanUpTransitionLis2;
336
+ cancelAnimationFrame(calcPos);
337
+ (_cleanUpTransitionLis2 = cleanUpTransitionListener) === null || _cleanUpTransitionLis2 === void 0 || _cleanUpTransitionLis2();
338
+ };
339
+ }, [calculatePosition, view.dom, anchorName, nodeType]);
311
340
  useEffect(function () {
312
341
  if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current && fg('platform_editor_element_drag_and_drop_ed_23873')) {
313
342
  var id = requestAnimationFrame(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@atlaskit/adf-schema": "^40.9.0",
34
- "@atlaskit/editor-common": "^92.0.0",
34
+ "@atlaskit/editor-common": "^92.1.0",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.8.0",
37
37
  "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
@@ -41,14 +41,14 @@
41
41
  "@atlaskit/editor-prosemirror": "6.0.0",
42
42
  "@atlaskit/editor-shared-styles": "^3.0.0",
43
43
  "@atlaskit/editor-tables": "^2.8.0",
44
- "@atlaskit/icon": "^22.19.0",
44
+ "@atlaskit/icon": "^22.20.0",
45
45
  "@atlaskit/platform-feature-flags": "^0.3.0",
46
46
  "@atlaskit/pragmatic-drag-and-drop": "^1.3.0",
47
47
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.4.0",
48
48
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
49
49
  "@atlaskit/primitives": "^12.2.0",
50
50
  "@atlaskit/theme": "^13.0.0",
51
- "@atlaskit/tmp-editor-statsig": "^2.1.0",
51
+ "@atlaskit/tmp-editor-statsig": "^2.2.0",
52
52
  "@atlaskit/tokens": "^2.0.0",
53
53
  "@atlaskit/tooltip": "^18.7.0",
54
54
  "@babel/runtime": "^7.0.0",
@@ -141,6 +141,9 @@
141
141
  },
142
142
  "platform_editor_element_dnd_nested_fix_patch_2": {
143
143
  "type": "boolean"
144
+ },
145
+ "platform_editor_element_dnd_nested_type_error_fix": {
146
+ "type": "boolean"
144
147
  }
145
148
  }
146
149
  }