add basic node interface

This commit is contained in:
Philipp Kühn
2020-10-12 10:32:54 +02:00
parent 8324f57528
commit 41d68ec859
4 changed files with 38 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
import { Command, Node } from '@tiptap/core'
import { Command, Node, INode } from '@tiptap/core'
import { DOMOutputSpecArray } from 'prosemirror-model'
// import ParagraphComponent from './paragraph.vue'
// export type ParagraphCommand = () => Command
@@ -28,7 +29,7 @@ import { Command, Node } from '@tiptap/core'
// }))
// .create()
export default class Paragraph extends Node {
export default class Paragraph extends Node implements INode {
name = 'paragraph'
@@ -36,6 +37,15 @@ export default class Paragraph extends Node {
content = 'inline*'
createAttributes() {
return {
// default rendering
class: {
default: 'jooo',
},
}
}
parseHTML() {
return [
{ tag: 'p' },
@@ -43,7 +53,7 @@ export default class Paragraph extends Node {
}
renderHTML() {
return ['p', 0]
return ['p', 0] as const
}
}