@atlaskit/editor-plugin-block-menu 1.0.3 → 1.0.5
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 +20 -0
- package/dist/cjs/editor-commands/formatNode.js +1 -1
- package/dist/cjs/editor-commands/transforms/layout-transforms.js +30 -0
- package/dist/cjs/editor-commands/transforms/list/transformBetweenListTypes.js +65 -63
- package/dist/cjs/editor-commands/transforms/list-transforms.js +97 -30
- package/dist/cjs/editor-commands/transforms/transformNodeToTargetType.js +4 -0
- package/dist/cjs/editor-commands/transforms/utils.js +23 -2
- package/dist/cjs/ui/block-menu-components.js +2 -1
- package/dist/es2019/editor-commands/formatNode.js +1 -1
- package/dist/es2019/editor-commands/transforms/layout-transforms.js +25 -0
- package/dist/es2019/editor-commands/transforms/list/transformBetweenListTypes.js +67 -62
- package/dist/es2019/editor-commands/transforms/list-transforms.js +97 -27
- package/dist/es2019/editor-commands/transforms/transformNodeToTargetType.js +5 -1
- package/dist/es2019/editor-commands/transforms/utils.js +22 -1
- package/dist/es2019/ui/block-menu-components.js +2 -1
- package/dist/esm/editor-commands/formatNode.js +1 -1
- package/dist/esm/editor-commands/transforms/layout-transforms.js +24 -0
- package/dist/esm/editor-commands/transforms/list/transformBetweenListTypes.js +66 -63
- package/dist/esm/editor-commands/transforms/list-transforms.js +92 -26
- package/dist/esm/editor-commands/transforms/transformNodeToTargetType.js +5 -1
- package/dist/esm/editor-commands/transforms/utils.js +22 -1
- package/dist/esm/ui/block-menu-components.js +2 -1
- package/dist/types/editor-commands/transforms/layout-transforms.d.ts +2 -0
- package/dist/types/editor-commands/transforms/list/transformBetweenListTypes.d.ts +3 -7
- package/dist/types/editor-commands/transforms/list-transforms.d.ts +5 -1
- package/dist/types/editor-commands/transforms/transformNodeToTargetType.d.ts +1 -1
- package/dist/types/editor-commands/transforms/types.d.ts +2 -2
- package/dist/types/editor-commands/transforms/utils.d.ts +5 -0
- package/dist/types-ts4.5/editor-commands/transforms/layout-transforms.d.ts +2 -0
- package/dist/types-ts4.5/editor-commands/transforms/list/transformBetweenListTypes.d.ts +3 -7
- package/dist/types-ts4.5/editor-commands/transforms/list-transforms.d.ts +5 -1
- package/dist/types-ts4.5/editor-commands/transforms/transformNodeToTargetType.d.ts +1 -1
- package/dist/types-ts4.5/editor-commands/transforms/types.d.ts +2 -2
- package/dist/types-ts4.5/editor-commands/transforms/utils.d.ts +5 -0
- package/package.json +6 -6
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
1
3
|
import { findWrapping } from '@atlaskit/editor-prosemirror/transform';
|
|
2
|
-
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
4
|
import { transformListStructure } from './list/transformBetweenListTypes';
|
|
4
5
|
import { transformOrderedUnorderedListToBlockNodes } from './list/transformOrderedUnorderedListToBlockNodes';
|
|
5
6
|
import { transformTaskListToBlockNodes } from './list/transformTaskListToBlockNodes';
|
|
6
7
|
import { transformToTaskList } from './list/transformToTaskList';
|
|
7
|
-
import { isBlockNodeType, isContainerNodeType, isListNodeType } from './utils';
|
|
8
|
+
import { getSupportedListTypesSet, isBulletOrOrderedList, isBlockNodeType, isContainerNodeType, isListNodeType, isTaskList } from './utils';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Transform selection to list type
|
|
@@ -22,7 +23,7 @@ export var transformBlockToList = function transformBlockToList(context) {
|
|
|
22
23
|
return null;
|
|
23
24
|
}
|
|
24
25
|
var nodes = tr.doc.type.schema.nodes;
|
|
25
|
-
var isTargetTask = targetNodeType
|
|
26
|
+
var isTargetTask = isTaskList(targetNodeType);
|
|
26
27
|
|
|
27
28
|
// Handle task lists differently due to their structure
|
|
28
29
|
if (isTargetTask) {
|
|
@@ -58,6 +59,60 @@ export var transformListToBlockNodes = function transformListToBlockNodes(contex
|
|
|
58
59
|
}
|
|
59
60
|
};
|
|
60
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Wraps bulletList, orderedList or taskList in node of container type
|
|
64
|
+
*/
|
|
65
|
+
export var transformListToContainer = function transformListToContainer(context) {
|
|
66
|
+
var tr = context.tr,
|
|
67
|
+
sourceNode = context.sourceNode,
|
|
68
|
+
sourcePos = context.sourcePos,
|
|
69
|
+
targetNodeType = context.targetNodeType,
|
|
70
|
+
targetAttrs = context.targetAttrs;
|
|
71
|
+
if (sourcePos === null) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
var schema = tr.doc.type.schema;
|
|
75
|
+
var _schema$nodes = schema.nodes,
|
|
76
|
+
blockquote = _schema$nodes.blockquote,
|
|
77
|
+
taskList = _schema$nodes.taskList,
|
|
78
|
+
taskItem = _schema$nodes.taskItem,
|
|
79
|
+
paragraph = _schema$nodes.paragraph;
|
|
80
|
+
|
|
81
|
+
// Special case: Task list -> Blockquote
|
|
82
|
+
// Flattens the task list before wrapping by blockquote
|
|
83
|
+
if (sourceNode.type === taskList && targetNodeType === blockquote) {
|
|
84
|
+
var _extractParagraphsFromTaskList = function extractParagraphsFromTaskList(node) {
|
|
85
|
+
var paragraphs = [];
|
|
86
|
+
node.forEach(function (child) {
|
|
87
|
+
if (child.type === taskItem) {
|
|
88
|
+
if (child.content.size > 0) {
|
|
89
|
+
var paragraphNode = paragraph.createChecked({}, child.content.content);
|
|
90
|
+
paragraphs.push(paragraphNode);
|
|
91
|
+
}
|
|
92
|
+
} else if (child.type === taskList) {
|
|
93
|
+
paragraphs.push.apply(paragraphs, _toConsumableArray(_extractParagraphsFromTaskList(child)));
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return paragraphs;
|
|
97
|
+
};
|
|
98
|
+
var liftedParagraphs = _extractParagraphsFromTaskList(sourceNode);
|
|
99
|
+
var _containerNode = targetNodeType.createAndFill(targetAttrs, Fragment.from(liftedParagraphs));
|
|
100
|
+
if (!_containerNode) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
tr.replaceWith(sourcePos, sourcePos + sourceNode.nodeSize, _containerNode);
|
|
104
|
+
return tr;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Default case
|
|
108
|
+
var containerNode = targetNodeType.createAndFill(targetAttrs, [sourceNode]);
|
|
109
|
+
if (!containerNode) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
tr.replaceWith(sourcePos, sourcePos + sourceNode.nodeSize, containerNode);
|
|
113
|
+
return tr;
|
|
114
|
+
};
|
|
115
|
+
|
|
61
116
|
/**
|
|
62
117
|
* Transform list nodes
|
|
63
118
|
*/
|
|
@@ -71,8 +126,8 @@ export var transformListNode = function transformListNode(context) {
|
|
|
71
126
|
|
|
72
127
|
// Transform list to container type
|
|
73
128
|
if (isContainerNodeType(targetNodeType)) {
|
|
74
|
-
//
|
|
75
|
-
return
|
|
129
|
+
// Wrap list items into container type, where possible
|
|
130
|
+
return transformListToContainer(context);
|
|
76
131
|
}
|
|
77
132
|
|
|
78
133
|
// Transform between list types
|
|
@@ -93,37 +148,48 @@ export var liftListToBlockType = function liftListToBlockType() {
|
|
|
93
148
|
/**
|
|
94
149
|
* Transform between different list types
|
|
95
150
|
*/
|
|
96
|
-
export var transformBetweenListTypes = function transformBetweenListTypes(
|
|
97
|
-
var tr =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
151
|
+
export var transformBetweenListTypes = function transformBetweenListTypes(context) {
|
|
152
|
+
var tr = context.tr,
|
|
153
|
+
sourceNode = context.sourceNode,
|
|
154
|
+
sourcePos = context.sourcePos,
|
|
155
|
+
targetNodeType = context.targetNodeType;
|
|
101
156
|
var nodes = tr.doc.type.schema.nodes;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
var
|
|
105
|
-
|
|
106
|
-
var
|
|
107
|
-
if (!listNode) {
|
|
108
|
-
return null;
|
|
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;
|
|
157
|
+
var sourceListType = sourceNode.type;
|
|
158
|
+
var isSourceBulletOrOrdered = isBulletOrOrderedList(sourceListType);
|
|
159
|
+
var isTargetTask = isTaskList(targetNodeType);
|
|
160
|
+
var isSourceTask = isTaskList(sourceListType);
|
|
161
|
+
var isTargetBulletOrOrdered = isBulletOrOrderedList(targetNodeType);
|
|
115
162
|
|
|
116
163
|
// Check if we need structure transformation
|
|
117
164
|
var needsStructureTransform = isSourceBulletOrOrdered && isTargetTask || isSourceTask && isTargetBulletOrOrdered;
|
|
118
165
|
try {
|
|
119
166
|
if (!needsStructureTransform) {
|
|
120
167
|
// Simple type change for same structure lists (bullet <-> ordered)
|
|
121
|
-
|
|
168
|
+
// Apply to the main list
|
|
169
|
+
tr.setNodeMarkup(sourcePos, targetNodeType);
|
|
170
|
+
|
|
171
|
+
// Apply to nested lists
|
|
172
|
+
var listStart = sourcePos;
|
|
173
|
+
var listEnd = sourcePos + sourceNode.nodeSize;
|
|
174
|
+
var supportedListTypesSet = getSupportedListTypesSet(nodes);
|
|
175
|
+
tr.doc.nodesBetween(listStart, listEnd, function (node, pos, parent) {
|
|
176
|
+
// Only process nested lists (not the root list we already handled)
|
|
177
|
+
if (supportedListTypesSet.has(node.type) && pos !== sourcePos) {
|
|
178
|
+
var isNestedList = parent && (supportedListTypesSet.has(parent.type) || parent.type === nodes.listItem);
|
|
179
|
+
if (isNestedList) {
|
|
180
|
+
var shouldTransformNode = node.type === sourceListType || isBulletOrOrderedList(node.type) && isTargetBulletOrOrdered;
|
|
181
|
+
if (shouldTransformNode) {
|
|
182
|
+
tr.setNodeMarkup(pos, targetNodeType);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return true; // Continue traversing
|
|
187
|
+
});
|
|
188
|
+
return tr;
|
|
122
189
|
} else {
|
|
123
|
-
|
|
190
|
+
return transformListStructure(context);
|
|
124
191
|
}
|
|
125
192
|
} catch (_unused) {
|
|
126
193
|
return null;
|
|
127
194
|
}
|
|
128
|
-
return tr;
|
|
129
195
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { transformBlockNode } from './block-transforms';
|
|
2
2
|
import { transformContainerNode } from './container-transforms';
|
|
3
|
+
import { convertToLayout } from './layout-transforms';
|
|
3
4
|
import { transformListNode } from './list-transforms';
|
|
4
|
-
import { getTargetNodeInfo, isBlockNode, isListNode, isContainerNode } from './utils';
|
|
5
|
+
import { getTargetNodeInfo, isBlockNode, isListNode, isContainerNode, isLayoutNodeType } from './utils';
|
|
5
6
|
export function transformNodeToTargetType(tr, sourceNode, sourcePos, targetType) {
|
|
6
7
|
var nodes = tr.doc.type.schema.nodes;
|
|
7
8
|
var targetNodeInfo = getTargetNodeInfo(targetType, nodes);
|
|
@@ -37,6 +38,9 @@ export function transformNodeToTargetType(tr, sourceNode, sourcePos, targetType)
|
|
|
37
38
|
|
|
38
39
|
// Route to appropriate transformation strategy based on source node type
|
|
39
40
|
try {
|
|
41
|
+
if (isLayoutNodeType(targetNodeType)) {
|
|
42
|
+
return convertToLayout(transformationContext);
|
|
43
|
+
}
|
|
40
44
|
if (isBlockNode(sourceNode)) {
|
|
41
45
|
return transformBlockNode(transformationContext);
|
|
42
46
|
}
|
|
@@ -77,6 +77,10 @@ export var getTargetNodeInfo = function getTargetNodeInfo(targetType, nodes) {
|
|
|
77
77
|
return {
|
|
78
78
|
nodeType: nodes.taskList
|
|
79
79
|
};
|
|
80
|
+
case 'layoutSection':
|
|
81
|
+
return {
|
|
82
|
+
nodeType: nodes.layoutSection
|
|
83
|
+
};
|
|
80
84
|
default:
|
|
81
85
|
return null;
|
|
82
86
|
}
|
|
@@ -87,7 +91,7 @@ export var isBlockNode = function isBlockNode(node) {
|
|
|
87
91
|
return ['paragraph', 'heading', 'codeBlock'].includes(node.type.name);
|
|
88
92
|
};
|
|
89
93
|
export var isListNode = function isListNode(node) {
|
|
90
|
-
return ['bulletList', 'orderedList', 'taskList'
|
|
94
|
+
return ['bulletList', 'orderedList', 'taskList'].includes(node.type.name);
|
|
91
95
|
};
|
|
92
96
|
export var isContainerNode = function isContainerNode(node) {
|
|
93
97
|
return ['panel', 'expand', 'blockquote'].includes(node.type.name);
|
|
@@ -100,4 +104,21 @@ export var isListNodeType = function isListNodeType(nodeType) {
|
|
|
100
104
|
};
|
|
101
105
|
export var isContainerNodeType = function isContainerNodeType(nodeType) {
|
|
102
106
|
return ['panel', 'expand', 'blockquote'].includes(nodeType.name);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// List type utilities
|
|
110
|
+
export var isBulletOrOrderedList = function isBulletOrOrderedList(nodeType) {
|
|
111
|
+
return nodeType.name === 'bulletList' || nodeType.name === 'orderedList';
|
|
112
|
+
};
|
|
113
|
+
export var isTaskList = function isTaskList(nodeType) {
|
|
114
|
+
return nodeType.name === 'taskList';
|
|
115
|
+
};
|
|
116
|
+
export var getSupportedListTypes = function getSupportedListTypes(nodes) {
|
|
117
|
+
return [nodes.bulletList, nodes.orderedList, nodes.taskList].filter(Boolean);
|
|
118
|
+
};
|
|
119
|
+
export var getSupportedListTypesSet = function getSupportedListTypesSet(nodes) {
|
|
120
|
+
return new Set(getSupportedListTypes(nodes));
|
|
121
|
+
};
|
|
122
|
+
export var isLayoutNodeType = function isLayoutNodeType(nodeType) {
|
|
123
|
+
return nodeType.name === 'layoutSection';
|
|
103
124
|
};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
1
|
+
import type { TransformContext } from '../types';
|
|
3
2
|
/**
|
|
4
|
-
* Transform list structure
|
|
3
|
+
* Transform list structure between different list types
|
|
5
4
|
*/
|
|
6
|
-
export declare const transformListStructure: (
|
|
7
|
-
node: PMNode;
|
|
8
|
-
pos: number;
|
|
9
|
-
}, targetNodeType: NodeType, nodes: Record<string, NodeType>) => Transaction;
|
|
5
|
+
export declare const transformListStructure: (context: TransformContext) => import("prosemirror-state").Transaction;
|
|
@@ -8,6 +8,10 @@ export declare const transformBlockToList: (context: TransformContext) => Transa
|
|
|
8
8
|
* Transform list to block nodes
|
|
9
9
|
*/
|
|
10
10
|
export declare const transformListToBlockNodes: (context: TransformContext) => Transaction | null;
|
|
11
|
+
/**
|
|
12
|
+
* Wraps bulletList, orderedList or taskList in node of container type
|
|
13
|
+
*/
|
|
14
|
+
export declare const transformListToContainer: (context: TransformContext) => Transaction | null;
|
|
11
15
|
/**
|
|
12
16
|
* Transform list nodes
|
|
13
17
|
*/
|
|
@@ -19,4 +23,4 @@ export declare const liftListToBlockType: () => null;
|
|
|
19
23
|
/**
|
|
20
24
|
* Transform between different list types
|
|
21
25
|
*/
|
|
22
|
-
export declare const transformBetweenListTypes: (
|
|
26
|
+
export declare const transformBetweenListTypes: (context: TransformContext) => Transaction | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { FormatNodeTargetType } from './types';
|
|
4
|
-
export declare function transformNodeToTargetType(tr: Transaction, sourceNode: PMNode, sourcePos: number
|
|
4
|
+
export declare function transformNodeToTargetType(tr: Transaction, sourceNode: PMNode, sourcePos: number, targetType: FormatNodeTargetType): Transaction | null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Node as PMNode, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
export type FormatNodeTargetType = 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6' | 'paragraph' | 'blockquote' | 'expand' | '
|
|
3
|
+
export type FormatNodeTargetType = 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6' | 'paragraph' | 'blockquote' | 'expand' | 'layoutSection' | 'panel' | 'codeBlock' | 'bulletList' | 'orderedList' | 'taskList';
|
|
4
4
|
export interface TransformContext {
|
|
5
5
|
sourceNode: PMNode;
|
|
6
|
-
sourcePos: number
|
|
6
|
+
sourcePos: number;
|
|
7
7
|
targetAttrs?: Record<string, unknown>;
|
|
8
8
|
targetNodeType: NodeType;
|
|
9
9
|
tr: Transaction;
|
|
@@ -10,3 +10,8 @@ export declare const isContainerNode: (node: PMNode) => boolean;
|
|
|
10
10
|
export declare const isBlockNodeType: (nodeType: NodeType) => boolean;
|
|
11
11
|
export declare const isListNodeType: (nodeType: NodeType) => boolean;
|
|
12
12
|
export declare const isContainerNodeType: (nodeType: NodeType) => boolean;
|
|
13
|
+
export declare const isBulletOrOrderedList: (nodeType: NodeType) => boolean;
|
|
14
|
+
export declare const isTaskList: (nodeType: NodeType) => boolean;
|
|
15
|
+
export declare const getSupportedListTypes: (nodes: Record<string, NodeType>) => NodeType[];
|
|
16
|
+
export declare const getSupportedListTypesSet: (nodes: Record<string, NodeType>) => Set<NodeType>;
|
|
17
|
+
export declare const isLayoutNodeType: (nodeType: NodeType) => boolean;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
1
|
+
import type { TransformContext } from '../types';
|
|
3
2
|
/**
|
|
4
|
-
* Transform list structure
|
|
3
|
+
* Transform list structure between different list types
|
|
5
4
|
*/
|
|
6
|
-
export declare const transformListStructure: (
|
|
7
|
-
node: PMNode;
|
|
8
|
-
pos: number;
|
|
9
|
-
}, targetNodeType: NodeType, nodes: Record<string, NodeType>) => Transaction;
|
|
5
|
+
export declare const transformListStructure: (context: TransformContext) => import("prosemirror-state").Transaction;
|
|
@@ -8,6 +8,10 @@ export declare const transformBlockToList: (context: TransformContext) => Transa
|
|
|
8
8
|
* Transform list to block nodes
|
|
9
9
|
*/
|
|
10
10
|
export declare const transformListToBlockNodes: (context: TransformContext) => Transaction | null;
|
|
11
|
+
/**
|
|
12
|
+
* Wraps bulletList, orderedList or taskList in node of container type
|
|
13
|
+
*/
|
|
14
|
+
export declare const transformListToContainer: (context: TransformContext) => Transaction | null;
|
|
11
15
|
/**
|
|
12
16
|
* Transform list nodes
|
|
13
17
|
*/
|
|
@@ -19,4 +23,4 @@ export declare const liftListToBlockType: () => null;
|
|
|
19
23
|
/**
|
|
20
24
|
* Transform between different list types
|
|
21
25
|
*/
|
|
22
|
-
export declare const transformBetweenListTypes: (
|
|
26
|
+
export declare const transformBetweenListTypes: (context: TransformContext) => Transaction | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { FormatNodeTargetType } from './types';
|
|
4
|
-
export declare function transformNodeToTargetType(tr: Transaction, sourceNode: PMNode, sourcePos: number
|
|
4
|
+
export declare function transformNodeToTargetType(tr: Transaction, sourceNode: PMNode, sourcePos: number, targetType: FormatNodeTargetType): Transaction | null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Node as PMNode, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
export type FormatNodeTargetType = 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6' | 'paragraph' | 'blockquote' | 'expand' | '
|
|
3
|
+
export type FormatNodeTargetType = 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6' | 'paragraph' | 'blockquote' | 'expand' | 'layoutSection' | 'panel' | 'codeBlock' | 'bulletList' | 'orderedList' | 'taskList';
|
|
4
4
|
export interface TransformContext {
|
|
5
5
|
sourceNode: PMNode;
|
|
6
|
-
sourcePos: number
|
|
6
|
+
sourcePos: number;
|
|
7
7
|
targetAttrs?: Record<string, unknown>;
|
|
8
8
|
targetNodeType: NodeType;
|
|
9
9
|
tr: Transaction;
|
|
@@ -10,3 +10,8 @@ export declare const isContainerNode: (node: PMNode) => boolean;
|
|
|
10
10
|
export declare const isBlockNodeType: (nodeType: NodeType) => boolean;
|
|
11
11
|
export declare const isListNodeType: (nodeType: NodeType) => boolean;
|
|
12
12
|
export declare const isContainerNodeType: (nodeType: NodeType) => boolean;
|
|
13
|
+
export declare const isBulletOrOrderedList: (nodeType: NodeType) => boolean;
|
|
14
|
+
export declare const isTaskList: (nodeType: NodeType) => boolean;
|
|
15
|
+
export declare const getSupportedListTypes: (nodes: Record<string, NodeType>) => NodeType[];
|
|
16
|
+
export declare const getSupportedListTypesSet: (nodes: Record<string, NodeType>) => Set<NodeType>;
|
|
17
|
+
export declare const isLayoutNodeType: (nodeType: NodeType) => boolean;
|
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.5",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@atlaskit/css": "^0.
|
|
31
|
+
"@atlaskit/css": "^0.13.0",
|
|
32
32
|
"@atlaskit/dropdown-menu": "^16.3.0",
|
|
33
33
|
"@atlaskit/editor-plugin-block-controls": "^5.0.0",
|
|
34
34
|
"@atlaskit/editor-plugin-decorations": "^4.0.0",
|
|
@@ -37,16 +37,16 @@
|
|
|
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.8.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",
|
|
44
|
-
"@atlaskit/primitives": "^14.
|
|
45
|
-
"@atlaskit/tokens": "^6.
|
|
44
|
+
"@atlaskit/primitives": "^14.13.0",
|
|
45
|
+
"@atlaskit/tokens": "^6.2.0",
|
|
46
46
|
"@babel/runtime": "^7.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@atlaskit/editor-common": "^108.
|
|
49
|
+
"@atlaskit/editor-common": "^108.3.0",
|
|
50
50
|
"react": "^18.2.0",
|
|
51
51
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
52
52
|
},
|