mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
34 lines
617 B
TypeScript
34 lines
617 B
TypeScript
import { mergeAttributes, Node } from '@tiptap/core'
|
|
import { ReactNodeViewRenderer } from '@tiptap/react'
|
|
|
|
import VideoBlockComponent from './VideoBlockComponent'
|
|
|
|
export default Node.create({
|
|
name: 'blockVideo',
|
|
group: 'block',
|
|
atom: true,
|
|
|
|
addAttributes() {
|
|
return {
|
|
blockObject: {
|
|
default: null,
|
|
},
|
|
}
|
|
},
|
|
|
|
parseHTML() {
|
|
return [
|
|
{
|
|
tag: 'block-video',
|
|
},
|
|
]
|
|
},
|
|
|
|
renderHTML({ HTMLAttributes }) {
|
|
return ['block-video', mergeAttributes(HTMLAttributes), 0]
|
|
},
|
|
|
|
addNodeView() {
|
|
return ReactNodeViewRenderer(VideoBlockComponent)
|
|
},
|
|
})
|