@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.
@@ -9,7 +9,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _react = require("@emotion/react");
10
10
  var _dragHandle = require("@atlaskit/editor-common/styles/drag-handle");
11
11
  var _nativeAnchor = require("@atlaskit/editor-common/styles/native-anchor");
12
- var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
13
12
  var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
14
13
  var _whitespace = require("@atlaskit/editor-common/whitespace/whitespace");
15
14
  var _constants = require("@atlaskit/editor-shared-styles/constants");
@@ -197,24 +196,10 @@ var extendedDragZoneNext = (0, _react.css)({
197
196
  left: "calc((100% - var(--ak-editor-max-container-width))/2)"
198
197
  })
199
198
  });
200
- var paragraphWithTrailingBreakAsOnlyChild = '+ :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
201
- var indentatedParagraphWithTrailingBreakAsOnlyChild = '+ div.fabric-editor-indentation-mark > :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
202
- var paragraphWithPlaceholder = '+ p > .placeholder-decoration';
203
199
  var dragHandleContainer = '.ProseMirror-widget[data-blocks-drag-handle-container="true"]';
204
- var dragHandleSelector = 'button[data-testid="block-ctrl-drag-handle"]';
205
200
  var dropTargetContainer = '.ProseMirror-widget[data-blocks-drop-target-container="true"]';
206
201
  var 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';
207
- var withInlineNodeStyleSelectors = ["".concat(dragHandleContainer, ":has(").concat(paragraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(indentatedParagraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(paragraphWithPlaceholder, ") ").concat(dragHandleSelector)].join(', ');
208
202
  var withFormatInLayoutStyleFixSelectors = ["".concat(dragHandleContainer, ":first-child + .fabric-editor-indentation-mark > p:first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-alignment > p:first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-font-size > p:first-child"), "".concat(dragHandleContainer, ":first-child + ").concat(dropTargetContainer, " + .fabric-editor-indentation-mark > p:first-child"), "".concat(dragHandleContainer, ":first-child + ").concat(dropTargetContainer, " + .fabric-editor-alignment > p:first-child"), "".concat(dragHandleContainer, ":first-child + ").concat(dropTargetContainer, " + .fabric-editor-font-size > p:first-child"), "".concat(dropTargetContainer, ":first-child + .fabric-editor-alignment > p:first-child"), "".concat(dropTargetContainer, ":first-child + .fabric-editor-indentation-mark > p:first-child"), "".concat(dropTargetContainer, ":first-child + .fabric-editor-font-size > p:first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-indentation-mark > :is(h1, h2, h3, h4, h5, h6):first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-font-size > :is(h1, h2, h3, h4, h5, h6):first-child")].join(', ');
209
-
210
- /**
211
- * Please do not change change transform to display:none, or visibility:hidden
212
- * Otherwise it might break composition input for Chrome
213
- * https://product-fabric.atlassian.net/browse/ED-24136
214
- */
215
- var withInlineNodeStyle = (0, _react.css)((0, _defineProperty2.default)({}, withInlineNodeStyleSelectors, {
216
- transform: 'scale(0)'
217
- }));
218
203
  var legacyBreakoutWideLayoutStyle = (0, _react.css)({
219
204
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
220
205
  '.ProseMirror-widget[data-blocks-drop-target-container="true"]': {
@@ -499,15 +484,12 @@ var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWra
499
484
  var isDragging = isDraggingFromState;
500
485
  var shouldRenderAnchors = (0, _nativeAnchor.isCSSAnchorSupported)() && (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true);
501
486
  var sparseSurfaceAnchorsEnabled = Boolean((0, _nativeAnchor.isCSSAnchorSupported)()) && sparseSurfacesEnabled;
502
- var toolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
503
487
  return (0, _react.jsx)(_react.Global
504
488
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
505
489
  , {
506
490
  styles: [globalStyles(), globalDnDStyle, (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? extendedHoverZoneNext() : extendedHoverZone()), isDragging && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? extendedDragZoneNext : extendedDragZone), (!sparseSurfacesEnabled || isDragging) && (0, _editorExperiment.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
507
491
  exposure: true
508
- }) ? (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined,
509
- // this allows drag handles to render on empty lines
510
- toolbarFlagsEnabled ? undefined : withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _editorExperiment.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_lovability_dividers') && withRuleOverflowStyleFix, withFormatInLayoutStyleFix, (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? withRelativePosStyleNext : withRelativePosStyle), (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle), (!sparseSurfacesEnabled || isDragging) && (((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) && (0, _expValEquals.expValEquals)('advanced_layouts', 'isEnabled', true) ? layoutColumnExtendedHoverZone : layoutColumnWithoutHoverZone), sparseSurfaceAnchorsEnabled ? isDragging ? dragAnchorStyles : false : (0, _expValEquals.expValEquals)('platform_editor_controls_reliable_anchor', 'isEnabled', true) ?
492
+ }) ? (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _editorExperiment.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_lovability_dividers') && withRuleOverflowStyleFix, withFormatInLayoutStyleFix, (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? withRelativePosStyleNext : withRelativePosStyle), (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle), (!sparseSurfacesEnabled || isDragging) && (((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) && (0, _expValEquals.expValEquals)('advanced_layouts', 'isEnabled', true) ? layoutColumnExtendedHoverZone : layoutColumnWithoutHoverZone), sparseSurfaceAnchorsEnabled ? isDragging ? dragAnchorStyles : false : (0, _expValEquals.expValEquals)('platform_editor_controls_reliable_anchor', 'isEnabled', true) ?
511
493
  // dragAnchorStyles sets anchor-name on ALL nodes during drag (needed for drop target positioning).
512
494
  // staticControlsAnchorStyles handles anchor-name via node decorations for non-drag state.
513
495
  // shouldRenderAnchors guards both: only apply anchor styles on browsers that support CSS anchor positioning.
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  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';
3
3
  import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
4
- import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
5
4
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
6
5
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
7
6
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
@@ -170,7 +169,7 @@ export const blockControlsPlugin = ({
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
@@ -465,7 +465,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
465
465
  }
466
466
  const sliceSize = sliceTo - sliceFrom;
467
467
  if (inputMethod === INPUT_METHOD.DRAG_AND_DROP) {
468
- tr = setCursorPositionAtMovedNode(tr, mappedTo, api);
468
+ tr = setCursorPositionAtMovedNode(tr, mappedTo);
469
469
  } else if (preservedSelection) {
470
470
  const currMeta = tr.getMeta(key);
471
471
  const nodeMovedOffset = mappedTo - sliceFrom;
@@ -1,6 +1,5 @@
1
1
  import memoizeOne from 'memoize-one';
2
2
  import { isMultiBlockSelection } from '@atlaskit/editor-common/selection/utils';
3
- import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
4
3
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
5
4
  import { fg } from '@atlaskit/platform-feature-flags/fg';
6
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
@@ -101,7 +100,6 @@ export const handleMouseOver = (view, event, api) => {
101
100
  };
102
101
  const editorViewMode = api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode;
103
102
  const isViewMode = editorViewMode === 'view';
104
- const toolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
105
103
 
106
104
  // EDITOR-7926: bail out while a diff is on screen (or a suggestion card is open) so hovering
107
105
  // doesn't dispatch showDragHandleAt and cause the drag handle to jitter over the diff.
@@ -245,47 +243,37 @@ export const handleMouseOver = (view, event, api) => {
245
243
  const targetPos = view.state.doc.resolve(pos).pos;
246
244
  let rootAnchorName;
247
245
  let rootNodeType;
248
- let rootPos;
249
-
250
246
  // enables quick insert
251
- if (toolbarFlagsEnabled) {
252
- rootPos = view.state.doc.resolve(pos).before(1);
253
- if (targetPos !== rootPos) {
254
- const rootDOM = view.nodeDOM(rootPos);
255
- if (rootDOM instanceof HTMLElement) {
256
- var _ref2, _rootDOM$getAttribute, _rootDOM$getAttribute2;
257
- rootAnchorName = (_ref2 = (_rootDOM$getAttribute = rootDOM.getAttribute(getAnchorAttrName())) !== null && _rootDOM$getAttribute !== void 0 ? _rootDOM$getAttribute : rootDOM.getAttribute(NODE_ANCHOR_ATTR_NAME)) !== null && _ref2 !== void 0 ? _ref2 : undefined;
258
- rootNodeType = isNativeAnchorSupported ? getTypeNameFromDom(rootDOM) : // Fallback: breakout mark wrappers have no data-drag-handler-node-type;
259
- // use data-prosemirror-node-name instead.
260
- (_rootDOM$getAttribute2 = rootDOM.getAttribute('data-drag-handler-node-type')) !== null && _rootDOM$getAttribute2 !== void 0 ? _rootDOM$getAttribute2 : getTypeNameFromDom(rootDOM);
261
- }
247
+ const rootPos = view.state.doc.resolve(pos).before(1);
248
+ if (targetPos !== rootPos) {
249
+ const rootDOM = view.nodeDOM(rootPos);
250
+ if (rootDOM instanceof HTMLElement) {
251
+ var _ref2, _rootDOM$getAttribute, _rootDOM$getAttribute2;
252
+ rootAnchorName = (_ref2 = (_rootDOM$getAttribute = rootDOM.getAttribute(getAnchorAttrName())) !== null && _rootDOM$getAttribute !== void 0 ? _rootDOM$getAttribute : rootDOM.getAttribute(NODE_ANCHOR_ATTR_NAME)) !== null && _ref2 !== void 0 ? _ref2 : undefined;
253
+ rootNodeType = isNativeAnchorSupported ? getTypeNameFromDom(rootDOM) : // Fallback: breakout mark wrappers have no data-drag-handler-node-type;
254
+ // use data-prosemirror-node-name instead.
255
+ (_rootDOM$getAttribute2 = rootDOM.getAttribute('data-drag-handler-node-type')) !== null && _rootDOM$getAttribute2 !== void 0 ? _rootDOM$getAttribute2 : getTypeNameFromDom(rootDOM);
262
256
  }
263
257
  }
264
258
  const nodeType = isNativeAnchorSupported ? getTypeNameFromDom(rootElement) : // Fallback for table nodes: tr has data-prosemirror-node-name but not data-drag-handler-node-type.
265
259
  (_rootElement$getAttri2 = rootElement.getAttribute('data-drag-handler-node-type')) !== null && _rootElement$getAttri2 !== void 0 ? _rootElement$getAttri2 : getTypeNameFromDom(rootElement);
266
260
  if (nodeType) {
267
- var _api$userIntent2, _api$userIntent2$shar;
261
+ var _selectionPreservatio, _api$userIntent2, _api$userIntent2$shar;
268
262
  // enables quick insert
269
- if (toolbarFlagsEnabled) {
270
- var _selectionPreservatio;
271
- const preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
272
- const selection = preservedSelection || view.state.selection;
273
- const isMultipleSelected = selection && isMultiBlockSelection(selection);
263
+ const preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
264
+ const selection = preservedSelection || view.state.selection;
265
+ const isMultipleSelected = selection && isMultiBlockSelection(selection);
274
266
 
275
- // Only execute when selection is not a multi-selection, block menu is open, and menu is opened via keyboard
276
- // as when it is a multi-selection, the showDragHandleAt command interfere with selection
277
- // sometimes makes the multi-selection not continous after block menu is opened with keyboard
278
- if (!(isMultipleSelected && isMenuOpen && blockMenuOptions !== null && blockMenuOptions !== void 0 && blockMenuOptions.openedViaKeyboard)) {
279
- var _api$core, _api$blockControls3, _rootPos, _rootAnchorName, _rootNodeType;
280
- api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.showDragHandleAt(targetPos, anchorName, nodeType, undefined, (_rootPos = rootPos) !== null && _rootPos !== void 0 ? _rootPos : targetPos, (_rootAnchorName = rootAnchorName) !== null && _rootAnchorName !== void 0 ? _rootAnchorName : anchorName, (_rootNodeType = rootNodeType) !== null && _rootNodeType !== void 0 ? _rootNodeType : nodeType));
281
- }
282
- } else {
283
- var _api$core2, _api$blockControls4;
284
- api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.showDragHandleAt(targetPos, anchorName, nodeType));
267
+ // Only execute when selection is not a multi-selection, block menu is open, and menu is opened via keyboard
268
+ // as when it is a multi-selection, the showDragHandleAt command interfere with selection
269
+ // sometimes makes the multi-selection not continous after block menu is opened with keyboard
270
+ if (!(isMultipleSelected && isMenuOpen && blockMenuOptions !== null && blockMenuOptions !== void 0 && blockMenuOptions.openedViaKeyboard)) {
271
+ var _api$core, _api$blockControls3, _rootAnchorName, _rootNodeType;
272
+ api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.showDragHandleAt(targetPos, anchorName, nodeType, undefined, rootPos, (_rootAnchorName = rootAnchorName) !== null && _rootAnchorName !== void 0 ? _rootAnchorName : anchorName, (_rootNodeType = rootNodeType) !== null && _rootNodeType !== void 0 ? _rootNodeType : nodeType));
285
273
  }
286
274
  if (isMenuOpen && originalAnchorName && (api === null || api === void 0 ? void 0 : (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : (_api$userIntent2$shar = _api$userIntent2.sharedState.currentState()) === null || _api$userIntent2$shar === void 0 ? void 0 : _api$userIntent2$shar.currentUserIntent) === 'blockMenuOpen') {
287
- var _api$core3, _api$blockControls5;
288
- api === null || api === void 0 ? void 0 : (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 ? void 0 : _api$blockControls5.commands.toggleBlockMenu());
275
+ var _api$core2, _api$blockControls4;
276
+ api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.toggleBlockMenu());
289
277
  }
290
278
  }
291
279
  }
@@ -6,7 +6,6 @@ import { getBrowserInfo } from '@atlaskit/editor-common/browser';
6
6
  import { getNodeIdProvider } from '@atlaskit/editor-common/node-anchor-provider';
7
7
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
8
8
  import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles/drag-handle';
9
- import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
10
9
  import { EDIT_AREA_ID } from '@atlaskit/editor-common/ui-toolbar';
11
10
  import { isEmptyDocument } from '@atlaskit/editor-common/utils';
12
11
  import { PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
@@ -171,8 +170,8 @@ const getDecorationAtPos = (state, decorations, pos, to) => {
171
170
  const nodeDecAtActivePos = nodeDecsAtActivePos.pop();
172
171
  return nodeDecAtActivePos;
173
172
  };
174
- export const apply = (api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled = false, quickInsertButtonEnabled = true, anchorRectCache, resizeObserverWidth, pragmaticCleanup, limitedModeTeardown) => {
175
- var _meta$multiSelectDnD, _api$editorViewMode, _api$editorViewMode$s, _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;
173
+ export const apply = (api, formatMessage, tr, currentState, newState, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled = false, quickInsertButtonEnabled = true, anchorRectCache, resizeObserverWidth, pragmaticCleanup, limitedModeTeardown) => {
174
+ var _meta$multiSelectDnD, _api$editorViewMode, _api$editorViewMode$s, _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;
176
175
  let {
177
176
  activeNode,
178
177
  decorations,
@@ -202,7 +201,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
202
201
  numReplaceSteps,
203
202
  isAllText,
204
203
  isReplacedWithSameSize
205
- } = getTrMetadata(tr, flags);
204
+ } = getTrMetadata(tr);
206
205
  const meta = tr.getMeta(key);
207
206
  if (isExperimentEnabled('platform_editor_dynamic_limited_mode')) {
208
207
  var _api$limitedMode, _api$limitedMode$shar;
@@ -297,62 +296,50 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
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
- const 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
+ let mappedPos;
302
+ const 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
- let mappedPos;
314
- const 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;
315
+ // for editor controls, remap the rootPos as well
316
+ let mappedRootPos;
317
+ if (activeNode.rootPos !== undefined) {
318
+ mappedRootPos = tr.mapping.mapResult(activeNode.rootPos, -1);
319
+ }
320
+ let mappedNodeType = activeNode.nodeType;
321
+ let 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
+ const mappedNode = newState.doc.nodeAt(mappedPos.pos);
327
+ if (mappedNode !== null && mappedNode !== void 0 && mappedNode.isBlock) {
328
+ mappedNodeType = getNodeTypeWithLevel(mappedNode);
326
329
  }
327
- // for editor controls, remap the rootPos as well
328
- let mappedRootPos;
329
- if (activeNode.rootPos !== undefined) {
330
- mappedRootPos = tr.mapping.mapResult(activeNode.rootPos, -1);
330
+ const 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);
331
333
  }
332
- let mappedNodeType = activeNode.nodeType;
333
- let 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
- const mappedNode = newState.doc.nodeAt(mappedPos.pos);
339
- if (mappedNode !== null && mappedNode !== void 0 && mappedNode.isBlock) {
340
- mappedNodeType = getNodeTypeWithLevel(mappedNode);
341
- }
342
- const 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
- }
346
- }
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,41 +382,21 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
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
- const findNewNodeDecs = findNodeDecs(newState, decorations, latestActiveNode.pos - 1, to);
402
-
403
- // Find the specific dec that the active node corresponds to
404
- const nodeDecsAtActivePos = findNewNodeDecs.filter(dec => (dec === null || dec === void 0 ? void 0 : dec.from) === latestActiveNode.pos);
405
-
406
- // If multiple decorations at the active node pos, we want the last one
407
- const nodeDecAtActivePos = nodeDecsAtActivePos.pop();
408
-
409
- // Update the active node anchor-name and type for accurate positioning
410
- if (nodeDecAtActivePos) {
411
- isActiveNodeModified = true;
412
- latestActiveNode.anchorName = nodeDecAtActivePos.spec.anchorName;
413
- latestActiveNode.nodeType = nodeDecAtActivePos.spec.nodeType;
414
- }
385
+ if (latestActiveNode && (!isActiveNodeDeleted || isReplacedWithSameSize)) {
386
+ const nodeDecAtActivePos = getDecorationAtPos(newState, decorations, latestActiveNode.pos, to);
387
+ const rootNodeDecAtActivePos = latestActiveNode.rootPos !== undefined ? getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to) : undefined;
388
+ if (nodeDecAtActivePos || rootNodeDecAtActivePos) {
389
+ isActiveNodeModified = true;
415
390
  }
416
- } else {
417
- if (latestActiveNode && (!isActiveNodeDeleted || isReplacedWithSameSize)) {
418
- const nodeDecAtActivePos = getDecorationAtPos(newState, decorations, latestActiveNode.pos, to);
419
- const rootNodeDecAtActivePos = latestActiveNode.rootPos !== undefined ? getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to) : undefined;
420
- if (nodeDecAtActivePos || rootNodeDecAtActivePos) {
421
- isActiveNodeModified = true;
422
- }
423
391
 
424
- // Update the active node anchor-name and type for accurate positioning
425
- if (nodeDecAtActivePos) {
426
- latestActiveNode.anchorName = nodeDecAtActivePos.spec.anchorName;
427
- latestActiveNode.nodeType = nodeDecAtActivePos.spec.nodeType;
428
- }
429
- if (rootNodeDecAtActivePos) {
430
- latestActiveNode.rootAnchorName = rootNodeDecAtActivePos.spec.anchorName;
431
- latestActiveNode.rootNodeType = rootNodeDecAtActivePos.spec.nodeType;
432
- }
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;
433
400
  }
434
401
  }
435
402
  }
@@ -452,10 +419,8 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
452
419
  let shouldRemoveHandle = latestActiveNode ? isResizerResizing || isActiveNodeDeleted && !isReplacedWithSameSize || (meta === null || meta === void 0 ? void 0 : meta.nodeMoved) : true;
453
420
 
454
421
  // enables quick insert
455
- if (flags.toolbarFlagsEnabled) {
456
- // Remove handle dec when editor is blurred
457
- shouldRemoveHandle = shouldRemoveHandle || (meta === null || meta === void 0 ? void 0 : meta.editorBlurred);
458
- }
422
+ // Remove handle dec when editor is blurred
423
+ shouldRemoveHandle = shouldRemoveHandle || (meta === null || meta === void 0 ? void 0 : meta.editorBlurred);
459
424
 
460
425
  // In view mode with right-side controls, remove any lingering drag handle decorations
461
426
  // (they may carry over from edit mode). Only remove drag handles specifically, not
@@ -488,25 +453,23 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
488
453
  // nodeDecorationRegistry cleanup (e.g. the legacy Remix button) is independent of the legacy
489
454
  // quick-insert button, so this must not be gated by quickInsertButtonEnabled — otherwise a
490
455
  // stale decoration is left behind whenever platform_editor_block_control_migration is on.
491
- if (flags.toolbarFlagsEnabled) {
492
- // enables quick insert
493
- if (quickInsertButtonEnabled) {
494
- var _activeNode7, _activeNode8;
495
- const oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.rootPos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.rootPos);
496
- decorations = decorations.remove(oldQuickInsertButton);
497
- }
456
+ // enables quick insert
457
+ if (quickInsertButtonEnabled) {
458
+ var _activeNode7, _activeNode8;
459
+ const 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
+ for (const factory of nodeDecorationRegistry) {
463
+ var _activeNode9, _activeNode0;
464
+ const old = decorations.find((_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.rootPos, (_activeNode0 = activeNode) === null || _activeNode0 === void 0 ? void 0 : _activeNode0.rootPos, spec => spec.type === factory.type);
465
+ decorations = decorations.remove(old);
466
+ }
467
+ if (rightSideControlsEnabled && isViewMode) {
498
468
  for (const factory of nodeDecorationRegistry) {
499
- var _activeNode9, _activeNode0;
500
- const old = decorations.find((_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.rootPos, (_activeNode0 = activeNode) === null || _activeNode0 === void 0 ? void 0 : _activeNode0.rootPos, spec => spec.type === factory.type);
501
- decorations = decorations.remove(old);
502
- }
503
- if (rightSideControlsEnabled && isViewMode) {
504
- for (const factory of nodeDecorationRegistry) {
505
- if (factory.showInViewMode) {
506
- var _activeNode1, _activeNode10;
507
- const old = decorations.find((_activeNode1 = activeNode) === null || _activeNode1 === void 0 ? void 0 : _activeNode1.rootPos, (_activeNode10 = activeNode) === null || _activeNode10 === void 0 ? void 0 : _activeNode10.rootPos, spec => spec.type === factory.type);
508
- decorations = decorations.remove(old);
509
- }
469
+ if (factory.showInViewMode) {
470
+ var _activeNode1, _activeNode10;
471
+ const old = decorations.find((_activeNode1 = activeNode) === null || _activeNode1 === void 0 ? void 0 : _activeNode1.rootPos, (_activeNode10 = activeNode) === null || _activeNode10 === void 0 ? void 0 : _activeNode10.rootPos, spec => spec.type === factory.type);
472
+ decorations = decorations.remove(old);
510
473
  }
511
474
  }
512
475
  }
@@ -585,9 +548,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
585
548
  }
586
549
  }
587
550
  }
588
- if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined && (quickInsertButtonEnabled || nodeDecorationRegistry.length > 0) &&
589
- // enables quick insert
590
- flags.toolbarFlagsEnabled && (!rightSideControlsEnabled || !isViewMode)) {
551
+ if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined && (quickInsertButtonEnabled || nodeDecorationRegistry.length > 0) && (!rightSideControlsEnabled || !isViewMode)) {
591
552
  var _latestActiveNode1;
592
553
  if (quickInsertButtonEnabled) {
593
554
  var _activeNode13, _activeNode14, _latestActiveNode6, _latestActiveNode7, _latestActiveNode8, _latestActiveNode9, _latestActiveNode0;
@@ -663,7 +624,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
663
624
  const rootPos = (_latestActiveNode10 = latestActiveNode) === null || _latestActiveNode10 === void 0 ? void 0 : _latestActiveNode10.rootPos;
664
625
  // 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.
665
626
  const isDocLevel = rootPos !== undefined && !isNaN(rootPos);
666
- if (isViewMode && isDocLevel && flags.toolbarFlagsEnabled && rightSideControlsEnabled) {
627
+ if (isViewMode && isDocLevel && rightSideControlsEnabled) {
667
628
  for (const factory of nodeDecorationRegistry) {
668
629
  if (factory.showInViewMode) {
669
630
  if (!latestActiveNode || latestActiveNode.rootPos === undefined) {
@@ -744,21 +705,15 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
744
705
  decorations = decorations.add(newState.doc, [emptyParagraphNodeDecorations()]);
745
706
  }
746
707
  }
747
- let newActiveNode;
708
+
748
709
  // enables quick insert
749
- if (flags.toolbarFlagsEnabled) {
750
- var _latestActiveNode11, _latestActiveNode12;
751
- // remove isEmptyDoc check and let decorations render and determine their own visibility
752
- // In view mode with right-side controls we render node decorations (right-edge button), not the
753
- // handle - so findHandleDec is always empty. Don't clear activeNode in that case.
754
- const 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;
755
- // Keep the registry surface mounted while its Block Menu owns focus.
756
- const keepActiveNodeForOpenBlockMenu = isExperimentEnabled('platform_editor_block_control_migration') && isMenuOpen;
757
- newActiveNode = meta !== null && meta !== void 0 && meta.editorBlurred && !keepActiveNodeForOpenBlockMenu || !(meta !== null && meta !== void 0 && meta.activeNode) && !hasHandleOrViewModeControls ? null : latestActiveNode;
758
- } else {
759
- var _latestActiveNode13, _latestActiveNode14;
760
- 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;
761
- }
710
+ // remove isEmptyDoc check and let decorations render and determine their own visibility
711
+ // In view mode with right-side controls we render node decorations (right-edge button), not the
712
+ // handle - so findHandleDec is always empty. Don't clear activeNode in that case.
713
+ const 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;
714
+ // Keep the registry surface mounted while its Block Menu owns focus.
715
+ const keepActiveNodeForOpenBlockMenu = isExperimentEnabled('platform_editor_block_control_migration') && isMenuOpen;
716
+ const newActiveNode = meta !== null && meta !== void 0 && meta.editorBlurred && !keepActiveNodeForOpenBlockMenu || !(meta !== null && meta !== void 0 && meta.activeNode) && !hasHandleOrViewModeControls ? null : latestActiveNode;
762
717
  let nextMenuTriggerByNode = (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.triggerByNode) || menuTriggerByNode;
763
718
  if (isExperimentEnabled('platform_editor_block_control_migration') && tr.docChanged && menuTriggerByNode && !(meta !== null && meta !== void 0 && meta.toggleMenu)) {
764
719
  var _menuTriggerByNode$ro, _newState$doc$nodeAt4;
@@ -781,11 +736,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
781
736
  const isSameAnchor = (meta === null || meta === void 0 ? void 0 : meta.toggleMenu.anchorName) === menuTriggerBy;
782
737
  isMenuOpen = menuTriggerBy === undefined || isSameAnchor || !isMenuOpen && !isSameAnchor ? !isMenuOpen : isMenuOpen;
783
738
  }
784
- if (flags.toolbarFlagsEnabled) {
785
- isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined ? meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle : isSelectedViaDragHandle;
786
- } else {
787
- isSelectedViaDragHandle = false;
788
- }
739
+ isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined ? meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle : isSelectedViaDragHandle;
789
740
  return {
790
741
  decorations,
791
742
  surfaceNodePositions,
@@ -818,10 +769,6 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecora
818
769
  const isAdvancedLayoutEnabled = editorExperiment('advanced_layouts', true, {
819
770
  exposure: true
820
771
  });
821
- const toolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
822
- const flags = {
823
- toolbarFlagsEnabled
824
- };
825
772
  let anchorRectCache;
826
773
  if (!isAnchorSupported()) {
827
774
  anchorRectCache = new AnchorRectCache();
@@ -869,7 +816,7 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecora
869
816
  init: () => ({
870
817
  ...initialState
871
818
  }),
872
- apply: (tr, currentState, _, newState) => apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled, anchorRectCache, resizeObserverWidth, pragmaticCleanup, limitedModeTeardown)
819
+ apply: (tr, currentState, _, newState) => apply(api, formatMessage, tr, currentState, newState, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled, anchorRectCache, resizeObserverWidth, pragmaticCleanup, limitedModeTeardown)
873
820
  },
874
821
  props: {
875
822
  decorations: state => {
@@ -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 const selectNode = (tr, start, nodeType, api) => {
68
67
  }
69
68
  return tr;
70
69
  };
71
- export const setCursorPositionAtMovedNode = (tr, start, api) => {
70
+ export const setCursorPositionAtMovedNode = (tr, start) => {
72
71
  const node = tr.doc.nodeAt(start);
73
72
  const isNodeSelection = node && NodeSelection.isSelectable(node);
74
73
  const nodeSize = node ? node.nodeSize : 1;
@@ -82,7 +81,7 @@ export const setCursorPositionAtMovedNode = (tr, start, api) => {
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
  const selection = new TextSelection(tr.doc.resolve(start));
87
86
  tr.setSelection(selection);
88
87
  return tr;
@@ -45,7 +45,7 @@ const isStepContentReplacedWithAnotherOfSameSize = s => {
45
45
  * Number of ReplaceStep and ReplaceAroundStep steps 'numReplaceSteps'.
46
46
  * 'isAllText' if all steps are represent adding inline text or a backspace/delete or no-op
47
47
  */
48
- export const getTrMetadata = (tr, flags) => {
48
+ export const getTrMetadata = tr => {
49
49
  let from;
50
50
  let to;
51
51
  let numReplaceSteps = 0;
@@ -57,10 +57,7 @@ export const getTrMetadata = (tr, flags) => {
57
57
  isAllText = false;
58
58
  }
59
59
  // Fixes drag handle and quick insert button overlap issues
60
- if (flags.toolbarFlagsEnabled) {
61
- // fixes drag handle and quick insert button overlap issues
62
- isReplacedWithSameSize = isStepContentReplacedWithAnotherOfSameSize(s);
63
- }
60
+ isReplacedWithSameSize = isStepContentReplacedWithAnotherOfSameSize(s);
64
61
  const mappedTo = tr.mapping.map(s.to);
65
62
  let $to = s.from + s.slice.size;
66
63
  $to = $to > mappedTo ? $to : mappedTo;