@atlaskit/editor-plugin-block-menu 5.1.5 → 5.1.7

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 (39) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/editor-commands/transform-node-utils/flattenListStep.js +9 -32
  3. package/dist/cjs/editor-commands/transform-node-utils/steps/unwrapLayoutStep.js +38 -0
  4. package/dist/cjs/editor-commands/transform-node-utils/transform.js +24 -4
  5. package/dist/cjs/editor-commands/transform-node-utils/unwrapExpandStep.js +6 -7
  6. package/dist/cjs/editor-commands/transform-node-utils/unwrapListStep.js +16 -1
  7. package/dist/cjs/editor-commands/transform-node-utils/utils.js +30 -1
  8. package/dist/cjs/editor-commands/transform-node-utils/wrapStep.js +0 -1
  9. package/dist/cjs/editor-commands/transformNode.js +6 -6
  10. package/dist/cjs/ui/utils/suggested-items-rank.js +107 -0
  11. package/dist/es2019/editor-commands/transform-node-utils/flattenListStep.js +9 -32
  12. package/dist/es2019/editor-commands/transform-node-utils/steps/unwrapLayoutStep.js +30 -0
  13. package/dist/es2019/editor-commands/transform-node-utils/transform.js +24 -4
  14. package/dist/es2019/editor-commands/transform-node-utils/unwrapExpandStep.js +8 -7
  15. package/dist/es2019/editor-commands/transform-node-utils/unwrapListStep.js +16 -1
  16. package/dist/es2019/editor-commands/transform-node-utils/utils.js +29 -1
  17. package/dist/es2019/editor-commands/transform-node-utils/wrapStep.js +0 -1
  18. package/dist/es2019/editor-commands/transformNode.js +2 -2
  19. package/dist/es2019/ui/utils/suggested-items-rank.js +223 -0
  20. package/dist/esm/editor-commands/transform-node-utils/flattenListStep.js +9 -32
  21. package/dist/esm/editor-commands/transform-node-utils/steps/unwrapLayoutStep.js +31 -0
  22. package/dist/esm/editor-commands/transform-node-utils/transform.js +24 -4
  23. package/dist/esm/editor-commands/transform-node-utils/unwrapExpandStep.js +7 -7
  24. package/dist/esm/editor-commands/transform-node-utils/unwrapListStep.js +16 -1
  25. package/dist/esm/editor-commands/transform-node-utils/utils.js +30 -1
  26. package/dist/esm/editor-commands/transform-node-utils/wrapStep.js +0 -1
  27. package/dist/esm/editor-commands/transformNode.js +4 -4
  28. package/dist/esm/ui/utils/suggested-items-rank.js +101 -0
  29. package/dist/types/editor-commands/transform-node-utils/flattenListStep.d.ts +0 -18
  30. package/dist/types/editor-commands/transform-node-utils/steps/unwrapLayoutStep.d.ts +14 -0
  31. package/dist/types/editor-commands/transform-node-utils/unwrapListStep.d.ts +16 -1
  32. package/dist/types/editor-commands/transform-node-utils/utils.d.ts +12 -0
  33. package/dist/types/ui/utils/suggested-items-rank.d.ts +81 -0
  34. package/dist/types-ts4.5/editor-commands/transform-node-utils/flattenListStep.d.ts +0 -18
  35. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/unwrapLayoutStep.d.ts +14 -0
  36. package/dist/types-ts4.5/editor-commands/transform-node-utils/unwrapListStep.d.ts +16 -1
  37. package/dist/types-ts4.5/editor-commands/transform-node-utils/utils.d.ts +12 -0
  38. package/dist/types-ts4.5/ui/utils/suggested-items-rank.d.ts +81 -0
  39. package/package.json +4 -4
@@ -0,0 +1,101 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ var _TRANSFORM_SUGGESTED_;
4
+ /**
5
+ * Suggested transformations mapping for each block type.
6
+ * Based on the Block Menu Compatibility Matrix:
7
+ * https://hello.atlassian.net/wiki/spaces/egcuc/pages/5868774224/Block+Menu+Compatibility+Matrix#Suggested-for-each-block-type
8
+ *
9
+ * This mapping defines which transform items should appear in the TRANSFORM_SUGGESTED_MENU_SECTION
10
+ * for each block type, ranked by priority (lower rank = higher priority).
11
+ *
12
+ * Structure:
13
+ * {
14
+ * [sourceNodeType]: {
15
+ * [targetMenuItemKey]: rank
16
+ * }
17
+ * }
18
+ */
19
+
20
+ import { TRANSFORM_STRUCTURE_PANEL_MENU_ITEM, TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM, TRANSFORM_STRUCTURE_LAYOUT_MENU_ITEM, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_CODE_BLOCK_MENU_ITEM, TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM } from '@atlaskit/editor-common/block-menu';
21
+ /**
22
+ * Node type keys that map to ProseMirror node types from the ADF schema.
23
+ * These values must match the NodeTypeName type.
24
+ *
25
+ * TypeScript will enforce that all values are valid NodeTypeName values.
26
+ * If a new node type is added, it must be added to NodeTypeName first.
27
+ *
28
+ * Reference: packages/editor/editor-plugin-block-menu/src/editor-commands/transform-node-utils/types.ts
29
+ *
30
+ * Note: 'heading' represents all heading levels (1-6) as a single node type.
31
+ * The specific level is determined by the node's `attrs.level` property at runtime.
32
+ *
33
+ * @example
34
+ * // Usage:
35
+ * const nodeType = BLOCK_MENU_NODE_TYPES.PARAGRAPH; // Type: "paragraph"
36
+ */
37
+ export var BLOCK_MENU_NODE_TYPES = {
38
+ PARAGRAPH: 'paragraph',
39
+ EXPAND: 'expand',
40
+ BLOCKQUOTE: 'blockquote',
41
+ LAYOUT_SECTION: 'layoutSection',
42
+ PANEL: 'panel',
43
+ CODE_BLOCK: 'codeBlock',
44
+ DECISION: 'decisionList',
45
+ BULLET_LIST: 'bulletList',
46
+ ORDERED_LIST: 'orderedList',
47
+ HEADING: 'heading',
48
+ TASK_LIST: 'taskList',
49
+ MEDIA_SINGLE: 'mediaSingle',
50
+ EXTENSION: 'extension',
51
+ BODIED_EXTENSION: 'bodiedExtension',
52
+ BLOCK_CARD: 'blockCard',
53
+ EMBED_CARD: 'embedCard',
54
+ TABLE: 'table'
55
+ };
56
+
57
+ /**
58
+ * Type for node type values extracted from BLOCK_MENU_NODE_TYPES
59
+ */
60
+
61
+ /**
62
+ * Type for the suggested items rank mapping
63
+ */
64
+
65
+ /**
66
+ * Mapping of source node types to suggested transformation menu items with their ranks.
67
+ * Lower rank number = higher priority in the suggested menu section.
68
+ */
69
+ export var TRANSFORM_SUGGESTED_ITEMS_RANK = (_TRANSFORM_SUGGESTED_ = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_TRANSFORM_SUGGESTED_, BLOCK_MENU_NODE_TYPES.PARAGRAPH, _defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM.key, 100), TRANSFORM_HEADINGS_H2_MENU_ITEM.key, 200), TRANSFORM_HEADINGS_H3_MENU_ITEM.key, 300)), BLOCK_MENU_NODE_TYPES.EXPAND, _defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_LAYOUT_MENU_ITEM.key, 200), TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key, 300)), BLOCK_MENU_NODE_TYPES.BLOCKQUOTE, _defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key, 200), TRANSFORM_STRUCTURE_LAYOUT_MENU_ITEM.key, 300)), BLOCK_MENU_NODE_TYPES.LAYOUT_SECTION, _defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM.key, 200), TRANSFORM_HEADINGS_H2_MENU_ITEM.key, 300)), BLOCK_MENU_NODE_TYPES.PANEL, _defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM.key, 200), TRANSFORM_STRUCTURE_CODE_BLOCK_MENU_ITEM.key, 300)), BLOCK_MENU_NODE_TYPES.CODE_BLOCK, _defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_LAYOUT_MENU_ITEM.key, 200), TRANSFORM_STRUCTURE_PANEL_MENU_ITEM.key, 300)), BLOCK_MENU_NODE_TYPES.DECISION, _defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key, 200), TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM.key, 300)), BLOCK_MENU_NODE_TYPES.BULLET_LIST, _defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM.key, 200), TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key, 300)), BLOCK_MENU_NODE_TYPES.ORDERED_LIST, _defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM.key, 200), TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key, 300)), BLOCK_MENU_NODE_TYPES.HEADING, _defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key, 100), TRANSFORM_HEADINGS_H2_MENU_ITEM.key, 200), TRANSFORM_STRUCTURE_PANEL_MENU_ITEM.key, 300)), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_TRANSFORM_SUGGESTED_, BLOCK_MENU_NODE_TYPES.TASK_LIST, _defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM.key, 200), TRANSFORM_STRUCTURE_CODE_BLOCK_MENU_ITEM.key, 300)), BLOCK_MENU_NODE_TYPES.MEDIA_SINGLE, _defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_LAYOUT_MENU_ITEM.key, 200), TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key, 300)), BLOCK_MENU_NODE_TYPES.EXTENSION, _defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key, 200), TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM.key, 300)), BLOCK_MENU_NODE_TYPES.BODIED_EXTENSION, _defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key, 200), TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM.key, 300)), BLOCK_MENU_NODE_TYPES.BLOCK_CARD, _defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key, 200)), BLOCK_MENU_NODE_TYPES.EMBED_CARD, _defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key, 200)), BLOCK_MENU_NODE_TYPES.TABLE, _defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_LAYOUT_MENU_ITEM.key, 200)));
70
+
71
+ /**
72
+ * Get suggested menu items for a given node type
73
+ * @param nodeType - The source node type (e.g., 'paragraph', 'heading')
74
+ * @returns Object mapping menu item keys to their ranks, or undefined if no suggestions
75
+ */
76
+ export var getSuggestedItemsForNodeType = function getSuggestedItemsForNodeType(nodeType) {
77
+ return TRANSFORM_SUGGESTED_ITEMS_RANK[nodeType];
78
+ };
79
+
80
+ /**
81
+ * Get sorted suggested menu item keys for a given node type
82
+ * @param nodeType - The source node type
83
+ * @returns Array of menu item keys sorted by rank (highest priority first)
84
+ */
85
+ export var getSortedSuggestedItems = function getSortedSuggestedItems(nodeType) {
86
+ var suggestions = getSuggestedItemsForNodeType(nodeType);
87
+ if (!suggestions) {
88
+ return [];
89
+ }
90
+ return Object.entries(suggestions).sort(function (_ref, _ref2) {
91
+ var _ref3 = _slicedToArray(_ref, 2),
92
+ rankA = _ref3[1];
93
+ var _ref4 = _slicedToArray(_ref2, 2),
94
+ rankB = _ref4[1];
95
+ return rankA - rankB;
96
+ }).map(function (_ref5) {
97
+ var _ref6 = _slicedToArray(_ref5, 1),
98
+ key = _ref6[0];
99
+ return key;
100
+ });
101
+ };
@@ -4,24 +4,6 @@ import type { TransformStep } from './types';
4
4
  * to it's first ancestor list, maintaining document order.
5
5
  *
6
6
  * @example
7
- * Input:
8
- * - bulletList
9
- * - listItem "A"
10
- * - listItem "B"
11
- * - bulletList
12
- * - listItem "C"
13
- * - listItem "D"
14
- * - listItem "E"
15
- *
16
- * Output:
17
- * - bulletList
18
- * - listItem "A"
19
- * - listItem "B"
20
- * - listItem "C"
21
- * - listItem "D"
22
- * - listItem "E"
23
- *
24
- * @example
25
7
  * Input (deeply nested):
26
8
  * - bulletList
27
9
  * - listItem "1"
@@ -0,0 +1,14 @@
1
+ import type { TransformStep } from '../types';
2
+ /**
3
+ * Unwraps a layoutSection node, extracting content from all columns.
4
+ * Works with any number of columns (2, 3, etc.).
5
+ *
6
+ * Example:
7
+ * layoutSection(
8
+ * layoutColumn(p('a'), p('b')),
9
+ * layoutColumn(p('c')),
10
+ * layoutColumn(p('d'))
11
+ * )
12
+ * → [p('a'), p('b'), p('c'), p('d')]
13
+ */
14
+ export declare const unwrapLayoutStep: TransformStep;
@@ -1,7 +1,22 @@
1
1
  import type { TransformStep } from './types';
2
2
  /**
3
- * Given an array of nodes, returns an array with the flattened children of any list nodes.
3
+ * Given an array of nodes, processes each list removing all parent list nodes and
4
+ * just returning their child contents.
5
+ *
6
+ * @example
7
+ * Input:
8
+ * - bulletList
9
+ * - listItem "1"
10
+ * - paragraph "1"
11
+ * - listItem "2"
12
+ * - paragraph "2"
13
+ *
14
+ * Output:
15
+ * - paragraph "1"
16
+ * - paragraph "2"
17
+ *
4
18
  * @param nodes
19
+ * @param context
5
20
  * @returns
6
21
  */
7
22
  export declare const unwrapListStep: TransformStep;
@@ -1,5 +1,17 @@
1
+ import type { Schema } from '@atlaskit/editor-prosemirror/model';
1
2
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
2
3
  import { type ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
3
4
  import type { NodeTypeName } from './types';
4
5
  export declare const getSelectedNode: (selection: Selection) => ContentNodeWithPos | undefined;
5
6
  export declare const getTargetNodeTypeNameInContext: (nodeTypeName: NodeTypeName | null, isNested?: boolean) => NodeTypeName | null;
7
+ /**
8
+ * Use common expandToBlockRange function, but account for edge cases with lists.
9
+ *
10
+ * @param selection
11
+ * @param schema
12
+ * @returns
13
+ */
14
+ export declare const expandSelectionToBlockRange: (selection: Selection, schema: Schema) => {
15
+ $from: import("prosemirror-model").ResolvedPos;
16
+ $to: import("prosemirror-model").ResolvedPos;
17
+ };
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Suggested transformations mapping for each block type.
3
+ * Based on the Block Menu Compatibility Matrix:
4
+ * https://hello.atlassian.net/wiki/spaces/egcuc/pages/5868774224/Block+Menu+Compatibility+Matrix#Suggested-for-each-block-type
5
+ *
6
+ * This mapping defines which transform items should appear in the TRANSFORM_SUGGESTED_MENU_SECTION
7
+ * for each block type, ranked by priority (lower rank = higher priority).
8
+ *
9
+ * Structure:
10
+ * {
11
+ * [sourceNodeType]: {
12
+ * [targetMenuItemKey]: rank
13
+ * }
14
+ * }
15
+ */
16
+ /**
17
+ * Node type keys that map to ProseMirror node types from the ADF schema.
18
+ * These values must match the NodeTypeName type.
19
+ *
20
+ * TypeScript will enforce that all values are valid NodeTypeName values.
21
+ * If a new node type is added, it must be added to NodeTypeName first.
22
+ *
23
+ * Reference: packages/editor/editor-plugin-block-menu/src/editor-commands/transform-node-utils/types.ts
24
+ *
25
+ * Note: 'heading' represents all heading levels (1-6) as a single node type.
26
+ * The specific level is determined by the node's `attrs.level` property at runtime.
27
+ *
28
+ * @example
29
+ * // Usage:
30
+ * const nodeType = BLOCK_MENU_NODE_TYPES.PARAGRAPH; // Type: "paragraph"
31
+ */
32
+ export declare const BLOCK_MENU_NODE_TYPES: {
33
+ readonly PARAGRAPH: "paragraph";
34
+ readonly EXPAND: "expand";
35
+ readonly BLOCKQUOTE: "blockquote";
36
+ readonly LAYOUT_SECTION: "layoutSection";
37
+ readonly PANEL: "panel";
38
+ readonly CODE_BLOCK: "codeBlock";
39
+ readonly DECISION: "decisionList";
40
+ readonly BULLET_LIST: "bulletList";
41
+ readonly ORDERED_LIST: "orderedList";
42
+ readonly HEADING: "heading";
43
+ readonly TASK_LIST: "taskList";
44
+ readonly MEDIA_SINGLE: "mediaSingle";
45
+ readonly EXTENSION: "extension";
46
+ readonly BODIED_EXTENSION: "bodiedExtension";
47
+ readonly BLOCK_CARD: "blockCard";
48
+ readonly EMBED_CARD: "embedCard";
49
+ readonly TABLE: "table";
50
+ };
51
+ /**
52
+ * Type for node type values extracted from BLOCK_MENU_NODE_TYPES
53
+ */
54
+ export type BlockMenuNodeType = (typeof BLOCK_MENU_NODE_TYPES)[keyof typeof BLOCK_MENU_NODE_TYPES];
55
+ /**
56
+ * Type for the suggested items rank mapping
57
+ */
58
+ export type SuggestedItemsRankMap = {
59
+ [nodeType: string]: {
60
+ [menuItemKey: string]: number;
61
+ };
62
+ };
63
+ /**
64
+ * Mapping of source node types to suggested transformation menu items with their ranks.
65
+ * Lower rank number = higher priority in the suggested menu section.
66
+ */
67
+ export declare const TRANSFORM_SUGGESTED_ITEMS_RANK: SuggestedItemsRankMap;
68
+ /**
69
+ * Get suggested menu items for a given node type
70
+ * @param nodeType - The source node type (e.g., 'paragraph', 'heading')
71
+ * @returns Object mapping menu item keys to their ranks, or undefined if no suggestions
72
+ */
73
+ export declare const getSuggestedItemsForNodeType: (nodeType: string) => {
74
+ [menuItemKey: string]: number;
75
+ } | undefined;
76
+ /**
77
+ * Get sorted suggested menu item keys for a given node type
78
+ * @param nodeType - The source node type
79
+ * @returns Array of menu item keys sorted by rank (highest priority first)
80
+ */
81
+ export declare const getSortedSuggestedItems: (nodeType: string) => string[];
@@ -4,24 +4,6 @@ import type { TransformStep } from './types';
4
4
  * to it's first ancestor list, maintaining document order.
5
5
  *
6
6
  * @example
7
- * Input:
8
- * - bulletList
9
- * - listItem "A"
10
- * - listItem "B"
11
- * - bulletList
12
- * - listItem "C"
13
- * - listItem "D"
14
- * - listItem "E"
15
- *
16
- * Output:
17
- * - bulletList
18
- * - listItem "A"
19
- * - listItem "B"
20
- * - listItem "C"
21
- * - listItem "D"
22
- * - listItem "E"
23
- *
24
- * @example
25
7
  * Input (deeply nested):
26
8
  * - bulletList
27
9
  * - listItem "1"
@@ -0,0 +1,14 @@
1
+ import type { TransformStep } from '../types';
2
+ /**
3
+ * Unwraps a layoutSection node, extracting content from all columns.
4
+ * Works with any number of columns (2, 3, etc.).
5
+ *
6
+ * Example:
7
+ * layoutSection(
8
+ * layoutColumn(p('a'), p('b')),
9
+ * layoutColumn(p('c')),
10
+ * layoutColumn(p('d'))
11
+ * )
12
+ * → [p('a'), p('b'), p('c'), p('d')]
13
+ */
14
+ export declare const unwrapLayoutStep: TransformStep;
@@ -1,7 +1,22 @@
1
1
  import type { TransformStep } from './types';
2
2
  /**
3
- * Given an array of nodes, returns an array with the flattened children of any list nodes.
3
+ * Given an array of nodes, processes each list removing all parent list nodes and
4
+ * just returning their child contents.
5
+ *
6
+ * @example
7
+ * Input:
8
+ * - bulletList
9
+ * - listItem "1"
10
+ * - paragraph "1"
11
+ * - listItem "2"
12
+ * - paragraph "2"
13
+ *
14
+ * Output:
15
+ * - paragraph "1"
16
+ * - paragraph "2"
17
+ *
4
18
  * @param nodes
19
+ * @param context
5
20
  * @returns
6
21
  */
7
22
  export declare const unwrapListStep: TransformStep;
@@ -1,5 +1,17 @@
1
+ import type { Schema } from '@atlaskit/editor-prosemirror/model';
1
2
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
2
3
  import { type ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
3
4
  import type { NodeTypeName } from './types';
4
5
  export declare const getSelectedNode: (selection: Selection) => ContentNodeWithPos | undefined;
5
6
  export declare const getTargetNodeTypeNameInContext: (nodeTypeName: NodeTypeName | null, isNested?: boolean) => NodeTypeName | null;
7
+ /**
8
+ * Use common expandToBlockRange function, but account for edge cases with lists.
9
+ *
10
+ * @param selection
11
+ * @param schema
12
+ * @returns
13
+ */
14
+ export declare const expandSelectionToBlockRange: (selection: Selection, schema: Schema) => {
15
+ $from: import("prosemirror-model").ResolvedPos;
16
+ $to: import("prosemirror-model").ResolvedPos;
17
+ };
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Suggested transformations mapping for each block type.
3
+ * Based on the Block Menu Compatibility Matrix:
4
+ * https://hello.atlassian.net/wiki/spaces/egcuc/pages/5868774224/Block+Menu+Compatibility+Matrix#Suggested-for-each-block-type
5
+ *
6
+ * This mapping defines which transform items should appear in the TRANSFORM_SUGGESTED_MENU_SECTION
7
+ * for each block type, ranked by priority (lower rank = higher priority).
8
+ *
9
+ * Structure:
10
+ * {
11
+ * [sourceNodeType]: {
12
+ * [targetMenuItemKey]: rank
13
+ * }
14
+ * }
15
+ */
16
+ /**
17
+ * Node type keys that map to ProseMirror node types from the ADF schema.
18
+ * These values must match the NodeTypeName type.
19
+ *
20
+ * TypeScript will enforce that all values are valid NodeTypeName values.
21
+ * If a new node type is added, it must be added to NodeTypeName first.
22
+ *
23
+ * Reference: packages/editor/editor-plugin-block-menu/src/editor-commands/transform-node-utils/types.ts
24
+ *
25
+ * Note: 'heading' represents all heading levels (1-6) as a single node type.
26
+ * The specific level is determined by the node's `attrs.level` property at runtime.
27
+ *
28
+ * @example
29
+ * // Usage:
30
+ * const nodeType = BLOCK_MENU_NODE_TYPES.PARAGRAPH; // Type: "paragraph"
31
+ */
32
+ export declare const BLOCK_MENU_NODE_TYPES: {
33
+ readonly PARAGRAPH: "paragraph";
34
+ readonly EXPAND: "expand";
35
+ readonly BLOCKQUOTE: "blockquote";
36
+ readonly LAYOUT_SECTION: "layoutSection";
37
+ readonly PANEL: "panel";
38
+ readonly CODE_BLOCK: "codeBlock";
39
+ readonly DECISION: "decisionList";
40
+ readonly BULLET_LIST: "bulletList";
41
+ readonly ORDERED_LIST: "orderedList";
42
+ readonly HEADING: "heading";
43
+ readonly TASK_LIST: "taskList";
44
+ readonly MEDIA_SINGLE: "mediaSingle";
45
+ readonly EXTENSION: "extension";
46
+ readonly BODIED_EXTENSION: "bodiedExtension";
47
+ readonly BLOCK_CARD: "blockCard";
48
+ readonly EMBED_CARD: "embedCard";
49
+ readonly TABLE: "table";
50
+ };
51
+ /**
52
+ * Type for node type values extracted from BLOCK_MENU_NODE_TYPES
53
+ */
54
+ export type BlockMenuNodeType = (typeof BLOCK_MENU_NODE_TYPES)[keyof typeof BLOCK_MENU_NODE_TYPES];
55
+ /**
56
+ * Type for the suggested items rank mapping
57
+ */
58
+ export type SuggestedItemsRankMap = {
59
+ [nodeType: string]: {
60
+ [menuItemKey: string]: number;
61
+ };
62
+ };
63
+ /**
64
+ * Mapping of source node types to suggested transformation menu items with their ranks.
65
+ * Lower rank number = higher priority in the suggested menu section.
66
+ */
67
+ export declare const TRANSFORM_SUGGESTED_ITEMS_RANK: SuggestedItemsRankMap;
68
+ /**
69
+ * Get suggested menu items for a given node type
70
+ * @param nodeType - The source node type (e.g., 'paragraph', 'heading')
71
+ * @returns Object mapping menu item keys to their ranks, or undefined if no suggestions
72
+ */
73
+ export declare const getSuggestedItemsForNodeType: (nodeType: string) => {
74
+ [menuItemKey: string]: number;
75
+ } | undefined;
76
+ /**
77
+ * Get sorted suggested menu item keys for a given node type
78
+ * @param nodeType - The source node type
79
+ * @returns Array of menu item keys sorted by rank (highest priority first)
80
+ */
81
+ export declare const getSortedSuggestedItems: (nodeType: string) => string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-menu",
3
- "version": "5.1.5",
3
+ "version": "5.1.7",
4
4
  "description": "BlockMenu plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/css": "^0.17.0",
32
32
  "@atlaskit/dropdown-menu": "^16.3.0",
33
33
  "@atlaskit/editor-plugin-analytics": "^6.2.0",
34
- "@atlaskit/editor-plugin-block-controls": "^7.11.0",
34
+ "@atlaskit/editor-plugin-block-controls": "^7.13.0",
35
35
  "@atlaskit/editor-plugin-decorations": "^6.1.0",
36
36
  "@atlaskit/editor-plugin-selection": "^6.1.0",
37
37
  "@atlaskit/editor-plugin-user-intent": "^4.0.0",
@@ -44,12 +44,12 @@
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
45
  "@atlaskit/platform-feature-flags-react": "^0.4.0",
46
46
  "@atlaskit/primitives": "^16.4.0",
47
- "@atlaskit/tmp-editor-statsig": "^14.6.0",
47
+ "@atlaskit/tmp-editor-statsig": "^14.7.0",
48
48
  "@atlaskit/tokens": "^8.4.0",
49
49
  "@babel/runtime": "^7.0.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@atlaskit/editor-common": "^110.38.0",
52
+ "@atlaskit/editor-common": "^110.39.0",
53
53
  "react": "^18.2.0",
54
54
  "react-intl-next": "npm:react-intl@^5.18.1"
55
55
  },