mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add user block
This commit is contained in:
parent
fe38020f02
commit
31c27bb70e
6 changed files with 336 additions and 4 deletions
|
|
@ -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)
|
||||
},
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue