@atlaskit/editor-plugin-block-controls 17.2.4 → 17.3.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.
Files changed (113) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/blockControlsPlugin.js +28 -8
  3. package/dist/cjs/editor-commands/move-node-with-block-menu.js +2 -2
  4. package/dist/cjs/editor-commands/move-node.js +6 -6
  5. package/dist/cjs/editor-commands/utils/move-node-utils.js +4 -4
  6. package/dist/cjs/pm-plugins/decorations-anchor.js +4 -4
  7. package/dist/cjs/pm-plugins/decorations-drag-handle.js +3 -3
  8. package/dist/cjs/pm-plugins/decorations-drop-target-active.js +2 -2
  9. package/dist/cjs/pm-plugins/decorations-drop-target.js +2 -2
  10. package/dist/cjs/pm-plugins/decorations-quick-insert-button.js +2 -2
  11. package/dist/cjs/pm-plugins/handle-mouse-down.js +3 -3
  12. package/dist/cjs/pm-plugins/handle-mouse-over.js +7 -7
  13. package/dist/cjs/pm-plugins/interaction-tracking/pm-plugin.js +3 -3
  14. package/dist/cjs/pm-plugins/main.js +23 -21
  15. package/dist/cjs/pm-plugins/react-root-registry.js +7 -7
  16. package/dist/cjs/pm-plugins/utils/active-anchor-tracker.js +2 -2
  17. package/dist/cjs/pm-plugins/utils/consts.js +2 -2
  18. package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +6 -6
  19. package/dist/cjs/pm-plugins/utils/expand-and-update-selection.js +2 -2
  20. package/dist/cjs/pm-plugins/utils/getSelection.js +5 -5
  21. package/dist/cjs/pm-plugins/utils/inline-drop-target.js +2 -2
  22. package/dist/cjs/pm-plugins/utils/remove-from-source.js +2 -2
  23. package/dist/cjs/pm-plugins/utils/surface-node-positions.js +45 -19
  24. package/dist/cjs/pm-plugins/utils/validation.js +2 -2
  25. package/dist/cjs/ui/block-controls-left-surfaces.js +5 -4
  26. package/dist/cjs/ui/block-controls-right-surface.compiled.css +4 -0
  27. package/dist/cjs/ui/block-controls-right-surface.js +45 -0
  28. package/dist/cjs/ui/block-controls-right-surfaces.js +222 -0
  29. package/dist/{esm/ui/block-controls-left-surface-targets.js → cjs/ui/block-controls-surface-targets.js} +14 -2
  30. package/dist/cjs/ui/consts.js +4 -4
  31. package/dist/cjs/ui/drag-handle.js +20 -19
  32. package/dist/cjs/ui/drop-target.js +2 -2
  33. package/dist/cjs/ui/global-styles.js +5 -5
  34. package/dist/cjs/ui/utils/get-surface-placement.js +20 -6
  35. package/dist/cjs/ui/visibility-container.js +2 -2
  36. package/dist/es2019/blockControlsPlugin.js +28 -4
  37. package/dist/es2019/editor-commands/move-node-with-block-menu.js +1 -1
  38. package/dist/es2019/editor-commands/move-node.js +1 -1
  39. package/dist/es2019/editor-commands/utils/move-node-utils.js +1 -1
  40. package/dist/es2019/pm-plugins/decorations-anchor.js +1 -1
  41. package/dist/es2019/pm-plugins/decorations-drag-handle.js +1 -1
  42. package/dist/es2019/pm-plugins/decorations-drop-target-active.js +1 -1
  43. package/dist/es2019/pm-plugins/decorations-drop-target.js +1 -1
  44. package/dist/es2019/pm-plugins/decorations-quick-insert-button.js +1 -1
  45. package/dist/es2019/pm-plugins/handle-mouse-down.js +1 -1
  46. package/dist/es2019/pm-plugins/handle-mouse-over.js +1 -1
  47. package/dist/es2019/pm-plugins/interaction-tracking/pm-plugin.js +1 -1
  48. package/dist/es2019/pm-plugins/main.js +10 -10
  49. package/dist/es2019/pm-plugins/react-root-registry.js +7 -7
  50. package/dist/es2019/pm-plugins/utils/active-anchor-tracker.js +1 -1
  51. package/dist/es2019/pm-plugins/utils/consts.js +1 -1
  52. package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +1 -1
  53. package/dist/es2019/pm-plugins/utils/expand-and-update-selection.js +1 -1
  54. package/dist/es2019/pm-plugins/utils/getSelection.js +1 -1
  55. package/dist/es2019/pm-plugins/utils/inline-drop-target.js +1 -1
  56. package/dist/es2019/pm-plugins/utils/remove-from-source.js +1 -1
  57. package/dist/es2019/pm-plugins/utils/surface-node-positions.js +34 -15
  58. package/dist/es2019/pm-plugins/utils/validation.js +1 -1
  59. package/dist/es2019/ui/block-controls-left-surfaces.js +5 -4
  60. package/dist/es2019/ui/block-controls-right-surface.compiled.css +4 -0
  61. package/dist/es2019/ui/block-controls-right-surface.js +39 -0
  62. package/dist/es2019/ui/block-controls-right-surfaces.js +187 -0
  63. package/dist/es2019/ui/{block-controls-left-surface-targets.js → block-controls-surface-targets.js} +8 -2
  64. package/dist/es2019/ui/consts.js +1 -1
  65. package/dist/es2019/ui/drag-handle.js +4 -3
  66. package/dist/es2019/ui/drop-target.js +1 -1
  67. package/dist/es2019/ui/global-styles.js +1 -1
  68. package/dist/es2019/ui/utils/get-surface-placement.js +20 -6
  69. package/dist/es2019/ui/visibility-container.js +1 -1
  70. package/dist/esm/blockControlsPlugin.js +24 -4
  71. package/dist/esm/editor-commands/move-node-with-block-menu.js +1 -1
  72. package/dist/esm/editor-commands/move-node.js +1 -1
  73. package/dist/esm/editor-commands/utils/move-node-utils.js +1 -1
  74. package/dist/esm/pm-plugins/decorations-anchor.js +1 -1
  75. package/dist/esm/pm-plugins/decorations-drag-handle.js +1 -1
  76. package/dist/esm/pm-plugins/decorations-drop-target-active.js +1 -1
  77. package/dist/esm/pm-plugins/decorations-drop-target.js +1 -1
  78. package/dist/esm/pm-plugins/decorations-quick-insert-button.js +1 -1
  79. package/dist/esm/pm-plugins/handle-mouse-down.js +1 -1
  80. package/dist/esm/pm-plugins/handle-mouse-over.js +1 -1
  81. package/dist/esm/pm-plugins/interaction-tracking/pm-plugin.js +1 -1
  82. package/dist/esm/pm-plugins/main.js +11 -9
  83. package/dist/esm/pm-plugins/react-root-registry.js +7 -7
  84. package/dist/esm/pm-plugins/utils/active-anchor-tracker.js +1 -1
  85. package/dist/esm/pm-plugins/utils/consts.js +1 -1
  86. package/dist/esm/pm-plugins/utils/drag-handle-positions.js +1 -1
  87. package/dist/esm/pm-plugins/utils/expand-and-update-selection.js +1 -1
  88. package/dist/esm/pm-plugins/utils/getSelection.js +1 -1
  89. package/dist/esm/pm-plugins/utils/inline-drop-target.js +1 -1
  90. package/dist/esm/pm-plugins/utils/remove-from-source.js +1 -1
  91. package/dist/esm/pm-plugins/utils/surface-node-positions.js +45 -19
  92. package/dist/esm/pm-plugins/utils/validation.js +1 -1
  93. package/dist/esm/ui/block-controls-left-surfaces.js +5 -4
  94. package/dist/esm/ui/block-controls-right-surface.compiled.css +4 -0
  95. package/dist/esm/ui/block-controls-right-surface.js +38 -0
  96. package/dist/esm/ui/block-controls-right-surfaces.js +213 -0
  97. package/dist/{cjs/ui/block-controls-left-surface-targets.js → esm/ui/block-controls-surface-targets.js} +8 -8
  98. package/dist/esm/ui/consts.js +1 -1
  99. package/dist/esm/ui/drag-handle.js +4 -3
  100. package/dist/esm/ui/drop-target.js +1 -1
  101. package/dist/esm/ui/global-styles.js +1 -1
  102. package/dist/esm/ui/utils/get-surface-placement.js +20 -6
  103. package/dist/esm/ui/visibility-container.js +1 -1
  104. package/dist/types/pm-plugins/main.d.ts +2 -2
  105. package/dist/types/pm-plugins/react-root-registry.d.ts +4 -4
  106. package/dist/types/pm-plugins/utils/surface-node-positions.d.ts +3 -3
  107. package/dist/types/ui/block-controls-left-surface.d.ts +2 -2
  108. package/dist/types/ui/block-controls-right-surface.d.ts +23 -0
  109. package/dist/types/ui/block-controls-right-surfaces.d.ts +20 -0
  110. package/dist/types/ui/block-controls-surface-targets.d.ts +13 -0
  111. package/dist/types/ui/utils/get-surface-placement.d.ts +12 -4
  112. package/package.json +23 -26
  113. package/dist/types/ui/block-controls-left-surface-targets.d.ts +0 -7
@@ -1,6 +1,6 @@
1
1
  import ReactDOM, { flushSync } from 'react-dom';
2
2
  import { createRoot } from 'react-dom/client';
3
- import { fg } from '@atlaskit/platform-feature-flags/fg';
3
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
4
4
 
5
5
  /**
6
6
  * Shared registry of React roots created via `createRoot`.
@@ -14,16 +14,16 @@ var reactRoots = new WeakMap();
14
14
  /**
15
15
  * Mounts `element` into `mountPoint`.
16
16
  *
17
- * When `nike_r19_render_unmount` is **on**, uses the React 18/19 `createRoot`
17
+ * When `platform_editor_react19_migration` is **on**, uses the React 18/19 `createRoot`
18
18
  * API wrapped in `flushSync` so the render is synchronous – matching the
19
19
  * legacy `ReactDOM.render` timing that ProseMirror decoration widgets depend
20
20
  * on (focus management, anchor positioning, block-menu visibility all read
21
21
  * the rendered DOM immediately after the callback returns).
22
22
  *
23
- * When the gate is **off**, falls back to the legacy `ReactDOM.render` path.
23
+ * Otherwise, falls back to the legacy `ReactDOM.render` path.
24
24
  */
25
25
  export var renderToMountPoint = function renderToMountPoint(element, mountPoint) {
26
- if (fg('nike_r19_render_unmount')) {
26
+ if (isExperimentEnabled('platform_editor_react19_migration')) {
27
27
  var root = reactRoots.get(mountPoint);
28
28
  if (!root) {
29
29
  root = createRoot(mountPoint);
@@ -44,13 +44,13 @@ export var renderToMountPoint = function renderToMountPoint(element, mountPoint)
44
44
  /**
45
45
  * Unmounts the React tree at `mountPoint`.
46
46
  *
47
- * When `nike_r19_render_unmount` is **on**, looks up the root in the shared
47
+ * When `platform_editor_react19_migration` is **on**, looks up the root in the shared
48
48
  * registry, calls `root.unmount()`, and removes the entry.
49
49
  *
50
- * When the gate is **off**, falls back to `ReactDOM.unmountComponentAtNode`.
50
+ * Otherwise, falls back to `ReactDOM.unmountComponentAtNode`.
51
51
  */
52
52
  export var unmountFromMountPoint = function unmountFromMountPoint(mountPoint) {
53
- if (fg('nike_r19_render_unmount')) {
53
+ if (isExperimentEnabled('platform_editor_react19_migration')) {
54
54
  var root = reactRoots.get(mountPoint);
55
55
  if (root) {
56
56
  root.unmount();
@@ -4,7 +4,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  import { EventEmitter } from 'events';
6
6
  import { useCallback, useEffect, useState } from 'react';
7
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
8
8
  export var ActiveAnchorTracker = /*#__PURE__*/function () {
9
9
  function ActiveAnchorTracker() {
10
10
  _classCallCheck(this, ActiveAnchorTracker);
@@ -1,4 +1,4 @@
1
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
1
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
2
2
  export var maxLayoutColumnSupported = function maxLayoutColumnSupported() {
3
3
  return editorExperiment('advanced_layouts', true) ? 5 : 3;
4
4
  };
@@ -2,7 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import memoizeOne from 'memoize-one';
3
3
  import { DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles';
4
4
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
6
6
  import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_H1_TOP_ADJUSTMENT, DRAG_HANDLE_H2_TOP_ADJUSTMENT, DRAG_HANDLE_H4_TOP_ADJUSTMENT, DRAG_HANDLE_H5_TOP_ADJUSTMENT, DRAG_HANDLE_H6_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_PARAGRAPH_SMALL_TOP_ADJUSTMENT, DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT, dragHandleGap } from '../../ui/consts';
7
7
  var STICKY_NODES = ['panel', 'table', 'expand', 'layoutSection', 'bodiedExtension'];
8
8
  export var getTopPosition = function getTopPosition(dom, type) {
@@ -4,7 +4,7 @@ import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-che
4
4
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { selectTableClosestToPos } from '@atlaskit/editor-tables/utils';
6
6
  import { fg } from '@atlaskit/platform-feature-flags/fg';
7
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
8
8
  import { selectNode } from './getSelection';
9
9
  import { adjustSelectionBoundsForEdgePositions } from './selection';
10
10
  var isPosWithinRange = function isPosWithinRange(pos, range) {
@@ -5,7 +5,7 @@ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state
5
5
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
6
6
  import { selectTableClosestToPos } from '@atlaskit/editor-tables/utils';
7
7
  import { fg } from '@atlaskit/platform-feature-flags/fg';
8
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
9
9
  export var getInlineNodePos = function getInlineNodePos(doc, start, nodeSize) {
10
10
  var $startPos = doc.resolve(start);
11
11
  // To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
@@ -1,5 +1,5 @@
1
1
  import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
2
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
2
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
3
3
  import { isWrappedMedia } from './check-media-layout';
4
4
  import { maxLayoutColumnSupported } from './consts';
5
5
  var syncedBlockTypes = ['syncBlock', 'bodiedSyncBlock'];
@@ -1,6 +1,6 @@
1
1
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
2
  import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
3
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
4
4
  import { isFragmentOfType } from './check-fragment';
5
5
  import { MIN_LAYOUT_COLUMN } from './consts';
6
6
  import { updateColumnWidths } from './update-column-widths';
@@ -7,19 +7,39 @@ var createSurfaceContextAtPosition = function createSurfaceContextAtPosition(sta
7
7
  var blockControlsContext = createBlockControlsSurfaceContextForPosition(state, position, activeNode);
8
8
  return blockControlsContext ? createSurfaceContext(BLOCK_CONTROL_UI_CONTEXT, blockControlsContext) : undefined;
9
9
  };
10
- export var getSurfaceNodePositions = function getSurfaceNodePositions(state, resolvedSurface, activeNode) {
10
+
11
+ /**
12
+ * A position qualifies as soon as ANY of the given surfaces would render something for it.
13
+ * The surface context depends only on state/position/activeNode, not on which surface is being
14
+ * checked, so it's built once here rather than once per surface inside the `.some()`.
15
+ */
16
+ var willAnySurfaceRenderAt = function willAnySurfaceRenderAt(surfaces, state, position, activeNode) {
17
+ var surfaceContext = createSurfaceContextAtPosition(state, position, activeNode);
18
+ return surfaces.some(function (_ref) {
19
+ var childrenMap = _ref.childrenMap,
20
+ root = _ref.root;
21
+ return willComponentRender(root, childrenMap, surfaceContext);
22
+ });
23
+ };
24
+ export var getSurfaceNodePositions = function getSurfaceNodePositions(state, resolvedSurfaces, activeNode) {
11
25
  var from = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
12
26
  var to = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : state.doc.content.size;
13
- var root = resolvedSurface.root,
14
- childrenMap = resolvedSurface.childrenMap;
15
- if (!root) {
27
+ var surfaces = resolvedSurfaces.flatMap(function (_ref2) {
28
+ var childrenMap = _ref2.childrenMap,
29
+ root = _ref2.root;
30
+ return root ? [{
31
+ childrenMap: childrenMap,
32
+ root: root
33
+ }] : [];
34
+ });
35
+ if (surfaces.length === 0) {
16
36
  return [];
17
37
  }
18
38
  var positions = [];
19
39
  var start = Math.max(0, from);
20
40
  var end = Math.min(state.doc.content.size, Math.max(start, to));
21
41
  state.doc.nodesBetween(start, end, function (node, position) {
22
- if (node.isBlock && willComponentRender(root, childrenMap, createSurfaceContextAtPosition(state, position, activeNode))) {
42
+ if (node.isBlock && willAnySurfaceRenderAt(surfaces, state, position, activeNode)) {
23
43
  positions.push(position);
24
44
  }
25
45
  });
@@ -28,25 +48,31 @@ export var getSurfaceNodePositions = function getSurfaceNodePositions(state, res
28
48
  var hasActiveNodeChanged = function hasActiveNodeChanged(previousActiveNode, activeNode) {
29
49
  return (previousActiveNode === null || previousActiveNode === void 0 ? void 0 : previousActiveNode.pos) !== (activeNode === null || activeNode === void 0 ? void 0 : activeNode.pos) || (previousActiveNode === null || previousActiveNode === void 0 ? void 0 : previousActiveNode.nodeType) !== (activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) || (previousActiveNode === null || previousActiveNode === void 0 ? void 0 : previousActiveNode.rootPos) !== (activeNode === null || activeNode === void 0 ? void 0 : activeNode.rootPos);
30
50
  };
31
- export var updateSurfaceNodePositions = function updateSurfaceNodePositions(_ref) {
32
- var activeNode = _ref.activeNode,
33
- currentPositions = _ref.currentPositions,
34
- from = _ref.from,
35
- newState = _ref.newState,
36
- previousActiveNode = _ref.previousActiveNode,
37
- resolvedSurface = _ref.resolvedSurface,
38
- to = _ref.to,
39
- tr = _ref.tr;
51
+ export var updateSurfaceNodePositions = function updateSurfaceNodePositions(_ref3) {
52
+ var activeNode = _ref3.activeNode,
53
+ currentPositions = _ref3.currentPositions,
54
+ from = _ref3.from,
55
+ newState = _ref3.newState,
56
+ previousActiveNode = _ref3.previousActiveNode,
57
+ resolvedSurfaces = _ref3.resolvedSurfaces,
58
+ to = _ref3.to,
59
+ tr = _ref3.tr;
40
60
  var activeNodeChanged = hasActiveNodeChanged(previousActiveNode, activeNode);
41
61
  if (!tr.docChanged && !activeNodeChanged) {
42
62
  return currentPositions;
43
63
  }
44
64
  var nextActiveNode = activeNode !== null && activeNode !== void 0 ? activeNode : undefined;
45
65
  if (activeNodeChanged) {
46
- return getSurfaceNodePositions(newState, resolvedSurface, nextActiveNode);
66
+ return getSurfaceNodePositions(newState, resolvedSurfaces, nextActiveNode);
47
67
  }
48
- var root = resolvedSurface.root,
49
- childrenMap = resolvedSurface.childrenMap;
68
+ var surfaces = resolvedSurfaces.flatMap(function (_ref4) {
69
+ var childrenMap = _ref4.childrenMap,
70
+ root = _ref4.root;
71
+ return root ? [{
72
+ childrenMap: childrenMap,
73
+ root: root
74
+ }] : [];
75
+ });
50
76
  var mappedPositions = currentPositions.map(function (position) {
51
77
  return tr.mapping.mapResult(position, -1);
52
78
  }).filter(function (result) {
@@ -55,9 +81,9 @@ export var updateSurfaceNodePositions = function updateSurfaceNodePositions(_ref
55
81
  return result.pos;
56
82
  }).filter(function (position) {
57
83
  var node = newState.doc.nodeAt(position);
58
- return Boolean((node === null || node === void 0 ? void 0 : node.isBlock) && root && willComponentRender(root, childrenMap, createSurfaceContextAtPosition(newState, position, nextActiveNode)));
84
+ return Boolean((node === null || node === void 0 ? void 0 : node.isBlock) && willAnySurfaceRenderAt(surfaces, newState, position, nextActiveNode));
59
85
  });
60
- var changedPositions = getSurfaceNodePositions(newState, resolvedSurface, nextActiveNode, from - 1, to + 1);
86
+ var changedPositions = getSurfaceNodePositions(newState, resolvedSurfaces, nextActiveNode, from - 1, to + 1);
61
87
  return Array.from(new Set([].concat(_toConsumableArray(mappedPositions), _toConsumableArray(changedPositions)))).sort(function (first, second) {
62
88
  return first - second;
63
89
  });
@@ -4,7 +4,7 @@ import { getBaseNodeTypeName } from '@atlaskit/editor-common/utils/node-type-uti
4
4
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
5
5
  import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
6
6
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
8
8
  export var isInsideTable = function isInsideTable(nodeType) {
9
9
  var _nodeType$schema$node = nodeType.schema.nodes,
10
10
  tableCell = _nodeType$schema$node.tableCell,
@@ -15,9 +15,9 @@ import { BLOCK_CONTROLS_LEFT_SURFACE } from '@atlaskit/editor-common/block-contr
15
15
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
16
16
  import { createSurfaceContext } from '@atlaskit/editor-ui-control-model/create-surface-context';
17
17
  import { getNodeTypeWithLevel } from '../pm-plugins/decorations-common';
18
- import { createBlockControlsSurfaceContext, createBlockControlsSurfaceContextForPosition } from './block-controls-surface-context';
19
18
  import { BlockControlsLeftSurface } from './block-controls-left-surface';
20
- import { getBlockControlsLeftSurfaceTargets } from './block-controls-left-surface-targets';
19
+ import { createBlockControlsSurfaceContext, createBlockControlsSurfaceContextForPosition } from './block-controls-surface-context';
20
+ import { getBlockControlsSurfaceTargets } from './block-controls-surface-targets';
21
21
  import { getNodeContentElement } from './utils/get-node-content-element';
22
22
  import { getAbsoluteSurfacePlacement, getSurfacePlacement } from './utils/get-surface-placement';
23
23
  var EMPTY_SURFACE_POSITIONS = [];
@@ -37,7 +37,7 @@ export var BlockControlsLeftSurfaces = function BlockControlsLeftSurfaces(_ref)
37
37
  surfaceNodePositions = _useSharedPluginState.surfaceNodePositions;
38
38
  var components = (_api$uiControlRegistr = (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(BLOCK_CONTROLS_LEFT_SURFACE)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : EMPTY_SURFACE_COMPONENTS;
39
39
  var targets = useMemo(function () {
40
- return getBlockControlsLeftSurfaceTargets(activeNode, surfaceNodePositions);
40
+ return getBlockControlsSurfaceTargets(activeNode, surfaceNodePositions);
41
41
  }, [activeNode, surfaceNodePositions]);
42
42
  var surfaces = useMemo(function () {
43
43
  return targets.flatMap(function (target) {
@@ -106,7 +106,8 @@ export var BlockControlsLeftSurfaces = function BlockControlsLeftSurfaces(_ref)
106
106
  nodeRect: targetElement.getBoundingClientRect(),
107
107
  nodeType: blockControlsContext.targetNode.type.name,
108
108
  nodeTypeWithLevel: getNodeTypeWithLevel(blockControlsContext.targetNode.node),
109
- parentNodeType: blockControlsContext.targetNode.parentType === 'doc' ? undefined : blockControlsContext.targetNode.parentType
109
+ parentNodeType: blockControlsContext.targetNode.parentType === 'doc' ? undefined : blockControlsContext.targetNode.parentType,
110
+ side: 'left'
110
111
  });
111
112
  nextPlacements.set(position, getAbsoluteSurfacePlacement({
112
113
  offsetParentRect: offsetParentRect,
@@ -0,0 +1,4 @@
1
+ ._zulpv77o{gap:var(--ds-space-025,2px)}._1e0c1txw{display:flex}
2
+ ._1pbyb4wl{z-index:100}
3
+ ._4cvr1h6o{align-items:center}
4
+ ._kqswstnw{position:absolute}
@@ -0,0 +1,38 @@
1
+ /* block-controls-right-surface.tsx generated by @compiled/babel-plugin v2.0.0 */
2
+ import "./block-controls-right-surface.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React from 'react';
5
+ import { BLOCK_CONTROLS_RIGHT_SURFACE } from '@atlaskit/editor-common/block-controls/surface-keys';
6
+ import { SurfaceRenderer, willSurfaceRender } from '@atlaskit/editor-ui-control-model/surface-renderer';
7
+ import { VisibilityContainer } from './visibility-container';
8
+ var rightSurfaceStyles = null;
9
+ /** Renders one right block-controls surface at a document position. */
10
+ export var BlockControlsRightSurface = function BlockControlsRightSurface(_ref) {
11
+ var api = _ref.api,
12
+ components = _ref.components,
13
+ forceVisibleOnMouseOut = _ref.forceVisibleOnMouseOut,
14
+ placement = _ref.placement,
15
+ source = _ref.source,
16
+ surfaceContext = _ref.surfaceContext;
17
+ if (!placement || !willSurfaceRender(components, BLOCK_CONTROLS_RIGHT_SURFACE, surfaceContext)) {
18
+ return null;
19
+ }
20
+ var surface = /*#__PURE__*/React.createElement(SurfaceRenderer, {
21
+ components: components,
22
+ surface: BLOCK_CONTROLS_RIGHT_SURFACE,
23
+ surfaceContext: surfaceContext
24
+ });
25
+ return /*#__PURE__*/React.createElement("div", {
26
+ "data-editor-block-controls-surface": true,
27
+ "data-testid": source === 'stored' ? 'block-controls-right-surface-stored' : source === 'active' ? 'block-controls-right-surface-active' : 'block-controls-right-surface'
28
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Placement is resolved from the target node's runtime DOM geometry.
29
+ ,
30
+ style: placement,
31
+ className: ax(["_zulpv77o _4cvr1h6o _1e0c1txw _kqswstnw _1pbyb4wl"])
32
+ }, /*#__PURE__*/React.createElement(VisibilityContainer, {
33
+ api: api,
34
+ controlSide: "right",
35
+ forceVisibleOnMouseOut: forceVisibleOnMouseOut,
36
+ shouldUseDisplayContents: true
37
+ }, surface));
38
+ };
@@ -0,0 +1,213 @@
1
+ /* block-controls-right-surfaces.tsx generated by @compiled/babel-plugin v2.0.0 */
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import { ax, ix } from "@compiled/react/runtime";
5
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
6
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
7
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
8
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
+ import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
11
+ import { bind } from 'bind-event-listener';
12
+ import { getDocument } from '@atlaskit/browser-apis';
13
+ import { BLOCK_CONTROL_UI_CONTEXT } from '@atlaskit/editor-common/block-controls/block-control-ui-context';
14
+ import { BLOCK_CONTROLS_RIGHT_SURFACE } from '@atlaskit/editor-common/block-controls/surface-keys';
15
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
16
+ import { createSurfaceContext } from '@atlaskit/editor-ui-control-model/types';
17
+ import { getNodeTypeWithLevel } from '../pm-plugins/decorations-common';
18
+ import { BlockControlsRightSurface } from './block-controls-right-surface';
19
+ import { createBlockControlsSurfaceContext, createBlockControlsSurfaceContextForPosition } from './block-controls-surface-context';
20
+ import { getBlockControlsSurfaceTargets } from './block-controls-surface-targets';
21
+ import { getNodeContentElement } from './utils/get-node-content-element';
22
+ import { getAbsoluteSurfacePlacement, getSurfacePlacement } from './utils/get-surface-placement';
23
+ var EMPTY_SURFACE_POSITIONS = [];
24
+ var EMPTY_SURFACE_COMPONENTS = [];
25
+ /**
26
+ * Registry-backed right surface tree. Mirrors the left surface's single-tree, measured-placement
27
+ * approach, but keeps its own components lookup, targets, placements and measurement lifecycle so
28
+ * the right surface never depends on the left surface's render pass.
29
+ */
30
+ export var BlockControlsRightSurfaces = function BlockControlsRightSurfaces(_ref) {
31
+ var _api$uiControlRegistr, _api$uiControlRegistr2;
32
+ var api = _ref.api,
33
+ editorView = _ref.editorView;
34
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['blockControls'], function (states) {
35
+ var _states$blockControls, _states$blockControls2, _states$blockControls3;
36
+ return {
37
+ activeNode: (_states$blockControls = states.blockControlsState) === null || _states$blockControls === void 0 ? void 0 : _states$blockControls.activeNode,
38
+ surfaceNodePositions: (_states$blockControls2 = (_states$blockControls3 = states.blockControlsState) === null || _states$blockControls3 === void 0 ? void 0 : _states$blockControls3.surfaceNodePositions) !== null && _states$blockControls2 !== void 0 ? _states$blockControls2 : EMPTY_SURFACE_POSITIONS
39
+ };
40
+ }),
41
+ activeNode = _useSharedPluginState.activeNode,
42
+ surfaceNodePositions = _useSharedPluginState.surfaceNodePositions;
43
+ var components = (_api$uiControlRegistr = (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(BLOCK_CONTROLS_RIGHT_SURFACE)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : EMPTY_SURFACE_COMPONENTS;
44
+ var targets = useMemo(function () {
45
+ return getBlockControlsSurfaceTargets(activeNode, surfaceNodePositions);
46
+ }, [activeNode, surfaceNodePositions]);
47
+ var surfaces = useMemo(function () {
48
+ return targets.flatMap(function (target) {
49
+ var context = target.source === 'stored' ? createBlockControlsSurfaceContextForPosition(editorView.state, target.position, activeNode) : createBlockControlsSurfaceContext(editorView, activeNode, target.source);
50
+ if (!context) {
51
+ return [];
52
+ }
53
+ var surfaceContext = createSurfaceContext(BLOCK_CONTROL_UI_CONTEXT, context);
54
+ return [_objectSpread(_objectSpread({}, target), {}, {
55
+ blockControlsContext: context,
56
+ surfaceContext: surfaceContext
57
+ })];
58
+ });
59
+ }, [activeNode, editorView, targets]);
60
+ var _useState = useState(new Map()),
61
+ _useState2 = _slicedToArray(_useState, 2),
62
+ placements = _useState2[0],
63
+ setPlacements = _useState2[1];
64
+ var animationFrameRef = useRef(undefined);
65
+ useLayoutEffect(function () {
66
+ var _getDocument;
67
+ if (surfaces.length === 0) {
68
+ setPlacements(new Map());
69
+ return;
70
+ }
71
+ var measurementTargets = surfaces.flatMap(function (_ref2) {
72
+ var blockControlsContext = _ref2.blockControlsContext,
73
+ position = _ref2.position;
74
+ var targetNodeElement = editorView.nodeDOM(blockControlsContext.targetNode.pos);
75
+ var targetElementRoot = targetNodeElement instanceof HTMLElement ? targetNodeElement : targetNodeElement === null || targetNodeElement === void 0 ? void 0 : targetNodeElement.parentElement;
76
+ if (!targetElementRoot) {
77
+ return [];
78
+ }
79
+ return [{
80
+ blockControlsContext: blockControlsContext,
81
+ position: position,
82
+ targetElement: getNodeContentElement(targetElementRoot, blockControlsContext.targetNode.type.name),
83
+ targetElementRoot: targetElementRoot
84
+ }];
85
+ });
86
+ var offsetParent = editorView.dom.offsetParent;
87
+ var isDocumentOffsetParent = !offsetParent || offsetParent === ((_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.body);
88
+ var scrollingOffsetParent = offsetParent instanceof HTMLElement && !isDocumentOffsetParent ? offsetParent : undefined;
89
+ var updatePositions = function updatePositions() {
90
+ var _scrollingOffsetParen, _scrollingOffsetParen2;
91
+ animationFrameRef.current = undefined;
92
+ var offsetParentRect = offsetParent === null || offsetParent === void 0 ? void 0 : offsetParent.getBoundingClientRect();
93
+ var offsetParentScrollTop = (_scrollingOffsetParen = scrollingOffsetParent === null || scrollingOffsetParent === void 0 ? void 0 : scrollingOffsetParent.scrollTop) !== null && _scrollingOffsetParen !== void 0 ? _scrollingOffsetParen : window.scrollY;
94
+ var offsetParentScrollLeft = (_scrollingOffsetParen2 = scrollingOffsetParent === null || scrollingOffsetParent === void 0 ? void 0 : scrollingOffsetParent.scrollLeft) !== null && _scrollingOffsetParen2 !== void 0 ? _scrollingOffsetParen2 : window.scrollX;
95
+ var nextPlacements = new Map();
96
+ var _iterator = _createForOfIteratorHelper(measurementTargets),
97
+ _step;
98
+ try {
99
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
100
+ var _targetElementRoot$ge;
101
+ var _step$value = _step.value,
102
+ blockControlsContext = _step$value.blockControlsContext,
103
+ position = _step$value.position,
104
+ targetElement = _step$value.targetElement,
105
+ targetElementRoot = _step$value.targetElementRoot;
106
+ if (!targetElementRoot.isConnected || !targetElement.isConnected) {
107
+ continue;
108
+ }
109
+ var placement = getSurfacePlacement({
110
+ layout: (_targetElementRoot$ge = targetElementRoot.getAttribute('layout')) !== null && _targetElementRoot$ge !== void 0 ? _targetElementRoot$ge : '',
111
+ nodeRect: targetElement.getBoundingClientRect(),
112
+ nodeType: blockControlsContext.targetNode.type.name,
113
+ nodeTypeWithLevel: getNodeTypeWithLevel(blockControlsContext.targetNode.node),
114
+ parentNodeType: blockControlsContext.targetNode.parentType === 'doc' ? undefined : blockControlsContext.targetNode.parentType,
115
+ side: 'right'
116
+ });
117
+ nextPlacements.set(position, getAbsoluteSurfacePlacement({
118
+ offsetParentRect: offsetParentRect,
119
+ offsetParentScrollLeft: offsetParentScrollLeft,
120
+ offsetParentScrollTop: offsetParentScrollTop,
121
+ placement: placement
122
+ }));
123
+ }
124
+ } catch (err) {
125
+ _iterator.e(err);
126
+ } finally {
127
+ _iterator.f();
128
+ }
129
+ setPlacements(nextPlacements);
130
+ };
131
+ var schedulePositionUpdate = function schedulePositionUpdate() {
132
+ if (animationFrameRef.current === undefined) {
133
+ animationFrameRef.current = requestAnimationFrame(updatePositions);
134
+ }
135
+ };
136
+ updatePositions();
137
+ var resizeObserver = new ResizeObserver(schedulePositionUpdate);
138
+ var observedElements = new Set([editorView.dom]);
139
+ var _iterator2 = _createForOfIteratorHelper(measurementTargets),
140
+ _step2;
141
+ try {
142
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
143
+ var targetElement = _step2.value.targetElement;
144
+ observedElements.add(targetElement);
145
+ }
146
+ } catch (err) {
147
+ _iterator2.e(err);
148
+ } finally {
149
+ _iterator2.f();
150
+ }
151
+ if (offsetParent instanceof HTMLElement) {
152
+ observedElements.add(offsetParent);
153
+ }
154
+ observedElements.forEach(function (element) {
155
+ return resizeObserver.observe(element);
156
+ });
157
+ var unbindWindowResize = bind(window, {
158
+ type: 'resize',
159
+ listener: schedulePositionUpdate
160
+ });
161
+ var unbindWindowScroll = bind(window, {
162
+ type: 'scroll',
163
+ listener: schedulePositionUpdate,
164
+ options: {
165
+ capture: true,
166
+ passive: true
167
+ }
168
+ });
169
+ var visualViewport = window.visualViewport;
170
+ var unbindVisualViewportResize = visualViewport ? bind(visualViewport, {
171
+ type: 'resize',
172
+ listener: schedulePositionUpdate
173
+ }) : undefined;
174
+ var unbindVisualViewportScroll = visualViewport ? bind(visualViewport, {
175
+ type: 'scroll',
176
+ listener: schedulePositionUpdate
177
+ }) : undefined;
178
+ var unbindTransitionEnd = bind(editorView.dom, {
179
+ type: 'transitionend',
180
+ listener: schedulePositionUpdate,
181
+ options: {
182
+ capture: true
183
+ }
184
+ });
185
+ return function () {
186
+ if (animationFrameRef.current !== undefined) {
187
+ cancelAnimationFrame(animationFrameRef.current);
188
+ animationFrameRef.current = undefined;
189
+ }
190
+ resizeObserver.disconnect();
191
+ unbindWindowResize();
192
+ unbindWindowScroll();
193
+ unbindVisualViewportResize === null || unbindVisualViewportResize === void 0 || unbindVisualViewportResize();
194
+ unbindVisualViewportScroll === null || unbindVisualViewportScroll === void 0 || unbindVisualViewportScroll();
195
+ unbindTransitionEnd();
196
+ };
197
+ }, [editorView, surfaces]);
198
+ return /*#__PURE__*/React.createElement(React.Fragment, null, surfaces.map(function (_ref3) {
199
+ var _activeNode$handleOpt;
200
+ var position = _ref3.position,
201
+ source = _ref3.source,
202
+ surfaceContext = _ref3.surfaceContext;
203
+ return /*#__PURE__*/React.createElement(BlockControlsRightSurface, {
204
+ api: api,
205
+ components: components,
206
+ forceVisibleOnMouseOut: Boolean(activeNode === null || activeNode === void 0 || (_activeNode$handleOpt = activeNode.handleOptions) === null || _activeNode$handleOpt === void 0 ? void 0 : _activeNode$handleOpt.isFocused),
207
+ key: position,
208
+ placement: placements.get(position),
209
+ source: source,
210
+ surfaceContext: surfaceContext
211
+ });
212
+ }));
213
+ };
@@ -1,14 +1,14 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getBlockControlsLeftSurfaceTargets = void 0;
7
1
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
8
2
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
3
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
- /** Combines hover-driven and stored surface positions into one deduplicated list. */
11
- var getBlockControlsLeftSurfaceTargets = exports.getBlockControlsLeftSurfaceTargets = function getBlockControlsLeftSurfaceTargets(activeNode, storedPositions) {
4
+ /**
5
+ * Combines hover-driven and stored surface positions into one deduplicated list.
6
+ * Shared by both the left and right surfaces: this is pure position bookkeeping with no
7
+ * surface-specific behavior, so there's nothing to keep independent between them. What *is*
8
+ * kept independent is each surface's own React tree (component lookup, measurement effects,
9
+ * observers) — see block-controls-left-surfaces.tsx / block-controls-right-surfaces.tsx.
10
+ */
11
+ export var getBlockControlsSurfaceTargets = function getBlockControlsSurfaceTargets(activeNode, storedPositions) {
12
12
  var targetsByPosition = new Map();
13
13
  var _iterator = _createForOfIteratorHelper(storedPositions),
14
14
  _step;
@@ -7,7 +7,7 @@ import { akEditorUnitZIndex, akRichMediaResizeZIndex } from '@atlaskit/editor-sh
7
7
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
8
8
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
9
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
10
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
11
11
  export var ACTIVE_DRAG_HANDLE_ATTR = 'data-active-drag-handle';
12
12
  export var ACTIVE_QUICK_INSERT_ATTR = 'data-active-quick-insert';
13
13
  export var BLOCK_CONTROLS_SURFACE_SELECTOR = '[data-editor-block-controls-surface]';
@@ -23,6 +23,7 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
23
23
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
24
24
  import { akEditorFullPageNarrowBreakout, akEditorTableToolbarSize, relativeSizeToBaseFontSize } from '@atlaskit/editor-shared-styles/consts';
25
25
  import DragHandleVerticalIcon from '@atlaskit/icon/core/drag-handle-vertical';
26
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
26
27
  import { fg } from '@atlaskit/platform-feature-flags/fg';
27
28
  import { draggable } from '@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter';
28
29
  import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/utils/set-custom-native-drag-preview';
@@ -30,7 +31,7 @@ import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/ut
30
31
  import { Box, xcss } from '@atlaskit/primitives';
31
32
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
32
33
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
33
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
34
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
34
35
  import Tooltip from '@atlaskit/tooltip/Tooltip';
35
36
  import { getNodeTypeWithLevel } from '../pm-plugins/decorations-common';
36
37
  import { key } from '../pm-plugins/main';
@@ -975,7 +976,7 @@ export var DragHandle = function DragHandle(_ref2) {
975
976
  }, [isReliableAnchorEnabled, calculatePositionOld, view.dom, anchorName, nodeType, docDepForReliableAnchor]);
976
977
  var isHandleShown = positionStylesOld.display !== 'none';
977
978
  useEffect(function () {
978
- if (fg('nike_r19_render_unmount')) {
979
+ if (isExperimentEnabled('platform_editor_react19_migration')) {
979
980
  return;
980
981
  }
981
982
  if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current) {
@@ -990,7 +991,7 @@ export var DragHandle = function DragHandle(_ref2) {
990
991
  }
991
992
  }, [buttonRef, handleOptions === null || handleOptions === void 0 ? void 0 : handleOptions.isFocused, view]);
992
993
  useEffect(function () {
993
- if (!fg('nike_r19_render_unmount')) {
994
+ if (!isExperimentEnabled('platform_editor_react19_migration')) {
994
995
  return;
995
996
  }
996
997
  if (!(handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && isHandleShown && buttonRef.current)) {
@@ -14,7 +14,7 @@ import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indi
14
14
  import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter';
15
15
  import { layers } from '@atlaskit/theme/constants';
16
16
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
17
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
17
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
18
18
  import { getNodeAnchor } from '../pm-plugins/decorations-common';
19
19
  import { useActiveAnchorTracker } from '../pm-plugins/utils/active-anchor-tracker';
20
20
  import { isAnchorSupported } from '../pm-plugins/utils/anchor-utils';
@@ -11,7 +11,7 @@ import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-che
11
11
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
12
12
  import { akEditorBreakoutPadding, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorFullPageNarrowBreakout, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced } from '@atlaskit/editor-shared-styles';
13
13
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
14
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
14
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
15
15
  import { ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME, ACTIVE_QUICK_INSERT_FALLBACK_ANCHOR_NAME, DRAG_HANDLE_MAX_WIDTH_PLUS_GAP } from './consts';
16
16
  import { NODE_ANCHOR_ATTR_NAME } from './utils/dom-attr-name';
17
17