tiptap/packages/starter-kit/src/index.ts

58 lines
2.4 KiB
TypeScript
Raw Normal View History

2020-11-26 06:35:23 +08:00
import Dropcursor, { DropcursorOptions } from '@tiptap/extension-dropcursor'
import Gapcursor from '@tiptap/extension-gapcursor'
2020-03-28 05:04:02 +08:00
import Document from '@tiptap/extension-document'
2020-11-26 06:35:23 +08:00
import Paragraph, { ParagraphOptions } from '@tiptap/extension-paragraph'
2020-03-28 05:04:02 +08:00
import Text from '@tiptap/extension-text'
import History, { HistoryOptions } from '@tiptap/extension-history'
2020-11-26 06:35:23 +08:00
import Bold, { BoldOptions } from '@tiptap/extension-bold'
import Italic, { ItalicOptions } from '@tiptap/extension-italic'
import Code, { CodeOptions } from '@tiptap/extension-code'
import CodeBlock, { CodeBlockOptions } from '@tiptap/extension-code-block'
import Heading, { HeadingOptions } from '@tiptap/extension-heading'
2020-11-26 06:35:23 +08:00
import HardBreak, { HardBreakOptions } from '@tiptap/extension-hard-break'
import Strike, { StrikeOptions } from '@tiptap/extension-strike'
import Blockquote, { BlockquoteOptions } from '@tiptap/extension-blockquote'
import HorizontalRule, { HorizontalRuleOptions } from '@tiptap/extension-horizontal-rule'
import BulletList, { BulletListOptions } from '@tiptap/extension-bullet-list'
import OrderedList, { OrderedListOptions } from '@tiptap/extension-ordered-list'
import ListItem, { ListItemOptions } from '@tiptap/extension-list-item'
2020-03-06 19:18:20 +08:00
2020-12-19 05:54:15 +08:00
export function defaultExtensions(options?: Partial<{
2020-11-26 06:35:23 +08:00
dropursor: DropcursorOptions,
paragraph: ParagraphOptions,
history: HistoryOptions,
2020-11-26 06:35:23 +08:00
bold: BoldOptions,
italic: ItalicOptions,
code: CodeOptions,
codeBlock: CodeBlockOptions,
heading: HeadingOptions,
2020-11-26 06:35:23 +08:00
hardBreak: HardBreakOptions,
strike: StrikeOptions,
blockquote: BlockquoteOptions,
horizontalRule: HorizontalRuleOptions,
bulletList: BulletListOptions,
orderedList: OrderedListOptions,
listItem: ListItemOptions,
2020-12-19 05:54:15 +08:00
}>) {
2020-03-06 19:18:20 +08:00
return [
2020-11-16 06:25:25 +08:00
Document,
2020-11-26 06:35:23 +08:00
Paragraph.configure(options?.paragraph),
2020-11-16 06:25:25 +08:00
Text,
2020-11-26 06:35:23 +08:00
Bold.configure(options?.bold),
Italic.configure(options?.italic),
Code.configure(options?.code),
Strike.configure(options?.strike),
2021-01-29 00:39:57 +08:00
HardBreak.configure(options?.hardBreak),
Heading.configure(options?.heading),
2020-11-26 06:35:23 +08:00
Blockquote.configure(options?.blockquote),
BulletList.configure(options?.bulletList),
OrderedList.configure(options?.orderedList),
ListItem.configure(options?.listItem),
2021-01-29 00:39:57 +08:00
HorizontalRule.configure(options?.horizontalRule),
CodeBlock.configure(options?.codeBlock),
History.configure(options?.history),
Dropcursor.configure(options?.dropursor),
Gapcursor,
2020-03-06 19:18:20 +08:00
]
2020-09-24 06:29:05 +08:00
}