@atlaskit/editor-plugin-block-controls 12.4.1 → 12.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/block-decoration-utils/anchor-name/package.json +1 -8
  3. package/block-decoration-utils/consts/package.json +1 -8
  4. package/block-decoration-utils/dom-attr-name/package.json +1 -8
  5. package/block-decoration-utils/drag-handle-positions/package.json +1 -8
  6. package/block-decoration-utils/package.json +1 -8
  7. package/block-decoration-utils/visibility-container/package.json +1 -8
  8. package/block-decoration-utils/widget-positions/package.json +1 -8
  9. package/blockControlsPlugin/package.json +1 -8
  10. package/blockControlsPluginType/package.json +1 -8
  11. package/package.json +2 -2
  12. package/dist/types-ts4.5/blockControlsPlugin.d.ts +0 -2
  13. package/dist/types-ts4.5/blockControlsPluginType.d.ts +0 -250
  14. package/dist/types-ts4.5/editor-commands/handle-key-down-with-preserved-selection.d.ts +0 -17
  15. package/dist/types-ts4.5/editor-commands/map-preserved-selection.d.ts +0 -13
  16. package/dist/types-ts4.5/editor-commands/move-node-with-block-menu.d.ts +0 -4
  17. package/dist/types-ts4.5/editor-commands/move-node.d.ts +0 -5
  18. package/dist/types-ts4.5/editor-commands/move-to-layout.d.ts +0 -7
  19. package/dist/types-ts4.5/editor-commands/show-drag-handle.d.ts +0 -3
  20. package/dist/types-ts4.5/editor-commands/utils/move-node-utils.d.ts +0 -31
  21. package/dist/types-ts4.5/entry-points/block-decoration-utils-anchor-name.d.ts +0 -1
  22. package/dist/types-ts4.5/entry-points/block-decoration-utils-consts.d.ts +0 -1
  23. package/dist/types-ts4.5/entry-points/block-decoration-utils-dom-attr-name.d.ts +0 -1
  24. package/dist/types-ts4.5/entry-points/block-decoration-utils-drag-handle-positions.d.ts +0 -1
  25. package/dist/types-ts4.5/entry-points/block-decoration-utils-visibility-container.d.ts +0 -1
  26. package/dist/types-ts4.5/entry-points/block-decoration-utils-widget-positions.d.ts +0 -1
  27. package/dist/types-ts4.5/entry-points/blockControlsPlugin.d.ts +0 -1
  28. package/dist/types-ts4.5/entry-points/blockControlsPluginType.d.ts +0 -1
  29. package/dist/types-ts4.5/index.d.ts +0 -2
  30. package/dist/types-ts4.5/pm-plugins/decorations-anchor.d.ts +0 -15
  31. package/dist/types-ts4.5/pm-plugins/decorations-common.d.ts +0 -9
  32. package/dist/types-ts4.5/pm-plugins/decorations-drag-handle.d.ts +0 -30
  33. package/dist/types-ts4.5/pm-plugins/decorations-drop-target-active.d.ts +0 -13
  34. package/dist/types-ts4.5/pm-plugins/decorations-drop-target.d.ts +0 -21
  35. package/dist/types-ts4.5/pm-plugins/decorations-find-surrounding-nodes.d.ts +0 -22
  36. package/dist/types-ts4.5/pm-plugins/decorations-quick-insert-button.d.ts +0 -30
  37. package/dist/types-ts4.5/pm-plugins/first-node-dec-plugin.d.ts +0 -5
  38. package/dist/types-ts4.5/pm-plugins/handle-mouse-down.d.ts +0 -4
  39. package/dist/types-ts4.5/pm-plugins/handle-mouse-over.d.ts +0 -4
  40. package/dist/types-ts4.5/pm-plugins/interaction-tracking/commands.d.ts +0 -7
  41. package/dist/types-ts4.5/pm-plugins/interaction-tracking/handle-key-down.d.ts +0 -2
  42. package/dist/types-ts4.5/pm-plugins/interaction-tracking/handle-mouse-move.d.ts +0 -4
  43. package/dist/types-ts4.5/pm-plugins/interaction-tracking/pm-plugin.d.ts +0 -20
  44. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +0 -5
  45. package/dist/types-ts4.5/pm-plugins/main.d.ts +0 -63
  46. package/dist/types-ts4.5/pm-plugins/quick-insert-calculate-position.d.ts +0 -12
  47. package/dist/types-ts4.5/pm-plugins/selection-preservation/editor-commands.d.ts +0 -13
  48. package/dist/types-ts4.5/pm-plugins/selection-preservation/plugin-key.d.ts +0 -3
  49. package/dist/types-ts4.5/pm-plugins/selection-preservation/pm-plugin.d.ts +0 -35
  50. package/dist/types-ts4.5/pm-plugins/selection-preservation/types.d.ts +0 -7
  51. package/dist/types-ts4.5/pm-plugins/selection-preservation/utils.d.ts +0 -30
  52. package/dist/types-ts4.5/pm-plugins/utils/active-anchor-tracker.d.ts +0 -16
  53. package/dist/types-ts4.5/pm-plugins/utils/analytics.d.ts +0 -12
  54. package/dist/types-ts4.5/pm-plugins/utils/anchor-utils.d.ts +0 -27
  55. package/dist/types-ts4.5/pm-plugins/utils/check-fragment.d.ts +0 -9
  56. package/dist/types-ts4.5/pm-plugins/utils/check-media-layout.d.ts +0 -2
  57. package/dist/types-ts4.5/pm-plugins/utils/consts.d.ts +0 -2
  58. package/dist/types-ts4.5/pm-plugins/utils/drag-handle-positions.d.ts +0 -12
  59. package/dist/types-ts4.5/pm-plugins/utils/expand-and-update-selection.d.ts +0 -20
  60. package/dist/types-ts4.5/pm-plugins/utils/getNestedNodePosition.d.ts +0 -16
  61. package/dist/types-ts4.5/pm-plugins/utils/getSelection.d.ts +0 -32
  62. package/dist/types-ts4.5/pm-plugins/utils/inline-drop-target.d.ts +0 -7
  63. package/dist/types-ts4.5/pm-plugins/utils/marks.d.ts +0 -25
  64. package/dist/types-ts4.5/pm-plugins/utils/remove-from-source.d.ts +0 -3
  65. package/dist/types-ts4.5/pm-plugins/utils/selection.d.ts +0 -71
  66. package/dist/types-ts4.5/pm-plugins/utils/transactions.d.ts +0 -31
  67. package/dist/types-ts4.5/pm-plugins/utils/update-column-widths.d.ts +0 -6
  68. package/dist/types-ts4.5/pm-plugins/utils/update-selection.d.ts +0 -4
  69. package/dist/types-ts4.5/pm-plugins/utils/validation.d.ts +0 -24
  70. package/dist/types-ts4.5/pm-plugins/utils/widget-positions.d.ts +0 -14
  71. package/dist/types-ts4.5/pm-plugins/vanilla-quick-insert.d.ts +0 -21
  72. package/dist/types-ts4.5/ui/block-decoration-utils.d.ts +0 -6
  73. package/dist/types-ts4.5/ui/consts.d.ts +0 -67
  74. package/dist/types-ts4.5/ui/drag-handle-nested-icon.d.ts +0 -12
  75. package/dist/types-ts4.5/ui/drag-handle.d.ts +0 -20
  76. package/dist/types-ts4.5/ui/drag-preview.d.ts +0 -9
  77. package/dist/types-ts4.5/ui/drop-target-layout.d.ts +0 -18
  78. package/dist/types-ts4.5/ui/drop-target.d.ts +0 -22
  79. package/dist/types-ts4.5/ui/global-styles.d.ts +0 -10
  80. package/dist/types-ts4.5/ui/inline-drop-target.d.ts +0 -7
  81. package/dist/types-ts4.5/ui/quick-insert-button.d.ts +0 -24
  82. package/dist/types-ts4.5/ui/utils/anchor-name.d.ts +0 -12
  83. package/dist/types-ts4.5/ui/utils/document-checks.d.ts +0 -5
  84. package/dist/types-ts4.5/ui/utils/dom-attr-name.d.ts +0 -5
  85. package/dist/types-ts4.5/ui/utils/editor-commands.d.ts +0 -2
  86. package/dist/types-ts4.5/ui/visibility-container.d.ts +0 -16
@@ -1,22 +0,0 @@
1
- import type { Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- type SurroundingNodes = {
4
- after: PMNode | null;
5
- before: PMNode | null;
6
- depth: number;
7
- index: number;
8
- node: PMNode;
9
- parent: PMNode;
10
- pos: number;
11
- };
12
- /**
13
- * This function returns the surrounding nodes of a given resolved position in the editor.
14
- * It provides the position, node, parent, before and after nodes, index, and depth.
15
- * @param state current editor state
16
- * @param $pos a resolved position in the editor state.
17
- * @returns {SurroundingNodes} An object containing the surrounding nodes information.
18
- * @example
19
- * const surroundingNodes = findSurroundingNodes(state, $pos);
20
- */
21
- export declare const findSurroundingNodes: (state: EditorState, $pos: ResolvedPos, nodeType?: string | null) => SurroundingNodes;
22
- export {};
@@ -1,30 +0,0 @@
1
- import type { IntlShape } from 'react-intl';
2
- import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
- import { Decoration } from '@atlaskit/editor-prosemirror/view';
6
- import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
7
- import type { BlockControlsPlugin } from '../blockControlsPluginType';
8
- import type { AnchorRectCache } from './utils/anchor-utils';
9
- export declare const findQuickInsertInsertButtonDecoration: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
10
- type QuickInsertButtonDecorationParams = {
11
- anchorName: string;
12
- anchorRectCache?: AnchorRectCache;
13
- api: ExtractInjectionAPI<BlockControlsPlugin>;
14
- editorState: EditorState;
15
- formatMessage: IntlShape['formatMessage'];
16
- nodeType: string;
17
- nodeViewPortalProviderAPI: PortalProviderAPI;
18
- rootAnchorName?: string;
19
- rootNodeType?: string;
20
- rootPos: number;
21
- };
22
- /**
23
- * Creates a Decoration.node that marks the active node with `data-active-quick-insert="true"`.
24
- * The CSS in staticControlsAnchorStyles applies `anchor-name` to this attribute directly,
25
- * replacing the unreliable adjacency selector `[block-ctrl-quick-insert-button] + *`.
26
- */
27
- export declare const createActiveQuickInsertNodeDecoration: (pos: number, nodeSize: number) => Decoration;
28
- export declare const findActiveQuickInsertNodeDec: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
29
- export declare const quickInsertButtonDecoration: ({ api, formatMessage, rootPos, anchorName, nodeType, nodeViewPortalProviderAPI, rootAnchorName, rootNodeType, anchorRectCache, editorState, }: QuickInsertButtonDecorationParams) => Decoration;
30
- export {};
@@ -1,5 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
- export declare const firstNodeDecPluginKey: PluginKey<DecorationSet>;
5
- export declare const firstNodeDecPlugin: () => SafePlugin<DecorationSet>;
@@ -1,4 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { BlockControlsPlugin } from '../blockControlsPluginType';
4
- export declare const handleMouseDown: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (view: EditorView, event: MouseEvent) => boolean;
@@ -1,4 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { BlockControlsPlugin } from '../blockControlsPluginType';
4
- export declare const handleMouseOver: (view: EditorView, event: Event, api: ExtractInjectionAPI<BlockControlsPlugin> | undefined) => false | undefined;
@@ -1,7 +0,0 @@
1
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- export declare const stopEditing: (view: EditorView) => void;
3
- export declare const startEditing: (view: EditorView) => void;
4
- export declare const mouseLeave: (view: EditorView) => void;
5
- export declare const mouseEnter: (view: EditorView) => void;
6
- export declare const setHoverSide: (view: EditorView, side: "left" | "right") => void;
7
- export declare const clearHoverSide: (view: EditorView) => void;
@@ -1,2 +0,0 @@
1
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- export declare const handleKeyDown: (view: EditorView, event: KeyboardEvent) => boolean;
@@ -1,4 +0,0 @@
1
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- export declare const handleMouseMove: (view: EditorView, event: Event, rightSideControlsEnabled?: boolean) => boolean;
3
- export declare const handleMouseLeave: (view: EditorView, rightSideControlsEnabled?: boolean) => boolean;
4
- export declare const handleMouseEnter: (view: EditorView) => boolean;
@@ -1,20 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
4
- export type InteractionTrackingPluginState = {
5
- /**
6
- * Tracks which side of the editor the mouse is currently on.
7
- */
8
- hoverSide?: 'left' | 'right';
9
- /**
10
- * Tracks if a users intention is to edit the document (e.g. typing, deleting, etc.)
11
- */
12
- isEditing: boolean;
13
- /**
14
- * Tracks if the mouse is outside of the editor
15
- */
16
- isMouseOut?: boolean;
17
- };
18
- export declare const interactionTrackingPluginKey: PluginKey<InteractionTrackingPluginState>;
19
- export declare const createInteractionTrackingPlugin: (rightSideControlsEnabled?: boolean) => SafePlugin<InteractionTrackingPluginState>;
20
- export declare const getInteractionTrackingState: (state: EditorState) => InteractionTrackingPluginState | undefined;
@@ -1,5 +0,0 @@
1
- import type { IntlShape } from 'react-intl';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { BlockControlsPlugin } from '../blockControlsPluginType';
5
- export declare const boundKeydownHandler: (api?: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage?: IntlShape['formatMessage']) => (view: EditorView, event: KeyboardEvent) => boolean;
@@ -1,63 +0,0 @@
1
- import type { IntlShape } from 'react-intl';
2
- import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
- import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
6
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
7
- import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
- import type { ActiveDropTargetNode, BlockControlsMeta, BlockControlsPlugin, MultiSelectDnD, NodeDecorationFactory, PluginState } from '../blockControlsPluginType';
9
- import { AnchorRectCache } from './utils/anchor-utils';
10
- export declare const key: PluginKey<PluginState>;
11
- export interface FlagType {
12
- toolbarFlagsEnabled: boolean;
13
- }
14
- 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) => PluginState | {
16
- activeDropTargetNode: ActiveDropTargetNode | undefined;
17
- activeNode: any;
18
- blockMenuOptions: {
19
- canMoveDown: any;
20
- canMoveUp: any;
21
- openedViaKeyboard: any;
22
- } | undefined;
23
- decorations: DecorationSet;
24
- editorHeight: any;
25
- editorWidthLeft: any;
26
- editorWidthRight: any;
27
- isDocSizeLimitEnabled: boolean | null;
28
- isDragging: any;
29
- isMenuOpen: boolean | undefined;
30
- isPMDragging: any;
31
- isResizerResizing: boolean;
32
- isSelectedViaDragHandle: any;
33
- isShiftDown: any;
34
- lastDragCancelled: any;
35
- menuTriggerBy: any;
36
- menuTriggerByNode: any;
37
- multiSelectDnD: MultiSelectDnD | undefined;
38
- };
39
- export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean, quickInsertButtonEnabled?: boolean) => SafePlugin<PluginState | {
40
- activeDropTargetNode: ActiveDropTargetNode | undefined;
41
- activeNode: any;
42
- blockMenuOptions: {
43
- canMoveDown: any;
44
- canMoveUp: any;
45
- openedViaKeyboard: any;
46
- } | undefined;
47
- decorations: DecorationSet;
48
- editorHeight: any;
49
- editorWidthLeft: any;
50
- editorWidthRight: any;
51
- isDocSizeLimitEnabled: boolean | null;
52
- isDragging: any;
53
- isMenuOpen: boolean | undefined;
54
- isPMDragging: any;
55
- isResizerResizing: boolean;
56
- isSelectedViaDragHandle: any;
57
- isShiftDown: any;
58
- lastDragCancelled: any;
59
- menuTriggerBy: any;
60
- menuTriggerByNode: any;
61
- multiSelectDnD: MultiSelectDnD | undefined;
62
- }>;
63
- export declare const getBlockControlsMeta: (tr: Transaction | ReadonlyTransaction) => BlockControlsMeta | undefined;
@@ -1,12 +0,0 @@
1
- import type { CSSProperties } from 'react';
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { AnchorRectCache } from './utils/anchor-utils';
4
- export declare const calculatePosition: ({ rootAnchorName, anchorName, view, getPos, rootNodeType, macroInteractionUpdates, anchorRectCache, }: {
5
- anchorName: string;
6
- anchorRectCache: AnchorRectCache | undefined;
7
- getPos: () => number | undefined;
8
- macroInteractionUpdates: boolean | undefined;
9
- rootAnchorName: string | undefined;
10
- rootNodeType: string;
11
- view: EditorView;
12
- }) => CSSProperties;
@@ -1,13 +0,0 @@
1
- import type { EditorCommand } from '@atlaskit/editor-common/types';
2
- /**
3
- * Start preserving the selection when a UI interaction requires it
4
- *
5
- * e.g., block menu open, drag-and-drop in progress
6
- */
7
- export declare const startPreservingSelection: EditorCommand;
8
- /**
9
- * Stop preserving the selection when a UI interaction completes
10
- *
11
- * e.g., block menu closed, drag-and-drop ended
12
- */
13
- export declare const stopPreservingSelection: EditorCommand;
@@ -1,3 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import type { SelectionPreservationPluginState } from './types';
3
- export declare const selectionPreservationPluginKey: PluginKey<SelectionPreservationPluginState>;
@@ -1,35 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { BlockControlsPlugin } from '../../blockControlsPluginType';
4
- import type { SelectionPreservationPluginState } from './types';
5
- /**
6
- * Selection Preservation Plugin
7
- *
8
- * Used to ensure the selection remains stable across selected nodes during specific UI operations,
9
- * such as when block menus are open or during drag-and-drop actions.
10
- *
11
- * We use a TextSelection to span multi-node selections, however there is a ProseMirror limitation
12
- * where TextSelection cannot include non inline positions at node boundaries (like media/images).
13
- *
14
- * When a selection spans text + media nodes, subsequent transactions cause ProseMirror to collapse
15
- * the selection to the nearest inline position, excluding the media node. This is problematic for
16
- * features like block menus and drag-and-drop that need stable multi-node selections while performing
17
- * operations.
18
- *
19
- * The plugin works in three phases:
20
- * (1) Explicitly save a selection via startPreservingSelection() when opening block menus or starting drag operations.
21
- * (2) Map the saved selection through document changes to keep positions valid.
22
- * (3) Detect when transactions collapse the selection and restore it via appendTransaction().
23
- *
24
- * Stops preserving via stopPreservingSelection() when the menu closes or operation completes.
25
- *
26
- * Commands: startPreservingSelection() to begin preservation, stopPreservingSelection() to end it.
27
- *
28
- * NOTE: Only use when the UI blocks user selection changes. For example: when a block menu overlay
29
- * is open (editor becomes non-interactive), during drag-and-drop operations (user is mid-drag), or
30
- * when modal dialogs are active. In these states, any selection changes are from ProseMirror's
31
- * internal behavior (not user input) and should be prevented. Do not use during normal editing.
32
- *
33
- * https://hello.atlassian.net/wiki/spaces/egcuc/pages/6170822503/Block+Menu+Solution+for+multi-select+and+selection+preservation
34
- */
35
- export declare const createSelectionPreservationPlugin: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => () => SafePlugin<SelectionPreservationPluginState>;
@@ -1,7 +0,0 @@
1
- import type { Selection } from '@atlaskit/editor-prosemirror/state';
2
- export type SelectionPreservationPluginState = {
3
- preservedSelection?: Selection;
4
- };
5
- export type SelectionPreservationMeta = {
6
- type: 'startPreserving' | 'stopPreserving';
7
- };
@@ -1,30 +0,0 @@
1
- import type { ReadonlyTransaction, Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { SelectionPreservationMeta } from './types';
4
- /**
5
- * Detects if any of the transactions include user-driven selection changes.
6
- *
7
- * @param transactions The list of transactions to check.
8
- * @returns True if any transaction includes a user-driven selection change, otherwise false.
9
- */
10
- export declare const hasUserSelectionChange: (transactions: readonly Transaction[]) => boolean;
11
- export declare const getSelectionPreservationMeta: (tr: Transaction | ReadonlyTransaction) => SelectionPreservationMeta | undefined;
12
- /**
13
- * Compares two selections for equality based on their from and to positions.
14
- *
15
- * @param a The first selection to compare.
16
- * @param b The second selection to compare.
17
- * @returns True if both selections are equal, otherwise false.
18
- */
19
- export declare const compareSelections: (a?: Selection, b?: Selection) => boolean;
20
- /**
21
- * Forces the browser's native selection to match ProseMirror's selection state.
22
- *
23
- * This is necessary when the editor doesn't have focus (e.g., when block menu is open)
24
- * but we still need to update the visual selection after moving nodes. Without this,
25
- * the browser's native selection remains at the old position, causing ghost highlighting.
26
- *
27
- * @param selection The current ProseMirror selection state to sync to DOM.
28
- * @param view The EditorView instance used to convert ProseMirror positions to DOM positions.
29
- */
30
- export declare const syncDOMSelection: (selection: Selection, view: EditorView) => void;
@@ -1,16 +0,0 @@
1
- import { EventEmitter } from 'events';
2
- export declare class ActiveAnchorTracker {
3
- emitter: EventEmitter | null;
4
- lastActiveAnchor: string;
5
- constructor();
6
- getActiveAnchor(): string;
7
- subscribe(anchorName: string, callback: (isActive: boolean) => void): void;
8
- unsubscribe(anchorName: string, callback: (isActive: boolean) => void): void;
9
- emit(anchorName: string): void;
10
- reset(): void;
11
- }
12
- export declare const defaultActiveAnchorTracker: ActiveAnchorTracker;
13
- export declare const useActiveAnchorTracker: (anchorName: string, activeAnchorTracker?: ActiveAnchorTracker) => [
14
- boolean,
15
- () => void
16
- ];
@@ -1,12 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
- import type { BlockControlsPlugin } from '../../blockControlsPluginType';
4
- export declare const attachMoveNodeAnalytics: (tr: Transaction, inputMethod: string, fromDepth: number, fromNodeTypes: string | undefined, toDepth?: number, toNodeType?: string, isSameParent?: boolean, api?: ExtractInjectionAPI<BlockControlsPlugin>, hasSelectedMultipleNodes?: boolean) => boolean | undefined;
5
- export declare const fireInsertLayoutAnalytics: (tr: Transaction, api?: ExtractInjectionAPI<BlockControlsPlugin>, nodeTypes?: string, hasSelectedMultipleNodes?: boolean, columnCount?: number) => void;
6
- /**
7
- * Given a range, return distinctive types of node and whether there are multiple nodes in the range
8
- */
9
- export declare const getMultiSelectAnalyticsAttributes: (tr: Transaction, anchor: number, head: number) => {
10
- hasSelectedMultipleNodes: boolean;
11
- nodeTypes: string | undefined;
12
- };
@@ -1,27 +0,0 @@
1
- import type { MemoizedFn } from 'memoize-one';
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- export declare const isAnchorSupported: MemoizedFn<() => boolean>;
4
- type RectInfo = {
5
- bottom: number;
6
- height: number;
7
- left: number;
8
- right: number;
9
- top: number;
10
- width: number;
11
- };
12
- export declare class AnchorRectCache {
13
- private anchorRectMap;
14
- private isAnchorSupported;
15
- private isDirty;
16
- private view;
17
- clear(): void;
18
- private getRects;
19
- setEditorView(view: EditorView): void;
20
- getHeight(anchorName: string): number | null;
21
- getWidth(anchorName: string): number | null;
22
- getLeft(anchorName: string): number | null;
23
- getTop(anchorName: string): number | null;
24
- getRight(anchorName: string): number | null;
25
- getRect(anchorName: string): RectInfo | null;
26
- }
27
- export {};
@@ -1,9 +0,0 @@
1
- import type { Fragment } from '@atlaskit/editor-prosemirror/model';
2
- /**
3
- * Check if the fragment has only one node of the specified type
4
- */
5
- export declare const isFragmentOfType: (fragment: Fragment, type: string) => boolean;
6
- /**
7
- * Check if the fragment contains at least a node of the specified type
8
- */
9
- export declare const containsNodeOfType: (fragment: Fragment, type: string) => boolean;
@@ -1,2 +0,0 @@
1
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
- export declare const isWrappedMedia: (node?: PMNode) => boolean;
@@ -1,2 +0,0 @@
1
- export declare const maxLayoutColumnSupported: () => 3 | 5;
2
- export declare const MIN_LAYOUT_COLUMN = 2;
@@ -1,12 +0,0 @@
1
- import type { AnchorRectCache } from './anchor-utils';
2
- export declare const getTopPosition: (dom: HTMLElement | null, type?: string) => string;
3
- export declare const getLeftPosition: (dom: HTMLElement | null, type: string, innerContainer?: HTMLElement | null, macroInteractionUpdates?: boolean, parentType?: string) => string;
4
- export declare const getNodeHeight: (dom: HTMLElement | null, anchor: string, anchorRectCache?: AnchorRectCache) => number | undefined;
5
- export declare const shouldBeSticky: (nodeType: string) => boolean;
6
- export declare const getControlBottomCSSValue: (anchor: string, isSticky: boolean, isTopLevelNode: boolean, isLayoutColumn?: boolean) => {
7
- bottom: String;
8
- };
9
- export declare const getControlHeightCSSValue: (nodeHeight: number, isSticky: boolean, isTopLevelNode: boolean, fallbackPxHeight: string, isLayoutColumn?: boolean) => {
10
- height: string;
11
- };
12
- export declare const shouldMaskNodeControls: (nodeType: string, isTopLevelNode: boolean) => boolean;
@@ -1,20 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import { type Selection, type Transaction } from '@atlaskit/editor-prosemirror/state';
3
- import type { BlockControlsPlugin } from '../../blockControlsPluginType';
4
- export type ExpandAndUpdateSelectionOptions = {
5
- api: ExtractInjectionAPI<BlockControlsPlugin>;
6
- isShiftPressed: boolean;
7
- nodeType: string;
8
- selection: Selection;
9
- startPos: number;
10
- tr: Transaction;
11
- };
12
- /**
13
- * Updates the transaction's selection based on the clicked drag handle position.
14
- *
15
- * - If the clicked handle is within an existing multi-block selection range, the selection
16
- * is expanded to cover both the existing range and the clicked node's range.
17
- * - For tables, a table cell selection is used.
18
- * - Otherwise, selects the single node at the clicked handle position.
19
- */
20
- export declare const expandAndUpdateSelection: ({ tr, selection, startPos, isShiftPressed, nodeType, api, }: ExpandAndUpdateSelectionOptions) => void;
@@ -1,16 +0,0 @@
1
- import type { ResolvedPos, Schema } from '@atlaskit/editor-prosemirror/model';
2
- import type { Selection } from '@atlaskit/editor-prosemirror/state';
3
- export declare const getNestedNodePosition: ({ selection, schema, resolve, }: {
4
- resolve: (pos: number) => ResolvedPos;
5
- schema: Schema;
6
- selection: Selection;
7
- }) => number;
8
- /**
9
- *
10
- * @returns starting position of nested node that drag handle can be shown next to
11
- */
12
- export declare const getNestedNodeStartingPosition: ({ selection, schema, resolve, }: {
13
- resolve: (pos: number) => ResolvedPos;
14
- schema: Schema;
15
- selection: Selection;
16
- }) => number;
@@ -1,32 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
3
- import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
4
- import type { EditorState, Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
5
- import type { BlockControlsPlugin } from '../../blockControlsPluginType';
6
- export declare const getInlineNodePos: (doc: PMNode, start: number, nodeSize: number) => {
7
- inlineNodeEndPos: number;
8
- inlineNodePos: number;
9
- };
10
- export declare const isNodeWithCodeBlock: (tr: Transaction, start: number, nodeSize: number) => boolean;
11
- /**
12
- * Gets the appropriate selection for the node at the given start position.
13
- *
14
- * @param doc The ProseMirror document.
15
- * @param selectionEmpty Indicates if the current selection is empty.
16
- * @param start The start position of the node.
17
- * @returns The appropriate selection for the node.
18
- */
19
- export declare const newGetSelection: (doc: PMNode, selectionEmpty: boolean, start: number) => false | TextSelection | NodeSelection;
20
- export declare const getSelection: (tr: Transaction, start: number, api?: ExtractInjectionAPI<BlockControlsPlugin>) => false | TextSelection | NodeSelection;
21
- export declare const selectNode: (tr: Transaction, start: number, nodeType: string, api?: ExtractInjectionAPI<BlockControlsPlugin>) => Transaction;
22
- export declare const setCursorPositionAtMovedNode: (tr: Transaction, start: number, api?: ExtractInjectionAPI<BlockControlsPlugin>) => Transaction;
23
- /**
24
- * Checks if handle position is with the selection or corresponds to a (partially) selected node
25
- * @param state
26
- * @param selection
27
- * @param handlePos
28
- * @returns
29
- */
30
- export declare const isHandleCorrelatedToSelection: (state: EditorState, selection: Selection, handlePos: number) => boolean;
31
- export declare const rootListDepth: (itemPos: ResolvedPos) => number | undefined;
32
- export declare const rootTaskListDepth: (taskListPos: ResolvedPos) => number | undefined;
@@ -1,7 +0,0 @@
1
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
- import type { ActiveNode } from '../../blockControlsPluginType';
3
- export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode,
4
- /**
5
- * Is the active node in the same layout as the target node
6
- */
7
- isSameLayout?: boolean, activeNode?: ActiveNode, parentNode?: PMNode) => boolean;
@@ -1,25 +0,0 @@
1
- import type { Mark, MarkType } from '@atlaskit/editor-prosemirror/model';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- /**
4
- * Remove this when platform_editor_clean_up_widget_mark_logic is cleaned up.
5
- *
6
- * Returns list of block marks on schema that widgets are allowed to render inside
7
- * Currently
8
- * - indent
9
- * - alignment
10
- * @param state - The editor state
11
- * @returns The block marks
12
- * @example
13
- * ```ts
14
- * const marks = getBlockMarks(state);
15
- * console.log(marks);
16
- * // [indent, alignment]
17
- * ```
18
- */
19
- export declare const getActiveBlockMarks: (state: EditorState, pos: number) => Mark[];
20
- /**
21
- * Returns supported block marks at `pos` only when both adjacent siblings
22
- * share the exact same set of those marks. Returns `[]` when they differ,
23
- * so the widget sits outside all mark wrappers and avoids mis-nesting.
24
- */
25
- export declare const getMatchingBlockMarks: (state: EditorState, pos: number, supportedMarkTypes: MarkType[]) => Mark[];
@@ -1,3 +0,0 @@
1
- import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
- export declare const removeFromSource: (tr: Transaction, $from: ResolvedPos, to: number) => Transaction;
@@ -1,71 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
3
- import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
4
- import type { ReadonlyTransaction, Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
5
- import type { CellSelection } from '@atlaskit/editor-tables';
6
- import type { BlockControlsPlugin } from '../../blockControlsPluginType';
7
- export declare const getMultiSelectionIfPosInside: (api: ExtractInjectionAPI<BlockControlsPlugin>, pos: number, tr?: Transaction) => {
8
- anchor?: number;
9
- head?: number;
10
- };
11
- /**
12
- * Given a handle position, returns the from and to positions of the selected content.
13
- * If the handle position is not in a multi-selection, it returns the node's from and to positions.
14
- *
15
- * @param handlePos The position of the handle
16
- * @param tr The transaction to use for position calculations
17
- * @param api The BlockControlsPlugin API for accessing shared state
18
- * @returns from and to positions of the selected content (after expansion)
19
- */
20
- export declare const getSelectedSlicePosition: (handlePos: number, tr: Transaction, api: ExtractInjectionAPI<BlockControlsPlugin>) => {
21
- from: number;
22
- to: number;
23
- };
24
- /**
25
- * Takes a position and expands the selection to encompass the node at that position. Ignores empty or out of range selections.
26
- * Ignores positions that are in text blocks (i.e. not start of a node)
27
- * @returns TextSelection if expanded, otherwise returns Selection that was passed in.
28
- */
29
- export declare const expandSelectionHeadToNodeAtPos: (selection: Selection, nodePos: number) => Selection;
30
- /**
31
- * This swaps the anchor/head for NodeSelections when its anchor > pos.
32
- * This is because NodeSelection always has an anchor at the start of the node,
33
- * which may not align with the existing selection.
34
- */
35
- export declare const alignAnchorHeadInDirectionOfPos: (selection: Selection, pos: number) => Selection;
36
- /**
37
- * This maps a preserved selection through a transaction, expanding text selections to block boundaries.
38
- *
39
- * @param selection The existing preserved selection to map
40
- * @param tr The transaction to map through
41
- * @returns The mapped selection or undefined if mapping is not possible
42
- */
43
- export declare const mapPreservedSelection: (selection: Selection, tr: ReadonlyTransaction | Transaction) => Selection | undefined;
44
- /**
45
- * Adjust selection bounds to exclude nodes where the selection only touches
46
- * the edge position without selecting any content.
47
- *
48
- * Exception: Don't adjust if the selection is inside an empty textblock,
49
- * as we want to include empty paragraphs in block operations.
50
- *
51
- * @param $from The resolved position of the start of the selection
52
- * @param $to The resolved position of the end of the selection
53
- * @returns Adjusted $from and $to positions
54
- */
55
- export declare const adjustSelectionBoundsForEdgePositions: ($from: ResolvedPos, $to: ResolvedPos) => {
56
- $from: ResolvedPos;
57
- $to: ResolvedPos;
58
- };
59
- /**
60
- * Creates a preserved selection which is expanded to block boundaries.
61
- *
62
- * Will return the correct type of selection based on the nodes contained within the
63
- * expanded selection range.
64
- *
65
- * If the selection becomes empty or invalid, it returns undefined.
66
- *
67
- * @param $from The resolved position of the start of the selection
68
- * @param $to The resolved position of the end of the selection
69
- * @returns A Selection or undefined if selection is invalid
70
- */
71
- export declare const createPreservedSelection: ($from: ResolvedPos, $to: ResolvedPos) => TextSelection | CellSelection | NodeSelection | undefined;
@@ -1,31 +0,0 @@
1
- import type { ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
3
- import type { FlagType } from '../main';
4
- interface TransactionMetadata {
5
- from: number;
6
- isAllText: boolean;
7
- isReplacedWithSameSize: boolean;
8
- numReplaceSteps: number;
9
- to: number;
10
- }
11
- /**
12
- * Checks if step adds inline char
13
- * @param s
14
- * @returns True if step adds inline char
15
- */
16
- export declare const isStepText: (s: ReplaceStep) => boolean;
17
- /**
18
- * Checks if step is an inline delete/backspace (replace range from -> from + 1 with empty content)
19
- * @param s
20
- * @returns True if delete/backspace
21
- */
22
- export declare const isStepDelete: (s: ReplaceStep) => boolean;
23
- /**
24
- * Get metadata from the transaction.
25
- * @param tr
26
- * @returns Min 'from', max 'to' (from + slice size, or mapped 'to', whichever is larger). If no steps, returns pos range of entire doc.
27
- * Number of ReplaceStep and ReplaceAroundStep steps 'numReplaceSteps'.
28
- * 'isAllText' if all steps are represent adding inline text or a backspace/delete or no-op
29
- */
30
- export declare const getTrMetadata: (tr: Transaction | ReadonlyTransaction, flags: FlagType) => TransactionMetadata;
31
- export {};
@@ -1,6 +0,0 @@
1
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
- export declare const updateColumnWidths: (tr: Transaction, layoutNode: PMNode, layoutNodePos: number, childCount: number) => {
4
- newColumnWidth: number;
5
- tr: Transaction;
6
- };
@@ -1,4 +0,0 @@
1
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
2
- import { Step } from '@atlaskit/editor-prosemirror/transform';
3
- export declare const getInsertLayoutStep: (tr: Transaction) => Step | undefined;
4
- export declare const updateSelection: (tr: Transaction, to: number, insertAtRight?: boolean) => Transaction;