@tiptap/starter-kit 2.0.0-beta.21 → 2.0.0-beta.211
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/README.md +2 -2
- package/dist/index.cjs +89 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +89 -0
- package/package.json +50 -26
- package/src/index.ts +5 -56
- package/src/starter-kit.ts +122 -0
- package/CHANGELOG.md +0 -296
- package/LICENSE.md +0 -21
- package/dist/packages/starter-kit/src/index.d.ts +0 -32
- package/dist/tiptap-starter-kit.bundle.umd.min.js +0 -2
- package/dist/tiptap-starter-kit.bundle.umd.min.js.map +0 -1
- package/dist/tiptap-starter-kit.cjs.js +0 -69
- package/dist/tiptap-starter-kit.cjs.js.map +0 -1
- package/dist/tiptap-starter-kit.esm.js +0 -44
- package/dist/tiptap-starter-kit.esm.js.map +0 -1
- package/dist/tiptap-starter-kit.umd.js +0 -56
- package/dist/tiptap-starter-kit.umd.js.map +0 -1
package/README.md
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
## Introduction
|
|
8
8
|
tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as *New York Times*, *The Guardian* or *Atlassian*.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Official Documentation
|
|
11
11
|
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
|
12
12
|
|
|
13
13
|
## License
|
|
14
|
-
tiptap is open
|
|
14
|
+
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/starter-kit.ts
|
|
2
|
+
var _core = require('@tiptap/core');
|
|
3
|
+
var _extensionblockquote = require('@tiptap/extension-blockquote');
|
|
4
|
+
var _extensionbold = require('@tiptap/extension-bold');
|
|
5
|
+
var _extensionbulletlist = require('@tiptap/extension-bullet-list');
|
|
6
|
+
var _extensioncode = require('@tiptap/extension-code');
|
|
7
|
+
var _extensioncodeblock = require('@tiptap/extension-code-block');
|
|
8
|
+
var _extensiondocument = require('@tiptap/extension-document');
|
|
9
|
+
var _extensiondropcursor = require('@tiptap/extension-dropcursor');
|
|
10
|
+
var _extensiongapcursor = require('@tiptap/extension-gapcursor');
|
|
11
|
+
var _extensionhardbreak = require('@tiptap/extension-hard-break');
|
|
12
|
+
var _extensionheading = require('@tiptap/extension-heading');
|
|
13
|
+
var _extensionhistory = require('@tiptap/extension-history');
|
|
14
|
+
var _extensionhorizontalrule = require('@tiptap/extension-horizontal-rule');
|
|
15
|
+
var _extensionitalic = require('@tiptap/extension-italic');
|
|
16
|
+
var _extensionlistitem = require('@tiptap/extension-list-item');
|
|
17
|
+
var _extensionorderedlist = require('@tiptap/extension-ordered-list');
|
|
18
|
+
var _extensionparagraph = require('@tiptap/extension-paragraph');
|
|
19
|
+
var _extensionstrike = require('@tiptap/extension-strike');
|
|
20
|
+
var _extensiontext = require('@tiptap/extension-text');
|
|
21
|
+
var StarterKit = _core.Extension.create({
|
|
22
|
+
name: "starterKit",
|
|
23
|
+
addExtensions() {
|
|
24
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
25
|
+
const extensions = [];
|
|
26
|
+
if (this.options.blockquote !== false) {
|
|
27
|
+
extensions.push(_extensionblockquote.Blockquote.configure((_a = this.options) == null ? void 0 : _a.blockquote));
|
|
28
|
+
}
|
|
29
|
+
if (this.options.bold !== false) {
|
|
30
|
+
extensions.push(_extensionbold.Bold.configure((_b = this.options) == null ? void 0 : _b.bold));
|
|
31
|
+
}
|
|
32
|
+
if (this.options.bulletList !== false) {
|
|
33
|
+
extensions.push(_extensionbulletlist.BulletList.configure((_c = this.options) == null ? void 0 : _c.bulletList));
|
|
34
|
+
}
|
|
35
|
+
if (this.options.code !== false) {
|
|
36
|
+
extensions.push(_extensioncode.Code.configure((_d = this.options) == null ? void 0 : _d.code));
|
|
37
|
+
}
|
|
38
|
+
if (this.options.codeBlock !== false) {
|
|
39
|
+
extensions.push(_extensioncodeblock.CodeBlock.configure((_e = this.options) == null ? void 0 : _e.codeBlock));
|
|
40
|
+
}
|
|
41
|
+
if (this.options.document !== false) {
|
|
42
|
+
extensions.push(_extensiondocument.Document.configure((_f = this.options) == null ? void 0 : _f.document));
|
|
43
|
+
}
|
|
44
|
+
if (this.options.dropcursor !== false) {
|
|
45
|
+
extensions.push(_extensiondropcursor.Dropcursor.configure((_g = this.options) == null ? void 0 : _g.dropcursor));
|
|
46
|
+
}
|
|
47
|
+
if (this.options.gapcursor !== false) {
|
|
48
|
+
extensions.push(_extensiongapcursor.Gapcursor.configure((_h = this.options) == null ? void 0 : _h.gapcursor));
|
|
49
|
+
}
|
|
50
|
+
if (this.options.hardBreak !== false) {
|
|
51
|
+
extensions.push(_extensionhardbreak.HardBreak.configure((_i = this.options) == null ? void 0 : _i.hardBreak));
|
|
52
|
+
}
|
|
53
|
+
if (this.options.heading !== false) {
|
|
54
|
+
extensions.push(_extensionheading.Heading.configure((_j = this.options) == null ? void 0 : _j.heading));
|
|
55
|
+
}
|
|
56
|
+
if (this.options.history !== false) {
|
|
57
|
+
extensions.push(_extensionhistory.History.configure((_k = this.options) == null ? void 0 : _k.history));
|
|
58
|
+
}
|
|
59
|
+
if (this.options.horizontalRule !== false) {
|
|
60
|
+
extensions.push(_extensionhorizontalrule.HorizontalRule.configure((_l = this.options) == null ? void 0 : _l.horizontalRule));
|
|
61
|
+
}
|
|
62
|
+
if (this.options.italic !== false) {
|
|
63
|
+
extensions.push(_extensionitalic.Italic.configure((_m = this.options) == null ? void 0 : _m.italic));
|
|
64
|
+
}
|
|
65
|
+
if (this.options.listItem !== false) {
|
|
66
|
+
extensions.push(_extensionlistitem.ListItem.configure((_n = this.options) == null ? void 0 : _n.listItem));
|
|
67
|
+
}
|
|
68
|
+
if (this.options.orderedList !== false) {
|
|
69
|
+
extensions.push(_extensionorderedlist.OrderedList.configure((_o = this.options) == null ? void 0 : _o.orderedList));
|
|
70
|
+
}
|
|
71
|
+
if (this.options.paragraph !== false) {
|
|
72
|
+
extensions.push(_extensionparagraph.Paragraph.configure((_p = this.options) == null ? void 0 : _p.paragraph));
|
|
73
|
+
}
|
|
74
|
+
if (this.options.strike !== false) {
|
|
75
|
+
extensions.push(_extensionstrike.Strike.configure((_q = this.options) == null ? void 0 : _q.strike));
|
|
76
|
+
}
|
|
77
|
+
if (this.options.text !== false) {
|
|
78
|
+
extensions.push(_extensiontext.Text.configure((_r = this.options) == null ? void 0 : _r.text));
|
|
79
|
+
}
|
|
80
|
+
return extensions;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// src/index.ts
|
|
85
|
+
var src_default = StarterKit;
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
exports.StarterKit = StarterKit; exports.default = src_default;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
import { BlockquoteOptions } from '@tiptap/extension-blockquote';
|
|
3
|
+
import { BoldOptions } from '@tiptap/extension-bold';
|
|
4
|
+
import { BulletListOptions } from '@tiptap/extension-bullet-list';
|
|
5
|
+
import { CodeOptions } from '@tiptap/extension-code';
|
|
6
|
+
import { CodeBlockOptions } from '@tiptap/extension-code-block';
|
|
7
|
+
import { DropcursorOptions } from '@tiptap/extension-dropcursor';
|
|
8
|
+
import { HardBreakOptions } from '@tiptap/extension-hard-break';
|
|
9
|
+
import { HeadingOptions } from '@tiptap/extension-heading';
|
|
10
|
+
import { HistoryOptions } from '@tiptap/extension-history';
|
|
11
|
+
import { HorizontalRuleOptions } from '@tiptap/extension-horizontal-rule';
|
|
12
|
+
import { ItalicOptions } from '@tiptap/extension-italic';
|
|
13
|
+
import { ListItemOptions } from '@tiptap/extension-list-item';
|
|
14
|
+
import { OrderedListOptions } from '@tiptap/extension-ordered-list';
|
|
15
|
+
import { ParagraphOptions } from '@tiptap/extension-paragraph';
|
|
16
|
+
import { StrikeOptions } from '@tiptap/extension-strike';
|
|
17
|
+
|
|
18
|
+
interface StarterKitOptions {
|
|
19
|
+
blockquote: Partial<BlockquoteOptions> | false;
|
|
20
|
+
bold: Partial<BoldOptions> | false;
|
|
21
|
+
bulletList: Partial<BulletListOptions> | false;
|
|
22
|
+
code: Partial<CodeOptions> | false;
|
|
23
|
+
codeBlock: Partial<CodeBlockOptions> | false;
|
|
24
|
+
document: false;
|
|
25
|
+
dropcursor: Partial<DropcursorOptions> | false;
|
|
26
|
+
gapcursor: false;
|
|
27
|
+
hardBreak: Partial<HardBreakOptions> | false;
|
|
28
|
+
heading: Partial<HeadingOptions> | false;
|
|
29
|
+
history: Partial<HistoryOptions> | false;
|
|
30
|
+
horizontalRule: Partial<HorizontalRuleOptions> | false;
|
|
31
|
+
italic: Partial<ItalicOptions> | false;
|
|
32
|
+
listItem: Partial<ListItemOptions> | false;
|
|
33
|
+
orderedList: Partial<OrderedListOptions> | false;
|
|
34
|
+
paragraph: Partial<ParagraphOptions> | false;
|
|
35
|
+
strike: Partial<StrikeOptions> | false;
|
|
36
|
+
text: false;
|
|
37
|
+
}
|
|
38
|
+
declare const StarterKit: Extension<StarterKitOptions, any>;
|
|
39
|
+
|
|
40
|
+
export { StarterKit, StarterKitOptions, StarterKit as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// src/starter-kit.ts
|
|
2
|
+
import { Extension } from "@tiptap/core";
|
|
3
|
+
import { Blockquote } from "@tiptap/extension-blockquote";
|
|
4
|
+
import { Bold } from "@tiptap/extension-bold";
|
|
5
|
+
import { BulletList } from "@tiptap/extension-bullet-list";
|
|
6
|
+
import { Code } from "@tiptap/extension-code";
|
|
7
|
+
import { CodeBlock } from "@tiptap/extension-code-block";
|
|
8
|
+
import { Document } from "@tiptap/extension-document";
|
|
9
|
+
import { Dropcursor } from "@tiptap/extension-dropcursor";
|
|
10
|
+
import { Gapcursor } from "@tiptap/extension-gapcursor";
|
|
11
|
+
import { HardBreak } from "@tiptap/extension-hard-break";
|
|
12
|
+
import { Heading } from "@tiptap/extension-heading";
|
|
13
|
+
import { History } from "@tiptap/extension-history";
|
|
14
|
+
import { HorizontalRule } from "@tiptap/extension-horizontal-rule";
|
|
15
|
+
import { Italic } from "@tiptap/extension-italic";
|
|
16
|
+
import { ListItem } from "@tiptap/extension-list-item";
|
|
17
|
+
import { OrderedList } from "@tiptap/extension-ordered-list";
|
|
18
|
+
import { Paragraph } from "@tiptap/extension-paragraph";
|
|
19
|
+
import { Strike } from "@tiptap/extension-strike";
|
|
20
|
+
import { Text } from "@tiptap/extension-text";
|
|
21
|
+
var StarterKit = Extension.create({
|
|
22
|
+
name: "starterKit",
|
|
23
|
+
addExtensions() {
|
|
24
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
25
|
+
const extensions = [];
|
|
26
|
+
if (this.options.blockquote !== false) {
|
|
27
|
+
extensions.push(Blockquote.configure((_a = this.options) == null ? void 0 : _a.blockquote));
|
|
28
|
+
}
|
|
29
|
+
if (this.options.bold !== false) {
|
|
30
|
+
extensions.push(Bold.configure((_b = this.options) == null ? void 0 : _b.bold));
|
|
31
|
+
}
|
|
32
|
+
if (this.options.bulletList !== false) {
|
|
33
|
+
extensions.push(BulletList.configure((_c = this.options) == null ? void 0 : _c.bulletList));
|
|
34
|
+
}
|
|
35
|
+
if (this.options.code !== false) {
|
|
36
|
+
extensions.push(Code.configure((_d = this.options) == null ? void 0 : _d.code));
|
|
37
|
+
}
|
|
38
|
+
if (this.options.codeBlock !== false) {
|
|
39
|
+
extensions.push(CodeBlock.configure((_e = this.options) == null ? void 0 : _e.codeBlock));
|
|
40
|
+
}
|
|
41
|
+
if (this.options.document !== false) {
|
|
42
|
+
extensions.push(Document.configure((_f = this.options) == null ? void 0 : _f.document));
|
|
43
|
+
}
|
|
44
|
+
if (this.options.dropcursor !== false) {
|
|
45
|
+
extensions.push(Dropcursor.configure((_g = this.options) == null ? void 0 : _g.dropcursor));
|
|
46
|
+
}
|
|
47
|
+
if (this.options.gapcursor !== false) {
|
|
48
|
+
extensions.push(Gapcursor.configure((_h = this.options) == null ? void 0 : _h.gapcursor));
|
|
49
|
+
}
|
|
50
|
+
if (this.options.hardBreak !== false) {
|
|
51
|
+
extensions.push(HardBreak.configure((_i = this.options) == null ? void 0 : _i.hardBreak));
|
|
52
|
+
}
|
|
53
|
+
if (this.options.heading !== false) {
|
|
54
|
+
extensions.push(Heading.configure((_j = this.options) == null ? void 0 : _j.heading));
|
|
55
|
+
}
|
|
56
|
+
if (this.options.history !== false) {
|
|
57
|
+
extensions.push(History.configure((_k = this.options) == null ? void 0 : _k.history));
|
|
58
|
+
}
|
|
59
|
+
if (this.options.horizontalRule !== false) {
|
|
60
|
+
extensions.push(HorizontalRule.configure((_l = this.options) == null ? void 0 : _l.horizontalRule));
|
|
61
|
+
}
|
|
62
|
+
if (this.options.italic !== false) {
|
|
63
|
+
extensions.push(Italic.configure((_m = this.options) == null ? void 0 : _m.italic));
|
|
64
|
+
}
|
|
65
|
+
if (this.options.listItem !== false) {
|
|
66
|
+
extensions.push(ListItem.configure((_n = this.options) == null ? void 0 : _n.listItem));
|
|
67
|
+
}
|
|
68
|
+
if (this.options.orderedList !== false) {
|
|
69
|
+
extensions.push(OrderedList.configure((_o = this.options) == null ? void 0 : _o.orderedList));
|
|
70
|
+
}
|
|
71
|
+
if (this.options.paragraph !== false) {
|
|
72
|
+
extensions.push(Paragraph.configure((_p = this.options) == null ? void 0 : _p.paragraph));
|
|
73
|
+
}
|
|
74
|
+
if (this.options.strike !== false) {
|
|
75
|
+
extensions.push(Strike.configure((_q = this.options) == null ? void 0 : _q.strike));
|
|
76
|
+
}
|
|
77
|
+
if (this.options.text !== false) {
|
|
78
|
+
extensions.push(Text.configure((_r = this.options) == null ? void 0 : _r.text));
|
|
79
|
+
}
|
|
80
|
+
return extensions;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// src/index.ts
|
|
85
|
+
var src_default = StarterKit;
|
|
86
|
+
export {
|
|
87
|
+
StarterKit,
|
|
88
|
+
src_default as default
|
|
89
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/starter-kit",
|
|
3
3
|
"description": "starter kit for tiptap",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.211",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -12,35 +12,59 @@
|
|
|
12
12
|
"type": "github",
|
|
13
13
|
"url": "https://github.com/sponsors/ueberdosis"
|
|
14
14
|
},
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"require": "./dist/index.cjs"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"main": "dist/index.cjs",
|
|
23
|
+
"module": "dist/index.js",
|
|
24
|
+
"types": "dist/index.d.ts",
|
|
25
|
+
"type": "module",
|
|
20
26
|
"files": [
|
|
21
27
|
"src",
|
|
22
28
|
"dist"
|
|
23
29
|
],
|
|
24
30
|
"dependencies": {
|
|
25
|
-
"@tiptap/core": "^2.0.0-beta.
|
|
26
|
-
"@tiptap/extension-blockquote": "^2.0.0-beta.
|
|
27
|
-
"@tiptap/extension-bold": "^2.0.0-beta.
|
|
28
|
-
"@tiptap/extension-bullet-list": "^2.0.0-beta.
|
|
29
|
-
"@tiptap/extension-code": "^2.0.0-beta.
|
|
30
|
-
"@tiptap/extension-code-block": "^2.0.0-beta.
|
|
31
|
-
"@tiptap/extension-document": "^2.0.0-beta.
|
|
32
|
-
"@tiptap/extension-dropcursor": "^2.0.0-beta.
|
|
33
|
-
"@tiptap/extension-gapcursor": "^2.0.0-beta.
|
|
34
|
-
"@tiptap/extension-hard-break": "^2.0.0-beta.
|
|
35
|
-
"@tiptap/extension-heading": "^2.0.0-beta.
|
|
36
|
-
"@tiptap/extension-history": "^2.0.0-beta.
|
|
37
|
-
"@tiptap/extension-horizontal-rule": "^2.0.0-beta.
|
|
38
|
-
"@tiptap/extension-italic": "^2.0.0-beta.
|
|
39
|
-
"@tiptap/extension-list-item": "^2.0.0-beta.
|
|
40
|
-
"@tiptap/extension-ordered-list": "^2.0.0-beta.
|
|
41
|
-
"@tiptap/extension-paragraph": "^2.0.0-beta.
|
|
42
|
-
"@tiptap/extension-strike": "^2.0.0-beta.
|
|
43
|
-
"@tiptap/extension-text": "^2.0.0-beta.
|
|
31
|
+
"@tiptap/core": "^2.0.0-beta.211",
|
|
32
|
+
"@tiptap/extension-blockquote": "^2.0.0-beta.211",
|
|
33
|
+
"@tiptap/extension-bold": "^2.0.0-beta.211",
|
|
34
|
+
"@tiptap/extension-bullet-list": "^2.0.0-beta.211",
|
|
35
|
+
"@tiptap/extension-code": "^2.0.0-beta.211",
|
|
36
|
+
"@tiptap/extension-code-block": "^2.0.0-beta.211",
|
|
37
|
+
"@tiptap/extension-document": "^2.0.0-beta.211",
|
|
38
|
+
"@tiptap/extension-dropcursor": "^2.0.0-beta.211",
|
|
39
|
+
"@tiptap/extension-gapcursor": "^2.0.0-beta.211",
|
|
40
|
+
"@tiptap/extension-hard-break": "^2.0.0-beta.211",
|
|
41
|
+
"@tiptap/extension-heading": "^2.0.0-beta.211",
|
|
42
|
+
"@tiptap/extension-history": "^2.0.0-beta.211",
|
|
43
|
+
"@tiptap/extension-horizontal-rule": "^2.0.0-beta.211",
|
|
44
|
+
"@tiptap/extension-italic": "^2.0.0-beta.211",
|
|
45
|
+
"@tiptap/extension-list-item": "^2.0.0-beta.211",
|
|
46
|
+
"@tiptap/extension-ordered-list": "^2.0.0-beta.211",
|
|
47
|
+
"@tiptap/extension-paragraph": "^2.0.0-beta.211",
|
|
48
|
+
"@tiptap/extension-strike": "^2.0.0-beta.211",
|
|
49
|
+
"@tiptap/extension-text": "^2.0.0-beta.211"
|
|
50
|
+
},
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "https://github.com/ueberdosis/tiptap",
|
|
54
|
+
"directory": "packages/starter-kit"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsup"
|
|
44
58
|
},
|
|
45
|
-
"
|
|
59
|
+
"tsup": {
|
|
60
|
+
"entry": [
|
|
61
|
+
"src/index.ts"
|
|
62
|
+
],
|
|
63
|
+
"dts": true,
|
|
64
|
+
"splitting": true,
|
|
65
|
+
"format": [
|
|
66
|
+
"esm",
|
|
67
|
+
"cjs"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
46
70
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,57 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Gapcursor from '@tiptap/extension-gapcursor'
|
|
3
|
-
import Document from '@tiptap/extension-document'
|
|
4
|
-
import Paragraph, { ParagraphOptions } from '@tiptap/extension-paragraph'
|
|
5
|
-
import Text from '@tiptap/extension-text'
|
|
6
|
-
import History, { HistoryOptions } from '@tiptap/extension-history'
|
|
7
|
-
import Bold, { BoldOptions } from '@tiptap/extension-bold'
|
|
8
|
-
import Italic, { ItalicOptions } from '@tiptap/extension-italic'
|
|
9
|
-
import Code, { CodeOptions } from '@tiptap/extension-code'
|
|
10
|
-
import CodeBlock, { CodeBlockOptions } from '@tiptap/extension-code-block'
|
|
11
|
-
import Heading, { HeadingOptions } from '@tiptap/extension-heading'
|
|
12
|
-
import HardBreak, { HardBreakOptions } from '@tiptap/extension-hard-break'
|
|
13
|
-
import Strike, { StrikeOptions } from '@tiptap/extension-strike'
|
|
14
|
-
import Blockquote, { BlockquoteOptions } from '@tiptap/extension-blockquote'
|
|
15
|
-
import HorizontalRule, { HorizontalRuleOptions } from '@tiptap/extension-horizontal-rule'
|
|
16
|
-
import BulletList, { BulletListOptions } from '@tiptap/extension-bullet-list'
|
|
17
|
-
import OrderedList, { OrderedListOptions } from '@tiptap/extension-ordered-list'
|
|
18
|
-
import ListItem, { ListItemOptions } from '@tiptap/extension-list-item'
|
|
1
|
+
import { StarterKit } from './starter-kit'
|
|
19
2
|
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
bold: Partial<BoldOptions>,
|
|
25
|
-
italic: Partial<ItalicOptions>,
|
|
26
|
-
code: Partial<CodeOptions>,
|
|
27
|
-
codeBlock: Partial<CodeBlockOptions>,
|
|
28
|
-
heading: Partial<HeadingOptions>,
|
|
29
|
-
hardBreak: Partial<HardBreakOptions>,
|
|
30
|
-
strike: Partial<StrikeOptions>,
|
|
31
|
-
blockquote: Partial<BlockquoteOptions>,
|
|
32
|
-
horizontalRule: Partial<HorizontalRuleOptions>,
|
|
33
|
-
bulletList: Partial<BulletListOptions>,
|
|
34
|
-
orderedList: Partial<OrderedListOptions>,
|
|
35
|
-
listItem: Partial<ListItemOptions>,
|
|
36
|
-
}>) {
|
|
37
|
-
return [
|
|
38
|
-
Document,
|
|
39
|
-
Paragraph.configure(options?.paragraph),
|
|
40
|
-
Text,
|
|
41
|
-
Bold.configure(options?.bold),
|
|
42
|
-
Italic.configure(options?.italic),
|
|
43
|
-
Code.configure(options?.code),
|
|
44
|
-
Strike.configure(options?.strike),
|
|
45
|
-
HardBreak.configure(options?.hardBreak),
|
|
46
|
-
Heading.configure(options?.heading),
|
|
47
|
-
Blockquote.configure(options?.blockquote),
|
|
48
|
-
BulletList.configure(options?.bulletList),
|
|
49
|
-
OrderedList.configure(options?.orderedList),
|
|
50
|
-
ListItem.configure(options?.listItem),
|
|
51
|
-
HorizontalRule.configure(options?.horizontalRule),
|
|
52
|
-
CodeBlock.configure(options?.codeBlock),
|
|
53
|
-
History.configure(options?.history),
|
|
54
|
-
Dropcursor.configure(options?.dropcursor),
|
|
55
|
-
Gapcursor,
|
|
56
|
-
]
|
|
57
|
-
}
|
|
3
|
+
export type { StarterKitOptions } from './starter-kit'
|
|
4
|
+
export * from './starter-kit'
|
|
5
|
+
|
|
6
|
+
export default StarterKit
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core'
|
|
2
|
+
import { Blockquote, BlockquoteOptions } from '@tiptap/extension-blockquote'
|
|
3
|
+
import { Bold, BoldOptions } from '@tiptap/extension-bold'
|
|
4
|
+
import { BulletList, BulletListOptions } from '@tiptap/extension-bullet-list'
|
|
5
|
+
import { Code, CodeOptions } from '@tiptap/extension-code'
|
|
6
|
+
import { CodeBlock, CodeBlockOptions } from '@tiptap/extension-code-block'
|
|
7
|
+
import { Document } from '@tiptap/extension-document'
|
|
8
|
+
import { Dropcursor, DropcursorOptions } from '@tiptap/extension-dropcursor'
|
|
9
|
+
import { Gapcursor } from '@tiptap/extension-gapcursor'
|
|
10
|
+
import { HardBreak, HardBreakOptions } from '@tiptap/extension-hard-break'
|
|
11
|
+
import { Heading, HeadingOptions } from '@tiptap/extension-heading'
|
|
12
|
+
import { History, HistoryOptions } from '@tiptap/extension-history'
|
|
13
|
+
import { HorizontalRule, HorizontalRuleOptions } from '@tiptap/extension-horizontal-rule'
|
|
14
|
+
import { Italic, ItalicOptions } from '@tiptap/extension-italic'
|
|
15
|
+
import { ListItem, ListItemOptions } from '@tiptap/extension-list-item'
|
|
16
|
+
import { OrderedList, OrderedListOptions } from '@tiptap/extension-ordered-list'
|
|
17
|
+
import { Paragraph, ParagraphOptions } from '@tiptap/extension-paragraph'
|
|
18
|
+
import { Strike, StrikeOptions } from '@tiptap/extension-strike'
|
|
19
|
+
import { Text } from '@tiptap/extension-text'
|
|
20
|
+
|
|
21
|
+
export interface StarterKitOptions {
|
|
22
|
+
blockquote: Partial<BlockquoteOptions> | false,
|
|
23
|
+
bold: Partial<BoldOptions> | false,
|
|
24
|
+
bulletList: Partial<BulletListOptions> | false,
|
|
25
|
+
code: Partial<CodeOptions> | false,
|
|
26
|
+
codeBlock: Partial<CodeBlockOptions> | false,
|
|
27
|
+
document: false,
|
|
28
|
+
dropcursor: Partial<DropcursorOptions> | false,
|
|
29
|
+
gapcursor: false,
|
|
30
|
+
hardBreak: Partial<HardBreakOptions> | false,
|
|
31
|
+
heading: Partial<HeadingOptions> | false,
|
|
32
|
+
history: Partial<HistoryOptions> | false,
|
|
33
|
+
horizontalRule: Partial<HorizontalRuleOptions> | false,
|
|
34
|
+
italic: Partial<ItalicOptions> | false,
|
|
35
|
+
listItem: Partial<ListItemOptions> | false,
|
|
36
|
+
orderedList: Partial<OrderedListOptions> | false,
|
|
37
|
+
paragraph: Partial<ParagraphOptions> | false,
|
|
38
|
+
strike: Partial<StrikeOptions> | false,
|
|
39
|
+
text: false,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const StarterKit = Extension.create<StarterKitOptions>({
|
|
43
|
+
name: 'starterKit',
|
|
44
|
+
|
|
45
|
+
addExtensions() {
|
|
46
|
+
const extensions = []
|
|
47
|
+
|
|
48
|
+
if (this.options.blockquote !== false) {
|
|
49
|
+
extensions.push(Blockquote.configure(this.options?.blockquote))
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (this.options.bold !== false) {
|
|
53
|
+
extensions.push(Bold.configure(this.options?.bold))
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (this.options.bulletList !== false) {
|
|
57
|
+
extensions.push(BulletList.configure(this.options?.bulletList))
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (this.options.code !== false) {
|
|
61
|
+
extensions.push(Code.configure(this.options?.code))
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (this.options.codeBlock !== false) {
|
|
65
|
+
extensions.push(CodeBlock.configure(this.options?.codeBlock))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (this.options.document !== false) {
|
|
69
|
+
extensions.push(Document.configure(this.options?.document))
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (this.options.dropcursor !== false) {
|
|
73
|
+
extensions.push(Dropcursor.configure(this.options?.dropcursor))
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (this.options.gapcursor !== false) {
|
|
77
|
+
extensions.push(Gapcursor.configure(this.options?.gapcursor))
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (this.options.hardBreak !== false) {
|
|
81
|
+
extensions.push(HardBreak.configure(this.options?.hardBreak))
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (this.options.heading !== false) {
|
|
85
|
+
extensions.push(Heading.configure(this.options?.heading))
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (this.options.history !== false) {
|
|
89
|
+
extensions.push(History.configure(this.options?.history))
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (this.options.horizontalRule !== false) {
|
|
93
|
+
extensions.push(HorizontalRule.configure(this.options?.horizontalRule))
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (this.options.italic !== false) {
|
|
97
|
+
extensions.push(Italic.configure(this.options?.italic))
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (this.options.listItem !== false) {
|
|
101
|
+
extensions.push(ListItem.configure(this.options?.listItem))
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (this.options.orderedList !== false) {
|
|
105
|
+
extensions.push(OrderedList.configure(this.options?.orderedList))
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (this.options.paragraph !== false) {
|
|
109
|
+
extensions.push(Paragraph.configure(this.options?.paragraph))
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (this.options.strike !== false) {
|
|
113
|
+
extensions.push(Strike.configure(this.options?.strike))
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (this.options.text !== false) {
|
|
117
|
+
extensions.push(Text.configure(this.options?.text))
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return extensions
|
|
121
|
+
},
|
|
122
|
+
})
|