mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 14:13:21 +08:00
register ParagraphCommand
This commit is contained in:
parent
d7db24a199
commit
188824c0bb
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user