2020-09-25 01:07:47 +08:00
|
|
|
import { Command, 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-10-10 04:59:25 +08:00
|
|
|
// export type ParagraphCommand = () => Command
|
2020-09-25 01:07:47 +08:00
|
|
|
|
2020-10-10 04:59:25 +08:00
|
|
|
// declare module '@tiptap/core/src/Editor' {
|
|
|
|
// interface Commands {
|
|
|
|
// paragraph: ParagraphCommand,
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// 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.toggleBlockType(name, 'paragraph')
|
|
|
|
// },
|
|
|
|
// }))
|
|
|
|
// .keys(({ editor }) => ({
|
|
|
|
// 'Mod-Alt-0': () => editor.paragraph(),
|
|
|
|
// }))
|
|
|
|
// .create()
|
|
|
|
|
|
|
|
export default class Paragraph extends Node {
|
|
|
|
|
|
|
|
name = 'paragraph'
|
|
|
|
|
|
|
|
group = 'block'
|
|
|
|
|
|
|
|
content = 'inline*'
|
|
|
|
|
|
|
|
parseHTML() {
|
|
|
|
return [
|
|
|
|
{ tag: 'p' },
|
|
|
|
]
|
2020-09-25 01:07:47 +08:00
|
|
|
}
|
|
|
|
|
2020-10-10 04:59:25 +08:00
|
|
|
renderHTML() {
|
|
|
|
return ['p', 0]
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|