register ParagraphCommand

This commit is contained in:
Hans Pagel 2020-09-24 19:07:47 +02:00
parent d7db24a199
commit 188824c0bb

View File

@ -1,6 +1,14 @@
import { Node } from '@tiptap/core'
import { Command, Node } from '@tiptap/core'
// import ParagraphComponent from './paragraph.vue'
export type ParagraphCommand = () => Command
declare module '@tiptap/core/src/Editor' {
interface Commands {
paragraph: ParagraphCommand,
}
}
export default new Node()
.name('paragraph')
.schema(() => ({
@ -15,9 +23,7 @@ export default new Node()
return commands.toggleNode(name, 'paragraph')
},
}))
.keys(({ editor, name }) => ({
// Exception: TS2339: Property 'paragraph' does not exist on type 'Editor'.
// 'Mod-Alt-0': () => editor.paragraph(),
'Mod-Alt-0': () => editor.toggleNode(name, 'paragraph'),
.keys(({ editor }) => ({
'Mod-Alt-0': () => editor.paragraph(),
}))
.create()