@atlaskit/editor-plugin-block-menu 1.0.0 → 1.0.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 +18 -0
- package/dist/cjs/editor-commands/formatNode.js +6 -3
- package/dist/cjs/editor-commands/transforms/block-transforms.js +22 -10
- package/dist/cjs/editor-commands/transforms/container-transforms.js +40 -7
- package/dist/cjs/editor-commands/transforms/inline-node-transforms.js +27 -0
- package/dist/cjs/editor-commands/transforms/list/transformBetweenListTypes.js +102 -0
- package/dist/cjs/editor-commands/transforms/list/transformOrderedUnorderedListToBlockNodes.js +54 -0
- package/dist/cjs/editor-commands/transforms/list/transformTaskListToBlockNodes.js +59 -0
- package/dist/cjs/editor-commands/transforms/list-transforms.js +66 -20
- package/dist/cjs/ui/block-menu-components.js +1 -2
- package/dist/cjs/ui/block-menu.compiled.css +1 -1
- package/dist/cjs/ui/block-menu.js +1 -1
- package/dist/es2019/editor-commands/formatNode.js +6 -3
- package/dist/es2019/editor-commands/transforms/block-transforms.js +29 -15
- package/dist/es2019/editor-commands/transforms/container-transforms.js +35 -2
- package/dist/es2019/editor-commands/transforms/inline-node-transforms.js +21 -0
- package/dist/es2019/editor-commands/transforms/list/transformBetweenListTypes.js +98 -0
- package/dist/es2019/editor-commands/transforms/list/transformOrderedUnorderedListToBlockNodes.js +42 -0
- package/dist/es2019/editor-commands/transforms/list/transformTaskListToBlockNodes.js +47 -0
- package/dist/es2019/editor-commands/transforms/list-transforms.js +66 -16
- package/dist/es2019/ui/block-menu-components.js +1 -2
- package/dist/es2019/ui/block-menu.compiled.css +1 -1
- package/dist/es2019/ui/block-menu.js +1 -1
- package/dist/esm/editor-commands/formatNode.js +6 -3
- package/dist/esm/editor-commands/transforms/block-transforms.js +23 -11
- package/dist/esm/editor-commands/transforms/container-transforms.js +39 -7
- package/dist/esm/editor-commands/transforms/inline-node-transforms.js +21 -0
- package/dist/esm/editor-commands/transforms/list/transformBetweenListTypes.js +95 -0
- package/dist/esm/editor-commands/transforms/list/transformOrderedUnorderedListToBlockNodes.js +48 -0
- package/dist/esm/editor-commands/transforms/list/transformTaskListToBlockNodes.js +53 -0
- package/dist/esm/editor-commands/transforms/list-transforms.js +65 -19
- package/dist/esm/ui/block-menu-components.js +1 -2
- package/dist/esm/ui/block-menu.compiled.css +1 -1
- package/dist/esm/ui/block-menu.js +1 -1
- package/dist/types/editor-commands/transforms/container-transforms.d.ts +2 -2
- package/dist/types/editor-commands/transforms/inline-node-transforms.d.ts +3 -0
- package/dist/types/editor-commands/transforms/list/transformBetweenListTypes.d.ts +9 -0
- package/dist/types/editor-commands/transforms/list/transformOrderedUnorderedListToBlockNodes.d.ts +3 -0
- package/dist/types/editor-commands/transforms/list/transformTaskListToBlockNodes.d.ts +3 -0
- package/dist/types/editor-commands/transforms/list-transforms.d.ts +5 -6
- package/dist/types-ts4.5/editor-commands/transforms/container-transforms.d.ts +2 -2
- package/dist/types-ts4.5/editor-commands/transforms/inline-node-transforms.d.ts +3 -0
- package/dist/types-ts4.5/editor-commands/transforms/list/transformBetweenListTypes.d.ts +9 -0
- package/dist/types-ts4.5/editor-commands/transforms/list/transformOrderedUnorderedListToBlockNodes.d.ts +3 -0
- package/dist/types-ts4.5/editor-commands/transforms/list/transformTaskListToBlockNodes.d.ts +3 -0
- package/dist/types-ts4.5/editor-commands/transforms/list-transforms.d.ts +5 -6
- package/package.json +3 -8
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
/**
|
|
3
|
+
* Extract all inline content from a node
|
|
4
|
+
*/
|
|
5
|
+
var extractInlineContent = function extractInlineContent(node) {
|
|
6
|
+
var inlineContent = [];
|
|
7
|
+
for (var i = 0; i < node.childCount; i++) {
|
|
8
|
+
inlineContent.push(node.child(i));
|
|
9
|
+
}
|
|
10
|
+
return inlineContent;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Transform list structure
|
|
15
|
+
*/
|
|
16
|
+
export var transformListStructure = function transformListStructure(tr, listNode, targetNodeType, nodes) {
|
|
17
|
+
try {
|
|
18
|
+
var sourceList = listNode.node,
|
|
19
|
+
listPos = listNode.pos;
|
|
20
|
+
var bulletList = nodes.bulletList,
|
|
21
|
+
orderedList = nodes.orderedList,
|
|
22
|
+
taskList = nodes.taskList,
|
|
23
|
+
listItem = nodes.listItem,
|
|
24
|
+
taskItem = nodes.taskItem,
|
|
25
|
+
paragraph = nodes.paragraph;
|
|
26
|
+
var isSourceBulletOrOrdered = sourceList.type === bulletList || sourceList.type === orderedList;
|
|
27
|
+
var isTargetTask = targetNodeType === taskList;
|
|
28
|
+
var isSourceTask = sourceList.type === taskList;
|
|
29
|
+
var newListItems = [];
|
|
30
|
+
var listStart = listPos;
|
|
31
|
+
var listEnd = listPos + sourceList.nodeSize;
|
|
32
|
+
|
|
33
|
+
// Use nodesBetween to efficiently traverse the list structure
|
|
34
|
+
tr.doc.nodesBetween(listStart, listEnd, function (node, pos, parent) {
|
|
35
|
+
// Only process direct children of the list (depth 1)
|
|
36
|
+
if (parent !== sourceList) {
|
|
37
|
+
return true; // Continue traversal
|
|
38
|
+
}
|
|
39
|
+
if (isSourceBulletOrOrdered && isTargetTask) {
|
|
40
|
+
// Converting from bullet/ordered list to task list
|
|
41
|
+
// Extract inline content from all children within listItem
|
|
42
|
+
if (node.type === listItem) {
|
|
43
|
+
var inlineContent = [];
|
|
44
|
+
|
|
45
|
+
// Extract all inline content from all child nodes
|
|
46
|
+
for (var i = 0; i < node.childCount; i++) {
|
|
47
|
+
var child = node.child(i);
|
|
48
|
+
if (child.type === paragraph) {
|
|
49
|
+
// Extract inline content from paragraphs
|
|
50
|
+
inlineContent.push.apply(inlineContent, _toConsumableArray(extractInlineContent(child)));
|
|
51
|
+
} else if (child.isBlock) {
|
|
52
|
+
// For other block content types eg. codeBlock, extract their text content and create text nodes
|
|
53
|
+
var textContent = child.textContent;
|
|
54
|
+
if (textContent) {
|
|
55
|
+
var textNode = tr.doc.type.schema.text(textContent);
|
|
56
|
+
inlineContent.push(textNode);
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
// Already inline content, add directly
|
|
60
|
+
inlineContent.push(child);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (inlineContent.length > 0) {
|
|
64
|
+
var newItem = taskItem.create(null, inlineContent);
|
|
65
|
+
newListItems.push(newItem);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
} else if (isSourceTask && !isTargetTask) {
|
|
69
|
+
// Converting from task list to bullet/ordered list
|
|
70
|
+
// Structure: taskItem > inline content -> listItem > paragraph > inline content
|
|
71
|
+
if (node.type === taskItem) {
|
|
72
|
+
var _inlineContent = extractInlineContent(node);
|
|
73
|
+
if (_inlineContent.length > 0) {
|
|
74
|
+
var paragraphNode = paragraph.create(null, _inlineContent);
|
|
75
|
+
var newListItem = listItem.create(null, paragraphNode);
|
|
76
|
+
newListItems.push(newListItem);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return false; // Don't traverse into children of list items
|
|
81
|
+
});
|
|
82
|
+
if (newListItems.length === 0) {
|
|
83
|
+
return tr;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Create new list with transformed items
|
|
87
|
+
var newList = targetNodeType.create(null, newListItems);
|
|
88
|
+
|
|
89
|
+
// Replace the entire list
|
|
90
|
+
tr.replaceWith(listStart, listEnd, newList);
|
|
91
|
+
return tr;
|
|
92
|
+
} catch (_unused) {
|
|
93
|
+
return tr;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
+
export var transformOrderedUnorderedListToBlockNodes = function transformOrderedUnorderedListToBlockNodes(context) {
|
|
4
|
+
var tr = context.tr,
|
|
5
|
+
targetNodeType = context.targetNodeType,
|
|
6
|
+
targetAttrs = context.targetAttrs,
|
|
7
|
+
sourceNode = context.sourceNode,
|
|
8
|
+
sourcePos = context.sourcePos;
|
|
9
|
+
var selection = tr.selection;
|
|
10
|
+
var schema = selection.$from.doc.type.schema;
|
|
11
|
+
// find all paragraph nodes inside the list node
|
|
12
|
+
var paragraphs = findChildrenByType(sourceNode, schema.nodes.paragraph);
|
|
13
|
+
var paragraphNodes = paragraphs.map(function (paragraph) {
|
|
14
|
+
return paragraph.node;
|
|
15
|
+
});
|
|
16
|
+
var targetNodes = paragraphNodes;
|
|
17
|
+
|
|
18
|
+
// Convert paragraphs to headings if target is heading
|
|
19
|
+
if (targetNodeType === schema.nodes.heading && targetAttrs) {
|
|
20
|
+
var targetHeadingLevel = targetAttrs.level;
|
|
21
|
+
targetNodes = paragraphNodes.map(function (paragraphNode) {
|
|
22
|
+
return schema.nodes.heading.createChecked({
|
|
23
|
+
level: targetHeadingLevel
|
|
24
|
+
}, paragraphNode.content);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Convert paragraphs to code block if target is code block
|
|
29
|
+
if (targetNodeType === schema.nodes.codeBlock) {
|
|
30
|
+
// convert the paragraphNodes to one code block
|
|
31
|
+
var listItemsResult = findChildrenByType(sourceNode, schema.nodes.listItem);
|
|
32
|
+
var listItems = listItemsResult.map(function (item) {
|
|
33
|
+
return item.node;
|
|
34
|
+
});
|
|
35
|
+
var listItemFragments = listItems.map(function (listItem) {
|
|
36
|
+
return listItem.content;
|
|
37
|
+
});
|
|
38
|
+
var codeBlockContent = listItemFragments.map(function (fragment) {
|
|
39
|
+
return fragment.textBetween(0, fragment.size, '\n');
|
|
40
|
+
}).join('\n');
|
|
41
|
+
targetNodes = [schema.nodes.codeBlock.createChecked({}, schema.text(codeBlockContent))];
|
|
42
|
+
}
|
|
43
|
+
var fragment = Fragment.fromArray(targetNodes);
|
|
44
|
+
var slice = new Slice(fragment, 0, 0);
|
|
45
|
+
var rangeStart = sourcePos !== null ? sourcePos : selection.from;
|
|
46
|
+
tr.replaceRange(rangeStart, rangeStart + sourceNode.nodeSize, slice);
|
|
47
|
+
return tr;
|
|
48
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
+
export var transformTaskListToBlockNodes = function transformTaskListToBlockNodes(context) {
|
|
4
|
+
var tr = context.tr,
|
|
5
|
+
targetNodeType = context.targetNodeType,
|
|
6
|
+
targetAttrs = context.targetAttrs,
|
|
7
|
+
sourceNode = context.sourceNode,
|
|
8
|
+
sourcePos = context.sourcePos;
|
|
9
|
+
var selection = tr.selection;
|
|
10
|
+
var schema = selection.$from.doc.type.schema;
|
|
11
|
+
var taskItemsResult = findChildrenByType(sourceNode, schema.nodes.taskItem);
|
|
12
|
+
var taskItems = taskItemsResult.map(function (item) {
|
|
13
|
+
return item.node;
|
|
14
|
+
});
|
|
15
|
+
var taskItemFragments = taskItems.map(function (taskItem) {
|
|
16
|
+
return taskItem.content;
|
|
17
|
+
});
|
|
18
|
+
var targetNodes = [];
|
|
19
|
+
|
|
20
|
+
// Convert fragments to headings if target is heading
|
|
21
|
+
if (targetNodeType === schema.nodes.heading && targetAttrs) {
|
|
22
|
+
// convert the fragments to headings
|
|
23
|
+
var targetHeadingLevel = targetAttrs.level;
|
|
24
|
+
targetNodes = taskItemFragments.map(function (fragment) {
|
|
25
|
+
return schema.nodes.heading.createChecked({
|
|
26
|
+
level: targetHeadingLevel
|
|
27
|
+
}, fragment.content);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Convert fragments to paragraphs if target is paragraphs
|
|
32
|
+
if (targetNodeType === schema.nodes.paragraph) {
|
|
33
|
+
// convert the fragments to paragraphs
|
|
34
|
+
targetNodes = taskItemFragments.map(function (fragment) {
|
|
35
|
+
return schema.nodes.paragraph.createChecked({}, fragment.content);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Convert fragments to code block if target is code block
|
|
40
|
+
if (targetNodeType === schema.nodes.codeBlock) {
|
|
41
|
+
// convert the fragments to one code block
|
|
42
|
+
var codeBlockContent = taskItemFragments.map(function (fragment) {
|
|
43
|
+
return fragment.textBetween(0, fragment.size, '\n');
|
|
44
|
+
}).join('\n');
|
|
45
|
+
targetNodes = [schema.nodes.codeBlock.createChecked({}, schema.text(codeBlockContent))];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Replace the task list node with the new content in the transaction
|
|
49
|
+
var slice = new Slice(Fragment.fromArray(targetNodes), 0, 0);
|
|
50
|
+
var rangeStart = sourcePos !== null ? sourcePos : selection.from;
|
|
51
|
+
tr.replaceRange(rangeStart, rangeStart + sourceNode.nodeSize, slice);
|
|
52
|
+
return tr;
|
|
53
|
+
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { findWrapping } from '@atlaskit/editor-prosemirror/transform';
|
|
2
2
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
+
import { transformListStructure } from './list/transformBetweenListTypes';
|
|
4
|
+
import { transformOrderedUnorderedListToBlockNodes } from './list/transformOrderedUnorderedListToBlockNodes';
|
|
5
|
+
import { transformTaskListToBlockNodes } from './list/transformTaskListToBlockNodes';
|
|
3
6
|
import { isBlockNodeType, isContainerNodeType, isListNodeType } from './utils';
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* Transform selection to list type
|
|
7
10
|
*/
|
|
8
|
-
export var
|
|
9
|
-
var tr =
|
|
10
|
-
targetNodeType =
|
|
11
|
-
targetAttrs =
|
|
12
|
-
// Wrap selection in list of target type
|
|
11
|
+
export var transformBlockToList = function transformBlockToList(context) {
|
|
12
|
+
var tr = context.tr,
|
|
13
|
+
targetNodeType = context.targetNodeType,
|
|
14
|
+
targetAttrs = context.targetAttrs;
|
|
13
15
|
var _tr$selection = tr.selection,
|
|
14
16
|
$from = _tr$selection.$from,
|
|
15
17
|
$to = _tr$selection.$to;
|
|
@@ -17,16 +19,45 @@ export var transformToList = function transformToList(_ref) {
|
|
|
17
19
|
if (!range) {
|
|
18
20
|
return null;
|
|
19
21
|
}
|
|
22
|
+
var nodes = tr.doc.type.schema.nodes;
|
|
23
|
+
var isTargetTask = targetNodeType === nodes.taskList;
|
|
24
|
+
|
|
25
|
+
// Handle task lists differently due to their structure
|
|
26
|
+
// TODO: ED-29152 - Implement task list transformation
|
|
27
|
+
if (isTargetTask) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
20
30
|
|
|
21
|
-
//
|
|
22
|
-
var
|
|
31
|
+
// For headings, convert to paragraph first since headings cannot be direct children of list items
|
|
32
|
+
var sourceNode = tr.doc.nodeAt(range.start);
|
|
33
|
+
if (sourceNode && sourceNode.type.name.startsWith('heading')) {
|
|
34
|
+
tr.setBlockType(range.start, range.end, nodes.paragraph);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Get the current range (updated if we converted from heading)
|
|
38
|
+
var currentRange = tr.selection.$from.blockRange(tr.selection.$to) || range;
|
|
39
|
+
|
|
40
|
+
// Wrap in the target list type
|
|
41
|
+
var wrapping = findWrapping(currentRange, targetNodeType, targetAttrs);
|
|
23
42
|
if (!wrapping) {
|
|
24
43
|
return null;
|
|
25
44
|
}
|
|
26
|
-
tr.wrap(
|
|
45
|
+
tr.wrap(currentRange, wrapping);
|
|
27
46
|
return tr;
|
|
28
47
|
};
|
|
29
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Transform list to block nodes
|
|
51
|
+
*/
|
|
52
|
+
export var transformListToBlockNodes = function transformListToBlockNodes(context) {
|
|
53
|
+
var sourceNode = context.sourceNode;
|
|
54
|
+
if (sourceNode.type.name === 'taskList') {
|
|
55
|
+
return transformTaskListToBlockNodes(context);
|
|
56
|
+
} else {
|
|
57
|
+
return transformOrderedUnorderedListToBlockNodes(context);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
30
61
|
/**
|
|
31
62
|
* Transform list nodes
|
|
32
63
|
*/
|
|
@@ -35,7 +66,7 @@ export var transformListNode = function transformListNode(context) {
|
|
|
35
66
|
// Transform list to block type
|
|
36
67
|
if (isBlockNodeType(targetNodeType)) {
|
|
37
68
|
// Lift list items out of the list and convert to target block type
|
|
38
|
-
return
|
|
69
|
+
return transformListToBlockNodes(context);
|
|
39
70
|
}
|
|
40
71
|
|
|
41
72
|
// Transform list to container type
|
|
@@ -62,22 +93,37 @@ export var liftListToBlockType = function liftListToBlockType() {
|
|
|
62
93
|
/**
|
|
63
94
|
* Transform between different list types
|
|
64
95
|
*/
|
|
65
|
-
export var transformBetweenListTypes = function transformBetweenListTypes(
|
|
66
|
-
var tr =
|
|
67
|
-
targetNodeType =
|
|
68
|
-
var
|
|
96
|
+
export var transformBetweenListTypes = function transformBetweenListTypes(_ref) {
|
|
97
|
+
var tr = _ref.tr,
|
|
98
|
+
targetNodeType = _ref.targetNodeType;
|
|
99
|
+
var _tr = tr,
|
|
100
|
+
selection = _tr.selection;
|
|
69
101
|
var nodes = tr.doc.type.schema.nodes;
|
|
70
102
|
|
|
71
|
-
// Find the list node
|
|
72
|
-
var
|
|
103
|
+
// Find the list node - support bullet lists, ordered lists, and task lists
|
|
104
|
+
var supportedListTypes = [nodes.bulletList, nodes.orderedList, nodes.taskList].filter(Boolean); // Filter out undefined nodes in case some schemas don't have all types
|
|
105
|
+
|
|
106
|
+
var listNode = findParentNodeOfType(supportedListTypes)(selection);
|
|
73
107
|
if (!listNode) {
|
|
74
108
|
return null;
|
|
75
109
|
}
|
|
110
|
+
var sourceListType = listNode.node.type;
|
|
111
|
+
var isSourceBulletOrOrdered = sourceListType === nodes.bulletList || sourceListType === nodes.orderedList;
|
|
112
|
+
var isTargetTask = targetNodeType === nodes.taskList;
|
|
113
|
+
var isSourceTask = sourceListType === nodes.taskList;
|
|
114
|
+
var isTargetBulletOrOrdered = targetNodeType === nodes.bulletList || targetNodeType === nodes.orderedList;
|
|
115
|
+
|
|
116
|
+
// Check if we need structure transformation
|
|
117
|
+
var needsStructureTransform = isSourceBulletOrOrdered && isTargetTask || isSourceTask && isTargetBulletOrOrdered;
|
|
76
118
|
try {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
119
|
+
if (!needsStructureTransform) {
|
|
120
|
+
// Simple type change for same structure lists (bullet <-> ordered)
|
|
121
|
+
tr.setNodeMarkup(listNode.pos, targetNodeType);
|
|
122
|
+
} else {
|
|
123
|
+
tr = transformListStructure(tr, listNode, targetNodeType, nodes);
|
|
124
|
+
}
|
|
125
|
+
} catch (_unused) {
|
|
81
126
|
return null;
|
|
82
127
|
}
|
|
128
|
+
return tr;
|
|
83
129
|
};
|
|
@@ -4,7 +4,6 @@ import { MOVE_UP_MENU_ITEM, MOVE_UP_DOWN_MENU_SECTION, MOVE_DOWN_MENU_ITEM, MOVE
|
|
|
4
4
|
import { ToolbarDropdownItemSection, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
5
5
|
import ChangesIcon from '@atlaskit/icon/core/changes';
|
|
6
6
|
import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import CopyBlockMenuItem from './copy-block';
|
|
9
8
|
import { CopyLinkDropdownItem } from './copy-link';
|
|
10
9
|
import { DeleteDropdownItem } from './delete-button';
|
|
@@ -91,7 +90,7 @@ var getFormatMenuComponents = function getFormatMenuComponents() {
|
|
|
91
90
|
export var getBlockMenuComponents = function getBlockMenuComponents(_ref4) {
|
|
92
91
|
var api = _ref4.api,
|
|
93
92
|
config = _ref4.config;
|
|
94
|
-
return [].concat(_toConsumableArray(
|
|
93
|
+
return [].concat(_toConsumableArray(getFormatMenuComponents()), [{
|
|
95
94
|
type: 'block-menu-section',
|
|
96
95
|
key: COPY_MENU_SECTION.key,
|
|
97
96
|
rank: BLOCK_MENU_SECTION_RANK[COPY_MENU_SECTION.key],
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
.
|
|
2
|
+
._2rko12b0{border-radius:var(--ds-radius-small,4px)}._16qs1cd0{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #091e4226,0 0 1px #091e424f)}
|
|
3
3
|
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
@@ -13,7 +13,7 @@ import { ToolbarDropdownItem, ToolbarDropdownItemSection, ToolbarNestedDropdownM
|
|
|
13
13
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
14
14
|
import { BlockMenuRenderer } from './block-menu-renderer';
|
|
15
15
|
var styles = {
|
|
16
|
-
base: "
|
|
16
|
+
base: "_2rko12b0 _bfhk1bhr _16qs1cd0"
|
|
17
17
|
};
|
|
18
18
|
var DEFAULT_MENU_WIDTH = 230;
|
|
19
19
|
var DRAG_HANDLE_OFFSET_PADDING = 5;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { TransformFunction } from './types';
|
|
1
|
+
import type { TransformContext, TransformFunction } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Transform selection to container type
|
|
4
4
|
*/
|
|
5
|
-
export declare const transformToContainer: () => null;
|
|
5
|
+
export declare const transformToContainer: ({ tr, sourceNode, targetNodeType, targetAttrs, }: TransformContext) => import("prosemirror-state").Transaction | null;
|
|
6
6
|
/**
|
|
7
7
|
* Transform container nodes (panel, expand, blockquote)
|
|
8
8
|
*/
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare const getInlineNodeTextContent: (sourceContent: Fragment, tr: Transaction) => import("prosemirror-model").Node | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Node as PMNode, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
/**
|
|
4
|
+
* Transform list structure
|
|
5
|
+
*/
|
|
6
|
+
export declare const transformListStructure: (tr: Transaction, listNode: {
|
|
7
|
+
node: PMNode;
|
|
8
|
+
pos: number;
|
|
9
|
+
}, targetNodeType: NodeType, nodes: Record<string, NodeType>) => Transaction;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
1
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
2
|
import type { TransformContext, TransformFunction } from './types';
|
|
4
3
|
/**
|
|
5
4
|
* Transform selection to list type
|
|
6
5
|
*/
|
|
7
|
-
export declare const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
export declare const transformBlockToList: (context: TransformContext) => Transaction | null;
|
|
7
|
+
/**
|
|
8
|
+
* Transform list to block nodes
|
|
9
|
+
*/
|
|
10
|
+
export declare const transformListToBlockNodes: (context: TransformContext) => Transaction | null;
|
|
12
11
|
/**
|
|
13
12
|
* Transform list nodes
|
|
14
13
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { TransformFunction } from './types';
|
|
1
|
+
import type { TransformContext, TransformFunction } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Transform selection to container type
|
|
4
4
|
*/
|
|
5
|
-
export declare const transformToContainer: () => null;
|
|
5
|
+
export declare const transformToContainer: ({ tr, sourceNode, targetNodeType, targetAttrs, }: TransformContext) => import("prosemirror-state").Transaction | null;
|
|
6
6
|
/**
|
|
7
7
|
* Transform container nodes (panel, expand, blockquote)
|
|
8
8
|
*/
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare const getInlineNodeTextContent: (sourceContent: Fragment, tr: Transaction) => import("prosemirror-model").Node | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Node as PMNode, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
/**
|
|
4
|
+
* Transform list structure
|
|
5
|
+
*/
|
|
6
|
+
export declare const transformListStructure: (tr: Transaction, listNode: {
|
|
7
|
+
node: PMNode;
|
|
8
|
+
pos: number;
|
|
9
|
+
}, targetNodeType: NodeType, nodes: Record<string, NodeType>) => Transaction;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
1
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
2
|
import type { TransformContext, TransformFunction } from './types';
|
|
4
3
|
/**
|
|
5
4
|
* Transform selection to list type
|
|
6
5
|
*/
|
|
7
|
-
export declare const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
export declare const transformBlockToList: (context: TransformContext) => Transaction | null;
|
|
7
|
+
/**
|
|
8
|
+
* Transform list to block nodes
|
|
9
|
+
*/
|
|
10
|
+
export declare const transformListToBlockNodes: (context: TransformContext) => Transaction | null;
|
|
12
11
|
/**
|
|
13
12
|
* Transform list nodes
|
|
14
13
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
38
38
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
39
39
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
40
|
-
"@atlaskit/editor-toolbar": "^0.
|
|
40
|
+
"@atlaskit/editor-toolbar": "^0.7.0",
|
|
41
41
|
"@atlaskit/icon": "^28.1.0",
|
|
42
42
|
"@atlaskit/icon-lab": "^5.7.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@babel/runtime": "^7.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@atlaskit/editor-common": "^108.
|
|
49
|
+
"@atlaskit/editor-common": "^108.1.0",
|
|
50
50
|
"react": "^18.2.0",
|
|
51
51
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
52
52
|
},
|
|
@@ -85,10 +85,5 @@
|
|
|
85
85
|
"import-no-extraneous-disable-for-examples-and-docs"
|
|
86
86
|
]
|
|
87
87
|
}
|
|
88
|
-
},
|
|
89
|
-
"platform-feature-flags": {
|
|
90
|
-
"platform_editor_block_menu_format": {
|
|
91
|
-
"type": "boolean"
|
|
92
|
-
}
|
|
93
88
|
}
|
|
94
89
|
}
|