@atlaskit/editor-plugin-block-controls 33.0.0 → 34.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.
@@ -6,7 +6,6 @@
6
6
  import { css, Global, jsx } from '@emotion/react';
7
7
  import { DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles/drag-handle';
8
8
  import { ANCHOR_VARIABLE_NAME, isCSSAnchorSupported } from '@atlaskit/editor-common/styles/native-anchor';
9
- import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
10
9
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
11
10
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace/whitespace';
12
11
  import { akEditorBreakoutPadding, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorFullPageNarrowBreakout, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced } from '@atlaskit/editor-shared-styles/constants';
@@ -248,27 +247,10 @@ const extendedDragZoneNext = css({
248
247
  }
249
248
  }
250
249
  });
251
- const paragraphWithTrailingBreakAsOnlyChild = '+ :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
252
- const indentatedParagraphWithTrailingBreakAsOnlyChild = '+ div.fabric-editor-indentation-mark > :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
253
- const paragraphWithPlaceholder = '+ p > .placeholder-decoration';
254
250
  const dragHandleContainer = '.ProseMirror-widget[data-blocks-drag-handle-container="true"]';
255
- const dragHandleSelector = 'button[data-testid="block-ctrl-drag-handle"]';
256
251
  const dropTargetContainer = '.ProseMirror-widget[data-blocks-drop-target-container="true"]';
257
252
  const dividerBodiedInCustomPanelWithNoIconSelector = '[data-panel-type].ak-editor-panel__no-icon .ProseMirror-widget:first-child + .ProseMirror-widget:nth-child(2) + hr, [data-panel-type] hr:first-child';
258
- const withInlineNodeStyleSelectors = [`${dragHandleContainer}:has(${paragraphWithTrailingBreakAsOnlyChild}) ${dragHandleSelector}`, `${dragHandleContainer}:has(${indentatedParagraphWithTrailingBreakAsOnlyChild}) ${dragHandleSelector}`, `${dragHandleContainer}:has(${paragraphWithPlaceholder}) ${dragHandleSelector}`].join(', ');
259
253
  const withFormatInLayoutStyleFixSelectors = [`${dragHandleContainer}:first-child + .fabric-editor-indentation-mark > p:first-child`, `${dragHandleContainer}:first-child + .fabric-editor-alignment > p:first-child`, `${dragHandleContainer}:first-child + .fabric-editor-font-size > p:first-child`, `${dragHandleContainer}:first-child + ${dropTargetContainer} + .fabric-editor-indentation-mark > p:first-child`, `${dragHandleContainer}:first-child + ${dropTargetContainer} + .fabric-editor-alignment > p:first-child`, `${dragHandleContainer}:first-child + ${dropTargetContainer} + .fabric-editor-font-size > p:first-child`, `${dropTargetContainer}:first-child + .fabric-editor-alignment > p:first-child`, `${dropTargetContainer}:first-child + .fabric-editor-indentation-mark > p:first-child`, `${dropTargetContainer}:first-child + .fabric-editor-font-size > p:first-child`, `${dragHandleContainer}:first-child + .fabric-editor-indentation-mark > :is(h1, h2, h3, h4, h5, h6):first-child`, `${dragHandleContainer}:first-child + .fabric-editor-font-size > :is(h1, h2, h3, h4, h5, h6):first-child`].join(', ');
260
-
261
- /**
262
- * Please do not change change transform to display:none, or visibility:hidden
263
- * Otherwise it might break composition input for Chrome
264
- * https://product-fabric.atlassian.net/browse/ED-24136
265
- */
266
- const withInlineNodeStyle = css({
267
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
268
- [withInlineNodeStyleSelectors]: {
269
- transform: 'scale(0)'
270
- }
271
- });
272
254
  const legacyBreakoutWideLayoutStyle = css({
273
255
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
274
256
  '.ProseMirror-widget[data-blocks-drop-target-container="true"]': {
@@ -587,15 +569,12 @@ export const GlobalStylesWrapper = ({
587
569
  const isDragging = isDraggingFromState;
588
570
  const shouldRenderAnchors = isCSSAnchorSupported() && expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true);
589
571
  const sparseSurfaceAnchorsEnabled = Boolean(isCSSAnchorSupported()) && sparseSurfacesEnabled;
590
- const toolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
591
572
  return jsx(Global
592
573
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
593
574
  , {
594
575
  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, {
595
576
  exposure: true
596
- }) ? expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined,
597
- // this allows drag handles to render on empty lines
598
- 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) ?
577
+ }) ? expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined, 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) ?
599
578
  // dragAnchorStyles sets anchor-name on ALL nodes during drag (needed for drop target positioning).
600
579
  // staticControlsAnchorStyles handles anchor-name via node decorations for non-drag state.
601
580
  // shouldRenderAnchors guards both: only apply anchor styles on browsers that support CSS anchor positioning.
@@ -5,7 +5,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
5
5
  import React from 'react';
6
6
  import { BLOCK_CONTROLS_LEFT_GROUP, BLOCK_CONTROLS_LEFT_SECTION, BLOCK_CONTROLS_LEFT_SURFACE, BLOCK_CONTROLS_RIGHT_GROUP, BLOCK_CONTROLS_RIGHT_SECTION, BLOCK_CONTROLS_RIGHT_SURFACE } from '@atlaskit/editor-common/block-controls/surface-keys';
7
7
  import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
8
- import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
9
8
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
10
9
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
11
10
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
@@ -170,7 +169,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
170
169
  // Not registered under the registry migration: the decoration puts an inline
171
170
  // `margin-top: 0` on the first document node, which fights features that render their own
172
171
  // content above it — a leading show-diff widget is left flush against the node below.
173
- if (areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) && !registryBlockControlsEnabled) {
172
+ if (!registryBlockControlsEnabled) {
174
173
  pmPlugins.push({
175
174
  name: 'firstNodeDec',
176
175
  plugin: firstNodeDecPlugin
@@ -460,7 +460,7 @@ export var moveNode = function moveNode(api) {
460
460
  }
461
461
  var sliceSize = sliceTo - sliceFrom;
462
462
  if (inputMethod === INPUT_METHOD.DRAG_AND_DROP) {
463
- tr = setCursorPositionAtMovedNode(tr, mappedTo, api);
463
+ tr = setCursorPositionAtMovedNode(tr, mappedTo);
464
464
  } else if (preservedSelection) {
465
465
  var _currMeta = tr.getMeta(key);
466
466
  var nodeMovedOffset = mappedTo - sliceFrom;
@@ -1,7 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import memoizeOne from 'memoize-one';
3
3
  import { isMultiBlockSelection } from '@atlaskit/editor-common/selection/utils';
4
- import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
5
4
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
6
5
  import { fg } from '@atlaskit/platform-feature-flags/fg';
7
6
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
@@ -102,7 +101,6 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
102
101
  editorDisabled = _ref2.editorDisabled;
103
102
  var editorViewMode = api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode;
104
103
  var isViewMode = editorViewMode === 'view';
105
- var toolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
106
104
 
107
105
  // EDITOR-7926: bail out while a diff is on screen (or a suggestion card is open) so hovering
108
106
  // doesn't dispatch showDragHandleAt and cause the drag handle to jitter over the diff.
@@ -246,47 +244,37 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
246
244
  var targetPos = view.state.doc.resolve(pos).pos;
247
245
  var rootAnchorName;
248
246
  var rootNodeType;
249
- var rootPos;
250
-
251
247
  // enables quick insert
252
- if (toolbarFlagsEnabled) {
253
- rootPos = view.state.doc.resolve(pos).before(1);
254
- if (targetPos !== rootPos) {
255
- var rootDOM = view.nodeDOM(rootPos);
256
- if (rootDOM instanceof HTMLElement) {
257
- var _ref4, _rootDOM$getAttribute, _rootDOM$getAttribute2;
258
- rootAnchorName = (_ref4 = (_rootDOM$getAttribute = rootDOM.getAttribute(getAnchorAttrName())) !== null && _rootDOM$getAttribute !== void 0 ? _rootDOM$getAttribute : rootDOM.getAttribute(NODE_ANCHOR_ATTR_NAME)) !== null && _ref4 !== void 0 ? _ref4 : undefined;
259
- rootNodeType = isNativeAnchorSupported ? getTypeNameFromDom(rootDOM) : // Fallback: breakout mark wrappers have no data-drag-handler-node-type;
260
- // use data-prosemirror-node-name instead.
261
- (_rootDOM$getAttribute2 = rootDOM.getAttribute('data-drag-handler-node-type')) !== null && _rootDOM$getAttribute2 !== void 0 ? _rootDOM$getAttribute2 : getTypeNameFromDom(rootDOM);
262
- }
248
+ var rootPos = view.state.doc.resolve(pos).before(1);
249
+ if (targetPos !== rootPos) {
250
+ var rootDOM = view.nodeDOM(rootPos);
251
+ if (rootDOM instanceof HTMLElement) {
252
+ var _ref4, _rootDOM$getAttribute, _rootDOM$getAttribute2;
253
+ rootAnchorName = (_ref4 = (_rootDOM$getAttribute = rootDOM.getAttribute(getAnchorAttrName())) !== null && _rootDOM$getAttribute !== void 0 ? _rootDOM$getAttribute : rootDOM.getAttribute(NODE_ANCHOR_ATTR_NAME)) !== null && _ref4 !== void 0 ? _ref4 : undefined;
254
+ rootNodeType = isNativeAnchorSupported ? getTypeNameFromDom(rootDOM) : // Fallback: breakout mark wrappers have no data-drag-handler-node-type;
255
+ // use data-prosemirror-node-name instead.
256
+ (_rootDOM$getAttribute2 = rootDOM.getAttribute('data-drag-handler-node-type')) !== null && _rootDOM$getAttribute2 !== void 0 ? _rootDOM$getAttribute2 : getTypeNameFromDom(rootDOM);
263
257
  }
264
258
  }
265
259
  var nodeType = isNativeAnchorSupported ? getTypeNameFromDom(rootElement) : // Fallback for table nodes: tr has data-prosemirror-node-name but not data-drag-handler-node-type.
266
260
  (_rootElement$getAttri2 = rootElement.getAttribute('data-drag-handler-node-type')) !== null && _rootElement$getAttri2 !== void 0 ? _rootElement$getAttri2 : getTypeNameFromDom(rootElement);
267
261
  if (nodeType) {
268
- var _api$userIntent2;
262
+ var _selectionPreservatio, _api$userIntent2;
269
263
  // enables quick insert
270
- if (toolbarFlagsEnabled) {
271
- var _selectionPreservatio;
272
- var preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
273
- var selection = preservedSelection || view.state.selection;
274
- var isMultipleSelected = selection && isMultiBlockSelection(selection);
264
+ var preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
265
+ var selection = preservedSelection || view.state.selection;
266
+ var isMultipleSelected = selection && isMultiBlockSelection(selection);
275
267
 
276
- // Only execute when selection is not a multi-selection, block menu is open, and menu is opened via keyboard
277
- // as when it is a multi-selection, the showDragHandleAt command interfere with selection
278
- // sometimes makes the multi-selection not continous after block menu is opened with keyboard
279
- if (!(isMultipleSelected && isMenuOpen && blockMenuOptions !== null && blockMenuOptions !== void 0 && blockMenuOptions.openedViaKeyboard)) {
280
- var _api$core, _api$blockControls3;
281
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.showDragHandleAt(targetPos, anchorName, nodeType, undefined, rootPos !== null && rootPos !== void 0 ? rootPos : targetPos, rootAnchorName !== null && rootAnchorName !== void 0 ? rootAnchorName : anchorName, rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType));
282
- }
283
- } else {
284
- var _api$core2, _api$blockControls4;
285
- api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.showDragHandleAt(targetPos, anchorName, nodeType));
268
+ // Only execute when selection is not a multi-selection, block menu is open, and menu is opened via keyboard
269
+ // as when it is a multi-selection, the showDragHandleAt command interfere with selection
270
+ // sometimes makes the multi-selection not continous after block menu is opened with keyboard
271
+ if (!(isMultipleSelected && isMenuOpen && blockMenuOptions !== null && blockMenuOptions !== void 0 && blockMenuOptions.openedViaKeyboard)) {
272
+ var _api$core, _api$blockControls3;
273
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.showDragHandleAt(targetPos, anchorName, nodeType, undefined, rootPos, rootAnchorName !== null && rootAnchorName !== void 0 ? rootAnchorName : anchorName, rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType));
286
274
  }
287
275
  if (isMenuOpen && originalAnchorName && (api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || (_api$userIntent2 = _api$userIntent2.sharedState.currentState()) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.currentUserIntent) === 'blockMenuOpen') {
288
- var _api$core3, _api$blockControls5;
289
- api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(api === null || api === void 0 || (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 ? void 0 : _api$blockControls5.commands.toggleBlockMenu());
276
+ var _api$core2, _api$blockControls4;
277
+ api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.toggleBlockMenu());
290
278
  }
291
279
  }
292
280
  }
@@ -12,7 +12,6 @@ import { getBrowserInfo } from '@atlaskit/editor-common/browser';
12
12
  import { getNodeIdProvider } from '@atlaskit/editor-common/node-anchor-provider';
13
13
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
14
14
  import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles/drag-handle';
15
- import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
16
15
  import { EDIT_AREA_ID } from '@atlaskit/editor-common/ui-toolbar';
17
16
  import { isEmptyDocument } from '@atlaskit/editor-common/utils';
18
17
  import { PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
@@ -173,14 +172,14 @@ var getDecorationAtPos = function getDecorationAtPos(state, decorations, pos, to
173
172
  var nodeDecAtActivePos = nodeDecsAtActivePos.pop();
174
173
  return nodeDecAtActivePos;
175
174
  };
176
- var _apply = function apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry) {
177
- var _meta$multiSelectDnD, _api$editorViewMode, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$toggleMenu, _meta$isDragging3, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$toggleMenu8, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$lastDragCancell;
178
- var rightSideControlsEnabled = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
179
- var quickInsertButtonEnabled = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : true;
180
- var anchorRectCache = arguments.length > 10 ? arguments[10] : undefined;
181
- var resizeObserverWidth = arguments.length > 11 ? arguments[11] : undefined;
182
- var pragmaticCleanup = arguments.length > 12 ? arguments[12] : undefined;
183
- var limitedModeTeardown = arguments.length > 13 ? arguments[13] : undefined;
175
+ var _apply = function apply(api, formatMessage, tr, currentState, newState, nodeViewPortalProviderAPI, nodeDecorationRegistry) {
176
+ var _meta$multiSelectDnD, _api$editorViewMode, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _latestActiveNode11, _latestActiveNode12, _meta$toggleMenu, _meta$isDragging3, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$toggleMenu8, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$lastDragCancell;
177
+ var rightSideControlsEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
178
+ var quickInsertButtonEnabled = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
179
+ var anchorRectCache = arguments.length > 9 ? arguments[9] : undefined;
180
+ var resizeObserverWidth = arguments.length > 10 ? arguments[10] : undefined;
181
+ var pragmaticCleanup = arguments.length > 11 ? arguments[11] : undefined;
182
+ var limitedModeTeardown = arguments.length > 12 ? arguments[12] : undefined;
184
183
  var activeNode = currentState.activeNode,
185
184
  decorations = currentState.decorations,
186
185
  isResizerResizing = currentState.isResizerResizing,
@@ -198,7 +197,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
198
197
  isPMDragging = currentState.isPMDragging,
199
198
  lastDragCancelled = currentState.lastDragCancelled;
200
199
  var isActiveNodeDeleted = false;
201
- var _getTrMetadata = getTrMetadata(tr, flags),
200
+ var _getTrMetadata = getTrMetadata(tr),
202
201
  from = _getTrMetadata.from,
203
202
  to = _getTrMetadata.to,
204
203
  numReplaceSteps = _getTrMetadata.numReplaceSteps,
@@ -297,62 +296,50 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
297
296
 
298
297
  // enables quick insert
299
298
  // don't remap activeNode if it's being dragged
300
- if (!flags.toolbarFlagsEnabled) {
301
- if (activeNode) {
302
- var mappedPos = tr.mapping.mapResult(activeNode.pos);
299
+ if (activeNode && (meta === null || meta === void 0 ? void 0 : meta.isDragging) !== true) {
300
+ var _mappedRootPos$pos, _mappedRootPos;
301
+ var mappedPos;
302
+ var browser = getBrowserInfo();
303
+ // In safari,
304
+ // sometimes the drag handle for the layout disppears after you click on the handle for a few times
305
+ // Which caused the drag handle onClick event not firing, then block menu wouldn't be opened
306
+ // This is caused by the mappedPos.deletedAfter sometimes returning true in webkit browsers even though the active node still exists
307
+ // This is likely a prosemirror and safari integration bug, but to unblock the issue, we are going to use mappedPos.deleted in safari for now
308
+ if (browser.webkit) {
309
+ mappedPos = tr.mapping.mapResult(activeNode.pos);
303
310
  isActiveNodeDeleted = mappedPos.deleted;
304
- activeNode = {
305
- pos: mappedPos.pos,
306
- anchorName: activeNode.anchorName,
307
- nodeType: activeNode.nodeType
308
- };
311
+ } else {
312
+ mappedPos = tr.mapping.mapResult(activeNode.pos, -1);
313
+ isActiveNodeDeleted = mappedPos.deletedAfter;
309
314
  }
310
- } else {
311
- if (activeNode && (meta === null || meta === void 0 ? void 0 : meta.isDragging) !== true) {
312
- var _mappedRootPos$pos, _mappedRootPos;
313
- var _mappedPos;
314
- var browser = getBrowserInfo();
315
- // In safari,
316
- // sometimes the drag handle for the layout disppears after you click on the handle for a few times
317
- // Which caused the drag handle onClick event not firing, then block menu wouldn't be opened
318
- // This is caused by the mappedPos.deletedAfter sometimes returning true in webkit browsers even though the active node still exists
319
- // This is likely a prosemirror and safari integration bug, but to unblock the issue, we are going to use mappedPos.deleted in safari for now
320
- if (browser.webkit) {
321
- _mappedPos = tr.mapping.mapResult(activeNode.pos);
322
- isActiveNodeDeleted = _mappedPos.deleted;
323
- } else {
324
- _mappedPos = tr.mapping.mapResult(activeNode.pos, -1);
325
- isActiveNodeDeleted = _mappedPos.deletedAfter;
326
- }
327
- // for editor controls, remap the rootPos as well
328
- var mappedRootPos;
329
- if (activeNode.rootPos !== undefined) {
330
- mappedRootPos = tr.mapping.mapResult(activeNode.rootPos, -1);
315
+ // for editor controls, remap the rootPos as well
316
+ var mappedRootPos;
317
+ if (activeNode.rootPos !== undefined) {
318
+ mappedRootPos = tr.mapping.mapResult(activeNode.rootPos, -1);
319
+ }
320
+ var mappedNodeType = activeNode.nodeType;
321
+ var mappedRootNodeType = activeNode.rootNodeType;
322
+ // Sparse mode does not redraw the old decorations. A block-type transaction may report
323
+ // a text range that excludes the active block position, so always refresh the already
324
+ // active node and root from the new document (for example, paragraph → heading-1).
325
+ if (isExperimentEnabled('platform_editor_block_control_migration')) {
326
+ var mappedNode = newState.doc.nodeAt(mappedPos.pos);
327
+ if (mappedNode !== null && mappedNode !== void 0 && mappedNode.isBlock) {
328
+ mappedNodeType = getNodeTypeWithLevel(mappedNode);
331
329
  }
332
- var mappedNodeType = activeNode.nodeType;
333
- var mappedRootNodeType = activeNode.rootNodeType;
334
- // Sparse mode does not redraw the old decorations. A block-type transaction may report
335
- // a text range that excludes the active block position, so always refresh the already
336
- // active node and root from the new document (for example, paragraph → heading-1).
337
- if (isExperimentEnabled('platform_editor_block_control_migration')) {
338
- var mappedNode = newState.doc.nodeAt(_mappedPos.pos);
339
- if (mappedNode !== null && mappedNode !== void 0 && mappedNode.isBlock) {
340
- mappedNodeType = getNodeTypeWithLevel(mappedNode);
341
- }
342
- var mappedRootNode = mappedRootPos ? mappedRootPos.pos === _mappedPos.pos && mappedNode ? mappedNode : newState.doc.nodeAt(mappedRootPos.pos) : undefined;
343
- if (mappedRootNode !== null && mappedRootNode !== void 0 && mappedRootNode.isBlock) {
344
- mappedRootNodeType = getNodeTypeWithLevel(mappedRootNode);
345
- }
330
+ var mappedRootNode = mappedRootPos ? mappedRootPos.pos === mappedPos.pos && mappedNode ? mappedNode : newState.doc.nodeAt(mappedRootPos.pos) : undefined;
331
+ if (mappedRootNode !== null && mappedRootNode !== void 0 && mappedRootNode.isBlock) {
332
+ mappedRootNodeType = getNodeTypeWithLevel(mappedRootNode);
346
333
  }
347
- activeNode = {
348
- pos: _mappedPos.pos,
349
- anchorName: activeNode.anchorName,
350
- nodeType: mappedNodeType,
351
- rootPos: (_mappedRootPos$pos = (_mappedRootPos = mappedRootPos) === null || _mappedRootPos === void 0 ? void 0 : _mappedRootPos.pos) !== null && _mappedRootPos$pos !== void 0 ? _mappedRootPos$pos : activeNode.rootPos,
352
- rootAnchorName: activeNode.rootAnchorName,
353
- rootNodeType: mappedRootNodeType
354
- };
355
334
  }
335
+ activeNode = {
336
+ pos: mappedPos.pos,
337
+ anchorName: activeNode.anchorName,
338
+ nodeType: mappedNodeType,
339
+ rootPos: (_mappedRootPos$pos = (_mappedRootPos = mappedRootPos) === null || _mappedRootPos === void 0 ? void 0 : _mappedRootPos.pos) !== null && _mappedRootPos$pos !== void 0 ? _mappedRootPos$pos : activeNode.rootPos,
340
+ rootAnchorName: activeNode.rootAnchorName,
341
+ rootNodeType: mappedRootNodeType
342
+ };
356
343
  }
357
344
  if (multiSelectDnD) {
358
345
  multiSelectDnD.anchor = tr.mapping.map(multiSelectDnD.anchor);
@@ -395,43 +382,21 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
395
382
  decorations = decorations.add(newState.doc, newNodeDecs);
396
383
 
397
384
  // enables quick insert
398
- if (!flags.toolbarFlagsEnabled) {
399
- if (latestActiveNode && !isActiveNodeDeleted) {
400
- // Find the newly minted node decs that touch the active node
401
- var findNewNodeDecs = findNodeDecs(newState, decorations, latestActiveNode.pos - 1, to);
402
-
403
- // Find the specific dec that the active node corresponds to
404
- var nodeDecsAtActivePos = findNewNodeDecs.filter(function (dec) {
405
- return (dec === null || dec === void 0 ? void 0 : dec.from) === latestActiveNode.pos;
406
- });
407
-
408
- // If multiple decorations at the active node pos, we want the last one
409
- var nodeDecAtActivePos = nodeDecsAtActivePos.pop();
410
-
411
- // Update the active node anchor-name and type for accurate positioning
412
- if (nodeDecAtActivePos) {
413
- isActiveNodeModified = true;
414
- latestActiveNode.anchorName = nodeDecAtActivePos.spec.anchorName;
415
- latestActiveNode.nodeType = nodeDecAtActivePos.spec.nodeType;
416
- }
385
+ if (latestActiveNode && (!isActiveNodeDeleted || isReplacedWithSameSize)) {
386
+ var nodeDecAtActivePos = getDecorationAtPos(newState, decorations, latestActiveNode.pos, to);
387
+ var rootNodeDecAtActivePos = latestActiveNode.rootPos !== undefined ? getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to) : undefined;
388
+ if (nodeDecAtActivePos || rootNodeDecAtActivePos) {
389
+ isActiveNodeModified = true;
417
390
  }
418
- } else {
419
- if (latestActiveNode && (!isActiveNodeDeleted || isReplacedWithSameSize)) {
420
- var _nodeDecAtActivePos = getDecorationAtPos(newState, decorations, latestActiveNode.pos, to);
421
- var rootNodeDecAtActivePos = latestActiveNode.rootPos !== undefined ? getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to) : undefined;
422
- if (_nodeDecAtActivePos || rootNodeDecAtActivePos) {
423
- isActiveNodeModified = true;
424
- }
425
391
 
426
- // Update the active node anchor-name and type for accurate positioning
427
- if (_nodeDecAtActivePos) {
428
- latestActiveNode.anchorName = _nodeDecAtActivePos.spec.anchorName;
429
- latestActiveNode.nodeType = _nodeDecAtActivePos.spec.nodeType;
430
- }
431
- if (rootNodeDecAtActivePos) {
432
- latestActiveNode.rootAnchorName = rootNodeDecAtActivePos.spec.anchorName;
433
- latestActiveNode.rootNodeType = rootNodeDecAtActivePos.spec.nodeType;
434
- }
392
+ // Update the active node anchor-name and type for accurate positioning
393
+ if (nodeDecAtActivePos) {
394
+ latestActiveNode.anchorName = nodeDecAtActivePos.spec.anchorName;
395
+ latestActiveNode.nodeType = nodeDecAtActivePos.spec.nodeType;
396
+ }
397
+ if (rootNodeDecAtActivePos) {
398
+ latestActiveNode.rootAnchorName = rootNodeDecAtActivePos.spec.anchorName;
399
+ latestActiveNode.rootNodeType = rootNodeDecAtActivePos.spec.nodeType;
435
400
  }
436
401
  }
437
402
  }
@@ -454,10 +419,8 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
454
419
  var shouldRemoveHandle = latestActiveNode ? isResizerResizing || isActiveNodeDeleted && !isReplacedWithSameSize || (meta === null || meta === void 0 ? void 0 : meta.nodeMoved) : true;
455
420
 
456
421
  // enables quick insert
457
- if (flags.toolbarFlagsEnabled) {
458
- // Remove handle dec when editor is blurred
459
- shouldRemoveHandle = shouldRemoveHandle || (meta === null || meta === void 0 ? void 0 : meta.editorBlurred);
460
- }
422
+ // Remove handle dec when editor is blurred
423
+ shouldRemoveHandle = shouldRemoveHandle || (meta === null || meta === void 0 ? void 0 : meta.editorBlurred);
461
424
 
462
425
  // In view mode with right-side controls, remove any lingering drag handle decorations
463
426
  // (they may carry over from edit mode). Only remove drag handles specifically, not
@@ -490,54 +453,52 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
490
453
  // nodeDecorationRegistry cleanup (e.g. the legacy Remix button) is independent of the legacy
491
454
  // quick-insert button, so this must not be gated by quickInsertButtonEnabled — otherwise a
492
455
  // stale decoration is left behind whenever platform_editor_block_control_migration is on.
493
- if (flags.toolbarFlagsEnabled) {
494
- // enables quick insert
495
- if (quickInsertButtonEnabled) {
496
- var _activeNode7, _activeNode8;
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);
498
- decorations = decorations.remove(oldQuickInsertButton);
456
+ // enables quick insert
457
+ if (quickInsertButtonEnabled) {
458
+ var _activeNode7, _activeNode8;
459
+ var oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.rootPos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.rootPos);
460
+ decorations = decorations.remove(oldQuickInsertButton);
461
+ }
462
+ var _iterator = _createForOfIteratorHelper(nodeDecorationRegistry),
463
+ _step;
464
+ try {
465
+ var _loop2 = function _loop2() {
466
+ var _activeNode1, _activeNode10;
467
+ var factory = _step.value;
468
+ var old = decorations.find((_activeNode1 = activeNode) === null || _activeNode1 === void 0 ? void 0 : _activeNode1.rootPos, (_activeNode10 = activeNode) === null || _activeNode10 === void 0 ? void 0 : _activeNode10.rootPos, function (spec) {
469
+ return spec.type === factory.type;
470
+ });
471
+ decorations = decorations.remove(old);
472
+ };
473
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
474
+ _loop2();
499
475
  }
500
- var _iterator = _createForOfIteratorHelper(nodeDecorationRegistry),
501
- _step;
476
+ } catch (err) {
477
+ _iterator.e(err);
478
+ } finally {
479
+ _iterator.f();
480
+ }
481
+ if (rightSideControlsEnabled && isViewMode) {
482
+ var _iterator2 = _createForOfIteratorHelper(nodeDecorationRegistry),
483
+ _step2;
502
484
  try {
503
- var _loop2 = function _loop2() {
504
- var _activeNode1, _activeNode10;
505
- var factory = _step.value;
506
- var old = decorations.find((_activeNode1 = activeNode) === null || _activeNode1 === void 0 ? void 0 : _activeNode1.rootPos, (_activeNode10 = activeNode) === null || _activeNode10 === void 0 ? void 0 : _activeNode10.rootPos, function (spec) {
507
- return spec.type === factory.type;
508
- });
509
- decorations = decorations.remove(old);
485
+ var _loop = function _loop() {
486
+ var factory = _step2.value;
487
+ if (factory.showInViewMode) {
488
+ var _activeNode9, _activeNode0;
489
+ var old = decorations.find((_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.rootPos, (_activeNode0 = activeNode) === null || _activeNode0 === void 0 ? void 0 : _activeNode0.rootPos, function (spec) {
490
+ return spec.type === factory.type;
491
+ });
492
+ decorations = decorations.remove(old);
493
+ }
510
494
  };
511
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
512
- _loop2();
495
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
496
+ _loop();
513
497
  }
514
498
  } catch (err) {
515
- _iterator.e(err);
499
+ _iterator2.e(err);
516
500
  } finally {
517
- _iterator.f();
518
- }
519
- if (rightSideControlsEnabled && isViewMode) {
520
- var _iterator2 = _createForOfIteratorHelper(nodeDecorationRegistry),
521
- _step2;
522
- try {
523
- var _loop = function _loop() {
524
- var factory = _step2.value;
525
- if (factory.showInViewMode) {
526
- var _activeNode9, _activeNode0;
527
- var old = decorations.find((_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.rootPos, (_activeNode0 = activeNode) === null || _activeNode0 === void 0 ? void 0 : _activeNode0.rootPos, function (spec) {
528
- return spec.type === factory.type;
529
- });
530
- decorations = decorations.remove(old);
531
- }
532
- };
533
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
534
- _loop();
535
- }
536
- } catch (err) {
537
- _iterator2.e(err);
538
- } finally {
539
- _iterator2.f();
540
- }
501
+ _iterator2.f();
541
502
  }
542
503
  }
543
504
  } else if (api) {
@@ -615,9 +576,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
615
576
  }
616
577
  }
617
578
  }
618
- if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined && (quickInsertButtonEnabled || nodeDecorationRegistry.length > 0) &&
619
- // enables quick insert
620
- flags.toolbarFlagsEnabled && (!rightSideControlsEnabled || !isViewMode)) {
579
+ if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined && (quickInsertButtonEnabled || nodeDecorationRegistry.length > 0) && (!rightSideControlsEnabled || !isViewMode)) {
621
580
  var _latestActiveNode1;
622
581
  if (quickInsertButtonEnabled) {
623
582
  var _activeNode13, _activeNode14, _latestActiveNode6, _latestActiveNode7, _latestActiveNode8, _latestActiveNode9, _latestActiveNode0;
@@ -723,7 +682,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
723
682
  var rootPos = (_latestActiveNode10 = latestActiveNode) === null || _latestActiveNode10 === void 0 ? void 0 : _latestActiveNode10.rootPos;
724
683
  // rootPos is computed using the same logic as the floating insert menu, so it always points to a top-level (doc child) block when defined.
725
684
  var isDocLevel = rootPos !== undefined && !isNaN(rootPos);
726
- if (isViewMode && isDocLevel && flags.toolbarFlagsEnabled && rightSideControlsEnabled) {
685
+ if (isViewMode && isDocLevel && rightSideControlsEnabled) {
727
686
  var _iterator5 = _createForOfIteratorHelper(nodeDecorationRegistry),
728
687
  _step5;
729
688
  try {
@@ -835,21 +794,15 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
835
794
  decorations = decorations.add(newState.doc, [emptyParagraphNodeDecorations()]);
836
795
  }
837
796
  }
838
- var newActiveNode;
797
+
839
798
  // enables quick insert
840
- if (flags.toolbarFlagsEnabled) {
841
- var _latestActiveNode11, _latestActiveNode12;
842
- // remove isEmptyDoc check and let decorations render and determine their own visibility
843
- // In view mode with right-side controls we render node decorations (right-edge button), not the
844
- // handle - so findHandleDec is always empty. Don't clear activeNode in that case.
845
- var hasHandleOrViewModeControls = isExperimentEnabled('platform_editor_block_control_migration') || isViewMode && rightSideControlsEnabled || findHandleDec(decorations, (_latestActiveNode11 = latestActiveNode) === null || _latestActiveNode11 === void 0 ? void 0 : _latestActiveNode11.pos, (_latestActiveNode12 = latestActiveNode) === null || _latestActiveNode12 === void 0 ? void 0 : _latestActiveNode12.pos).length > 0;
846
- // Keep the registry surface mounted while its Block Menu owns focus.
847
- var keepActiveNodeForOpenBlockMenu = isExperimentEnabled('platform_editor_block_control_migration') && isMenuOpen;
848
- newActiveNode = meta !== null && meta !== void 0 && meta.editorBlurred && !keepActiveNodeForOpenBlockMenu || !(meta !== null && meta !== void 0 && meta.activeNode) && !hasHandleOrViewModeControls ? null : latestActiveNode;
849
- } else {
850
- var _latestActiveNode13, _latestActiveNode14;
851
- newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && !isExperimentEnabled('platform_editor_block_control_migration') && findHandleDec(decorations, (_latestActiveNode13 = latestActiveNode) === null || _latestActiveNode13 === void 0 ? void 0 : _latestActiveNode13.pos, (_latestActiveNode14 = latestActiveNode) === null || _latestActiveNode14 === void 0 ? void 0 : _latestActiveNode14.pos).length === 0 ? null : latestActiveNode;
852
- }
799
+ // remove isEmptyDoc check and let decorations render and determine their own visibility
800
+ // In view mode with right-side controls we render node decorations (right-edge button), not the
801
+ // handle - so findHandleDec is always empty. Don't clear activeNode in that case.
802
+ var hasHandleOrViewModeControls = isExperimentEnabled('platform_editor_block_control_migration') || isViewMode && rightSideControlsEnabled || findHandleDec(decorations, (_latestActiveNode11 = latestActiveNode) === null || _latestActiveNode11 === void 0 ? void 0 : _latestActiveNode11.pos, (_latestActiveNode12 = latestActiveNode) === null || _latestActiveNode12 === void 0 ? void 0 : _latestActiveNode12.pos).length > 0;
803
+ // Keep the registry surface mounted while its Block Menu owns focus.
804
+ var keepActiveNodeForOpenBlockMenu = isExperimentEnabled('platform_editor_block_control_migration') && isMenuOpen;
805
+ var newActiveNode = meta !== null && meta !== void 0 && meta.editorBlurred && !keepActiveNodeForOpenBlockMenu || !(meta !== null && meta !== void 0 && meta.activeNode) && !hasHandleOrViewModeControls ? null : latestActiveNode;
853
806
  var nextMenuTriggerByNode = (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.triggerByNode) || menuTriggerByNode;
854
807
  if (isExperimentEnabled('platform_editor_block_control_migration') && tr.docChanged && menuTriggerByNode && !(meta !== null && meta !== void 0 && meta.toggleMenu)) {
855
808
  var _menuTriggerByNode$ro, _newState$doc$nodeAt4;
@@ -871,11 +824,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
871
824
  var isSameAnchor = (meta === null || meta === void 0 ? void 0 : meta.toggleMenu.anchorName) === menuTriggerBy;
872
825
  isMenuOpen = menuTriggerBy === undefined || isSameAnchor || !isMenuOpen && !isSameAnchor ? !isMenuOpen : isMenuOpen;
873
826
  }
874
- if (flags.toolbarFlagsEnabled) {
875
- isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined ? meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle : isSelectedViaDragHandle;
876
- } else {
877
- isSelectedViaDragHandle = false;
878
- }
827
+ isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined ? meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle : isSelectedViaDragHandle;
879
828
  return {
880
829
  decorations: decorations,
881
830
  surfaceNodePositions: surfaceNodePositions,
@@ -910,10 +859,6 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
910
859
  var isAdvancedLayoutEnabled = editorExperiment('advanced_layouts', true, {
911
860
  exposure: true
912
861
  });
913
- var toolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
914
- var flags = {
915
- toolbarFlagsEnabled: toolbarFlagsEnabled
916
- };
917
862
  var anchorRectCache;
918
863
  if (!isAnchorSupported()) {
919
864
  anchorRectCache = new AnchorRectCache();
@@ -962,7 +907,7 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
962
907
  return _objectSpread({}, initialState);
963
908
  },
964
909
  apply: function apply(tr, currentState, _, newState) {
965
- return _apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled, anchorRectCache, resizeObserverWidth, pragmaticCleanup, limitedModeTeardown);
910
+ return _apply(api, formatMessage, tr, currentState, newState, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled, anchorRectCache, resizeObserverWidth, pragmaticCleanup, limitedModeTeardown);
966
911
  }
967
912
  },
968
913
  props: {
@@ -1,7 +1,6 @@
1
1
  import { getNodeSelectionForPos, selectNodeAtPos } from '@atlaskit/editor-common/node-selection';
2
2
  import { Side } from '@atlaskit/editor-common/selection';
3
3
  import { GapCursorSelection } from '@atlaskit/editor-common/selection/gap-cursor/selection';
4
- import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
5
4
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
6
5
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
7
6
  import { selectTableClosestToPos } from '@atlaskit/editor-tables/select-table-closest-to-pos';
@@ -68,7 +67,7 @@ export var selectNode = function selectNode(tr, start, nodeType, api) {
68
67
  }
69
68
  return tr;
70
69
  };
71
- export var setCursorPositionAtMovedNode = function setCursorPositionAtMovedNode(tr, start, api) {
70
+ export var setCursorPositionAtMovedNode = function setCursorPositionAtMovedNode(tr, start) {
72
71
  var node = tr.doc.nodeAt(start);
73
72
  var isNodeSelection = node && NodeSelection.isSelectable(node);
74
73
  var nodeSize = node ? node.nodeSize : 1;
@@ -82,7 +81,7 @@ export var setCursorPositionAtMovedNode = function setCursorPositionAtMovedNode(
82
81
  }
83
82
 
84
83
  // this is a fix for empty paragraph selection - can safely use start position as the paragraph is empty
85
- if ((node === null || node === void 0 ? void 0 : node.type.name) === 'paragraph' && (node === null || node === void 0 ? void 0 : node.childCount) === 0 && areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar))) {
84
+ if ((node === null || node === void 0 ? void 0 : node.type.name) === 'paragraph' && (node === null || node === void 0 ? void 0 : node.childCount) === 0) {
86
85
  var _selection = new TextSelection(tr.doc.resolve(start));
87
86
  tr.setSelection(_selection);
88
87
  return tr;