@atlaskit/editor-plugin-block-controls 32.0.0 → 33.0.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 (29) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/blockControlsPlugin.js +11 -17
  3. package/dist/cjs/pm-plugins/decorations-drag-handle.js +16 -54
  4. package/dist/cjs/pm-plugins/handle-mouse-over.js +2 -2
  5. package/dist/cjs/pm-plugins/interaction-tracking/pm-plugin.js +12 -16
  6. package/dist/cjs/pm-plugins/main.js +27 -30
  7. package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +2 -5
  8. package/dist/cjs/pm-plugins/utils/transactions.js +1 -1
  9. package/dist/cjs/ui/drag-handle.js +38 -173
  10. package/dist/cjs/ui/global-styles.js +3 -3
  11. package/dist/es2019/blockControlsPlugin.js +9 -15
  12. package/dist/es2019/pm-plugins/decorations-drag-handle.js +16 -55
  13. package/dist/es2019/pm-plugins/handle-mouse-over.js +2 -2
  14. package/dist/es2019/pm-plugins/interaction-tracking/pm-plugin.js +5 -9
  15. package/dist/es2019/pm-plugins/main.js +29 -32
  16. package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +2 -5
  17. package/dist/es2019/pm-plugins/utils/transactions.js +1 -1
  18. package/dist/es2019/ui/drag-handle.js +16 -151
  19. package/dist/es2019/ui/global-styles.js +3 -3
  20. package/dist/esm/blockControlsPlugin.js +11 -17
  21. package/dist/esm/pm-plugins/decorations-drag-handle.js +15 -55
  22. package/dist/esm/pm-plugins/handle-mouse-over.js +2 -2
  23. package/dist/esm/pm-plugins/interaction-tracking/pm-plugin.js +12 -16
  24. package/dist/esm/pm-plugins/main.js +27 -30
  25. package/dist/esm/pm-plugins/utils/drag-handle-positions.js +2 -5
  26. package/dist/esm/pm-plugins/utils/transactions.js +1 -1
  27. package/dist/esm/ui/drag-handle.js +40 -175
  28. package/dist/esm/ui/global-styles.js +3 -3
  29. package/package.json +21 -21
@@ -7,7 +7,6 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
7
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
8
8
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
9
9
  import { UNSAFE_expValNoExposure } from '@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure';
10
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
11
10
  import { RIGHT_MARGIN_ROVO_GAP_PX } from './constants';
12
11
  import { handleKeyDown } from './handle-key-down';
13
12
  import { handleMouseEnter, handleMouseLeave, handleMouseMove } from './handle-mouse-move';
@@ -64,13 +63,10 @@ export var createInteractionTrackingPlugin = function createInteractionTrackingP
64
63
  key: interactionTrackingPluginKey,
65
64
  state: {
66
65
  init: function init() {
67
- var state = {
68
- isEditing: false
66
+ return {
67
+ isEditing: false,
68
+ isMouseOut: false
69
69
  };
70
- if (editorExperiment('platform_editor_controls', 'variant1')) {
71
- state.isMouseOut = false;
72
- }
73
- return state;
74
70
  },
75
71
  apply: function apply(tr, pluginState) {
76
72
  var meta = tr.getMeta(interactionTrackingPluginKey);
@@ -110,8 +106,8 @@ export var createInteractionTrackingPlugin = function createInteractionTrackingP
110
106
  }
111
107
  }
112
108
  },
113
- view: editorExperiment('platform_editor_controls', 'variant1') ? function (view) {
114
- var editorContentArea = view.dom.closest('.ak-editor-content-area');
109
+ view: function view(_view) {
110
+ var editorContentArea = _view.dom.closest('.ak-editor-content-area');
115
111
  var unbindMouseEnter;
116
112
  var unbindMouseLeave;
117
113
  var unbindDocumentMouseMove;
@@ -145,7 +141,7 @@ export var createInteractionTrackingPlugin = function createInteractionTrackingP
145
141
  return;
146
142
  }
147
143
  }
148
- handleMouseLeave(view, rightSideControlsEnabled);
144
+ handleMouseLeave(_view, rightSideControlsEnabled);
149
145
  }, MOUSE_LEAVE_DEBOUNCE_MS);
150
146
  };
151
147
  var cancelScheduledMouseLeave = function cancelScheduledMouseLeave() {
@@ -163,7 +159,7 @@ export var createInteractionTrackingPlugin = function createInteractionTrackingP
163
159
  var isOverKnownHoverTarget = (editorContentArea === null || editorContentArea === void 0 ? void 0 : editorContentArea.contains(event.target)) || isMovingToBlockControlsArea(event.target);
164
160
  var overClickArea = event.target instanceof Element && !!event.target.closest(CLICK_AREA_SELECTOR);
165
161
  if (isOverKnownHoverTarget || overClickArea) {
166
- handleMouseMove(view, event, rightSideControlsEnabled, api);
162
+ handleMouseMove(_view, event, rightSideControlsEnabled, api);
167
163
  }
168
164
  };
169
165
  var handleTreatmentDocumentMouseMove = function handleTreatmentDocumentMouseMove(event) {
@@ -174,8 +170,8 @@ export var createInteractionTrackingPlugin = function createInteractionTrackingP
174
170
  y: event.clientY
175
171
  };
176
172
  cancelScheduledMouseLeave();
177
- if (!((_interactionTrackingP = interactionTrackingPluginKey.getState(view.state)) !== null && _interactionTrackingP !== void 0 && _interactionTrackingP.isMouseOut)) {
178
- handleMouseLeave(view, rightSideControlsEnabled);
173
+ if (!((_interactionTrackingP = interactionTrackingPluginKey.getState(_view.state)) !== null && _interactionTrackingP !== void 0 && _interactionTrackingP.isMouseOut)) {
174
+ handleMouseLeave(_view, rightSideControlsEnabled);
179
175
  }
180
176
  return;
181
177
  }
@@ -209,7 +205,7 @@ export var createInteractionTrackingPlugin = function createInteractionTrackingP
209
205
  if (rightSideControlsEnabled) {
210
206
  cancelScheduledMouseLeave();
211
207
  }
212
- handleMouseEnter(view);
208
+ handleMouseEnter(_view);
213
209
  }
214
210
  });
215
211
  unbindMouseLeave = bind(editorContentArea, {
@@ -223,7 +219,7 @@ export var createInteractionTrackingPlugin = function createInteractionTrackingP
223
219
  if (rightSideControlsEnabled) {
224
220
  scheduleMouseLeave(e);
225
221
  } else {
226
- handleMouseLeave(view, false);
222
+ handleMouseLeave(_view, false);
227
223
  }
228
224
  }
229
225
  });
@@ -240,7 +236,7 @@ export var createInteractionTrackingPlugin = function createInteractionTrackingP
240
236
  (_unbindMouseLeave = unbindMouseLeave) === null || _unbindMouseLeave === void 0 || _unbindMouseLeave();
241
237
  }
242
238
  };
243
- } : undefined
239
+ }
244
240
  });
245
241
  };
246
242
  export var getInteractionTrackingState = function getInteractionTrackingState(state) {
@@ -295,7 +295,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
295
295
  decorations = decorations.map(tr.mapping, tr.doc);
296
296
  }
297
297
 
298
- // platform_editor_controls note: enables quick insert
298
+ // enables quick insert
299
299
  // don't remap activeNode if it's being dragged
300
300
  if (!flags.toolbarFlagsEnabled) {
301
301
  if (activeNode) {
@@ -312,7 +312,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
312
312
  var _mappedRootPos$pos, _mappedRootPos;
313
313
  var _mappedPos;
314
314
  var browser = getBrowserInfo();
315
- // In safari, when platform_editor_controls is on,
315
+ // In safari,
316
316
  // sometimes the drag handle for the layout disppears after you click on the handle for a few times
317
317
  // Which caused the drag handle onClick event not firing, then block menu wouldn't be opened
318
318
  // This is caused by the mappedPos.deletedAfter sometimes returning true in webkit browsers even though the active node still exists
@@ -394,7 +394,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
394
394
  var newNodeDecs = nodeDecorations(newState, isDecSetEmpty ? undefined : from, isDecSetEmpty ? undefined : to);
395
395
  decorations = decorations.add(newState.doc, newNodeDecs);
396
396
 
397
- // platform_editor_controls note: enables quick insert
397
+ // enables quick insert
398
398
  if (!flags.toolbarFlagsEnabled) {
399
399
  if (latestActiveNode && !isActiveNodeDeleted) {
400
400
  // Find the newly minted node decs that touch the active node
@@ -453,7 +453,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
453
453
  // If the active node is missing, we need to remove the handle
454
454
  var shouldRemoveHandle = latestActiveNode ? isResizerResizing || isActiveNodeDeleted && !isReplacedWithSameSize || (meta === null || meta === void 0 ? void 0 : meta.nodeMoved) : true;
455
455
 
456
- // platform_editor_controls note: enables quick insert
456
+ // enables quick insert
457
457
  if (flags.toolbarFlagsEnabled) {
458
458
  // Remove handle dec when editor is blurred
459
459
  shouldRemoveHandle = shouldRemoveHandle || (meta === null || meta === void 0 ? void 0 : meta.editorBlurred);
@@ -491,7 +491,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
491
491
  // quick-insert button, so this must not be gated by quickInsertButtonEnabled — otherwise a
492
492
  // stale decoration is left behind whenever platform_editor_block_control_migration is on.
493
493
  if (flags.toolbarFlagsEnabled) {
494
- // platform_editor_controls note: enables quick insert
494
+ // enables quick insert
495
495
  if (quickInsertButtonEnabled) {
496
496
  var _activeNode7, _activeNode8;
497
497
  var oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.rootPos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.rootPos);
@@ -616,7 +616,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
616
616
  }
617
617
  }
618
618
  if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined && (quickInsertButtonEnabled || nodeDecorationRegistry.length > 0) &&
619
- // platform_editor_controls note: enables quick insert
619
+ // enables quick insert
620
620
  flags.toolbarFlagsEnabled && (!rightSideControlsEnabled || !isViewMode)) {
621
621
  var _latestActiveNode1;
622
622
  if (quickInsertButtonEnabled) {
@@ -836,7 +836,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
836
836
  }
837
837
  }
838
838
  var newActiveNode;
839
- // platform_editor_controls note: enables quick insert
839
+ // enables quick insert
840
840
  if (flags.toolbarFlagsEnabled) {
841
841
  var _latestActiveNode11, _latestActiveNode12;
842
842
  // remove isEmptyDoc check and let decorations render and determine their own visibility
@@ -1111,7 +1111,7 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
1111
1111
  if (api !== null && api !== void 0 && (_api$limitedMode8 = api.limitedMode) !== null && _api$limitedMode8 !== void 0 && (_api$limitedMode8 = _api$limitedMode8.sharedState.currentState()) !== null && _api$limitedMode8 !== void 0 && _api$limitedMode8.enabled) {
1112
1112
  return;
1113
1113
  }
1114
- return editorExperiment('platform_editor_controls', 'variant1') ? handleMouseDown(api)(view, event) : undefined;
1114
+ return handleMouseDown(api)(view, event);
1115
1115
  },
1116
1116
  keydown: function keydown(view, event) {
1117
1117
  var _api$limitedMode9;
@@ -1125,11 +1125,11 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
1125
1125
  return true;
1126
1126
  }
1127
1127
  }
1128
- if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && editorExperiment('platform_editor_controls', 'variant1')) {
1128
+ if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement) {
1129
1129
  var isDragHandle = event.target.closest(DRAG_HANDLE_SELECTOR) !== null;
1130
1130
  api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
1131
1131
  }
1132
- if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')) {
1132
+ if (event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') {
1133
1133
  var _api$blockControls$sh2, _api$blockControls$sh3;
1134
1134
  var isBlockMenuOpen = api === null || api === void 0 || (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.isMenuOpen;
1135
1135
  // when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
@@ -1141,32 +1141,29 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
1141
1141
  return false;
1142
1142
  },
1143
1143
  blur: function blur(view, event) {
1144
- var _api$limitedMode0;
1144
+ var _api$limitedMode0, _api$core2;
1145
1145
  if (api !== null && api !== void 0 && (_api$limitedMode0 = api.limitedMode) !== null && _api$limitedMode0 !== void 0 && (_api$limitedMode0 = _api$limitedMode0.sharedState.currentState()) !== null && _api$limitedMode0 !== void 0 && _api$limitedMode0.enabled) {
1146
1146
  return;
1147
1147
  }
1148
- if (editorExperiment('platform_editor_controls', 'variant1')) {
1149
- var _api$core2;
1150
- // Focus moving into the registry surface remains inside the editor experience.
1151
- var isChildOfSurface = isExperimentEnabled('platform_editor_block_control_migration') && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest(BLOCK_CONTROLS_SURFACE_SELECTOR) !== null;
1152
- var shouldPreserveRemixInlineDropdownFocus = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('[data-editor-remix-inline-dropdown-preserve-focus]') !== null;
1153
- var isChildOfEditor = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest("#".concat(EDIT_AREA_ID)) !== null;
1148
+ // Focus moving into the registry surface remains inside the editor experience.
1149
+ var isChildOfSurface = isExperimentEnabled('platform_editor_block_control_migration') && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest(BLOCK_CONTROLS_SURFACE_SELECTOR) !== null;
1150
+ var shouldPreserveRemixInlineDropdownFocus = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('[data-editor-remix-inline-dropdown-preserve-focus]') !== null;
1151
+ var isChildOfEditor = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest("#".concat(EDIT_AREA_ID)) !== null;
1154
1152
 
1155
- // don't do anything if the event relatedTarget (the element receiving focus) is a child of the editor
1156
- // or if the editor has focus
1157
- if (isChildOfEditor || isChildOfSurface || shouldPreserveRemixInlineDropdownFocus || view.hasFocus()) {
1158
- return false;
1159
- }
1160
- api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref6) {
1161
- var tr = _ref6.tr;
1162
- var currMeta = tr.getMeta(key);
1163
- tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
1164
- editorBlurred: true
1165
- }));
1166
- return tr;
1167
- });
1153
+ // don't do anything if the event relatedTarget (the element receiving focus) is a child of the editor
1154
+ // or if the editor has focus
1155
+ if (isChildOfEditor || isChildOfSurface || shouldPreserveRemixInlineDropdownFocus || view.hasFocus()) {
1168
1156
  return false;
1169
1157
  }
1158
+ api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref6) {
1159
+ var tr = _ref6.tr;
1160
+ var currMeta = tr.getMeta(key);
1161
+ tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
1162
+ editorBlurred: true
1163
+ }));
1164
+ return tr;
1165
+ });
1166
+ return false;
1170
1167
  }
1171
1168
  }
1172
1169
  },
@@ -60,7 +60,7 @@ var getStickyNodes = memoizeOne(function () {
60
60
  return [].concat(STICKY_NODES, _toConsumableArray(expValEquals('confluence_native_tabs_experiment', 'isEnabled', true) ? ['multiBodiedExtension'] : []));
61
61
  });
62
62
  export var shouldBeSticky = function shouldBeSticky(nodeType) {
63
- return editorExperiment('platform_editor_controls', 'variant1') && getStickyNodes().includes(nodeType);
63
+ return getStickyNodes().includes(nodeType);
64
64
  };
65
65
  export var getControlBottomCSSValue = function getControlBottomCSSValue(anchor, isSticky, isTopLevelNode, isLayoutColumn, fallbackAnchor) {
66
66
  if (expValEquals('platform_editor_controls_reliable_anchor', 'isEnabled', true)) {
@@ -84,8 +84,5 @@ export var getControlHeightCSSValue = function getControlHeightCSSValue(nodeHeig
84
84
  };
85
85
  };
86
86
  export var shouldMaskNodeControls = function shouldMaskNodeControls(nodeType, isTopLevelNode) {
87
- return (
88
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
89
- isTopLevelNode && ['table'].includes(nodeType) && editorExperiment('platform_editor_controls', 'variant1')
90
- );
87
+ return isTopLevelNode && ['table'].includes(nodeType);
91
88
  };
@@ -58,7 +58,7 @@ export var getTrMetadata = function getTrMetadata(tr, flags) {
58
58
  }
59
59
  // Fixes drag handle and quick insert button overlap issues
60
60
  if (flags.toolbarFlagsEnabled) {
61
- // platform_editor_controls note: fixes drag handle and quick insert button overlap issues
61
+ // fixes drag handle and quick insert button overlap issues
62
62
  isReplacedWithSameSize = isStepContentReplacedWithAnotherOfSameSize(s);
63
63
  }
64
64
  var mappedTo = tr.mapping.map(s.to);
@@ -1,6 +1,5 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
3
  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; }
5
4
  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; }
6
5
  /**
@@ -15,13 +14,13 @@ import { bind } from 'bind-event-listener';
15
14
  import { getDocument } from '@atlaskit/browser-apis';
16
15
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
17
16
  import { getBrowserInfo } from '@atlaskit/editor-common/browser';
18
- import { dragToMoveDown, dragToMoveLeft, dragToMoveRight, dragToMoveUp, getAriaKeyshortcuts, TooltipContentWithMultipleShortcuts } from '@atlaskit/editor-common/keymaps';
17
+ import { TooltipContentWithMultipleShortcuts } from '@atlaskit/editor-common/keymaps';
19
18
  import { messages as blockControlsMessages } from '@atlaskit/editor-common/messages/block-controls';
20
19
  import { DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles/drag-handle';
21
20
  import { tableControlsSpacing } from '@atlaskit/editor-common/styles/table';
22
21
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
23
22
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
24
- import { akEditorFullPageNarrowBreakout, akEditorTableToolbarSize, relativeSizeToBaseFontSize } from '@atlaskit/editor-shared-styles/constants';
23
+ import { akEditorTableToolbarSize, relativeSizeToBaseFontSize } from '@atlaskit/editor-shared-styles/constants';
25
24
  import DragHandleVerticalIcon from '@atlaskit/icon/core/drag-handle-vertical';
26
25
  import { fg } from '@atlaskit/platform-feature-flags/fg';
27
26
  import { draggable } from '@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter';
@@ -94,11 +93,6 @@ var buttonWrapperStylesPatch = css({
94
93
  paddingRight: akEditorTableToolbarSize
95
94
  }
96
95
  });
97
-
98
- // update color to match quick insert button for new editor controls
99
- var dragHandleColor = css({
100
- color: "var(--ds-icon-subtle, #505258)"
101
- });
102
96
  var dragHandleButtonStyles = css({
103
97
  display: 'flex',
104
98
  boxSizing: 'border-box',
@@ -113,8 +107,7 @@ var dragHandleButtonStyles = css({
113
107
  background: 'transparent',
114
108
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
115
109
  borderRadius: DRAG_HANDLE_BORDER_RADIUS,
116
- // when platform_editor_controls is enabled, the drag handle color is overridden. Update color here when experiment is cleaned up.
117
- color: "var(--ds-icon, #292A2E)",
110
+ color: "var(--ds-icon-subtle, #505258)",
118
111
  cursor: 'grab',
119
112
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
120
113
  zIndex: DRAG_HANDLE_ZINDEX,
@@ -143,52 +136,6 @@ var dragHandleButtonScaledStyles = css({
143
136
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
144
137
  width: relativeSizeToBaseFontSize(DRAG_HANDLE_WIDTH)
145
138
  });
146
- var dragHandleButtonSmallScreenStyles = css(_defineProperty({}, "@container editor-area (max-width: ".concat(akEditorFullPageNarrowBreakout, "px)"), {
147
- opacity: 0,
148
- visibility: 'hidden'
149
- }));
150
- var dragHandleButtonStylesOld = css({
151
- position: 'absolute',
152
- paddingTop: "var(--ds-space-025, 2px)",
153
- paddingBottom: "var(--ds-space-025, 2px)",
154
- paddingLeft: '0',
155
- paddingRight: '0',
156
- boxSizing: 'border-box',
157
- display: 'flex',
158
- flexDirection: 'column',
159
- justifyContent: 'center',
160
- alignItems: 'center',
161
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
162
- height: DRAG_HANDLE_HEIGHT,
163
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
164
- width: DRAG_HANDLE_WIDTH,
165
- border: 'none',
166
- background: 'transparent',
167
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
168
- borderRadius: DRAG_HANDLE_BORDER_RADIUS,
169
- // when platform_editor_controls is enabled, the drag handle color is overridden. Update color here when experiment is cleaned up.
170
- color: "var(--ds-icon, #292A2E)",
171
- cursor: 'grab',
172
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
173
- zIndex: DRAG_HANDLE_ZINDEX,
174
- outline: 'none',
175
- '&:hover': {
176
- backgroundColor: "var(--ds-background-neutral-subtle-hovered, #0515240F)"
177
- },
178
- '&:active': {
179
- backgroundColor: "var(--ds-background-neutral-subtle-pressed, #0B120E24)"
180
- },
181
- '&:focus': {
182
- outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #4688EC)")
183
- },
184
- '&:disabled': {
185
- color: "var(--ds-icon-disabled, #080F214A)",
186
- backgroundColor: 'transparent'
187
- },
188
- '&:hover:disabled': {
189
- backgroundColor: "var(--ds-background-disabled, #0515240F)"
190
- }
191
- });
192
139
  var focusedStyles = css({
193
140
  '&:focus-visible': {
194
141
  outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #4688EC)")
@@ -736,11 +683,11 @@ export var DragHandle = function DragHandle(_ref2) {
736
683
  var nodeTypeWithLevel = $pos !== null && $pos !== void 0 && (_$pos$nodeAfter = $pos.nodeAfter) !== null && _$pos$nodeAfter !== void 0 && _$pos$nodeAfter.isBlock ? getNodeTypeWithLevel($pos.nodeAfter) : nodeType;
737
684
  var parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
738
685
  var supportsAnchor = CSS.supports('top', "anchor(".concat(anchorName, " start)")) && CSS.supports('left', "anchor(".concat(anchorName, " start)"));
739
- var safeAnchorName = editorExperiment('platform_editor_controls', 'variant1') ? refreshAnchorName({
686
+ var safeAnchorName = refreshAnchorName({
740
687
  getPos: getPos,
741
688
  view: view,
742
689
  anchorName: anchorName
743
- }) : anchorName;
690
+ });
744
691
  var dom = view.dom.querySelector("[".concat(getAnchorAttrName(), "=\"").concat(safeAnchorName, "\"]"));
745
692
 
746
693
  // Defence-in-depth guard: since the node decoration sets data-active-drag-handle on the
@@ -788,13 +735,13 @@ export var DragHandle = function DragHandle(_ref2) {
788
735
  edge: 'right',
789
736
  safeAnchorName: safeAnchorName
790
737
  });
791
- var bottom = editorExperiment('platform_editor_controls', 'variant1') ? getControlBottomCSSValue(safeAnchorName, isSticky, isTopLevelNodeValue, isLayoutColumn, ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME) : {};
738
+ var bottom = getControlBottomCSSValue(safeAnchorName, isSticky, isTopLevelNodeValue, isLayoutColumn, ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME);
792
739
  return _objectSpread({
793
740
  left: isEdgeCase ? "calc(".concat(anchorStart, " + ").concat(getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc((".concat(anchorRight, " + ").concat(anchorLeft, ")/2 - ").concat(DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(".concat(anchorStart, " - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType, parentNodeType), "px)"),
794
741
  top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc(".concat(anchorTop, " - ").concat(DRAG_HANDLE_WIDTH, "px)") : "calc(".concat(anchorStart, " + ").concat(topPositionAdjustment(nodeTypeWithLevel, (dom === null || dom === void 0 ? void 0 : dom.getAttribute('layout')) || ''), "px)")
795
742
  }, bottom);
796
743
  }
797
- var height = editorExperiment('platform_editor_controls', 'variant1') ? getControlHeightCSSValue(getNodeHeight(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNodeValue, "".concat(DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
744
+ var height = getControlHeightCSSValue(getNodeHeight(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNodeValue, "".concat(DRAG_HANDLE_HEIGHT), isLayoutColumn);
798
745
  return _objectSpread({
799
746
  left: isEdgeCase ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat(getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType),
800
747
  top: getTopPosition(dom, nodeTypeWithLevel)
@@ -931,73 +878,11 @@ export var DragHandle = function DragHandle(_ref2) {
931
878
  var dragHandleAriaLabel = formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
932
879
  br: ' '
933
880
  });
934
- var helpDescriptors = isTopLevelNodeValue ? [{
881
+ var helpDescriptors = [{
935
882
  description: dragHandleMessage
936
- }, {
937
- description: formatMessage(blockControlsMessages.moveUp),
938
- keymap: dragToMoveUp
939
- }, {
940
- description: formatMessage(blockControlsMessages.moveDown),
941
- keymap: dragToMoveDown
942
- }, {
943
- description: formatMessage(blockControlsMessages.moveLeft),
944
- keymap: dragToMoveLeft
945
- }, {
946
- description: formatMessage(blockControlsMessages.moveRight),
947
- keymap: dragToMoveRight
948
- }] : [{
949
- description: dragHandleMessage
950
- }, {
951
- description: formatMessage(blockControlsMessages.moveUp),
952
- keymap: dragToMoveUp
953
- }, {
954
- description: formatMessage(blockControlsMessages.moveDown),
955
- keymap: dragToMoveDown
956
883
  }];
957
- var isParentNodeOfTypeLayout;
958
- if (!isTopLevelNodeValue) {
959
- var pos = getPos();
960
- if (typeof pos === 'number') {
961
- var _$pos$parent;
962
- var $pos = view.state.doc.resolve(pos);
963
- isParentNodeOfTypeLayout = ($pos === null || $pos === void 0 || (_$pos$parent = $pos.parent) === null || _$pos$parent === void 0 ? void 0 : _$pos$parent.type.name) === 'layoutColumn';
964
- }
965
- if (isParentNodeOfTypeLayout) {
966
- helpDescriptors = [].concat(_toConsumableArray(helpDescriptors), [{
967
- description: formatMessage(blockControlsMessages.moveLeft),
968
- keymap: dragToMoveLeft
969
- }, {
970
- description: formatMessage(blockControlsMessages.moveRight),
971
- keymap: dragToMoveRight
972
- }]);
973
- }
974
- }
975
-
976
- // When advanced layout is on, layout column drag handle show only show 'Drag to move', no shortcuts
977
- if (editorExperiment('advanced_layouts', true) && nodeType === 'layoutColumn') {
978
- helpDescriptors = [{
979
- description: formatMessage(blockControlsMessages.dragToRearrange)
980
- }, {
981
- description: formatMessage(blockControlsMessages.moveUp),
982
- keymap: dragToMoveUp
983
- }, {
984
- description: formatMessage(blockControlsMessages.moveDown),
985
- keymap: dragToMoveDown
986
- }, {
987
- description: formatMessage(blockControlsMessages.moveLeft),
988
- keymap: dragToMoveLeft
989
- }, {
990
- description: formatMessage(blockControlsMessages.moveRight),
991
- keymap: dragToMoveRight
992
- }];
993
- }
994
- if (editorExperiment('platform_editor_controls', 'variant1')) {
995
- helpDescriptors = [{
996
- description: dragHandleMessage
997
- }];
998
- }
999
884
  var message = helpDescriptors.map(function (descriptor) {
1000
- return descriptor.keymap ? [descriptor.description, getAriaKeyshortcuts(descriptor.keymap)] : [descriptor.description];
885
+ return [descriptor.description];
1001
886
  }).join('. ');
1002
887
  var handleOnDrop = function handleOnDrop(event) {
1003
888
  event.stopPropagation();
@@ -1009,14 +894,11 @@ export var DragHandle = function DragHandle(_ref2) {
1009
894
  // eslint-disable-next-line @atlaskit/design-system/no-html-button
1010
895
  jsx("button", {
1011
896
  type: "button",
1012
- css: [editorExperiment('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
897
+ css: [dragHandleButtonStyles,
1013
898
  // ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
1014
899
  // See https://product-fabric.atlassian.net/browse/ED-26266
1015
- browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true) && editorExperiment('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, isFocused && keyboardFocusedDragHandleStyles, focusedStyles, dragHandleButtonScaledStyles],
1016
- ref: buttonRef
1017
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
1018
- ,
1019
- style: !editorExperiment('platform_editor_controls', 'variant1') ? positionStylesOld : {},
900
+ browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, isFocused && keyboardFocusedDragHandleStyles, focusedStyles, dragHandleButtonScaledStyles],
901
+ ref: buttonRef,
1020
902
  onMouseDown: expValEqualsNoExposure('platform_editor_selection_toolbar_block_handle', 'isEnabled', true) ? handleMouseDown : undefined,
1021
903
  onMouseUp: handleMouseUp,
1022
904
  onClick: handleOnClickNew,
@@ -1061,53 +943,36 @@ export var DragHandle = function DragHandle(_ref2) {
1061
943
  })))
1062
944
  );
1063
945
  };
1064
- var stickyWithTooltip = function stickyWithTooltip() {
1065
- return jsx(Box
1066
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
1067
- , {
1068
- style: positionStylesOld
1069
- // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
1070
- ,
1071
- xcss: [dragHandleContainerStyles],
1072
- as: "span",
1073
- testId: "block-ctrl-drag-handle-container"
1074
- }, jsx("span", {
1075
- css: [tooltipContainerStyles, shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && tooltipContainerStylesImprovedStickyHeaderWithMask, !shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithoutMask]
1076
- }, jsx(Tooltip, {
1077
- content: tooltipContent,
1078
- ignoreTooltipPointerEvents: true,
1079
- position: 'top',
1080
- tag: fg('platform-dst-top-layer-tooltip') ? 'span' : 'div'
1081
- // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
1082
- ,
1083
- onShow: function onShow() {
1084
- var _api$accessibilityUti;
1085
- api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(message, {
1086
- priority: 'important'
1087
- });
1088
- }
1089
- }, jsx("span", {
1090
- css: [shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && buttonWrapperStylesNoBackground, buttonWrapperStylesPatch]
1091
- }, renderButton()))));
1092
- };
1093
- var buttonWithTooltip = function buttonWithTooltip() {
1094
- return jsx(Tooltip, {
1095
- content: tooltipContent,
1096
- ignoreTooltipPointerEvents: true
1097
- // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
1098
- ,
1099
- onShow: function onShow() {
1100
- var _api$accessibilityUti2;
1101
- api === null || api === void 0 || (_api$accessibilityUti2 = api.accessibilityUtils) === null || _api$accessibilityUti2 === void 0 || _api$accessibilityUti2.actions.ariaNotify(message, {
1102
- priority: 'important'
1103
- });
1104
- }
1105
- }, renderButton());
1106
- };
1107
946
  var tooltipContent = isLayoutColumn && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : jsx(TooltipContentWithMultipleShortcuts, {
1108
947
  helpDescriptors: helpDescriptors
1109
948
  });
1110
- return editorExperiment('platform_editor_controls', 'variant1') ? stickyWithTooltip() : buttonWithTooltip();
949
+ return jsx(Box
950
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
951
+ , {
952
+ style: positionStylesOld
953
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
954
+ ,
955
+ xcss: [dragHandleContainerStyles],
956
+ as: "span",
957
+ testId: "block-ctrl-drag-handle-container"
958
+ }, jsx("span", {
959
+ css: [tooltipContainerStyles, shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && tooltipContainerStylesImprovedStickyHeaderWithMask, !shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithoutMask]
960
+ }, jsx(Tooltip, {
961
+ content: tooltipContent,
962
+ ignoreTooltipPointerEvents: true,
963
+ position: 'top',
964
+ tag: fg('platform-dst-top-layer-tooltip') ? 'span' : 'div'
965
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
966
+ ,
967
+ onShow: function onShow() {
968
+ var _api$accessibilityUti;
969
+ api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(message, {
970
+ priority: 'important'
971
+ });
972
+ }
973
+ }, jsx("span", {
974
+ css: [shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && buttonWrapperStylesNoBackground, buttonWrapperStylesPatch]
975
+ }, renderButton()))));
1111
976
  };
1112
977
  export var DragHandleWithVisibility = function DragHandleWithVisibility(_ref0) {
1113
978
  var view = _ref0.view,
@@ -33,10 +33,10 @@ var dragHandlerAnchorSelectorNext = "[".concat(NODE_ANCHOR_ATTR_NAME, "]:not([da
33
33
  */
34
34
  var dragHandlerAnchorSelectorWithTaskExclusion = "[".concat(NODE_ANCHOR_ATTR_NAME, "]:not([data-prosemirror-node-name=\"tableRow\"], [data-prosemirror-node-name=\"tableCell\"], [data-prosemirror-node-name=\"tableHeader\"], [data-prosemirror-node-name=\"media\"], [data-prosemirror-node-inline=\"true\"], [data-prosemirror-node-name=\"taskList\"] [").concat(NODE_ANCHOR_ATTR_NAME, "])");
35
35
  var gutterPaddingWidth = function gutterPaddingWidth() {
36
- return editorExperiment('platform_editor_controls', 'variant1') ? "".concat(akEditorGutterPaddingDynamic(), "px") : '100%';
36
+ return "".concat(akEditorGutterPaddingDynamic(), "px");
37
37
  };
38
38
  var gutterPaddingLeft = function gutterPaddingLeft() {
39
- return editorExperiment('platform_editor_controls', 'variant1') ? "-".concat(akEditorGutterPaddingDynamic(), "px") : '-100px';
39
+ return "-".concat(akEditorGutterPaddingDynamic(), "px");
40
40
  };
41
41
  var extendedHoverZone = function extendedHoverZone() {
42
42
  return css(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ".block-ctrl-drag-preview ".concat(dragHandlerAnchorSelector, "::after"), {
@@ -499,7 +499,7 @@ export var GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
499
499
  styles: [globalStyles(), globalDnDStyle, (!sparseSurfacesEnabled || isDragging) && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? extendedHoverZoneNext() : extendedHoverZone()), isDragging && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? extendedDragZoneNext : extendedDragZone), (!sparseSurfacesEnabled || isDragging) && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
500
500
  exposure: true
501
501
  }) ? expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined,
502
- // platform_editor_controls note: this allows drag handles to render on empty lines
502
+ // this allows drag handles to render on empty lines
503
503
  toolbarFlagsEnabled ? undefined : withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, isExperimentEnabled('platform_editor_lovability_dividers') && withRuleOverflowStyleFix, withFormatInLayoutStyleFix, (!sparseSurfacesEnabled || isDragging) && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? withRelativePosStyleNext : withRelativePosStyle), (!sparseSurfacesEnabled || isDragging) && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle), (!sparseSurfacesEnabled || isDragging) && ((expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration')) && expValEquals('advanced_layouts', 'isEnabled', true) ? layoutColumnExtendedHoverZone : layoutColumnWithoutHoverZone), sparseSurfaceAnchorsEnabled ? isDragging ? dragAnchorStyles : false : expValEquals('platform_editor_controls_reliable_anchor', 'isEnabled', true) ?
504
504
  // dragAnchorStyles sets anchor-name on ALL nodes during drag (needed for drop target positioning).
505
505
  // staticControlsAnchorStyles handles anchor-name via node decorations for non-drag state.