mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-24 01:17:50 +08:00
24 lines
666 B
TypeScript
24 lines
666 B
TypeScript
import { Node } from '@tiptap/core'
|
|
// import ParagraphComponent from './paragraph.vue'
|
|
|
|
export default new Node()
|
|
.name('paragraph')
|
|
.schema(() => ({
|
|
content: 'inline*',
|
|
group: 'block',
|
|
parseDOM: [{ tag: 'p' }],
|
|
toDOM: () => ['p', 0],
|
|
// toVue: ParagraphComponent,
|
|
}))
|
|
.commands(({ name }) => ({
|
|
[name]: () => ({ commands }) => {
|
|
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'),
|
|
}))
|
|
.create()
|