2020-03-06 03:30:58 +08:00
|
|
|
import { Node } from '@tiptap/core'
|
2020-04-27 15:06:42 +08:00
|
|
|
// import ParagraphComponent from './paragraph.vue'
|
2020-03-06 03:30:58 +08:00
|
|
|
|
2020-09-09 05:44:45 +08:00
|
|
|
export default new Node()
|
|
|
|
.name('paragraph')
|
|
|
|
.schema(() => ({
|
|
|
|
content: 'inline*',
|
|
|
|
group: 'block',
|
|
|
|
parseDOM: [{ tag: 'p' }],
|
|
|
|
toDOM: () => ['p', 0],
|
|
|
|
// toVue: ParagraphComponent,
|
|
|
|
}))
|
2020-09-24 21:27:29 +08:00
|
|
|
.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'),
|
|
|
|
}))
|
2020-09-24 06:29:05 +08:00
|
|
|
.create()
|