@atlaskit/editor-plugin-block-menu 6.0.8 → 6.0.10
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 +15 -0
- package/dist/cjs/editor-commands/transform-node-utils/TRANSFORMATION_MATRIX.js +224 -0
- package/dist/cjs/editor-commands/transform-node-utils/steps/applyTargetTextTypeStep.js +4 -0
- package/dist/cjs/editor-commands/transform-node-utils/steps/convertEachNodeStep.js +58 -1
- package/dist/cjs/editor-commands/transform-node-utils/steps/wrapMixedContentStep.js +12 -1
- package/dist/cjs/editor-commands/transform-node-utils/transform.js +4 -236
- package/dist/cjs/editor-commands/transform-node-utils/utils.js +33 -11
- package/dist/es2019/editor-commands/transform-node-utils/TRANSFORMATION_MATRIX.js +219 -0
- package/dist/es2019/editor-commands/transform-node-utils/steps/applyTargetTextTypeStep.js +4 -0
- package/dist/es2019/editor-commands/transform-node-utils/steps/convertEachNodeStep.js +56 -1
- package/dist/es2019/editor-commands/transform-node-utils/steps/wrapMixedContentStep.js +13 -2
- package/dist/es2019/editor-commands/transform-node-utils/transform.js +5 -238
- package/dist/es2019/editor-commands/transform-node-utils/utils.js +32 -10
- package/dist/esm/editor-commands/transform-node-utils/TRANSFORMATION_MATRIX.js +219 -0
- package/dist/esm/editor-commands/transform-node-utils/steps/applyTargetTextTypeStep.js +4 -0
- package/dist/esm/editor-commands/transform-node-utils/steps/convertEachNodeStep.js +58 -1
- package/dist/esm/editor-commands/transform-node-utils/steps/wrapMixedContentStep.js +13 -2
- package/dist/esm/editor-commands/transform-node-utils/transform.js +5 -238
- package/dist/esm/editor-commands/transform-node-utils/utils.js +32 -10
- package/dist/types/editor-commands/transform-node-utils/TRANSFORMATION_MATRIX.d.ts +2 -0
- package/dist/types/editor-commands/transform-node-utils/utils.d.ts +10 -5
- package/dist/types-ts4.5/editor-commands/transform-node-utils/TRANSFORMATION_MATRIX.d.ts +2 -0
- package/dist/types-ts4.5/editor-commands/transform-node-utils/utils.d.ts +10 -5
- package/package.json +4 -4
|
@@ -126,20 +126,42 @@ export var getBlockNodesInRange = function getBlockNodesInRange(range) {
|
|
|
126
126
|
};
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
129
|
+
* Splits a text node (paragraph/heading) into parts for codeBlock conversion.
|
|
130
|
+
* Returns an array of:
|
|
131
|
+
* - strings (text content that can go into codeBlock)
|
|
132
|
+
* - PMNodes (incompatible inline nodes wrapped in paragraphs that need to break out)
|
|
131
133
|
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
+
* This preserves inline nodes (like status, inlineExtension) that cannot be represented as plain text.
|
|
135
|
+
*
|
|
136
|
+
* @param node - The text node (paragraph or heading) to split
|
|
137
|
+
* @param schema - The schema to use for creating paragraph nodes
|
|
138
|
+
* @returns Array of strings (for codeBlock) and PMNodes (to break out)
|
|
134
139
|
*/
|
|
135
|
-
export var
|
|
136
|
-
var
|
|
140
|
+
export var splitTextNodeForCodeBlock = function splitTextNodeForCodeBlock(node, schema) {
|
|
141
|
+
var result = [];
|
|
142
|
+
var currentText = '';
|
|
143
|
+
node.content.forEach(function (child) {
|
|
137
144
|
if (child.isText) {
|
|
138
|
-
|
|
145
|
+
currentText += child.text || '';
|
|
139
146
|
} else if (child.type.name === 'hardBreak') {
|
|
140
|
-
|
|
147
|
+
currentText += '\n';
|
|
148
|
+
} else {
|
|
149
|
+
// Incompatible inline node (status, inlineExtension, etc.)
|
|
150
|
+
// Flush accumulated text if any
|
|
151
|
+
if (currentText) {
|
|
152
|
+
result.push(currentText);
|
|
153
|
+
currentText = '';
|
|
154
|
+
}
|
|
155
|
+
// Wrap the inline node in a paragraph and add it to break out
|
|
156
|
+
var paragraph = schema.nodes.paragraph.create({}, child);
|
|
157
|
+
result.push(paragraph);
|
|
141
158
|
}
|
|
142
|
-
return '';
|
|
143
159
|
});
|
|
144
|
-
|
|
160
|
+
|
|
161
|
+
// Don't forget remaining text (or empty string for empty nodes)
|
|
162
|
+
// Always push at least an empty string so empty paragraphs create empty codeBlocks
|
|
163
|
+
if (currentText || result.length === 0) {
|
|
164
|
+
result.push(currentText);
|
|
165
|
+
}
|
|
166
|
+
return result;
|
|
145
167
|
};
|
|
@@ -29,10 +29,15 @@ export declare const convertExpandToNestedExpand: (node: PMNode, schema: Schema)
|
|
|
29
29
|
export declare const convertTextNodeToParagraph: (node: PMNode, schema: Schema) => PMNode | null;
|
|
30
30
|
export declare const getBlockNodesInRange: (range: NodeRange) => PMNode[];
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* Splits a text node (paragraph/heading) into parts for codeBlock conversion.
|
|
33
|
+
* Returns an array of:
|
|
34
|
+
* - strings (text content that can go into codeBlock)
|
|
35
|
+
* - PMNodes (incompatible inline nodes wrapped in paragraphs that need to break out)
|
|
34
36
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
+
* This preserves inline nodes (like status, inlineExtension) that cannot be represented as plain text.
|
|
38
|
+
*
|
|
39
|
+
* @param node - The text node (paragraph or heading) to split
|
|
40
|
+
* @param schema - The schema to use for creating paragraph nodes
|
|
41
|
+
* @returns Array of strings (for codeBlock) and PMNodes (to break out)
|
|
37
42
|
*/
|
|
38
|
-
export declare const
|
|
43
|
+
export declare const splitTextNodeForCodeBlock: (node: PMNode, schema: Schema) => Array<string | PMNode>;
|
|
@@ -29,10 +29,15 @@ export declare const convertExpandToNestedExpand: (node: PMNode, schema: Schema)
|
|
|
29
29
|
export declare const convertTextNodeToParagraph: (node: PMNode, schema: Schema) => PMNode | null;
|
|
30
30
|
export declare const getBlockNodesInRange: (range: NodeRange) => PMNode[];
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* Splits a text node (paragraph/heading) into parts for codeBlock conversion.
|
|
33
|
+
* Returns an array of:
|
|
34
|
+
* - strings (text content that can go into codeBlock)
|
|
35
|
+
* - PMNodes (incompatible inline nodes wrapped in paragraphs that need to break out)
|
|
34
36
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
+
* This preserves inline nodes (like status, inlineExtension) that cannot be represented as plain text.
|
|
38
|
+
*
|
|
39
|
+
* @param node - The text node (paragraph or heading) to split
|
|
40
|
+
* @param schema - The schema to use for creating paragraph nodes
|
|
41
|
+
* @returns Array of strings (for codeBlock) and PMNodes (to break out)
|
|
37
42
|
*/
|
|
38
|
-
export declare const
|
|
43
|
+
export declare const splitTextNodeForCodeBlock: (node: PMNode, schema: Schema) => Array<string | PMNode>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.10",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
41
41
|
"@atlaskit/editor-toolbar": "^0.18.0",
|
|
42
42
|
"@atlaskit/flag": "^17.7.0",
|
|
43
|
-
"@atlaskit/icon": "^29.
|
|
43
|
+
"@atlaskit/icon": "^29.4.0",
|
|
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.8.0",
|
|
48
48
|
"@atlaskit/tokens": "^9.1.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@atlaskit/editor-common": "^111.
|
|
52
|
+
"@atlaskit/editor-common": "^111.6.0",
|
|
53
53
|
"react": "^18.2.0",
|
|
54
54
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
55
55
|
},
|