@tiptap/extension-bullet-list 3.0.0-next.4 → 3.0.0-next.6
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 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -51
- package/dist/index.d.ts +2 -51
- package/dist/index.js +5 -64
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +2 -2
- package/src/bullet-list.ts +0 -126
package/LICENSE.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -20,78 +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
|
-
BulletList: () => BulletList,
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
BulletList: () => import_extension_list2.BulletList,
|
|
24
|
+
BulletListOptions: () => import_extension_list2.BulletListOptions,
|
|
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 = /^\s*([-+*])\s$/;
|
|
34
|
-
var BulletList = import_core.Node.create({
|
|
35
|
-
name: "bulletList",
|
|
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
|
-
parseHTML() {
|
|
49
|
-
return [{ tag: "ul" }];
|
|
50
|
-
},
|
|
51
|
-
renderHTML({ HTMLAttributes }) {
|
|
52
|
-
return ["ul", (0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
53
|
-
},
|
|
54
|
-
addCommands() {
|
|
55
|
-
return {
|
|
56
|
-
toggleBulletList: () => ({ commands, chain }) => {
|
|
57
|
-
if (this.options.keepAttributes) {
|
|
58
|
-
return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName)).run();
|
|
59
|
-
}
|
|
60
|
-
return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
},
|
|
64
|
-
addKeyboardShortcuts() {
|
|
65
|
-
return {
|
|
66
|
-
"Mod-Shift-8": () => this.editor.commands.toggleBulletList()
|
|
67
|
-
};
|
|
68
|
-
},
|
|
69
|
-
addInputRules() {
|
|
70
|
-
let inputRule = (0, import_core.wrappingInputRule)({
|
|
71
|
-
find: inputRegex,
|
|
72
|
-
type: this.type
|
|
73
|
-
});
|
|
74
|
-
if (this.options.keepMarks || this.options.keepAttributes) {
|
|
75
|
-
inputRule = (0, import_core.wrappingInputRule)({
|
|
76
|
-
find: inputRegex,
|
|
77
|
-
type: this.type,
|
|
78
|
-
keepMarks: this.options.keepMarks,
|
|
79
|
-
keepAttributes: this.options.keepAttributes,
|
|
80
|
-
getAttributes: () => {
|
|
81
|
-
return this.editor.getAttributes(TextStyleName);
|
|
82
|
-
},
|
|
83
|
-
editor: this.editor
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
return [inputRule];
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
// src/index.ts
|
|
91
|
-
var index_default = BulletList;
|
|
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.BulletList;
|
|
92
31
|
// Annotate the CommonJS export names for ESM import in node:
|
|
93
32
|
0 && (module.exports = {
|
|
94
33
|
BulletList,
|
|
95
|
-
|
|
34
|
+
BulletListOptions
|
|
96
35
|
});
|
|
97
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 { BulletList } from '@tiptap/extension-list'\n\nexport { BulletList, BulletListOptions } from '@tiptap/extension-list'\n\nexport default BulletList\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA2B;AAE3B,IAAAA,yBAA8C;AAE9C,IAAO,gBAAQ;","names":["import_extension_list"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,51 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
interface BulletListOptions {
|
|
4
|
-
/**
|
|
5
|
-
* The node name for the list items
|
|
6
|
-
* @default 'listItem'
|
|
7
|
-
* @example 'paragraph'
|
|
8
|
-
*/
|
|
9
|
-
itemTypeName: string;
|
|
10
|
-
/**
|
|
11
|
-
* HTML attributes to add to the bullet list element
|
|
12
|
-
* @default {}
|
|
13
|
-
* @example { class: 'foo' }
|
|
14
|
-
*/
|
|
15
|
-
HTMLAttributes: Record<string, any>;
|
|
16
|
-
/**
|
|
17
|
-
* Keep the marks when splitting the list
|
|
18
|
-
* @default false
|
|
19
|
-
* @example true
|
|
20
|
-
*/
|
|
21
|
-
keepMarks: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Keep the attributes when splitting the list
|
|
24
|
-
* @default false
|
|
25
|
-
* @example true
|
|
26
|
-
*/
|
|
27
|
-
keepAttributes: boolean;
|
|
28
|
-
}
|
|
29
|
-
declare module '@tiptap/core' {
|
|
30
|
-
interface Commands<ReturnType> {
|
|
31
|
-
bulletList: {
|
|
32
|
-
/**
|
|
33
|
-
* Toggle a bullet list
|
|
34
|
-
*/
|
|
35
|
-
toggleBulletList: () => ReturnType;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Matches a bullet list to a dash or asterisk.
|
|
41
|
-
*/
|
|
42
|
-
declare const inputRegex: RegExp;
|
|
43
|
-
/**
|
|
44
|
-
* This extension allows you to create bullet lists.
|
|
45
|
-
* This requires the ListItem extension
|
|
46
|
-
* @see https://tiptap.dev/api/nodes/bullet-list
|
|
47
|
-
* @see https://tiptap.dev/api/nodes/list-item.
|
|
48
|
-
*/
|
|
49
|
-
declare const BulletList: Node<BulletListOptions, any>;
|
|
50
|
-
|
|
51
|
-
export { BulletList, type BulletListOptions, BulletList as default, inputRegex };
|
|
1
|
+
import { BulletList } from '@tiptap/extension-list';
|
|
2
|
+
export { BulletList, BulletListOptions, BulletList as default } from '@tiptap/extension-list';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,51 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
interface BulletListOptions {
|
|
4
|
-
/**
|
|
5
|
-
* The node name for the list items
|
|
6
|
-
* @default 'listItem'
|
|
7
|
-
* @example 'paragraph'
|
|
8
|
-
*/
|
|
9
|
-
itemTypeName: string;
|
|
10
|
-
/**
|
|
11
|
-
* HTML attributes to add to the bullet list element
|
|
12
|
-
* @default {}
|
|
13
|
-
* @example { class: 'foo' }
|
|
14
|
-
*/
|
|
15
|
-
HTMLAttributes: Record<string, any>;
|
|
16
|
-
/**
|
|
17
|
-
* Keep the marks when splitting the list
|
|
18
|
-
* @default false
|
|
19
|
-
* @example true
|
|
20
|
-
*/
|
|
21
|
-
keepMarks: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Keep the attributes when splitting the list
|
|
24
|
-
* @default false
|
|
25
|
-
* @example true
|
|
26
|
-
*/
|
|
27
|
-
keepAttributes: boolean;
|
|
28
|
-
}
|
|
29
|
-
declare module '@tiptap/core' {
|
|
30
|
-
interface Commands<ReturnType> {
|
|
31
|
-
bulletList: {
|
|
32
|
-
/**
|
|
33
|
-
* Toggle a bullet list
|
|
34
|
-
*/
|
|
35
|
-
toggleBulletList: () => ReturnType;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Matches a bullet list to a dash or asterisk.
|
|
41
|
-
*/
|
|
42
|
-
declare const inputRegex: RegExp;
|
|
43
|
-
/**
|
|
44
|
-
* This extension allows you to create bullet lists.
|
|
45
|
-
* This requires the ListItem extension
|
|
46
|
-
* @see https://tiptap.dev/api/nodes/bullet-list
|
|
47
|
-
* @see https://tiptap.dev/api/nodes/list-item.
|
|
48
|
-
*/
|
|
49
|
-
declare const BulletList: Node<BulletListOptions, any>;
|
|
50
|
-
|
|
51
|
-
export { BulletList, type BulletListOptions, BulletList as default, inputRegex };
|
|
1
|
+
import { BulletList } from '@tiptap/extension-list';
|
|
2
|
+
export { BulletList, BulletListOptions, BulletList as default } from '@tiptap/extension-list';
|
package/dist/index.js
CHANGED
|
@@ -1,69 +1,10 @@
|
|
|
1
|
-
// src/bullet-list.ts
|
|
2
|
-
import { mergeAttributes, Node, wrappingInputRule } from "@tiptap/core";
|
|
3
|
-
var ListItemName = "listItem";
|
|
4
|
-
var TextStyleName = "textStyle";
|
|
5
|
-
var inputRegex = /^\s*([-+*])\s$/;
|
|
6
|
-
var BulletList = Node.create({
|
|
7
|
-
name: "bulletList",
|
|
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
|
-
parseHTML() {
|
|
21
|
-
return [{ tag: "ul" }];
|
|
22
|
-
},
|
|
23
|
-
renderHTML({ HTMLAttributes }) {
|
|
24
|
-
return ["ul", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
25
|
-
},
|
|
26
|
-
addCommands() {
|
|
27
|
-
return {
|
|
28
|
-
toggleBulletList: () => ({ commands, chain }) => {
|
|
29
|
-
if (this.options.keepAttributes) {
|
|
30
|
-
return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName)).run();
|
|
31
|
-
}
|
|
32
|
-
return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
addKeyboardShortcuts() {
|
|
37
|
-
return {
|
|
38
|
-
"Mod-Shift-8": () => this.editor.commands.toggleBulletList()
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
addInputRules() {
|
|
42
|
-
let inputRule = wrappingInputRule({
|
|
43
|
-
find: inputRegex,
|
|
44
|
-
type: this.type
|
|
45
|
-
});
|
|
46
|
-
if (this.options.keepMarks || this.options.keepAttributes) {
|
|
47
|
-
inputRule = wrappingInputRule({
|
|
48
|
-
find: inputRegex,
|
|
49
|
-
type: this.type,
|
|
50
|
-
keepMarks: this.options.keepMarks,
|
|
51
|
-
keepAttributes: this.options.keepAttributes,
|
|
52
|
-
getAttributes: () => {
|
|
53
|
-
return this.editor.getAttributes(TextStyleName);
|
|
54
|
-
},
|
|
55
|
-
editor: this.editor
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
return [inputRule];
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
1
|
// src/index.ts
|
|
2
|
+
import { BulletList } from "@tiptap/extension-list";
|
|
3
|
+
import { BulletList as BulletList2, BulletListOptions } from "@tiptap/extension-list";
|
|
63
4
|
var index_default = BulletList;
|
|
64
5
|
export {
|
|
65
|
-
BulletList,
|
|
66
|
-
|
|
67
|
-
|
|
6
|
+
BulletList2 as BulletList,
|
|
7
|
+
BulletListOptions,
|
|
8
|
+
index_default as default
|
|
68
9
|
};
|
|
69
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 { BulletList } from '@tiptap/extension-list'\n\nexport { BulletList, BulletListOptions } from '@tiptap/extension-list'\n\nexport default BulletList\n"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,cAAAA,aAAY,yBAAyB;AAE9C,IAAO,gBAAQ;","names":["BulletList"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-bullet-list",
|
|
3
3
|
"description": "bullet list extension for tiptap",
|
|
4
|
-
"version": "3.0.0-next.
|
|
4
|
+
"version": "3.0.0-next.6",
|
|
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.6"
|
|
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/bullet-list.ts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core'
|
|
2
|
-
|
|
3
|
-
const ListItemName = 'listItem'
|
|
4
|
-
const TextStyleName = 'textStyle'
|
|
5
|
-
|
|
6
|
-
export interface BulletListOptions {
|
|
7
|
-
/**
|
|
8
|
-
* The node name for the list items
|
|
9
|
-
* @default 'listItem'
|
|
10
|
-
* @example 'paragraph'
|
|
11
|
-
*/
|
|
12
|
-
itemTypeName: string
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* HTML attributes to add to the bullet list element
|
|
16
|
-
* @default {}
|
|
17
|
-
* @example { class: 'foo' }
|
|
18
|
-
*/
|
|
19
|
-
HTMLAttributes: Record<string, any>
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Keep the marks when splitting the list
|
|
23
|
-
* @default false
|
|
24
|
-
* @example true
|
|
25
|
-
*/
|
|
26
|
-
keepMarks: boolean
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Keep the attributes when splitting the list
|
|
30
|
-
* @default false
|
|
31
|
-
* @example true
|
|
32
|
-
*/
|
|
33
|
-
keepAttributes: boolean
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
declare module '@tiptap/core' {
|
|
37
|
-
interface Commands<ReturnType> {
|
|
38
|
-
bulletList: {
|
|
39
|
-
/**
|
|
40
|
-
* Toggle a bullet list
|
|
41
|
-
*/
|
|
42
|
-
toggleBulletList: () => ReturnType
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Matches a bullet list to a dash or asterisk.
|
|
49
|
-
*/
|
|
50
|
-
export const inputRegex = /^\s*([-+*])\s$/
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* This extension allows you to create bullet lists.
|
|
54
|
-
* This requires the ListItem extension
|
|
55
|
-
* @see https://tiptap.dev/api/nodes/bullet-list
|
|
56
|
-
* @see https://tiptap.dev/api/nodes/list-item.
|
|
57
|
-
*/
|
|
58
|
-
export const BulletList = Node.create<BulletListOptions>({
|
|
59
|
-
name: 'bulletList',
|
|
60
|
-
|
|
61
|
-
addOptions() {
|
|
62
|
-
return {
|
|
63
|
-
itemTypeName: 'listItem',
|
|
64
|
-
HTMLAttributes: {},
|
|
65
|
-
keepMarks: false,
|
|
66
|
-
keepAttributes: false,
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
group: 'block list',
|
|
71
|
-
|
|
72
|
-
content() {
|
|
73
|
-
return `${this.options.itemTypeName}+`
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
parseHTML() {
|
|
77
|
-
return [{ tag: 'ul' }]
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
renderHTML({ HTMLAttributes }) {
|
|
81
|
-
return ['ul', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
addCommands() {
|
|
85
|
-
return {
|
|
86
|
-
toggleBulletList:
|
|
87
|
-
() =>
|
|
88
|
-
({ commands, chain }) => {
|
|
89
|
-
if (this.options.keepAttributes) {
|
|
90
|
-
return chain()
|
|
91
|
-
.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
92
|
-
.updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName))
|
|
93
|
-
.run()
|
|
94
|
-
}
|
|
95
|
-
return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
96
|
-
},
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
addKeyboardShortcuts() {
|
|
101
|
-
return {
|
|
102
|
-
'Mod-Shift-8': () => this.editor.commands.toggleBulletList(),
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
addInputRules() {
|
|
107
|
-
let inputRule = wrappingInputRule({
|
|
108
|
-
find: inputRegex,
|
|
109
|
-
type: this.type,
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
if (this.options.keepMarks || this.options.keepAttributes) {
|
|
113
|
-
inputRule = wrappingInputRule({
|
|
114
|
-
find: inputRegex,
|
|
115
|
-
type: this.type,
|
|
116
|
-
keepMarks: this.options.keepMarks,
|
|
117
|
-
keepAttributes: this.options.keepAttributes,
|
|
118
|
-
getAttributes: () => {
|
|
119
|
-
return this.editor.getAttributes(TextStyleName)
|
|
120
|
-
},
|
|
121
|
-
editor: this.editor,
|
|
122
|
-
})
|
|
123
|
-
}
|
|
124
|
-
return [inputRule]
|
|
125
|
-
},
|
|
126
|
-
})
|