feat: add user block

This commit is contained in:
swve 2025-04-01 22:35:17 +02:00
parent fe38020f02
commit 31c27bb70e
6 changed files with 336 additions and 4 deletions

View file

@ -0,0 +1,35 @@
import { mergeAttributes, Node } from '@tiptap/core'
import { ReactNodeViewRenderer } from '@tiptap/react'
import UserBlockComponent from './UserBlockComponent'
export default Node.create({
name: 'blockUser',
group: 'block',
atom: true,
addAttributes() {
return {
user_id: {
default: '',
},
}
},
parseHTML() {
return [
{
tag: 'block-user',
},
]
},
renderHTML({ HTMLAttributes }) {
return ['block-user', mergeAttributes(HTMLAttributes), 0]
},
addNodeView() {
return ReactNodeViewRenderer(UserBlockComponent)
},
})