mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 22:36:14 +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'
|
// import ParagraphComponent from './paragraph.vue'
|
||||||
|
|
||||||
|
export type ParagraphCommand = () => Command
|
||||||
|
|
||||||
|
declare module '@tiptap/core/src/Editor' {
|
||||||
|
interface Commands {
|
||||||
|
paragraph: ParagraphCommand,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default new Node()
|
export default new Node()
|
||||||
.name('paragraph')
|
.name('paragraph')
|
||||||
.schema(() => ({
|
.schema(() => ({
|
||||||
@ -15,9 +23,7 @@ export default new Node()
|
|||||||
return commands.toggleNode(name, 'paragraph')
|
return commands.toggleNode(name, 'paragraph')
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
.keys(({ editor, name }) => ({
|
.keys(({ editor }) => ({
|
||||||
// Exception: TS2339: Property 'paragraph' does not exist on type 'Editor'.
|
'Mod-Alt-0': () => editor.paragraph(),
|
||||||
// 'Mod-Alt-0': () => editor.paragraph(),
|
|
||||||
'Mod-Alt-0': () => editor.toggleNode(name, 'paragraph'),
|
|
||||||
}))
|
}))
|
||||||
.create()
|
.create()
|
||||||
|
Loading…
Reference in New Issue
Block a user