mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-13 09:29:01 +08:00
31 lines
399 B
JavaScript
31 lines
399 B
JavaScript
import { Node } from 'tiptap/utils'
|
|
|
|
export default class MentionNode extends Node {
|
|
|
|
get name() {
|
|
return 'mention'
|
|
}
|
|
|
|
get schema() {
|
|
return {
|
|
attrs: {
|
|
id: {
|
|
default: null,
|
|
},
|
|
},
|
|
group: 'inline',
|
|
inline: true,
|
|
draggable: true,
|
|
toDOM: node => [
|
|
'span',
|
|
{
|
|
dataId: node.attrs.id,
|
|
class: 'mention',
|
|
},
|
|
`@${node.attrs.id}`,
|
|
],
|
|
}
|
|
}
|
|
|
|
}
|