tiptap/packages/extension-paragraph/index.ts
2020-10-12 10:32:54 +02:00

60 lines
1.2 KiB
TypeScript

import { Command, Node, INode } from '@tiptap/core'
import { DOMOutputSpecArray } from 'prosemirror-model'
// 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(() => ({
// 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 implements INode {
name = 'paragraph'
group = 'block'
content = 'inline*'
createAttributes() {
return {
// default rendering
class: {
default: 'jooo',
},
}
}
parseHTML() {
return [
{ tag: 'p' },
]
}
renderHTML() {
return ['p', 0] as const
}
}