@atlaskit/editor-plugin-block-menu 5.2.19 → 5.2.21
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.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/blockMenuPlugin.js +17 -2
- package/dist/cjs/editor-actions/isTrasformToTargetDisabled.js +114 -0
- package/dist/cjs/editor-commands/transform-node-utils/steps/listToDecisionListStep.js +1 -1
- package/dist/cjs/editor-commands/transform-node-utils/steps/wrapMixedContentStep.js +2 -16
- package/dist/cjs/editor-commands/transform-node-utils/transform.js +99 -29
- package/dist/cjs/editor-commands/transform-node-utils/utils.js +16 -1
- package/dist/cjs/editor-commands/transform-node-utils/wrapIntoListStep.js +10 -2
- package/dist/es2019/blockMenuPlugin.js +17 -2
- package/dist/es2019/editor-actions/isTrasformToTargetDisabled.js +110 -0
- package/dist/es2019/editor-commands/transform-node-utils/steps/listToDecisionListStep.js +1 -1
- package/dist/es2019/editor-commands/transform-node-utils/steps/wrapMixedContentStep.js +1 -15
- package/dist/es2019/editor-commands/transform-node-utils/transform.js +98 -28
- package/dist/es2019/editor-commands/transform-node-utils/utils.js +15 -0
- package/dist/es2019/editor-commands/transform-node-utils/wrapIntoListStep.js +6 -2
- package/dist/esm/blockMenuPlugin.js +17 -2
- package/dist/esm/editor-actions/isTrasformToTargetDisabled.js +108 -0
- package/dist/esm/editor-commands/transform-node-utils/steps/listToDecisionListStep.js +1 -1
- package/dist/esm/editor-commands/transform-node-utils/steps/wrapMixedContentStep.js +1 -15
- package/dist/esm/editor-commands/transform-node-utils/transform.js +98 -28
- package/dist/esm/editor-commands/transform-node-utils/utils.js +15 -0
- package/dist/esm/editor-commands/transform-node-utils/wrapIntoListStep.js +10 -2
- package/dist/types/blockMenuPluginType.d.ts +1 -0
- package/dist/types/editor-actions/isTrasformToTargetDisabled.d.ts +11 -0
- package/dist/types/editor-commands/transform-node-utils/transform.d.ts +2 -0
- package/dist/types/editor-commands/transform-node-utils/utils.d.ts +6 -0
- package/dist/types-ts4.5/blockMenuPluginType.d.ts +1 -0
- package/dist/types-ts4.5/editor-actions/isTrasformToTargetDisabled.d.ts +11 -0
- package/dist/types-ts4.5/editor-commands/transform-node-utils/transform.d.ts +2 -0
- package/dist/types-ts4.5/editor-commands/transform-node-utils/utils.d.ts +6 -0
- package/package.json +4 -4
- package/dist/cjs/editor-commands/transform-node-utils/stubStep.js +0 -9
- package/dist/es2019/editor-commands/transform-node-utils/stubStep.js +0 -3
- package/dist/esm/editor-commands/transform-node-utils/stubStep.js +0 -3
- package/dist/types/editor-commands/transform-node-utils/stubStep.d.ts +0 -2
- package/dist/types-ts4.5/editor-commands/transform-node-utils/stubStep.d.ts +0 -2
|
@@ -10,7 +10,6 @@ import { unwrapListStep } from './steps/unwrapListStep';
|
|
|
10
10
|
import { wrapBlockquoteToDecisionListStep } from './steps/wrapBlockquoteToDecisionListStep';
|
|
11
11
|
import { wrapMixedContentStep } from './steps/wrapMixedContentStep';
|
|
12
12
|
import { wrapTextToCodeblockStep } from './steps/wrapTextToCodeblock';
|
|
13
|
-
import { stubStep } from './stubStep';
|
|
14
13
|
import { NODE_CATEGORY_BY_TYPE, toNodeTypeValue } from './types';
|
|
15
14
|
import { unwrapExpandStep } from './unwrapExpandStep';
|
|
16
15
|
import { unwrapStep } from './unwrapStep';
|
|
@@ -40,7 +39,7 @@ var TRANSFORM_STEPS = {
|
|
|
40
39
|
},
|
|
41
40
|
text: {
|
|
42
41
|
atomic: undefined,
|
|
43
|
-
container: [
|
|
42
|
+
container: [wrapMixedContentStep],
|
|
44
43
|
list: [wrapIntoListStep],
|
|
45
44
|
text: [flattenStep, applyTargetTextTypeStep]
|
|
46
45
|
}
|
|
@@ -48,102 +47,166 @@ var TRANSFORM_STEPS = {
|
|
|
48
47
|
|
|
49
48
|
// Transform steps for specific pairs of node types that cannot be processed
|
|
50
49
|
// using generic rules/steps from TRANSFORM_STEPS.
|
|
50
|
+
// Use 'null' to indicate unavailable transfrorm for a case where TRANSFORM_STEPS are not undefined.
|
|
51
51
|
var TRANSFORM_STEPS_OVERRIDE = {
|
|
52
52
|
paragraph: {
|
|
53
|
+
paragraph: null,
|
|
54
|
+
codeBlock: [wrapTextToCodeblockStep],
|
|
55
|
+
layoutSection: [wrapIntoLayoutStep]
|
|
56
|
+
},
|
|
57
|
+
heading: {
|
|
53
58
|
codeBlock: [wrapTextToCodeblockStep],
|
|
54
59
|
layoutSection: [wrapIntoLayoutStep]
|
|
55
60
|
},
|
|
56
61
|
panel: {
|
|
62
|
+
panel: null,
|
|
57
63
|
layoutSection: [unwrapStep, wrapIntoLayoutStep],
|
|
58
64
|
codeBlock: [unwrapStep, flattenStep, wrapStep],
|
|
59
|
-
blockquote: [unwrapStep, wrapMixedContentStep]
|
|
65
|
+
blockquote: [unwrapStep, wrapMixedContentStep],
|
|
66
|
+
taskList: null,
|
|
67
|
+
bulletList: null,
|
|
68
|
+
orderedList: null,
|
|
69
|
+
heading: null
|
|
60
70
|
},
|
|
61
71
|
expand: {
|
|
72
|
+
expand: null,
|
|
62
73
|
panel: [unwrapExpandStep, wrapMixedContentStep],
|
|
63
74
|
blockquote: [unwrapExpandStep, wrapMixedContentStep],
|
|
64
75
|
layoutSection: [unwrapExpandStep, wrapIntoLayoutStep],
|
|
65
76
|
paragraph: [unwrapExpandStep],
|
|
66
|
-
codeBlock:
|
|
77
|
+
codeBlock: null,
|
|
78
|
+
heading: null
|
|
67
79
|
},
|
|
68
80
|
nestedExpand: {
|
|
81
|
+
expand: null,
|
|
82
|
+
nestedExpand: null,
|
|
69
83
|
panel: [unwrapExpandStep, wrapMixedContentStep],
|
|
70
84
|
blockquote: [unwrapExpandStep, wrapMixedContentStep],
|
|
71
85
|
paragraph: [unwrapExpandStep],
|
|
72
|
-
codeBlock:
|
|
86
|
+
codeBlock: null,
|
|
87
|
+
heading: null
|
|
73
88
|
},
|
|
74
89
|
blockquote: {
|
|
90
|
+
blockquote: null,
|
|
75
91
|
expand: [wrapStep],
|
|
76
92
|
nestedExpand: [wrapStep],
|
|
77
93
|
layoutSection: [wrapIntoLayoutStep],
|
|
78
|
-
codeBlock:
|
|
94
|
+
codeBlock: null,
|
|
79
95
|
decisionList: [unwrapStep, wrapBlockquoteToDecisionListStep]
|
|
80
96
|
},
|
|
81
97
|
layoutSection: {
|
|
98
|
+
layoutSection: null,
|
|
82
99
|
blockquote: [unwrapLayoutStep, wrapMixedContentStep],
|
|
83
100
|
expand: [unwrapLayoutStep, wrapStep],
|
|
84
101
|
panel: [unwrapLayoutStep, wrapMixedContentStep],
|
|
85
|
-
codeBlock:
|
|
86
|
-
paragraph: [unwrapLayoutStep]
|
|
102
|
+
codeBlock: null,
|
|
103
|
+
paragraph: [unwrapLayoutStep],
|
|
104
|
+
heading: null
|
|
87
105
|
},
|
|
88
106
|
codeBlock: {
|
|
107
|
+
codeBlock: null,
|
|
89
108
|
blockquote: [wrapStep],
|
|
90
109
|
expand: [wrapStep],
|
|
91
110
|
nestedExpand: [wrapStep],
|
|
92
111
|
layoutSection: [wrapIntoLayoutStep],
|
|
93
|
-
panel: [wrapStep]
|
|
112
|
+
panel: [wrapStep],
|
|
113
|
+
heading: null
|
|
94
114
|
},
|
|
95
115
|
bulletList: {
|
|
96
|
-
|
|
97
|
-
codeBlock:
|
|
116
|
+
bulletList: null,
|
|
117
|
+
codeBlock: null,
|
|
98
118
|
layoutSection: [wrapIntoLayoutStep],
|
|
99
|
-
decisionList: [flattenListStep, listToDecisionListStep]
|
|
119
|
+
decisionList: [flattenListStep, listToDecisionListStep],
|
|
120
|
+
heading: null
|
|
100
121
|
},
|
|
101
122
|
orderedList: {
|
|
102
|
-
|
|
103
|
-
codeBlock:
|
|
123
|
+
orderedList: null,
|
|
124
|
+
codeBlock: null,
|
|
104
125
|
layoutSection: [wrapIntoLayoutStep],
|
|
105
|
-
decisionList: [flattenListStep, listToDecisionListStep]
|
|
126
|
+
decisionList: [flattenListStep, listToDecisionListStep],
|
|
127
|
+
heading: null
|
|
106
128
|
},
|
|
107
129
|
taskList: {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
codeBlock: [stubStep],
|
|
130
|
+
blockquote: null,
|
|
131
|
+
codeBlock: null,
|
|
111
132
|
layoutSection: [wrapIntoLayoutStep],
|
|
112
|
-
decisionList: [flattenListStep, listToDecisionListStep]
|
|
133
|
+
decisionList: [flattenListStep, listToDecisionListStep],
|
|
134
|
+
heading: null,
|
|
135
|
+
taskList: null
|
|
113
136
|
},
|
|
114
137
|
table: {
|
|
115
|
-
layoutSection: [wrapIntoLayoutStep]
|
|
138
|
+
layoutSection: [wrapIntoLayoutStep],
|
|
139
|
+
blockquote: null,
|
|
140
|
+
panel: null,
|
|
141
|
+
codeBlock: null,
|
|
142
|
+
orderedList: null,
|
|
143
|
+
bulletList: null,
|
|
144
|
+
taskList: null,
|
|
145
|
+
decisionList: null
|
|
116
146
|
},
|
|
117
147
|
mediaSingle: {
|
|
118
|
-
layoutSection: [wrapIntoLayoutStep]
|
|
148
|
+
layoutSection: [wrapIntoLayoutStep],
|
|
149
|
+
codeBlock: null,
|
|
150
|
+
decisionList: null,
|
|
151
|
+
taskList: null
|
|
119
152
|
},
|
|
120
153
|
mediaGroup: {
|
|
121
|
-
layoutSection: [wrapIntoLayoutStep]
|
|
154
|
+
layoutSection: [wrapIntoLayoutStep],
|
|
155
|
+
codeBlock: null
|
|
122
156
|
},
|
|
123
157
|
decisionList: {
|
|
158
|
+
decisionList: null,
|
|
124
159
|
bulletList: [decisionListToListStep],
|
|
125
160
|
orderedList: [decisionListToListStep],
|
|
126
161
|
taskList: [decisionListToListStep],
|
|
127
162
|
layoutSection: [wrapIntoLayoutStep]
|
|
128
163
|
},
|
|
129
164
|
blockCard: {
|
|
130
|
-
layoutSection: [wrapIntoLayoutStep]
|
|
165
|
+
layoutSection: [wrapIntoLayoutStep],
|
|
166
|
+
blockquote: null,
|
|
167
|
+
codeBlock: null,
|
|
168
|
+
orderedList: null,
|
|
169
|
+
bulletList: null,
|
|
170
|
+
taskList: null,
|
|
171
|
+
decisionList: null
|
|
131
172
|
},
|
|
132
173
|
embedCard: {
|
|
133
|
-
layoutSection: [wrapIntoLayoutStep]
|
|
174
|
+
layoutSection: [wrapIntoLayoutStep],
|
|
175
|
+
blockquote: null,
|
|
176
|
+
panel: null,
|
|
177
|
+
codeBlock: null,
|
|
178
|
+
orderedList: null,
|
|
179
|
+
bulletList: null,
|
|
180
|
+
taskList: null,
|
|
181
|
+
decisionList: null
|
|
134
182
|
},
|
|
135
183
|
extension: {
|
|
136
|
-
layoutSection: [wrapIntoLayoutStep]
|
|
184
|
+
layoutSection: [wrapIntoLayoutStep],
|
|
185
|
+
codeBlock: null,
|
|
186
|
+
decisionList: null,
|
|
187
|
+
taskList: null
|
|
137
188
|
},
|
|
138
189
|
bodiedExtension: {
|
|
139
|
-
layoutSection: [wrapIntoLayoutStep]
|
|
190
|
+
layoutSection: [wrapIntoLayoutStep],
|
|
191
|
+
blockquote: null,
|
|
192
|
+
expand: null,
|
|
193
|
+
panel: null,
|
|
194
|
+
codeBlock: null,
|
|
195
|
+
orderedList: null,
|
|
196
|
+
bulletList: null,
|
|
197
|
+
taskList: null,
|
|
198
|
+
decisionList: null
|
|
140
199
|
}
|
|
141
200
|
};
|
|
142
201
|
var getTransformStepsForNodeTypes = function getTransformStepsForNodeTypes(selectedNodeTypeName, targetNodeTypeName) {
|
|
143
|
-
var _TRANSFORM_STEPS_OVER
|
|
202
|
+
var _TRANSFORM_STEPS_OVER;
|
|
144
203
|
var fromCategory = NODE_CATEGORY_BY_TYPE[selectedNodeTypeName];
|
|
145
204
|
var toCategory = NODE_CATEGORY_BY_TYPE[targetNodeTypeName];
|
|
146
|
-
var
|
|
205
|
+
var overrideSteps = (_TRANSFORM_STEPS_OVER = TRANSFORM_STEPS_OVERRIDE[selectedNodeTypeName]) === null || _TRANSFORM_STEPS_OVER === void 0 ? void 0 : _TRANSFORM_STEPS_OVER[targetNodeTypeName];
|
|
206
|
+
if (overrideSteps === null) {
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
var steps = overrideSteps !== null && overrideSteps !== void 0 ? overrideSteps : TRANSFORM_STEPS[fromCategory][toCategory];
|
|
147
210
|
return steps;
|
|
148
211
|
};
|
|
149
212
|
// Note: Currently works only for single node in the selection
|
|
@@ -174,4 +237,11 @@ export var getOutputNodes = function getOutputNodes(_ref) {
|
|
|
174
237
|
return steps.reduce(function (nodes, step) {
|
|
175
238
|
return step(nodes, context);
|
|
176
239
|
}, nodesToReplace);
|
|
240
|
+
};
|
|
241
|
+
export var isTransformDisabledBasedOnStepsConfig = function isTransformDisabledBasedOnStepsConfig(selectedNodeType, targetNodeType) {
|
|
242
|
+
var steps = getTransformStepsForNodeTypes(selectedNodeType, targetNodeType);
|
|
243
|
+
if (!steps || steps.length === 0) {
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
return false;
|
|
177
247
|
};
|
|
@@ -81,6 +81,21 @@ export var convertExpandToNestedExpand = function convertExpandToNestedExpand(no
|
|
|
81
81
|
title: ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.title) || ''
|
|
82
82
|
}, node.content);
|
|
83
83
|
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Converts a text node (heading, paragraph) to a paragraph preserving its inline content.
|
|
87
|
+
* This is used when a text node can't be wrapped directly in the target container
|
|
88
|
+
* (e.g., heading can't go in blockquote, so it becomes a paragraph).
|
|
89
|
+
*/
|
|
90
|
+
export var convertTextNodeToParagraph = function convertTextNodeToParagraph(node, schema) {
|
|
91
|
+
var _schema$nodes$paragra;
|
|
92
|
+
// If it's already a paragraph, return as-is
|
|
93
|
+
if (node.type.name === 'paragraph') {
|
|
94
|
+
return node;
|
|
95
|
+
}
|
|
96
|
+
// Convert heading (or other text node) to paragraph with same inline content
|
|
97
|
+
return (_schema$nodes$paragra = schema.nodes.paragraph.createAndFill({}, node.content)) !== null && _schema$nodes$paragra !== void 0 ? _schema$nodes$paragra : null;
|
|
98
|
+
};
|
|
84
99
|
export var getBlockNodesInRange = function getBlockNodesInRange(range) {
|
|
85
100
|
if (range.startIndex === range.endIndex) {
|
|
86
101
|
return [];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isListWithTextContentOnly } from './nodeChecks';
|
|
2
|
+
import { convertTextNodeToParagraph } from './utils';
|
|
2
3
|
var wrapIntoTaskOrDecisionList = function wrapIntoTaskOrDecisionList(nodes, targetNodeTypeName, schema) {
|
|
3
4
|
var itemNodeType = targetNodeTypeName === 'taskList' ? schema.nodes.taskItem : schema.nodes.decisionItem;
|
|
4
5
|
var inlineContent = nodes.flatMap(function (node) {
|
|
@@ -14,8 +15,15 @@ var wrapIntoTaskOrDecisionList = function wrapIntoTaskOrDecisionList(nodes, targ
|
|
|
14
15
|
return outputNode ? [outputNode] : nodes;
|
|
15
16
|
};
|
|
16
17
|
var wrapIntoBulletOrOrderedList = function wrapIntoBulletOrOrderedList(nodes, targetNodeTypeName, schema) {
|
|
17
|
-
var
|
|
18
|
-
|
|
18
|
+
var listItemNodes = nodes.map(function (node) {
|
|
19
|
+
return schema.nodes.listItem.createAndFill({}, node.isTextblock ? convertTextNodeToParagraph(node, schema) : node);
|
|
20
|
+
}).filter(function (node) {
|
|
21
|
+
return node !== null;
|
|
22
|
+
});
|
|
23
|
+
if (listItemNodes.length === 0) {
|
|
24
|
+
return nodes;
|
|
25
|
+
}
|
|
26
|
+
var outputNode = schema.nodes[targetNodeTypeName].createAndFill({}, listItemNodes);
|
|
19
27
|
return outputNode ? [outputNode] : nodes;
|
|
20
28
|
};
|
|
21
29
|
|
|
@@ -14,6 +14,7 @@ type TransformNodeCommand = (targetType: NodeType, metadata?: TransformNodeMetad
|
|
|
14
14
|
export type BlockMenuPlugin = NextEditorPlugin<'blockMenu', {
|
|
15
15
|
actions: {
|
|
16
16
|
getBlockMenuComponents: () => Array<RegisterBlockMenuComponent>;
|
|
17
|
+
isTransformOptionDisabled: (optionNodeTypeName: string, optionNodeTypeAttrs?: Record<string, unknown>) => boolean;
|
|
17
18
|
registerBlockMenuComponents: (blockMenuComponents: Array<RegisterBlockMenuComponent>) => void;
|
|
18
19
|
};
|
|
19
20
|
commands: {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { type NodeTypeName } from '../editor-commands/transform-node-utils/types';
|
|
4
|
+
type TransformDisabledArgs = {
|
|
5
|
+
selection: Selection;
|
|
6
|
+
targetNodeTypeAttrs?: Record<string, unknown>;
|
|
7
|
+
targetNodeTypeName: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const canParentContainNodeType: (schema: Schema, parentNode: PMNode, nodeTypeName: NodeTypeName, nodeTypeAttrs?: Record<string, unknown>) => boolean;
|
|
10
|
+
export declare const isTrasformToTargetDisabled: ({ selection, targetNodeTypeName, targetNodeTypeAttrs, }: TransformDisabledArgs) => boolean;
|
|
11
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Node as PMNode, type NodeType, type Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { NodeTypeName } from './types';
|
|
2
3
|
interface GetOutputNodesArgs {
|
|
3
4
|
isNested: boolean;
|
|
4
5
|
schema: Schema;
|
|
@@ -7,4 +8,5 @@ interface GetOutputNodesArgs {
|
|
|
7
8
|
targetNodeType: NodeType;
|
|
8
9
|
}
|
|
9
10
|
export declare const getOutputNodes: ({ sourceNode, targetNodeType, schema, isNested, targetAttrs, }: GetOutputNodesArgs) => PMNode[] | undefined;
|
|
11
|
+
export declare const isTransformDisabledBasedOnStepsConfig: (selectedNodeType: NodeTypeName, targetNodeType: NodeTypeName) => boolean;
|
|
10
12
|
export {};
|
|
@@ -16,6 +16,12 @@ export declare const convertNestedExpandToExpand: (node: PMNode, schema: Schema)
|
|
|
16
16
|
* since expand cannot be a direct child of expand.
|
|
17
17
|
*/
|
|
18
18
|
export declare const convertExpandToNestedExpand: (node: PMNode, schema: Schema) => PMNode | null;
|
|
19
|
+
/**
|
|
20
|
+
* Converts a text node (heading, paragraph) to a paragraph preserving its inline content.
|
|
21
|
+
* This is used when a text node can't be wrapped directly in the target container
|
|
22
|
+
* (e.g., heading can't go in blockquote, so it becomes a paragraph).
|
|
23
|
+
*/
|
|
24
|
+
export declare const convertTextNodeToParagraph: (node: PMNode, schema: Schema) => PMNode | null;
|
|
19
25
|
export declare const getBlockNodesInRange: (range: NodeRange) => PMNode[];
|
|
20
26
|
/**
|
|
21
27
|
* Iterates over a nodes children and extracting text content, removing all other inline content and converting
|
|
@@ -14,6 +14,7 @@ type TransformNodeCommand = (targetType: NodeType, metadata?: TransformNodeMetad
|
|
|
14
14
|
export type BlockMenuPlugin = NextEditorPlugin<'blockMenu', {
|
|
15
15
|
actions: {
|
|
16
16
|
getBlockMenuComponents: () => Array<RegisterBlockMenuComponent>;
|
|
17
|
+
isTransformOptionDisabled: (optionNodeTypeName: string, optionNodeTypeAttrs?: Record<string, unknown>) => boolean;
|
|
17
18
|
registerBlockMenuComponents: (blockMenuComponents: Array<RegisterBlockMenuComponent>) => void;
|
|
18
19
|
};
|
|
19
20
|
commands: {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { type NodeTypeName } from '../editor-commands/transform-node-utils/types';
|
|
4
|
+
type TransformDisabledArgs = {
|
|
5
|
+
selection: Selection;
|
|
6
|
+
targetNodeTypeAttrs?: Record<string, unknown>;
|
|
7
|
+
targetNodeTypeName: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const canParentContainNodeType: (schema: Schema, parentNode: PMNode, nodeTypeName: NodeTypeName, nodeTypeAttrs?: Record<string, unknown>) => boolean;
|
|
10
|
+
export declare const isTrasformToTargetDisabled: ({ selection, targetNodeTypeName, targetNodeTypeAttrs, }: TransformDisabledArgs) => boolean;
|
|
11
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Node as PMNode, type NodeType, type Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { NodeTypeName } from './types';
|
|
2
3
|
interface GetOutputNodesArgs {
|
|
3
4
|
isNested: boolean;
|
|
4
5
|
schema: Schema;
|
|
@@ -7,4 +8,5 @@ interface GetOutputNodesArgs {
|
|
|
7
8
|
targetNodeType: NodeType;
|
|
8
9
|
}
|
|
9
10
|
export declare const getOutputNodes: ({ sourceNode, targetNodeType, schema, isNested, targetAttrs, }: GetOutputNodesArgs) => PMNode[] | undefined;
|
|
11
|
+
export declare const isTransformDisabledBasedOnStepsConfig: (selectedNodeType: NodeTypeName, targetNodeType: NodeTypeName) => boolean;
|
|
10
12
|
export {};
|
|
@@ -16,6 +16,12 @@ export declare const convertNestedExpandToExpand: (node: PMNode, schema: Schema)
|
|
|
16
16
|
* since expand cannot be a direct child of expand.
|
|
17
17
|
*/
|
|
18
18
|
export declare const convertExpandToNestedExpand: (node: PMNode, schema: Schema) => PMNode | null;
|
|
19
|
+
/**
|
|
20
|
+
* Converts a text node (heading, paragraph) to a paragraph preserving its inline content.
|
|
21
|
+
* This is used when a text node can't be wrapped directly in the target container
|
|
22
|
+
* (e.g., heading can't go in blockquote, so it becomes a paragraph).
|
|
23
|
+
*/
|
|
24
|
+
export declare const convertTextNodeToParagraph: (node: PMNode, schema: Schema) => PMNode | null;
|
|
19
25
|
export declare const getBlockNodesInRange: (range: NodeRange) => PMNode[];
|
|
20
26
|
/**
|
|
21
27
|
* Iterates over a nodes children and extracting text content, removing all other inline content and converting
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.21",
|
|
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.19.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.
|
|
34
|
+
"@atlaskit/editor-plugin-block-controls": "^7.17.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": "^17.0.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^16.
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^16.1.0",
|
|
48
48
|
"@atlaskit/tokens": "^9.0.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@atlaskit/editor-common": "^110.
|
|
52
|
+
"@atlaskit/editor-common": "^110.48.0",
|
|
53
53
|
"react": "^18.2.0",
|
|
54
54
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
55
55
|
},
|