@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.
@@ -45,7 +45,7 @@ var isStepContentReplacedWithAnotherOfSameSize = function isStepContentReplacedW
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 var getTrMetadata = function getTrMetadata(tr, flags) {
48
+ export var getTrMetadata = function getTrMetadata(tr) {
49
49
  var from;
50
50
  var to;
51
51
  var numReplaceSteps = 0;
@@ -57,10 +57,7 @@ export var getTrMetadata = function 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
  var mappedTo = tr.mapping.map(s.to);
65
62
  var $to = s.from + s.slice.size;
66
63
  $to = $to > mappedTo ? $to : mappedTo;
@@ -7,7 +7,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
7
  import { css, Global, jsx } from '@emotion/react';
8
8
  import { DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles/drag-handle';
9
9
  import { ANCHOR_VARIABLE_NAME, isCSSAnchorSupported } from '@atlaskit/editor-common/styles/native-anchor';
10
- import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
11
10
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
12
11
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace/whitespace';
13
12
  import { akEditorBreakoutPadding, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorFullPageNarrowBreakout, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced } from '@atlaskit/editor-shared-styles/constants';
@@ -190,24 +189,10 @@ var extendedDragZoneNext = css({
190
189
  left: "calc((100% - var(--ak-editor-max-container-width))/2)"
191
190
  })
192
191
  });
193
- var paragraphWithTrailingBreakAsOnlyChild = '+ :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
194
- var indentatedParagraphWithTrailingBreakAsOnlyChild = '+ div.fabric-editor-indentation-mark > :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
195
- var paragraphWithPlaceholder = '+ p > .placeholder-decoration';
196
192
  var dragHandleContainer = '.ProseMirror-widget[data-blocks-drag-handle-container="true"]';
197
- var dragHandleSelector = 'button[data-testid="block-ctrl-drag-handle"]';
198
193
  var dropTargetContainer = '.ProseMirror-widget[data-blocks-drop-target-container="true"]';
199
194
  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';
200
- var withInlineNodeStyleSelectors = ["".concat(dragHandleContainer, ":has(").concat(paragraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(indentatedParagraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(paragraphWithPlaceholder, ") ").concat(dragHandleSelector)].join(', ');
201
195
  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(', ');
202
-
203
- /**
204
- * Please do not change change transform to display:none, or visibility:hidden
205
- * Otherwise it might break composition input for Chrome
206
- * https://product-fabric.atlassian.net/browse/ED-24136
207
- */
208
- var withInlineNodeStyle = css(_defineProperty({}, withInlineNodeStyleSelectors, {
209
- transform: 'scale(0)'
210
- }));
211
196
  var legacyBreakoutWideLayoutStyle = css({
212
197
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
213
198
  '.ProseMirror-widget[data-blocks-drop-target-container="true"]': {
@@ -492,15 +477,12 @@ export var GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
492
477
  var isDragging = isDraggingFromState;
493
478
  var shouldRenderAnchors = isCSSAnchorSupported() && expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true);
494
479
  var sparseSurfaceAnchorsEnabled = Boolean(isCSSAnchorSupported()) && sparseSurfacesEnabled;
495
- var toolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
496
480
  return jsx(Global
497
481
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
498
482
  , {
499
483
  styles: [globalStyles(), globalDnDStyle, (!sparseSurfacesEnabled || isDragging) && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? extendedHoverZoneNext() : extendedHoverZone()), isDragging && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? extendedDragZoneNext : extendedDragZone), (!sparseSurfacesEnabled || isDragging) && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
500
484
  exposure: true
501
- }) ? expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined,
502
- // this allows drag handles to render on empty lines
503
- toolbarFlagsEnabled ? undefined : withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, isExperimentEnabled('platform_editor_lovability_dividers') && withRuleOverflowStyleFix, withFormatInLayoutStyleFix, (!sparseSurfacesEnabled || isDragging) && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? withRelativePosStyleNext : withRelativePosStyle), (!sparseSurfacesEnabled || isDragging) && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle), (!sparseSurfacesEnabled || isDragging) && ((expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration')) && expValEquals('advanced_layouts', 'isEnabled', true) ? layoutColumnExtendedHoverZone : layoutColumnWithoutHoverZone), sparseSurfaceAnchorsEnabled ? isDragging ? dragAnchorStyles : false : expValEquals('platform_editor_controls_reliable_anchor', 'isEnabled', true) ?
485
+ }) ? 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) ?
504
486
  // dragAnchorStyles sets anchor-name on ALL nodes during drag (needed for drop target positioning).
505
487
  // staticControlsAnchorStyles handles anchor-name via node decorations for non-drag state.
506
488
  // shouldRenderAnchors guards both: only apply anchor styles on browsers that support CSS anchor positioning.
@@ -8,11 +8,8 @@ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
8
  import type { BlockControlsMeta, BlockControlsPlugin, NodeDecorationFactory, PluginState } from '../blockControlsPluginType';
9
9
  import { AnchorRectCache } from './utils/anchor-utils';
10
10
  export declare const key: PluginKey<PluginState>;
11
- export interface FlagType {
12
- toolbarFlagsEnabled: boolean;
13
- }
14
11
  export declare const getDecorations: (state: EditorState) => DecorationSet | undefined;
15
- export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean, quickInsertButtonEnabled?: boolean, anchorRectCache?: AnchorRectCache, resizeObserverWidth?: ResizeObserver, pragmaticCleanup?: (() => void) | null, limitedModeTeardown?: {
12
+ export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean, quickInsertButtonEnabled?: boolean, anchorRectCache?: AnchorRectCache, resizeObserverWidth?: ResizeObserver, pragmaticCleanup?: (() => void) | null, limitedModeTeardown?: {
16
13
  done: boolean;
17
14
  }) => PluginState;
18
15
  export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean, quickInsertButtonEnabled?: boolean) => SafePlugin<PluginState>;
@@ -18,7 +18,7 @@ export declare const getInlineNodePos: (doc: PMNode, start: number, nodeSize: nu
18
18
  export declare const newGetSelection: (doc: PMNode, selectionEmpty: boolean, start: number) => false | TextSelection | NodeSelection;
19
19
  export declare const getSelection: (tr: Transaction, start: number) => false | TextSelection | NodeSelection;
20
20
  export declare const selectNode: (tr: Transaction, start: number, nodeType: string, api?: ExtractInjectionAPI<BlockControlsPlugin>) => Transaction;
21
- export declare const setCursorPositionAtMovedNode: (tr: Transaction, start: number, api?: ExtractInjectionAPI<BlockControlsPlugin>) => Transaction;
21
+ export declare const setCursorPositionAtMovedNode: (tr: Transaction, start: number) => Transaction;
22
22
  /**
23
23
  * Checks if handle position is with the selection or corresponds to a (partially) selected node
24
24
  * @param state
@@ -1,6 +1,5 @@
1
1
  import type { ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
2
2
  import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
3
- import type { FlagType } from '../main';
4
3
  interface TransactionMetadata {
5
4
  from: number;
6
5
  isAllText: boolean;
@@ -27,5 +26,5 @@ export declare const isStepDelete: (s: ReplaceStep) => boolean;
27
26
  * Number of ReplaceStep and ReplaceAroundStep steps 'numReplaceSteps'.
28
27
  * 'isAllText' if all steps are represent adding inline text or a backspace/delete or no-op
29
28
  */
30
- export declare const getTrMetadata: (tr: Transaction | ReadonlyTransaction, flags: FlagType) => TransactionMetadata;
29
+ export declare const getTrMetadata: (tr: Transaction | ReadonlyTransaction) => TransactionMetadata;
31
30
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "33.0.0",
3
+ "version": "34.0.0",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -29,23 +29,23 @@
29
29
  "@atlaskit/button": "^25.8.0",
30
30
  "@atlaskit/css": "^1.1.0",
31
31
  "@atlaskit/docs": "^12.3.0",
32
- "@atlaskit/editor-plugin-accessibility-utils": "^32.0.0",
33
- "@atlaskit/editor-plugin-analytics": "^32.0.0",
34
- "@atlaskit/editor-plugin-block-collapse": "^18.0.0",
35
- "@atlaskit/editor-plugin-editor-disabled": "^32.0.0",
36
- "@atlaskit/editor-plugin-editor-viewmode": "^34.0.0",
37
- "@atlaskit/editor-plugin-feature-flags": "^31.0.0",
38
- "@atlaskit/editor-plugin-interaction": "^46.0.0",
39
- "@atlaskit/editor-plugin-limited-mode": "^29.0.0",
40
- "@atlaskit/editor-plugin-metrics": "^33.0.0",
41
- "@atlaskit/editor-plugin-quick-insert": "^32.0.0",
42
- "@atlaskit/editor-plugin-selection": "^32.0.0",
43
- "@atlaskit/editor-plugin-show-diff": "^32.0.0",
44
- "@atlaskit/editor-plugin-toolbar": "^29.0.0",
45
- "@atlaskit/editor-plugin-type-ahead": "^33.0.0",
46
- "@atlaskit/editor-plugin-ui-control-registry": "^26.0.0",
47
- "@atlaskit/editor-plugin-user-intent": "^30.0.0",
48
- "@atlaskit/editor-plugin-width": "^33.0.0",
32
+ "@atlaskit/editor-plugin-accessibility-utils": "^33.0.0",
33
+ "@atlaskit/editor-plugin-analytics": "^33.0.0",
34
+ "@atlaskit/editor-plugin-block-collapse": "^19.0.0",
35
+ "@atlaskit/editor-plugin-editor-disabled": "^33.0.0",
36
+ "@atlaskit/editor-plugin-editor-viewmode": "^35.0.0",
37
+ "@atlaskit/editor-plugin-feature-flags": "^32.0.0",
38
+ "@atlaskit/editor-plugin-interaction": "^47.0.0",
39
+ "@atlaskit/editor-plugin-limited-mode": "^30.0.0",
40
+ "@atlaskit/editor-plugin-metrics": "^34.0.0",
41
+ "@atlaskit/editor-plugin-quick-insert": "^33.0.0",
42
+ "@atlaskit/editor-plugin-selection": "^33.0.0",
43
+ "@atlaskit/editor-plugin-show-diff": "^33.0.0",
44
+ "@atlaskit/editor-plugin-toolbar": "^30.0.0",
45
+ "@atlaskit/editor-plugin-type-ahead": "^34.0.0",
46
+ "@atlaskit/editor-plugin-ui-control-registry": "^27.0.0",
47
+ "@atlaskit/editor-plugin-user-intent": "^31.0.0",
48
+ "@atlaskit/editor-plugin-width": "^34.0.0",
49
49
  "@atlaskit/editor-prosemirror": "^9.0.0",
50
50
  "@atlaskit/editor-shared-styles": "^5.2.0",
51
51
  "@atlaskit/editor-tables": "^3.2.0",
@@ -72,7 +72,7 @@
72
72
  "uuid": "^11.1.1"
73
73
  },
74
74
  "peerDependencies": {
75
- "@atlaskit/editor-common": "^136.0.0",
75
+ "@atlaskit/editor-common": "^137.0.0",
76
76
  "react": "^18.2.0 || ^19.2.0",
77
77
  "react-dom": "^18.2.0 || ^19.2.0",
78
78
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -96,7 +96,7 @@
96
96
  }
97
97
  },
98
98
  "devDependencies": {
99
- "@atlaskit/editor-common": "^136.0.0",
99
+ "@atlaskit/editor-common": "^137.0.0",
100
100
  "@atlassian/structured-docs-types": "workspace:^",
101
101
  "@atlassian/workbench": "workspace:*",
102
102
  "react": "^19.2.0",