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