add extension options to default extensions

This commit is contained in:
Philipp Kühn 2020-11-11 10:21:25 +01:00
parent 0db8d2cc61
commit fe0842d8c8

View File

@ -3,12 +3,12 @@ import Gapcursor from '@tiptap/extension-gapcursor'
import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
import History from '@tiptap/extension-history'
import History, { HistoryOptions } from '@tiptap/extension-history'
import Bold from '@tiptap/extension-bold'
import Italic from '@tiptap/extension-italic'
import Code from '@tiptap/extension-code'
import CodeBlock from '@tiptap/extension-code-block'
import Heading from '@tiptap/extension-heading'
import CodeBlock, { CodeBlockOptions } from '@tiptap/extension-code-block'
import Heading, { HeadingOptions } from '@tiptap/extension-heading'
import HardBreak from '@tiptap/extension-hard-break'
import Strike from '@tiptap/extension-strike'
import Blockquote from '@tiptap/extension-blockquote'
@ -17,19 +17,23 @@ import BulletList from '@tiptap/extension-bullet-list'
import OrderedList from '@tiptap/extension-ordered-list'
import ListItem from '@tiptap/extension-list-item'
export function defaultExtensions() {
export function defaultExtensions(options: {
history: HistoryOptions,
codeBlock: CodeBlockOptions,
heading: HeadingOptions,
}) {
return [
Dropcursor(),
Gapcursor(),
Document(),
History(),
History(options.history),
Paragraph(),
Text(),
Bold(),
Italic(),
Code(),
CodeBlock(),
Heading(),
CodeBlock(options.codeBlock),
Heading(options.heading),
HardBreak(),
Strike(),
Blockquote(),