@atlaskit/editor-plugin-block-menu 3.1.0 → 3.1.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.
- package/CHANGELOG.md +16 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-dev-agents/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-passionfruit/tsconfig.json +3 -0
- package/afm-post-office/tsconfig.json +3 -0
- package/afm-rovo-extension/tsconfig.json +3 -0
- package/afm-townsquare/tsconfig.json +3 -0
- package/dist/cjs/editor-commands/transforms/layout/utils.js +25 -11
- package/dist/cjs/editor-commands/transforms/layout-transforms.js +1 -1
- package/dist/cjs/ui/block-menu.js +1 -1
- package/dist/cjs/ui/utils/checkIsFormatMenuHidden.js +9 -1
- package/dist/es2019/editor-commands/transforms/layout/utils.js +23 -9
- package/dist/es2019/editor-commands/transforms/layout-transforms.js +1 -1
- package/dist/es2019/ui/block-menu.js +1 -1
- package/dist/es2019/ui/utils/checkIsFormatMenuHidden.js +9 -1
- package/dist/esm/editor-commands/transforms/layout/utils.js +25 -11
- package/dist/esm/editor-commands/transforms/layout-transforms.js +1 -1
- package/dist/esm/ui/block-menu.js +1 -1
- package/dist/esm/ui/utils/checkIsFormatMenuHidden.js +9 -1
- package/dist/types/editor-commands/transforms/layout/utils.d.ts +1 -1
- package/dist/types-ts4.5/editor-commands/transforms/layout/utils.d.ts +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-menu
|
|
2
2
|
|
|
3
|
+
## 3.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`77f5d276a6b30`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/77f5d276a6b30) -
|
|
8
|
+
[ux] Put layout and expand format menu visibility behind experiment flags
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 3.1.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`c30d1876a650a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c30d1876a650a) -
|
|
16
|
+
ED-29256 Transform content with indentation in layouts
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 3.1.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -56,6 +56,9 @@
|
|
|
56
56
|
{
|
|
57
57
|
"path": "../../../design-system/primitives/afm-rovo-extension/tsconfig.json"
|
|
58
58
|
},
|
|
59
|
+
{
|
|
60
|
+
"path": "../../tmp-editor-statsig/afm-rovo-extension/tsconfig.json"
|
|
61
|
+
},
|
|
59
62
|
{
|
|
60
63
|
"path": "../../../design-system/tokens/afm-rovo-extension/tsconfig.json"
|
|
61
64
|
},
|
|
@@ -20,10 +20,16 @@ var unwrapLayoutNodesToTextNodes = exports.unwrapLayoutNodesToTextNodes = functi
|
|
|
20
20
|
var isValid = (0, _utils2.getContentSupportChecker)(finalTargetNodeType);
|
|
21
21
|
var createTextNode = function createTextNode(node) {
|
|
22
22
|
var isTextNode = node.type.name === 'text';
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
var nodeToTransform = node;
|
|
24
|
+
if ((0, _utils2.isContainerNodeType)(finalTargetNodeType) || (0, _utils2.isListNodeType)(finalTargetNodeType)) {
|
|
25
|
+
nodeToTransform = node.mark(node.marks.filter(function (mark) {
|
|
26
|
+
return !['alignment', 'indentation'].includes(mark.type.name);
|
|
27
|
+
}));
|
|
25
28
|
}
|
|
26
|
-
|
|
29
|
+
if (isValid(nodeToTransform) && !isTextNode) {
|
|
30
|
+
return nodeToTransform;
|
|
31
|
+
}
|
|
32
|
+
return targetNodeType.createChecked(targetAttrs, isTextNode ? nodeToTransform : nodeToTransform.content, nodeToTransform.marks);
|
|
27
33
|
};
|
|
28
34
|
if ((0, _utils2.isBlockNode)(sourceNode)) {
|
|
29
35
|
// code block acts like a container, we need to unwrap it
|
|
@@ -190,21 +196,17 @@ var transformToContainerNode = function transformToContainerNode(nodes, targetNo
|
|
|
190
196
|
canBeTransformed: false
|
|
191
197
|
});
|
|
192
198
|
} else {
|
|
193
|
-
// Remove alignment marks as container nodes don't support them
|
|
194
|
-
var nodeWithValidAttrs = node.mark(node.marks.filter(function (mark) {
|
|
195
|
-
return mark.type.name !== 'alignment';
|
|
196
|
-
}));
|
|
197
199
|
var isSameNodeType = node.type === targetNodeType;
|
|
198
200
|
|
|
199
201
|
// If the node is not valid and not the same type, we cannot transform it
|
|
200
|
-
if (!isNodeValid(
|
|
202
|
+
if (!isNodeValid(node) && !isSameNodeType) {
|
|
201
203
|
newNodes.push({
|
|
202
204
|
node: node,
|
|
203
205
|
canBeTransformed: false
|
|
204
206
|
});
|
|
205
207
|
return;
|
|
206
208
|
}
|
|
207
|
-
var _nodes = isSameNodeType ? node.content.content : [
|
|
209
|
+
var _nodes = isSameNodeType ? node.content.content : [node];
|
|
208
210
|
if (newNodes.length === 0) {
|
|
209
211
|
newNodes.push({
|
|
210
212
|
node: _nodes,
|
|
@@ -322,8 +324,20 @@ var transformToListNode = exports.transformToListNode = function transformToList
|
|
|
322
324
|
}
|
|
323
325
|
});
|
|
324
326
|
};
|
|
325
|
-
var convertUnwrappedLayoutContent = exports.convertUnwrappedLayoutContent = function convertUnwrappedLayoutContent(nodes, targetNodeType, schema) {
|
|
326
|
-
if (nodes.length === 1 && nodes[0].content.size === 0) {
|
|
327
|
+
var convertUnwrappedLayoutContent = exports.convertUnwrappedLayoutContent = function convertUnwrappedLayoutContent(nodes, targetNodeType, schema, targetAttrs) {
|
|
328
|
+
if (nodes.length === 1 && nodes[0].content.size === 0 && !(0, _utils2.isContainerNodeType)(targetNodeType)) {
|
|
329
|
+
if ((0, _utils2.isBlockNodeType)(targetNodeType)) {
|
|
330
|
+
if (['heading', 'paragraph'].includes(targetNodeType.name)) {
|
|
331
|
+
return [targetNodeType.createChecked(targetAttrs)];
|
|
332
|
+
}
|
|
333
|
+
if (targetNodeType.name === 'codeBlock') {
|
|
334
|
+
return [targetNodeType.createChecked()];
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
if ((0, _utils2.isListNodeType)(targetNodeType)) {
|
|
338
|
+
var listItem = (0, _transforms.isTaskList)(targetNodeType) ? schema.nodes.taskItem.createChecked() : schema.nodes.listItem.createChecked(null, schema.nodes.paragraph.createChecked());
|
|
339
|
+
return [targetNodeType.createChecked(null, listItem)];
|
|
340
|
+
}
|
|
327
341
|
return nodes;
|
|
328
342
|
}
|
|
329
343
|
if ((0, _utils2.isBlockNodeType)(targetNodeType)) {
|
|
@@ -60,7 +60,7 @@ var transformLayoutNode = exports.transformLayoutNode = function transformLayout
|
|
|
60
60
|
var newContent = (0, _utils.unwrapLayoutNodesToTextNodes)(context, targetNodeType);
|
|
61
61
|
unwrappedContent.push.apply(unwrappedContent, (0, _toConsumableArray2.default)(newContent));
|
|
62
62
|
});
|
|
63
|
-
var newColumnContent = (0, _utils.convertUnwrappedLayoutContent)(unwrappedContent, targetNodeType, schema);
|
|
63
|
+
var newColumnContent = (0, _utils.convertUnwrappedLayoutContent)(unwrappedContent, targetNodeType, schema, targetAttrs);
|
|
64
64
|
layoutColumnNodes.push(layoutColumn.createChecked(child.attrs, _model.Fragment.fromArray(newColumnContent), child.marks));
|
|
65
65
|
}
|
|
66
66
|
});
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.checkIsFormatMenuHidden = void 0;
|
|
7
7
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
8
9
|
var _isNestedNode = require("./isNestedNode");
|
|
9
10
|
var getIsFormatMenuHidden = function getIsFormatMenuHidden(selection, schema, menuTriggerBy) {
|
|
10
11
|
var nodes = schema.nodes;
|
|
@@ -12,7 +13,14 @@ var getIsFormatMenuHidden = function getIsFormatMenuHidden(selection, schema, me
|
|
|
12
13
|
return false;
|
|
13
14
|
}
|
|
14
15
|
var content;
|
|
15
|
-
var
|
|
16
|
+
var allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList];
|
|
17
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_block_menu_layout_format', 'isEnabled', true)) {
|
|
18
|
+
allowedNodes.push(nodes.layoutSection);
|
|
19
|
+
}
|
|
20
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_block_menu_expand_format', 'isEnabled', true)) {
|
|
21
|
+
allowedNodes.push(nodes.expand);
|
|
22
|
+
}
|
|
23
|
+
var selectedNode = (0, _utils.findSelectedNodeOfType)(allowedNodes)(selection);
|
|
16
24
|
if (selectedNode) {
|
|
17
25
|
content = selectedNode.node;
|
|
18
26
|
} else {
|
|
@@ -14,10 +14,14 @@ export const unwrapLayoutNodesToTextNodes = (context, finalTargetNodeType) => {
|
|
|
14
14
|
const isValid = getContentSupportChecker(finalTargetNodeType);
|
|
15
15
|
const createTextNode = node => {
|
|
16
16
|
const isTextNode = node.type.name === 'text';
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
let nodeToTransform = node;
|
|
18
|
+
if (isContainerNodeType(finalTargetNodeType) || isListNodeType(finalTargetNodeType)) {
|
|
19
|
+
nodeToTransform = node.mark(node.marks.filter(mark => !['alignment', 'indentation'].includes(mark.type.name)));
|
|
20
|
+
}
|
|
21
|
+
if (isValid(nodeToTransform) && !isTextNode) {
|
|
22
|
+
return nodeToTransform;
|
|
19
23
|
}
|
|
20
|
-
return targetNodeType.createChecked(targetAttrs, isTextNode ?
|
|
24
|
+
return targetNodeType.createChecked(targetAttrs, isTextNode ? nodeToTransform : nodeToTransform.content, nodeToTransform.marks);
|
|
21
25
|
};
|
|
22
26
|
if (isBlockNode(sourceNode)) {
|
|
23
27
|
// code block acts like a container, we need to unwrap it
|
|
@@ -169,19 +173,17 @@ const transformToContainerNode = (nodes, targetNodeType) => {
|
|
|
169
173
|
canBeTransformed: false
|
|
170
174
|
});
|
|
171
175
|
} else {
|
|
172
|
-
// Remove alignment marks as container nodes don't support them
|
|
173
|
-
const nodeWithValidAttrs = node.mark(node.marks.filter(mark => mark.type.name !== 'alignment'));
|
|
174
176
|
const isSameNodeType = node.type === targetNodeType;
|
|
175
177
|
|
|
176
178
|
// If the node is not valid and not the same type, we cannot transform it
|
|
177
|
-
if (!isNodeValid(
|
|
179
|
+
if (!isNodeValid(node) && !isSameNodeType) {
|
|
178
180
|
newNodes.push({
|
|
179
181
|
node: node,
|
|
180
182
|
canBeTransformed: false
|
|
181
183
|
});
|
|
182
184
|
return;
|
|
183
185
|
}
|
|
184
|
-
const nodes = isSameNodeType ? node.content.content : [
|
|
186
|
+
const nodes = isSameNodeType ? node.content.content : [node];
|
|
185
187
|
if (newNodes.length === 0) {
|
|
186
188
|
newNodes.push({
|
|
187
189
|
node: nodes,
|
|
@@ -301,8 +303,20 @@ export const transformToListNode = (nodes, targetNodeType, schema) => {
|
|
|
301
303
|
}
|
|
302
304
|
});
|
|
303
305
|
};
|
|
304
|
-
export const convertUnwrappedLayoutContent = (nodes, targetNodeType, schema) => {
|
|
305
|
-
if (nodes.length === 1 && nodes[0].content.size === 0) {
|
|
306
|
+
export const convertUnwrappedLayoutContent = (nodes, targetNodeType, schema, targetAttrs) => {
|
|
307
|
+
if (nodes.length === 1 && nodes[0].content.size === 0 && !isContainerNodeType(targetNodeType)) {
|
|
308
|
+
if (isBlockNodeType(targetNodeType)) {
|
|
309
|
+
if (['heading', 'paragraph'].includes(targetNodeType.name)) {
|
|
310
|
+
return [targetNodeType.createChecked(targetAttrs)];
|
|
311
|
+
}
|
|
312
|
+
if (targetNodeType.name === 'codeBlock') {
|
|
313
|
+
return [targetNodeType.createChecked()];
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (isListNodeType(targetNodeType)) {
|
|
317
|
+
const listItem = isTaskList(targetNodeType) ? schema.nodes.taskItem.createChecked() : schema.nodes.listItem.createChecked(null, schema.nodes.paragraph.createChecked());
|
|
318
|
+
return [targetNodeType.createChecked(null, listItem)];
|
|
319
|
+
}
|
|
306
320
|
return nodes;
|
|
307
321
|
}
|
|
308
322
|
if (isBlockNodeType(targetNodeType)) {
|
|
@@ -56,7 +56,7 @@ export const transformLayoutNode = context => {
|
|
|
56
56
|
const newContent = unwrapLayoutNodesToTextNodes(context, targetNodeType);
|
|
57
57
|
unwrappedContent.push(...newContent);
|
|
58
58
|
});
|
|
59
|
-
const newColumnContent = convertUnwrappedLayoutContent(unwrappedContent, targetNodeType, schema);
|
|
59
|
+
const newColumnContent = convertUnwrappedLayoutContent(unwrappedContent, targetNodeType, schema, targetAttrs);
|
|
60
60
|
layoutColumnNodes.push(layoutColumn.createChecked(child.attrs, Fragment.fromArray(newColumnContent), child.marks));
|
|
61
61
|
}
|
|
62
62
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* block-menu.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* block-menu.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import "./block-menu.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useContext, useEffect } from 'react';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
3
|
import { isNestedNode } from './isNestedNode';
|
|
3
4
|
const getIsFormatMenuHidden = (selection, schema, menuTriggerBy) => {
|
|
4
5
|
const nodes = schema.nodes;
|
|
@@ -6,7 +7,14 @@ const getIsFormatMenuHidden = (selection, schema, menuTriggerBy) => {
|
|
|
6
7
|
return false;
|
|
7
8
|
}
|
|
8
9
|
let content;
|
|
9
|
-
const
|
|
10
|
+
const allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList];
|
|
11
|
+
if (expValEquals('platform_editor_block_menu_layout_format', 'isEnabled', true)) {
|
|
12
|
+
allowedNodes.push(nodes.layoutSection);
|
|
13
|
+
}
|
|
14
|
+
if (expValEquals('platform_editor_block_menu_expand_format', 'isEnabled', true)) {
|
|
15
|
+
allowedNodes.push(nodes.expand);
|
|
16
|
+
}
|
|
17
|
+
const selectedNode = findSelectedNodeOfType(allowedNodes)(selection);
|
|
10
18
|
if (selectedNode) {
|
|
11
19
|
content = selectedNode.node;
|
|
12
20
|
} else {
|
|
@@ -13,10 +13,16 @@ export var unwrapLayoutNodesToTextNodes = function unwrapLayoutNodesToTextNodes(
|
|
|
13
13
|
var isValid = getContentSupportChecker(finalTargetNodeType);
|
|
14
14
|
var createTextNode = function createTextNode(node) {
|
|
15
15
|
var isTextNode = node.type.name === 'text';
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
var nodeToTransform = node;
|
|
17
|
+
if (isContainerNodeType(finalTargetNodeType) || isListNodeType(finalTargetNodeType)) {
|
|
18
|
+
nodeToTransform = node.mark(node.marks.filter(function (mark) {
|
|
19
|
+
return !['alignment', 'indentation'].includes(mark.type.name);
|
|
20
|
+
}));
|
|
18
21
|
}
|
|
19
|
-
|
|
22
|
+
if (isValid(nodeToTransform) && !isTextNode) {
|
|
23
|
+
return nodeToTransform;
|
|
24
|
+
}
|
|
25
|
+
return targetNodeType.createChecked(targetAttrs, isTextNode ? nodeToTransform : nodeToTransform.content, nodeToTransform.marks);
|
|
20
26
|
};
|
|
21
27
|
if (isBlockNode(sourceNode)) {
|
|
22
28
|
// code block acts like a container, we need to unwrap it
|
|
@@ -183,21 +189,17 @@ var transformToContainerNode = function transformToContainerNode(nodes, targetNo
|
|
|
183
189
|
canBeTransformed: false
|
|
184
190
|
});
|
|
185
191
|
} else {
|
|
186
|
-
// Remove alignment marks as container nodes don't support them
|
|
187
|
-
var nodeWithValidAttrs = node.mark(node.marks.filter(function (mark) {
|
|
188
|
-
return mark.type.name !== 'alignment';
|
|
189
|
-
}));
|
|
190
192
|
var isSameNodeType = node.type === targetNodeType;
|
|
191
193
|
|
|
192
194
|
// If the node is not valid and not the same type, we cannot transform it
|
|
193
|
-
if (!isNodeValid(
|
|
195
|
+
if (!isNodeValid(node) && !isSameNodeType) {
|
|
194
196
|
newNodes.push({
|
|
195
197
|
node: node,
|
|
196
198
|
canBeTransformed: false
|
|
197
199
|
});
|
|
198
200
|
return;
|
|
199
201
|
}
|
|
200
|
-
var _nodes = isSameNodeType ? node.content.content : [
|
|
202
|
+
var _nodes = isSameNodeType ? node.content.content : [node];
|
|
201
203
|
if (newNodes.length === 0) {
|
|
202
204
|
newNodes.push({
|
|
203
205
|
node: _nodes,
|
|
@@ -315,8 +317,20 @@ export var transformToListNode = function transformToListNode(nodes, targetNodeT
|
|
|
315
317
|
}
|
|
316
318
|
});
|
|
317
319
|
};
|
|
318
|
-
export var convertUnwrappedLayoutContent = function convertUnwrappedLayoutContent(nodes, targetNodeType, schema) {
|
|
319
|
-
if (nodes.length === 1 && nodes[0].content.size === 0) {
|
|
320
|
+
export var convertUnwrappedLayoutContent = function convertUnwrappedLayoutContent(nodes, targetNodeType, schema, targetAttrs) {
|
|
321
|
+
if (nodes.length === 1 && nodes[0].content.size === 0 && !isContainerNodeType(targetNodeType)) {
|
|
322
|
+
if (isBlockNodeType(targetNodeType)) {
|
|
323
|
+
if (['heading', 'paragraph'].includes(targetNodeType.name)) {
|
|
324
|
+
return [targetNodeType.createChecked(targetAttrs)];
|
|
325
|
+
}
|
|
326
|
+
if (targetNodeType.name === 'codeBlock') {
|
|
327
|
+
return [targetNodeType.createChecked()];
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (isListNodeType(targetNodeType)) {
|
|
331
|
+
var listItem = isTaskList(targetNodeType) ? schema.nodes.taskItem.createChecked() : schema.nodes.listItem.createChecked(null, schema.nodes.paragraph.createChecked());
|
|
332
|
+
return [targetNodeType.createChecked(null, listItem)];
|
|
333
|
+
}
|
|
320
334
|
return nodes;
|
|
321
335
|
}
|
|
322
336
|
if (isBlockNodeType(targetNodeType)) {
|
|
@@ -53,7 +53,7 @@ export var transformLayoutNode = function transformLayoutNode(context) {
|
|
|
53
53
|
var newContent = unwrapLayoutNodesToTextNodes(context, targetNodeType);
|
|
54
54
|
unwrappedContent.push.apply(unwrappedContent, _toConsumableArray(newContent));
|
|
55
55
|
});
|
|
56
|
-
var newColumnContent = convertUnwrappedLayoutContent(unwrappedContent, targetNodeType, schema);
|
|
56
|
+
var newColumnContent = convertUnwrappedLayoutContent(unwrappedContent, targetNodeType, schema, targetAttrs);
|
|
57
57
|
layoutColumnNodes.push(layoutColumn.createChecked(child.attrs, Fragment.fromArray(newColumnContent), child.marks));
|
|
58
58
|
}
|
|
59
59
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* block-menu.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* block-menu.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import "./block-menu.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useContext, useEffect } from 'react';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
3
|
import { isNestedNode } from './isNestedNode';
|
|
3
4
|
var getIsFormatMenuHidden = function getIsFormatMenuHidden(selection, schema, menuTriggerBy) {
|
|
4
5
|
var nodes = schema.nodes;
|
|
@@ -6,7 +7,14 @@ var getIsFormatMenuHidden = function getIsFormatMenuHidden(selection, schema, me
|
|
|
6
7
|
return false;
|
|
7
8
|
}
|
|
8
9
|
var content;
|
|
9
|
-
var
|
|
10
|
+
var allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList];
|
|
11
|
+
if (expValEquals('platform_editor_block_menu_layout_format', 'isEnabled', true)) {
|
|
12
|
+
allowedNodes.push(nodes.layoutSection);
|
|
13
|
+
}
|
|
14
|
+
if (expValEquals('platform_editor_block_menu_expand_format', 'isEnabled', true)) {
|
|
15
|
+
allowedNodes.push(nodes.expand);
|
|
16
|
+
}
|
|
17
|
+
var selectedNode = findSelectedNodeOfType(allowedNodes)(selection);
|
|
10
18
|
if (selectedNode) {
|
|
11
19
|
content = selectedNode.node;
|
|
12
20
|
} else {
|
|
@@ -2,4 +2,4 @@ import type { TransformContext } from '@atlaskit/editor-common/transforms';
|
|
|
2
2
|
import type { NodeType, Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
export declare const unwrapLayoutNodesToTextNodes: (context: TransformContext, finalTargetNodeType: NodeType) => PMNode[];
|
|
4
4
|
export declare const transformToListNode: (nodes: PMNode[], targetNodeType: NodeType, schema: Schema) => PMNode[];
|
|
5
|
-
export declare const convertUnwrappedLayoutContent: (nodes: PMNode[], targetNodeType: NodeType, schema: Schema) => PMNode[];
|
|
5
|
+
export declare const convertUnwrappedLayoutContent: (nodes: PMNode[], targetNodeType: NodeType, schema: Schema, targetAttrs?: TransformContext["targetAttrs"]) => PMNode[];
|
|
@@ -2,4 +2,4 @@ import type { TransformContext } from '@atlaskit/editor-common/transforms';
|
|
|
2
2
|
import type { NodeType, Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
export declare const unwrapLayoutNodesToTextNodes: (context: TransformContext, finalTargetNodeType: NodeType) => PMNode[];
|
|
4
4
|
export declare const transformToListNode: (nodes: PMNode[], targetNodeType: NodeType, schema: Schema) => PMNode[];
|
|
5
|
-
export declare const convertUnwrappedLayoutContent: (nodes: PMNode[], targetNodeType: NodeType, schema: Schema) => PMNode[];
|
|
5
|
+
export declare const convertUnwrappedLayoutContent: (nodes: PMNode[], targetNodeType: NodeType, schema: Schema, targetAttrs?: TransformContext["targetAttrs"]) => PMNode[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/css": "^0.14.0",
|
|
32
32
|
"@atlaskit/dropdown-menu": "^16.3.0",
|
|
33
|
-
"@atlaskit/editor-plugin-block-controls": "^6.
|
|
33
|
+
"@atlaskit/editor-plugin-block-controls": "^6.2.0",
|
|
34
34
|
"@atlaskit/editor-plugin-decorations": "^5.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-selection": "^5.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-user-intent": "^3.0.0",
|
|
@@ -42,11 +42,12 @@
|
|
|
42
42
|
"@atlaskit/icon-lab": "^5.7.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
44
|
"@atlaskit/primitives": "^14.14.0",
|
|
45
|
+
"@atlaskit/tmp-editor-statsig": "^12.19.0",
|
|
45
46
|
"@atlaskit/tokens": "^6.3.0",
|
|
46
47
|
"@babel/runtime": "^7.0.0"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
|
-
"@atlaskit/editor-common": "^109.
|
|
50
|
+
"@atlaskit/editor-common": "^109.5.0",
|
|
50
51
|
"react": "^18.2.0",
|
|
51
52
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
52
53
|
},
|