@atlaskit/editor-plugin-block-menu 10.1.14 → 10.1.16

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 (74) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/blockMenuPlugin/package.json +1 -8
  3. package/blockMenuPluginType/package.json +1 -8
  4. package/package.json +2 -2
  5. package/types/package.json +1 -8
  6. package/dist/types-ts4.5/blockMenuPlugin.d.ts +0 -2
  7. package/dist/types-ts4.5/blockMenuPluginType.d.ts +0 -125
  8. package/dist/types-ts4.5/editor-actions/index.d.ts +0 -52
  9. package/dist/types-ts4.5/editor-actions/isTransformToTargetDisabled.d.ts +0 -11
  10. package/dist/types-ts4.5/editor-commands/selection.d.ts +0 -10
  11. package/dist/types-ts4.5/editor-commands/transform-node-utils/TRANSFORMATION_MATRIX.d.ts +0 -5
  12. package/dist/types-ts4.5/editor-commands/transform-node-utils/marks.d.ts +0 -9
  13. package/dist/types-ts4.5/editor-commands/transform-node-utils/nodeChecks.d.ts +0 -17
  14. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/applyTargetTextTypeStep.d.ts +0 -23
  15. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/convertEachNodeStep.d.ts +0 -2
  16. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/decisionListToListStep.d.ts +0 -30
  17. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/flattenListStep.d.ts +0 -29
  18. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/flattenStep.d.ts +0 -2
  19. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/listToDecisionListStep.d.ts +0 -25
  20. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/listToListStep.d.ts +0 -65
  21. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/mergeNeighbourListsStep.d.ts +0 -32
  22. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/unwrapExpandStep.d.ts +0 -13
  23. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/unwrapLayoutStep.d.ts +0 -14
  24. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/unwrapListStep.d.ts +0 -25
  25. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/unwrapStep.d.ts +0 -2
  26. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/wrapBlockquoteToDecisionListStep.d.ts +0 -15
  27. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/wrapIntoListStep.d.ts +0 -9
  28. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/wrapMixedContentStep.d.ts +0 -39
  29. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/wrapStep.d.ts +0 -10
  30. package/dist/types-ts4.5/editor-commands/transform-node-utils/transform.d.ts +0 -29
  31. package/dist/types-ts4.5/editor-commands/transform-node-utils/types.d.ts +0 -14
  32. package/dist/types-ts4.5/editor-commands/transform-node-utils/utils.d.ts +0 -39
  33. package/dist/types-ts4.5/editor-commands/transformNode.d.ts +0 -5
  34. package/dist/types-ts4.5/editor-commands/types.d.ts +0 -8
  35. package/dist/types-ts4.5/entry-points/blockMenuPlugin.d.ts +0 -1
  36. package/dist/types-ts4.5/entry-points/blockMenuPluginType.d.ts +0 -1
  37. package/dist/types-ts4.5/entry-points/types.d.ts +0 -1
  38. package/dist/types-ts4.5/index.d.ts +0 -3
  39. package/dist/types-ts4.5/pm-plugins/experiences/block-menu-experiences.d.ts +0 -10
  40. package/dist/types-ts4.5/pm-plugins/experiences/experience-check-utils.d.ts +0 -65
  41. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +0 -4
  42. package/dist/types-ts4.5/pm-plugins/main.d.ts +0 -10
  43. package/dist/types-ts4.5/pm-plugins/utils/shouldSuppressKeyboardEvent.d.ts +0 -14
  44. package/dist/types-ts4.5/ui/MenuSection.d.ts +0 -9
  45. package/dist/types-ts4.5/ui/block-menu-components.d.ts +0 -6
  46. package/dist/types-ts4.5/ui/block-menu-provider.d.ts +0 -24
  47. package/dist/types-ts4.5/ui/block-menu-renderer/BlockMenuComponent.d.ts +0 -11
  48. package/dist/types-ts4.5/ui/block-menu-renderer/BlockMenuComponents.d.ts +0 -12
  49. package/dist/types-ts4.5/ui/block-menu-renderer/BlockMenuRenderer.d.ts +0 -12
  50. package/dist/types-ts4.5/ui/block-menu-renderer/fallbacks.d.ts +0 -2
  51. package/dist/types-ts4.5/ui/block-menu-renderer/types.d.ts +0 -27
  52. package/dist/types-ts4.5/ui/block-menu-renderer/utils.d.ts +0 -36
  53. package/dist/types-ts4.5/ui/block-menu.d.ts +0 -16
  54. package/dist/types-ts4.5/ui/consts.d.ts +0 -11
  55. package/dist/types-ts4.5/ui/copy-link.d.ts +0 -12
  56. package/dist/types-ts4.5/ui/copy-section.d.ts +0 -4
  57. package/dist/types-ts4.5/ui/delete-button.d.ts +0 -11
  58. package/dist/types-ts4.5/ui/delete-section.d.ts +0 -4
  59. package/dist/types-ts4.5/ui/flag.d.ts +0 -8
  60. package/dist/types-ts4.5/ui/format-menu-nested.d.ts +0 -7
  61. package/dist/types-ts4.5/ui/format-menu-section.d.ts +0 -7
  62. package/dist/types-ts4.5/ui/hooks/useSuggestedItems.d.ts +0 -3
  63. package/dist/types-ts4.5/ui/move-down.d.ts +0 -11
  64. package/dist/types-ts4.5/ui/move-up.d.ts +0 -11
  65. package/dist/types-ts4.5/ui/suggested-items-menu-section.d.ts +0 -9
  66. package/dist/types-ts4.5/ui/suggested-menu-items.d.ts +0 -8
  67. package/dist/types-ts4.5/ui/utils/checkHasPreviousSectionContent.d.ts +0 -26
  68. package/dist/types-ts4.5/ui/utils/checkIsFormatMenuHidden.d.ts +0 -3
  69. package/dist/types-ts4.5/ui/utils/copyLink.d.ts +0 -8
  70. package/dist/types-ts4.5/ui/utils/createMenuItemsMap.d.ts +0 -6
  71. package/dist/types-ts4.5/ui/utils/fixBlockMenuPositionAndScroll.d.ts +0 -1
  72. package/dist/types-ts4.5/ui/utils/getSuggestedItemsFromSelection.d.ts +0 -6
  73. package/dist/types-ts4.5/ui/utils/isNestedNode.d.ts +0 -14
  74. package/dist/types-ts4.5/ui/utils/suggested-items-rank.d.ts +0 -46
@@ -1,39 +0,0 @@
1
- import type { TransformStep } from '../types';
2
- /**
3
- * A wrap step that handles mixed content according to the Compatibility Matrix:
4
- * - Wraps consecutive compatible nodes into the target container
5
- * - Same-type containers break out as separate containers (preserved as-is)
6
- * - NestedExpands break out as regular expands (converted since nestedExpand can't exist outside expand)
7
- * - Container structures that can't be nested in target break out (not flattened)
8
- * - Text/list nodes that can't be wrapped are converted to paragraphs and merged into the container
9
- * - Atomic nodes (tables, media, macros) break out
10
- *
11
- * Special handling for layouts:
12
- * - Layout sections break out as separate layouts (preserved as-is, not wrapped)
13
- * - Other nodes (including headings, paragraphs, lists) are wrapped into layout columns within a layout section
14
- * - Layouts always require layoutColumns as children (never paragraphs directly)
15
- * - Layout columns can contain most block content including headings, paragraphs, lists, etc.
16
- *
17
- * Special handling for codeblocks:
18
- * - Text nodes are converted to plain text and added to the codeblock
19
- *
20
- * Edge case handling:
21
- * - For regular containers: If all content breaks out (container → container transform with no
22
- * valid children), an empty container with a paragraph is created to ensure the target type exists
23
- * - For layouts: Edge case handling is skipped because layouts require columns, not direct paragraphs.
24
- * If all content breaks out, only the broken-out nodes are returned (no empty layout created)
25
- *
26
- * What can be wrapped depends on the target container's schema:
27
- * - expand → panel: tables break out, nestedExpands convert to expands and break out
28
- * - expand → blockquote: tables/media break out, nestedExpands convert to expands and break out, headings converted to paragraphs
29
- * - expand → expand: tables/media stay inside (expands can contain them)
30
- * - multi → layoutSection: layout sections break out, headings/paragraphs/lists wrapped into layout columns
31
- *
32
- * Example: expand(p('a'), table(), p('b')) → panel: [panel(p('a')), table(), panel(p('b'))]
33
- * Example: expand(p('a'), panel(p('x')), p('b')) → panel: [panel(p('a')), panel(p('x')), panel(p('b'))]
34
- * Example: expand(p('a'), nestedExpand({title: 'inner'})(p('x')), p('b')) → panel: [panel(p('a')), expand({title: 'inner'})(p('x')), panel(p('b'))]
35
- * Example: expand(nestedExpand()(p())) → panel: [panel(), expand()(p())] (empty panel when all content breaks out)
36
- * Example: [p('a'), layoutSection(...), p('b')] → layoutSection: [layoutSection(layoutColumn(p('a'))), layoutSection(...), layoutSection(layoutColumn(p('b')))]
37
- * Example: [h1('heading'), p('para')] → layoutSection: [layoutSection(layoutColumn(h1('heading'), p('para')))] (headings stay as headings in layouts)
38
- */
39
- export declare const wrapMixedContentStep: TransformStep;
@@ -1,10 +0,0 @@
1
- import type { TransformStep } from '../types';
2
- /**
3
- * Wraps nodes into the target container type.
4
- * When wrapping into expand, any expand children are converted to nestedExpand
5
- * since expand cannot be a direct child of expand.
6
- *
7
- * Preserves breakout marks when both source and target nodes support resizing
8
- * (codeBlock, expand, layoutSection).
9
- */
10
- export declare const wrapStep: TransformStep;
@@ -1,29 +0,0 @@
1
- import type { Node as PMNode, NodeType, Schema } from '@atlaskit/editor-prosemirror/model';
2
- import type { NodeTypeName } from './types';
3
- interface GetOutputNodesArgs {
4
- isNested: boolean;
5
- parentNode?: PMNode;
6
- schema: Schema;
7
- sourceNodes: PMNode[];
8
- targetAttrs?: Record<string, unknown>;
9
- targetNodeType: NodeType;
10
- }
11
- export declare const upgradePanelNodesToPanelC1: (nodes: PMNode[], parentNode: PMNode | undefined, schema: Schema) => PMNode[];
12
- /**
13
- * Convert a list of nodes to a target node type.
14
- * If no steps are found, the source nodes are returned unchanged.
15
- * If steps are found, they are applied to the source nodes in order.
16
- * If a step returns an empty array, the source nodes are returned.
17
- * If a step returns a non-empty array, that array is returned.
18
- * @param args - The conversion arguments
19
- * @param args.sourceNodes - The list of nodes to convert
20
- * @param args.targetNodeType - The type of node to convert into
21
- * @param args.schema - The schema to use for the conversion
22
- * @param args.isNested - Whether the conversion is nested
23
- * @param args.targetAttrs - The attributes to use for the conversion
24
- * @param args.parentNode - The parent node of the selected node
25
- * @returns The converted list of nodes
26
- */
27
- export declare const convertNodesToTargetType: ({ sourceNodes, targetNodeType, schema, isNested, targetAttrs, parentNode, }: GetOutputNodesArgs) => PMNode[];
28
- export declare const isTransformDisabledBasedOnStepsConfig: (selectedNodeType: NodeTypeName, targetNodeType: NodeTypeName) => boolean;
29
- export {};
@@ -1,14 +0,0 @@
1
- import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
2
- export type NodeTypeName = 'blockquote' | 'blockCard' | 'bodiedExtension' | 'bulletList' | 'codeBlock' | 'decisionList' | 'embedCard' | 'expand' | 'extension' | 'heading' | 'layoutSection' | 'media' | 'mediaGroup' | 'mediaSingle' | 'multiBodiedExtension' | 'orderedList' | 'panel' | 'panel_c1' | 'paragraph' | 'nestedExpand' | 'taskList' | 'table' | 'multi';
3
- export type NodeCategory = 'atomic' | 'container' | 'list' | 'text' | 'multi';
4
- export declare const NODE_CATEGORY_BY_TYPE: Record<NodeTypeName, NodeCategory>;
5
- export declare const isNodeTypeName: (value: string) => value is NodeTypeName;
6
- export declare const toNodeTypeValue: (value?: string | null) => NodeTypeName | null;
7
- export declare const getNodeName: (nodes: PMNode[]) => string | undefined;
8
- export type TransformStep = (nodes: PMNode[], context: TransformStepContext) => PMNode[];
9
- export interface TransformStepContext {
10
- fromNode: PMNode;
11
- schema: Schema;
12
- targetAttrs?: Record<string, unknown>;
13
- targetNodeTypeName: NodeTypeName;
14
- }
@@ -1,39 +0,0 @@
1
- import type { NodeRange, Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
2
- import type { Selection } from '@atlaskit/editor-prosemirror/state';
3
- import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
4
- import type { NodeTypeName } from './types';
5
- /**
6
- * Determines if a node is a text node (heading or paragraph).
7
- * Text nodes can have their content converted to paragraphs when they can't be wrapped directly.
8
- */
9
- export declare const isTextNode: (node: PMNode) => boolean;
10
- export declare const isListNode: (node: PMNode) => boolean;
11
- export declare const getSelectedNode: (selection: Selection) => ContentNodeWithPos | undefined;
12
- export declare const getTargetNodeTypeNameInContext: (nodeTypeName: NodeTypeName | null, isNested?: boolean, parentNode?: PMNode, schema?: Schema) => NodeTypeName | null;
13
- /**
14
- * Converts a nestedExpand to a regular expand node.
15
- * NestedExpands can only exist inside expands, so when breaking out or placing
16
- * in containers that don't support nesting, they must be converted.
17
- */
18
- export declare const convertNestedExpandToExpand: (node: PMNode, schema: Schema) => PMNode | null;
19
- /**
20
- * Converts an expand to a nestedExpand node.
21
- * When placing an expand inside another expand, it must become a nestedExpand
22
- * since expand cannot be a direct child of expand.
23
- */
24
- export declare const convertExpandToNestedExpand: (node: PMNode, schema: Schema) => PMNode | null;
25
- /**
26
- * Converts a text node (heading, paragraph) to a paragraph preserving its inline content.
27
- * This is used when a text node can't be wrapped directly in the target container
28
- * (e.g., heading can't go in blockquote, so it becomes a paragraph).
29
- */
30
- export declare const convertTextNodeToParagraph: (node: PMNode, schema: Schema) => PMNode | null;
31
- export declare const getBlockNodesInRange: (range: NodeRange) => PMNode[];
32
- /**
33
- * Iterates over a nodes children and extracting text content, removing all other inline content and converting
34
- * hardbreaks to newlines.
35
- *
36
- * @param node - The node to create text content from (should be paragraph)
37
- * @returns The text content string.
38
- */
39
- export declare const createTextContent: (node: PMNode) => string;
@@ -1,5 +0,0 @@
1
- import type { EditorCommand, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { NodeType } from '@atlaskit/editor-prosemirror/model';
3
- import type { BlockMenuPlugin } from '../blockMenuPluginType';
4
- import type { TransformNodeMetadata } from './types';
5
- export declare const transformNode: (api?: ExtractInjectionAPI<BlockMenuPlugin>) => (targetType: NodeType, metadata?: TransformNodeMetadata) => EditorCommand;
@@ -1,8 +0,0 @@
1
- import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- export type TransfromNodeTargetType = 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6' | 'paragraph' | 'blockquote' | 'expand' | 'layoutSection' | 'panel' | 'panel_c1' | 'codeBlock' | 'bulletList' | 'orderedList' | 'taskList' | 'decisionList';
3
- export type TransformNodeMetadata = {
4
- inputMethod: INPUT_METHOD.BLOCK_MENU;
5
- targetAttrs?: Record<string, unknown>;
6
- targetTypeName: TransfromNodeTargetType;
7
- triggeredFrom: INPUT_METHOD.MOUSE | INPUT_METHOD.KEYBOARD;
8
- };
@@ -1 +0,0 @@
1
- export { blockMenuPlugin } from '../blockMenuPlugin';
@@ -1 +0,0 @@
1
- export type { BlockMenuPlugin, RegisterBlockMenuComponent, Parent, BlockMenuPluginOptions, BlockMenuSharedState, } from '../blockMenuPluginType';
@@ -1 +0,0 @@
1
- export type { TransformNodeMetadata, TransfromNodeTargetType } from '../editor-commands/types';
@@ -1,3 +0,0 @@
1
- export { blockMenuPlugin } from './blockMenuPlugin';
2
- export type { BlockMenuPlugin, RegisterBlockMenuComponent, Parent, BlockMenuPluginOptions, BlockMenuSharedState, } from './blockMenuPluginType';
3
- export type { TransformNodeMetadata, TransfromNodeTargetType } from './editor-commands/types';
@@ -1,10 +0,0 @@
1
- import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- type ExperienceOptions = {
4
- dispatchAnalyticsEvent: DispatchAnalyticsEvent;
5
- refs: {
6
- popupsMountPoint?: HTMLElement;
7
- };
8
- };
9
- export declare const getBlockMenuExperiencesPlugin: ({ refs, dispatchAnalyticsEvent, }: ExperienceOptions) => SafePlugin;
10
- export {};
@@ -1,65 +0,0 @@
1
- import type { ExperienceCheckResult } from '@atlaskit/editor-common/experiences';
2
- /**
3
- * Checks if the given element or any of its ancestors is a drag handle element.
4
- *
5
- * @param element - The DOM element to check.
6
- * @returns True if the element is a drag handle, false otherwise.
7
- */
8
- export declare const isDragHandleElement: (element: Element | null) => boolean;
9
- /**
10
- * Checks if the block menu is currently visible within the provided popups target element.
11
- *
12
- * @param popupsTarget - The container element for popups.
13
- * @returns True if the block menu is visible, false otherwise.
14
- */
15
- export declare const isBlockMenuVisible: (popupsTarget: HTMLElement | undefined) => boolean;
16
- /**
17
- * Handles DOM mutations to determine if the block menu was opened
18
- *
19
- * This function looks for mutations that indicate the block menu
20
- * has been added to the DOM.
21
- *
22
- * @param mutations - The list of DOM mutations to evaluate
23
- * @returns An ExperienceCheckResult indicating success if the menu was opened, otherwise undefined
24
- */
25
- export declare const handleMenuOpenDomMutation: ({ mutations, }: {
26
- mutations: MutationRecord[];
27
- }) => ExperienceCheckResult | undefined;
28
- /**
29
- * Handles DOM mutations to determine if a move action was performed
30
- *
31
- * Move actions typically produce two mutations: one where nodes are removed
32
- * from their original location, and another where the same number of nodes are
33
- * added to a new location. This function checks for that pattern.
34
- *
35
- * @param mutations - The list of DOM mutations to evaluate
36
- * @returns An ExperienceCheckResult indicating success if a move was detected, otherwise undefined
37
- */
38
- export declare const handleMoveDomMutation: ({ mutations, }: {
39
- mutations: MutationRecord[];
40
- }) => ExperienceCheckResult | undefined;
41
- /**
42
- * Handles DOM mutations to determine if a delete action was performed
43
- *
44
- * Delete actions typically produce a single mutation where nodes are removed
45
- * from the DOM without any corresponding additions. This function checks for
46
- * that specific pattern.
47
- *
48
- * @param mutations - The list of DOM mutations to evaluate
49
- * @returns An ExperienceCheckResult indicating success if a delete was detected, otherwise undefined
50
- */
51
- export declare const handleDeleteDomMutation: ({ mutations, }: {
52
- mutations: MutationRecord[];
53
- }) => ExperienceCheckResult | undefined;
54
- /**
55
- * Handles DOM mutations to determine if a transform action was performed.
56
- *
57
- * Transforms replace one block type with another (e.g. paragraph → heading),
58
- * producing childList mutations with both removed (old node) and added (new node).
59
- *
60
- * @param options.mutations - The list of DOM mutation records
61
- * @returns An ExperienceCheckResult indicating success if a transform was detected, otherwise undefined
62
- */
63
- export declare const handleTransformDomMutation: ({ mutations, }: {
64
- mutations: MutationRecord[];
65
- }) => ExperienceCheckResult | undefined;
@@ -1,4 +0,0 @@
1
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { BlockMenuPlugin, BlockMenuPluginOptions } from '../blockMenuPluginType';
4
- export declare function keymapPlugin(api: ExtractInjectionAPI<BlockMenuPlugin> | undefined, config: BlockMenuPluginOptions | undefined): SafePlugin;
@@ -1,10 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
- import type { BlockMenuPlugin, FLAG_ID } from '../blockMenuPluginType';
5
- export declare const blockMenuPluginKey: PluginKey;
6
- type BlockMenuPluginState = {
7
- showFlag: FLAG_ID | false;
8
- };
9
- export declare const createPlugin: (api: ExtractInjectionAPI<BlockMenuPlugin> | undefined) => SafePlugin<BlockMenuPluginState>;
10
- export {};
@@ -1,14 +0,0 @@
1
- /**
2
- * Determines whether keyboard events should be suppressed when the block menu is open.
3
- *
4
- * When the block menu is open, we want to block most keyboard events to prevent
5
- * unintended interactions. However, certain actions should still be allowed:
6
- * - Backspace/Delete: Allow deleting selected content
7
- * - Copy/Cut/Paste: Allow clipboard operations (Cmd/Ctrl+C, Cmd/Ctrl+X, Cmd/Ctrl+V)
8
- * - Undo/Redo: Allow undo/redo operations (Cmd/Ctrl+Z, Cmd/Ctrl+Y)
9
- * - Copy Link to Selection: Allow the keyboard shortcut (Cmd/Ctrl+Alt+A)
10
- *
11
- * @param event - The keyboard event to check
12
- * @returns true if the event should be suppressed, false if it should be allowed
13
- */
14
- export declare const shouldSuppressKeyboardEvent: (event: KeyboardEvent) => boolean;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import type { MessageDescriptor } from 'react-intl';
3
- type MenuSectionProps = {
4
- children?: React.ReactNode;
5
- hasSeparator?: boolean;
6
- title: MessageDescriptor;
7
- };
8
- export declare const MenuSection: ({ children, title, hasSeparator, }: MenuSectionProps) => React.JSX.Element;
9
- export {};
@@ -1,6 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { BlockMenuPlugin, BlockMenuPluginOptions, RegisterBlockMenuComponent } from '../blockMenuPluginType';
3
- export declare const getBlockMenuComponents: ({ api, config, }: {
4
- api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
5
- config: BlockMenuPluginOptions | undefined;
6
- }) => RegisterBlockMenuComponent[];
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { BlockMenuPlugin } from '../blockMenuPluginType';
5
- export type Direction = 'moveUp' | 'moveDown';
6
- type BlockMenuProviderProps = {
7
- api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
8
- children: React.ReactNode;
9
- editorView: EditorView | undefined;
10
- };
11
- export type BlockMenuContextType = {
12
- getFirstSelectedDomNode: () => Element | undefined;
13
- moveDownRef: React.MutableRefObject<HTMLButtonElement | null>;
14
- moveUpRef: React.MutableRefObject<HTMLButtonElement | null>;
15
- /**
16
- * Callback for when the dropdown is open/closed. Receives an object with `isOpen` state.
17
- *
18
- * If the dropdown was closed programmatically, the `event` parameter will be `null`.
19
- */
20
- onDropdownOpenChanged: (isOpen: boolean) => void;
21
- };
22
- export declare const useBlockMenu: () => BlockMenuContextType;
23
- export declare const BlockMenuProvider: ({ children, api, editorView, }: BlockMenuProviderProps) => React.JSX.Element;
24
- export {};
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import type { RegisterBlockMenuComponent } from '../../blockMenuPluginType';
3
- import type { BlockMenuRenderingContext } from './types';
4
- type BlockMenuComponentProps = BlockMenuRenderingContext & {
5
- registeredComponent: RegisterBlockMenuComponent;
6
- };
7
- /**
8
- * Renders the given registered component based on its type
9
- */
10
- export declare const BlockMenuComponent: ({ registeredComponent, childrenMap, fallbacks, }: BlockMenuComponentProps) => React.JSX.Element | null;
11
- export {};
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { RegisterBlockMenuComponent } from '../../blockMenuPluginType';
3
- import type { BlockMenuRenderingContext } from './types';
4
- type BlockMenuComponentsProps = BlockMenuRenderingContext & {
5
- registeredComponents?: RegisterBlockMenuComponent[];
6
- };
7
- /**
8
- * Renders the given registered components
9
- * Returns null if no components are rendered
10
- */
11
- export declare const BlockMenuComponents: ({ registeredComponents, childrenMap, fallbacks, }: BlockMenuComponentsProps) => React.JSX.Element | null;
12
- export {};
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { RegisterBlockMenuComponent } from '../../blockMenuPluginType';
3
- import type { BlockMenuFallbacks } from './types';
4
- type BlockMenuProps = {
5
- allRegisteredComponents: RegisterBlockMenuComponent[];
6
- fallbacks?: BlockMenuFallbacks;
7
- };
8
- /**
9
- * BlockMenuRenderer orchestrates the rendering of the entire block menu hierarchy
10
- */
11
- export declare const BlockMenuRenderer: ({ allRegisteredComponents, fallbacks, }: BlockMenuProps) => React.JSX.Element;
12
- export {};
@@ -1,2 +0,0 @@
1
- import type { BlockMenuFallbacks } from './types';
2
- export declare const BLOCK_MENU_FALLBACKS: BlockMenuFallbacks;
@@ -1,27 +0,0 @@
1
- import type { BlockMenuItemComponent, BlockMenuNestedComponent, BlockMenuSectionComponent, RegisterBlockMenuComponent } from '../../blockMenuPluginType';
2
- /**
3
- * Fallback components used as defaults when specific components aren't provided
4
- */
5
- export type BlockMenuFallbacks = {
6
- 'block-menu-item': BlockMenuItemComponent;
7
- 'block-menu-nested': BlockMenuNestedComponent;
8
- 'block-menu-section': BlockMenuSectionComponent;
9
- };
10
- /**
11
- * Map of parent keys to their sorted children components
12
- * Used to efficiently organize and render hierarchical menu structures
13
- */
14
- export type ChildrenMap = Map<string, RegisterBlockMenuComponent[]>;
15
- /**
16
- * Props shared across multiple block menu rendering components
17
- */
18
- export type BlockMenuRenderingContext = {
19
- /**
20
- * Lookup map for child components organized by parent key
21
- */
22
- childrenMap: ChildrenMap;
23
- /**
24
- * Fallback components when specific components aren't registered
25
- */
26
- fallbacks: BlockMenuFallbacks;
27
- };
@@ -1,36 +0,0 @@
1
- import type { RegisterBlockMenuComponent, RegisterBlockMenuComponentType, RegisterBlockMenuSection } from '../../blockMenuPluginType';
2
- import type { ChildrenMap } from './types';
3
- /**
4
- * Gets all top-level sections (those without a parent) sorted by rank
5
- *
6
- * @param components All registered block menu components
7
- * @returns Sorted array of top-level sections
8
- */
9
- export declare const getSortedTopLevelSections: (components: RegisterBlockMenuComponent[]) => RegisterBlockMenuSection[];
10
- /**
11
- * Generates a unique key from a key and type
12
- * Used to lookup children in the childrenMap
13
- *
14
- * @param key The component's key
15
- * @param type The component's type
16
- * @returns A unique string key combining type and key
17
- */
18
- export declare const getChildrenMapKey: (key: string, type: Omit<RegisterBlockMenuComponentType, "block-menu-item">) => string;
19
- /**
20
- * Builds a map of parent keys to their sorted children
21
- * This enables efficient hierarchical rendering of the menu structure
22
- *
23
- * @param components All registered block menu components
24
- * @returns Map where keys are parent identifiers and values are sorted child components
25
- */
26
- export declare const buildChildrenMap: (components: RegisterBlockMenuComponent[]) => ChildrenMap;
27
- /**
28
- * Determines whether a component will render based on its type and children
29
- *
30
- * Rules:
31
- * - An item will not render if it has isHidden that returns true OR if its component returns null (fallback)
32
- * - A nested menu will render if at least one section, that has at least one registered child
33
- * - A section will render if it has at least one registered child component that will render
34
- *
35
- */
36
- export declare const willComponentRender: (registeredComponent: RegisterBlockMenuComponent, childrenMap: ChildrenMap) => boolean;
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import type { WithIntlProps, WrappedComponentProps } from 'react-intl';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- import type { BlockMenuPlugin } from '../blockMenuPluginType';
6
- export type BlockMenuProps = {
7
- api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
8
- boundariesElement?: HTMLElement;
9
- editorView: EditorView | undefined;
10
- mountTo?: HTMLElement;
11
- scrollableElement?: HTMLElement;
12
- };
13
- declare const _default_1: React.FC<WithIntlProps<BlockMenuProps & WrappedComponentProps>> & {
14
- WrappedComponent: React.ComponentType<BlockMenuProps & WrappedComponentProps>;
15
- };
16
- export default _default_1;
@@ -1,11 +0,0 @@
1
- export declare const BLOCK_MENU_LABEL = "Editor Block Menu";
2
- /**
3
- * Constants for block menu analytics menu item names
4
- */
5
- export declare const BLOCK_MENU_ITEM_NAME: {
6
- readonly COPY_LINK_TO_BLOCK: "copyLinkToBlock";
7
- readonly MOVE_UP: "moveUp";
8
- readonly MOVE_DOWN: "moveDown";
9
- readonly DELETE: "delete";
10
- readonly FORMAT_MENU: "formatMenu";
11
- };
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { WithIntlProps, WrappedComponentProps } from 'react-intl';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { BlockMenuPlugin, BlockMenuPluginOptions } from '../blockMenuPluginType';
5
- type Props = {
6
- api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
7
- config: BlockMenuPluginOptions | undefined;
8
- };
9
- export declare const CopyLinkDropdownItem: React.FC<WithIntlProps<Props & WrappedComponentProps>> & {
10
- WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
11
- };
12
- export {};
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- export declare const CopySection: ({ children }: {
3
- children: React.ReactNode;
4
- }) => React.JSX.Element;
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import type { WithIntlProps, WrappedComponentProps } from 'react-intl';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { BlockMenuPlugin } from '../blockMenuPluginType';
5
- type Props = {
6
- api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
7
- } & WrappedComponentProps;
8
- export declare const DeleteDropdownItem: React.FC<WithIntlProps<Props>> & {
9
- WrappedComponent: React.ComponentType<Props>;
10
- };
11
- export {};
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- export declare const DeleteSection: ({ children, }: {
3
- children: React.ReactNode;
4
- }) => React.JSX.Element | null;
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { BlockMenuPlugin } from '../blockMenuPluginType';
4
- type Props = {
5
- api?: ExtractInjectionAPI<BlockMenuPlugin>;
6
- };
7
- export declare const Flag: ({ api }: Props) => React.JSX.Element | undefined;
8
- export {};
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { BlockMenuPlugin } from '../blockMenuPluginType';
4
- export declare const FormatMenuComponent: ({ api, children, }: {
5
- api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
6
- children: React.ReactNode;
7
- }) => React.JSX.Element;
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { BlockMenuPlugin } from '../blockMenuPluginType';
4
- export declare const FormatMenuSection: ({ children, api, }: {
5
- api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
6
- children: React.ReactNode;
7
- }) => React.JSX.Element | null;
@@ -1,3 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { BlockMenuPlugin, RegisterBlockMenuItem } from '../../blockMenuPluginType';
3
- export declare const useSuggestedItems: (api: ExtractInjectionAPI<BlockMenuPlugin> | undefined) => RegisterBlockMenuItem[];
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import type { WithIntlProps, WrappedComponentProps } from 'react-intl';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { BlockMenuPlugin } from '../blockMenuPluginType';
5
- type Props = {
6
- api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
7
- };
8
- export declare const MoveDownDropdownItem: React.FC<WithIntlProps<Props & WrappedComponentProps>> & {
9
- WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
10
- };
11
- export {};
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import type { WithIntlProps, WrappedComponentProps } from 'react-intl';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { BlockMenuPlugin } from '../blockMenuPluginType';
5
- type Props = {
6
- api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
7
- };
8
- export declare const MoveUpDropdownItem: React.FC<WithIntlProps<Props & WrappedComponentProps>> & {
9
- WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
10
- };
11
- export {};
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { BlockMenuPlugin } from '../blockMenuPluginType';
4
- type SuggestedItemsMenuSectionProps = {
5
- api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
6
- children?: React.ReactNode;
7
- };
8
- export declare const SuggestedItemsMenuSection: React.NamedExoticComponent<SuggestedItemsMenuSectionProps>;
9
- export {};
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { BlockMenuPlugin } from '../blockMenuPluginType';
4
- type SuggestedMenuItemsProps = {
5
- api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
6
- };
7
- export declare const SuggestedMenuItems: React.NamedExoticComponent<SuggestedMenuItemsProps>;
8
- export {};
@@ -1,26 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { BlockMenuPlugin } from '../../blockMenuPluginType';
3
- /**
4
- * Checks if the Suggested section has any visible content
5
- */
6
- export declare const hasSuggestedSectionContent: (api: ExtractInjectionAPI<BlockMenuPlugin> | undefined) => boolean;
7
- /**
8
- * Checks if the Create section has any visible content
9
- */
10
- export declare const hasCreateSectionContent: (api: ExtractInjectionAPI<BlockMenuPlugin> | undefined) => boolean;
11
- /**
12
- * Checks if the Structure section has any visible content
13
- */
14
- export declare const hasStructureSectionContent: (api: ExtractInjectionAPI<BlockMenuPlugin> | undefined) => boolean;
15
- /**
16
- * Checks if there's any content before the Create section (i.e., Suggested section has content)
17
- */
18
- export declare const hasContentBeforeCreate: (api: ExtractInjectionAPI<BlockMenuPlugin> | undefined) => boolean;
19
- /**
20
- * Checks if there's any content before the Structure section (i.e., Create or Suggested sections have content)
21
- */
22
- export declare const hasContentBeforeStructure: (api: ExtractInjectionAPI<BlockMenuPlugin> | undefined) => boolean;
23
- /**
24
- * Checks if there's any content before the Headings section (i.e., Structure, Create, or Suggested sections have content)
25
- */
26
- export declare const hasContentBeforeHeadings: (api: ExtractInjectionAPI<BlockMenuPlugin> | undefined) => boolean;
@@ -1,3 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { BlockMenuPlugin } from '../../blockMenuPluginType';
3
- export declare const checkIsFormatMenuHidden: (api: ExtractInjectionAPI<BlockMenuPlugin> | undefined) => boolean;
@@ -1,8 +0,0 @@
1
- import type { Selection } from '@atlaskit/editor-prosemirror/state';
2
- type CopyLinkOptions = {
3
- blockLinkHashPrefix?: string;
4
- getLinkPath?: () => string | null;
5
- selection: Selection;
6
- };
7
- export declare const copyLink: ({ getLinkPath, blockLinkHashPrefix, selection, }: CopyLinkOptions) => Promise<boolean>;
8
- export {};