add some more commands

This commit is contained in:
Philipp Kühn
2020-09-21 23:17:30 +02:00
parent 778e064979
commit 4da71ecfbb
27 changed files with 207 additions and 210 deletions

View File

@@ -1,8 +1,10 @@
import { Mark, markInputRule, markPasteRule } from '@tiptap/core'
import { Command, Mark, markInputRule, markPasteRule } from '@tiptap/core'
export type BoldCommand = () => Command
declare module '@tiptap/core/src/Editor' {
interface Editor {
bold(): Editor,
bold: BoldCommand,
}
}
@@ -29,10 +31,9 @@ export default new Mark()
],
toDOM: () => ['strong', 0],
}))
.commands(({ editor, name }) => ({
bold: next => () => {
editor.toggleMark(name)
next()
.commands(({ name }) => ({
bold: () => ({ commands }) => {
return commands.toggleMark(name)
},
}))
.keys(({ editor }) => ({