@tiptap/extension-ordered-list 3.0.0-next.4 → 3.0.0-next.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/LICENSE.md +1 -1
- package/dist/index.cjs +7 -88
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -52
- package/dist/index.d.ts +2 -52
- package/dist/index.js +5 -84
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +2 -2
- package/src/ordered-list.ts +0 -151
package/LICENSE.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -20,98 +20,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
OrderedList: () => OrderedList,
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
OrderedList: () => import_extension_list2.OrderedList,
|
|
24
|
+
OrderedListOptions: () => import_extension_list2.OrderedListOptions,
|
|
25
|
+
default: () => index_default
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(index_exports);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
var ListItemName = "listItem";
|
|
32
|
-
var TextStyleName = "textStyle";
|
|
33
|
-
var inputRegex = /^(\d+)\.\s$/;
|
|
34
|
-
var OrderedList = import_core.Node.create({
|
|
35
|
-
name: "orderedList",
|
|
36
|
-
addOptions() {
|
|
37
|
-
return {
|
|
38
|
-
itemTypeName: "listItem",
|
|
39
|
-
HTMLAttributes: {},
|
|
40
|
-
keepMarks: false,
|
|
41
|
-
keepAttributes: false
|
|
42
|
-
};
|
|
43
|
-
},
|
|
44
|
-
group: "block list",
|
|
45
|
-
content() {
|
|
46
|
-
return `${this.options.itemTypeName}+`;
|
|
47
|
-
},
|
|
48
|
-
addAttributes() {
|
|
49
|
-
return {
|
|
50
|
-
start: {
|
|
51
|
-
default: 1,
|
|
52
|
-
parseHTML: (element) => {
|
|
53
|
-
return element.hasAttribute("start") ? parseInt(element.getAttribute("start") || "", 10) : 1;
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
type: {
|
|
57
|
-
default: void 0,
|
|
58
|
-
parseHTML: (element) => element.getAttribute("type")
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
parseHTML() {
|
|
63
|
-
return [
|
|
64
|
-
{
|
|
65
|
-
tag: "ol"
|
|
66
|
-
}
|
|
67
|
-
];
|
|
68
|
-
},
|
|
69
|
-
renderHTML({ HTMLAttributes }) {
|
|
70
|
-
const { start, ...attributesWithoutStart } = HTMLAttributes;
|
|
71
|
-
return start === 1 ? ["ol", (0, import_core.mergeAttributes)(this.options.HTMLAttributes, attributesWithoutStart), 0] : ["ol", (0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
72
|
-
},
|
|
73
|
-
addCommands() {
|
|
74
|
-
return {
|
|
75
|
-
toggleOrderedList: () => ({ commands, chain }) => {
|
|
76
|
-
if (this.options.keepAttributes) {
|
|
77
|
-
return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName)).run();
|
|
78
|
-
}
|
|
79
|
-
return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
},
|
|
83
|
-
addKeyboardShortcuts() {
|
|
84
|
-
return {
|
|
85
|
-
"Mod-Shift-7": () => this.editor.commands.toggleOrderedList()
|
|
86
|
-
};
|
|
87
|
-
},
|
|
88
|
-
addInputRules() {
|
|
89
|
-
let inputRule = (0, import_core.wrappingInputRule)({
|
|
90
|
-
find: inputRegex,
|
|
91
|
-
type: this.type,
|
|
92
|
-
getAttributes: (match) => ({ start: +match[1] }),
|
|
93
|
-
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1]
|
|
94
|
-
});
|
|
95
|
-
if (this.options.keepMarks || this.options.keepAttributes) {
|
|
96
|
-
inputRule = (0, import_core.wrappingInputRule)({
|
|
97
|
-
find: inputRegex,
|
|
98
|
-
type: this.type,
|
|
99
|
-
keepMarks: this.options.keepMarks,
|
|
100
|
-
keepAttributes: this.options.keepAttributes,
|
|
101
|
-
getAttributes: (match) => ({ start: +match[1], ...this.editor.getAttributes(TextStyleName) }),
|
|
102
|
-
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],
|
|
103
|
-
editor: this.editor
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
return [inputRule];
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
// src/index.ts
|
|
111
|
-
var index_default = OrderedList;
|
|
28
|
+
var import_extension_list = require("@tiptap/extension-list");
|
|
29
|
+
var import_extension_list2 = require("@tiptap/extension-list");
|
|
30
|
+
var index_default = import_extension_list.OrderedList;
|
|
112
31
|
// Annotate the CommonJS export names for ESM import in node:
|
|
113
32
|
0 && (module.exports = {
|
|
114
33
|
OrderedList,
|
|
115
|
-
|
|
34
|
+
OrderedListOptions
|
|
116
35
|
});
|
|
117
36
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { OrderedList } from '@tiptap/extension-list'\n\nexport { OrderedList, OrderedListOptions } from '@tiptap/extension-list'\n\nexport default OrderedList\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA4B;AAE5B,IAAAA,yBAAgD;AAEhD,IAAO,gBAAQ;","names":["import_extension_list"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,52 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
interface OrderedListOptions {
|
|
4
|
-
/**
|
|
5
|
-
* The node type name for list items.
|
|
6
|
-
* @default 'listItem'
|
|
7
|
-
* @example 'myListItem'
|
|
8
|
-
*/
|
|
9
|
-
itemTypeName: string;
|
|
10
|
-
/**
|
|
11
|
-
* The HTML attributes for an ordered list node.
|
|
12
|
-
* @default {}
|
|
13
|
-
* @example { class: 'foo' }
|
|
14
|
-
*/
|
|
15
|
-
HTMLAttributes: Record<string, any>;
|
|
16
|
-
/**
|
|
17
|
-
* Keep the marks when splitting a list item.
|
|
18
|
-
* @default false
|
|
19
|
-
* @example true
|
|
20
|
-
*/
|
|
21
|
-
keepMarks: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Keep the attributes when splitting a list item.
|
|
24
|
-
* @default false
|
|
25
|
-
* @example true
|
|
26
|
-
*/
|
|
27
|
-
keepAttributes: boolean;
|
|
28
|
-
}
|
|
29
|
-
declare module '@tiptap/core' {
|
|
30
|
-
interface Commands<ReturnType> {
|
|
31
|
-
orderedList: {
|
|
32
|
-
/**
|
|
33
|
-
* Toggle an ordered list
|
|
34
|
-
* @example editor.commands.toggleOrderedList()
|
|
35
|
-
*/
|
|
36
|
-
toggleOrderedList: () => ReturnType;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Matches an ordered list to a 1. on input (or any number followed by a dot).
|
|
42
|
-
*/
|
|
43
|
-
declare const inputRegex: RegExp;
|
|
44
|
-
/**
|
|
45
|
-
* This extension allows you to create ordered lists.
|
|
46
|
-
* This requires the ListItem extension
|
|
47
|
-
* @see https://www.tiptap.dev/api/nodes/ordered-list
|
|
48
|
-
* @see https://www.tiptap.dev/api/nodes/list-item
|
|
49
|
-
*/
|
|
50
|
-
declare const OrderedList: Node<OrderedListOptions, any>;
|
|
51
|
-
|
|
52
|
-
export { OrderedList, type OrderedListOptions, OrderedList as default, inputRegex };
|
|
1
|
+
import { OrderedList } from '@tiptap/extension-list';
|
|
2
|
+
export { OrderedList, OrderedListOptions, OrderedList as default } from '@tiptap/extension-list';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,52 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
interface OrderedListOptions {
|
|
4
|
-
/**
|
|
5
|
-
* The node type name for list items.
|
|
6
|
-
* @default 'listItem'
|
|
7
|
-
* @example 'myListItem'
|
|
8
|
-
*/
|
|
9
|
-
itemTypeName: string;
|
|
10
|
-
/**
|
|
11
|
-
* The HTML attributes for an ordered list node.
|
|
12
|
-
* @default {}
|
|
13
|
-
* @example { class: 'foo' }
|
|
14
|
-
*/
|
|
15
|
-
HTMLAttributes: Record<string, any>;
|
|
16
|
-
/**
|
|
17
|
-
* Keep the marks when splitting a list item.
|
|
18
|
-
* @default false
|
|
19
|
-
* @example true
|
|
20
|
-
*/
|
|
21
|
-
keepMarks: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Keep the attributes when splitting a list item.
|
|
24
|
-
* @default false
|
|
25
|
-
* @example true
|
|
26
|
-
*/
|
|
27
|
-
keepAttributes: boolean;
|
|
28
|
-
}
|
|
29
|
-
declare module '@tiptap/core' {
|
|
30
|
-
interface Commands<ReturnType> {
|
|
31
|
-
orderedList: {
|
|
32
|
-
/**
|
|
33
|
-
* Toggle an ordered list
|
|
34
|
-
* @example editor.commands.toggleOrderedList()
|
|
35
|
-
*/
|
|
36
|
-
toggleOrderedList: () => ReturnType;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Matches an ordered list to a 1. on input (or any number followed by a dot).
|
|
42
|
-
*/
|
|
43
|
-
declare const inputRegex: RegExp;
|
|
44
|
-
/**
|
|
45
|
-
* This extension allows you to create ordered lists.
|
|
46
|
-
* This requires the ListItem extension
|
|
47
|
-
* @see https://www.tiptap.dev/api/nodes/ordered-list
|
|
48
|
-
* @see https://www.tiptap.dev/api/nodes/list-item
|
|
49
|
-
*/
|
|
50
|
-
declare const OrderedList: Node<OrderedListOptions, any>;
|
|
51
|
-
|
|
52
|
-
export { OrderedList, type OrderedListOptions, OrderedList as default, inputRegex };
|
|
1
|
+
import { OrderedList } from '@tiptap/extension-list';
|
|
2
|
+
export { OrderedList, OrderedListOptions, OrderedList as default } from '@tiptap/extension-list';
|
package/dist/index.js
CHANGED
|
@@ -1,89 +1,10 @@
|
|
|
1
|
-
// src/ordered-list.ts
|
|
2
|
-
import { mergeAttributes, Node, wrappingInputRule } from "@tiptap/core";
|
|
3
|
-
var ListItemName = "listItem";
|
|
4
|
-
var TextStyleName = "textStyle";
|
|
5
|
-
var inputRegex = /^(\d+)\.\s$/;
|
|
6
|
-
var OrderedList = Node.create({
|
|
7
|
-
name: "orderedList",
|
|
8
|
-
addOptions() {
|
|
9
|
-
return {
|
|
10
|
-
itemTypeName: "listItem",
|
|
11
|
-
HTMLAttributes: {},
|
|
12
|
-
keepMarks: false,
|
|
13
|
-
keepAttributes: false
|
|
14
|
-
};
|
|
15
|
-
},
|
|
16
|
-
group: "block list",
|
|
17
|
-
content() {
|
|
18
|
-
return `${this.options.itemTypeName}+`;
|
|
19
|
-
},
|
|
20
|
-
addAttributes() {
|
|
21
|
-
return {
|
|
22
|
-
start: {
|
|
23
|
-
default: 1,
|
|
24
|
-
parseHTML: (element) => {
|
|
25
|
-
return element.hasAttribute("start") ? parseInt(element.getAttribute("start") || "", 10) : 1;
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
type: {
|
|
29
|
-
default: void 0,
|
|
30
|
-
parseHTML: (element) => element.getAttribute("type")
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
},
|
|
34
|
-
parseHTML() {
|
|
35
|
-
return [
|
|
36
|
-
{
|
|
37
|
-
tag: "ol"
|
|
38
|
-
}
|
|
39
|
-
];
|
|
40
|
-
},
|
|
41
|
-
renderHTML({ HTMLAttributes }) {
|
|
42
|
-
const { start, ...attributesWithoutStart } = HTMLAttributes;
|
|
43
|
-
return start === 1 ? ["ol", mergeAttributes(this.options.HTMLAttributes, attributesWithoutStart), 0] : ["ol", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
44
|
-
},
|
|
45
|
-
addCommands() {
|
|
46
|
-
return {
|
|
47
|
-
toggleOrderedList: () => ({ commands, chain }) => {
|
|
48
|
-
if (this.options.keepAttributes) {
|
|
49
|
-
return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName)).run();
|
|
50
|
-
}
|
|
51
|
-
return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
},
|
|
55
|
-
addKeyboardShortcuts() {
|
|
56
|
-
return {
|
|
57
|
-
"Mod-Shift-7": () => this.editor.commands.toggleOrderedList()
|
|
58
|
-
};
|
|
59
|
-
},
|
|
60
|
-
addInputRules() {
|
|
61
|
-
let inputRule = wrappingInputRule({
|
|
62
|
-
find: inputRegex,
|
|
63
|
-
type: this.type,
|
|
64
|
-
getAttributes: (match) => ({ start: +match[1] }),
|
|
65
|
-
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1]
|
|
66
|
-
});
|
|
67
|
-
if (this.options.keepMarks || this.options.keepAttributes) {
|
|
68
|
-
inputRule = wrappingInputRule({
|
|
69
|
-
find: inputRegex,
|
|
70
|
-
type: this.type,
|
|
71
|
-
keepMarks: this.options.keepMarks,
|
|
72
|
-
keepAttributes: this.options.keepAttributes,
|
|
73
|
-
getAttributes: (match) => ({ start: +match[1], ...this.editor.getAttributes(TextStyleName) }),
|
|
74
|
-
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],
|
|
75
|
-
editor: this.editor
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return [inputRule];
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
|
|
82
1
|
// src/index.ts
|
|
2
|
+
import { OrderedList } from "@tiptap/extension-list";
|
|
3
|
+
import { OrderedList as OrderedList2, OrderedListOptions } from "@tiptap/extension-list";
|
|
83
4
|
var index_default = OrderedList;
|
|
84
5
|
export {
|
|
85
|
-
OrderedList,
|
|
86
|
-
|
|
87
|
-
|
|
6
|
+
OrderedList2 as OrderedList,
|
|
7
|
+
OrderedListOptions,
|
|
8
|
+
index_default as default
|
|
88
9
|
};
|
|
89
10
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { OrderedList } from '@tiptap/extension-list'\n\nexport { OrderedList, OrderedListOptions } from '@tiptap/extension-list'\n\nexport default OrderedList\n"],"mappings":";AAAA,SAAS,mBAAmB;AAE5B,SAAS,eAAAA,cAAa,0BAA0B;AAEhD,IAAO,gBAAQ;","names":["OrderedList"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-ordered-list",
|
|
3
3
|
"description": "ordered list extension for tiptap",
|
|
4
|
-
"version": "3.0.0-next.
|
|
4
|
+
"version": "3.0.0-next.5",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"dist"
|
|
32
32
|
],
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@tiptap/
|
|
34
|
+
"@tiptap/extension-list": "^3.0.0-next.5"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@tiptap/
|
|
37
|
+
"@tiptap/extension-list": "^3.0.0-next.4"
|
|
38
38
|
},
|
|
39
39
|
"repository": {
|
|
40
40
|
"type": "git",
|
package/src/index.ts
CHANGED
package/src/ordered-list.ts
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core'
|
|
2
|
-
|
|
3
|
-
const ListItemName = 'listItem'
|
|
4
|
-
const TextStyleName = 'textStyle'
|
|
5
|
-
|
|
6
|
-
export interface OrderedListOptions {
|
|
7
|
-
/**
|
|
8
|
-
* The node type name for list items.
|
|
9
|
-
* @default 'listItem'
|
|
10
|
-
* @example 'myListItem'
|
|
11
|
-
*/
|
|
12
|
-
itemTypeName: string
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The HTML attributes for an ordered list node.
|
|
16
|
-
* @default {}
|
|
17
|
-
* @example { class: 'foo' }
|
|
18
|
-
*/
|
|
19
|
-
HTMLAttributes: Record<string, any>
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Keep the marks when splitting a list item.
|
|
23
|
-
* @default false
|
|
24
|
-
* @example true
|
|
25
|
-
*/
|
|
26
|
-
keepMarks: boolean
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Keep the attributes when splitting a list item.
|
|
30
|
-
* @default false
|
|
31
|
-
* @example true
|
|
32
|
-
*/
|
|
33
|
-
keepAttributes: boolean
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
declare module '@tiptap/core' {
|
|
37
|
-
interface Commands<ReturnType> {
|
|
38
|
-
orderedList: {
|
|
39
|
-
/**
|
|
40
|
-
* Toggle an ordered list
|
|
41
|
-
* @example editor.commands.toggleOrderedList()
|
|
42
|
-
*/
|
|
43
|
-
toggleOrderedList: () => ReturnType
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Matches an ordered list to a 1. on input (or any number followed by a dot).
|
|
50
|
-
*/
|
|
51
|
-
export const inputRegex = /^(\d+)\.\s$/
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* This extension allows you to create ordered lists.
|
|
55
|
-
* This requires the ListItem extension
|
|
56
|
-
* @see https://www.tiptap.dev/api/nodes/ordered-list
|
|
57
|
-
* @see https://www.tiptap.dev/api/nodes/list-item
|
|
58
|
-
*/
|
|
59
|
-
export const OrderedList = Node.create<OrderedListOptions>({
|
|
60
|
-
name: 'orderedList',
|
|
61
|
-
|
|
62
|
-
addOptions() {
|
|
63
|
-
return {
|
|
64
|
-
itemTypeName: 'listItem',
|
|
65
|
-
HTMLAttributes: {},
|
|
66
|
-
keepMarks: false,
|
|
67
|
-
keepAttributes: false,
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
group: 'block list',
|
|
72
|
-
|
|
73
|
-
content() {
|
|
74
|
-
return `${this.options.itemTypeName}+`
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
addAttributes() {
|
|
78
|
-
return {
|
|
79
|
-
start: {
|
|
80
|
-
default: 1,
|
|
81
|
-
parseHTML: element => {
|
|
82
|
-
return element.hasAttribute('start') ? parseInt(element.getAttribute('start') || '', 10) : 1
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
type: {
|
|
86
|
-
default: undefined,
|
|
87
|
-
parseHTML: element => element.getAttribute('type'),
|
|
88
|
-
},
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
parseHTML() {
|
|
93
|
-
return [
|
|
94
|
-
{
|
|
95
|
-
tag: 'ol',
|
|
96
|
-
},
|
|
97
|
-
]
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
renderHTML({ HTMLAttributes }) {
|
|
101
|
-
const { start, ...attributesWithoutStart } = HTMLAttributes
|
|
102
|
-
|
|
103
|
-
return start === 1
|
|
104
|
-
? ['ol', mergeAttributes(this.options.HTMLAttributes, attributesWithoutStart), 0]
|
|
105
|
-
: ['ol', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
addCommands() {
|
|
109
|
-
return {
|
|
110
|
-
toggleOrderedList:
|
|
111
|
-
() =>
|
|
112
|
-
({ commands, chain }) => {
|
|
113
|
-
if (this.options.keepAttributes) {
|
|
114
|
-
return chain()
|
|
115
|
-
.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
116
|
-
.updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName))
|
|
117
|
-
.run()
|
|
118
|
-
}
|
|
119
|
-
return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
120
|
-
},
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
addKeyboardShortcuts() {
|
|
125
|
-
return {
|
|
126
|
-
'Mod-Shift-7': () => this.editor.commands.toggleOrderedList(),
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
addInputRules() {
|
|
131
|
-
let inputRule = wrappingInputRule({
|
|
132
|
-
find: inputRegex,
|
|
133
|
-
type: this.type,
|
|
134
|
-
getAttributes: match => ({ start: +match[1] }),
|
|
135
|
-
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
if (this.options.keepMarks || this.options.keepAttributes) {
|
|
139
|
-
inputRule = wrappingInputRule({
|
|
140
|
-
find: inputRegex,
|
|
141
|
-
type: this.type,
|
|
142
|
-
keepMarks: this.options.keepMarks,
|
|
143
|
-
keepAttributes: this.options.keepAttributes,
|
|
144
|
-
getAttributes: match => ({ start: +match[1], ...this.editor.getAttributes(TextStyleName) }),
|
|
145
|
-
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],
|
|
146
|
-
editor: this.editor,
|
|
147
|
-
})
|
|
148
|
-
}
|
|
149
|
-
return [inputRule]
|
|
150
|
-
},
|
|
151
|
-
})
|