Skip to content

Commit

Permalink
fix for data attributes not rendering after pr #4082
Browse files Browse the repository at this point in the history
  • Loading branch information
moham96 committed Mar 15, 2024
1 parent 0be1c5b commit 1ab920f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/api/nodes/mention.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Mention.configure({
renderHTML({ options, node }) {
return [
"a",
{ href: '/profile/1' },
mergeAttributes({ href: '/profile/1' }, options.HTMLAttributes),
`${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`,
];
}
Expand Down
7 changes: 5 additions & 2 deletions packages/extension-mention/src/mention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Mention = Node.create<MentionOptions>({
renderHTML({ options, node }) {
return [
'span',
this.HTMLAttributes,
mergeAttributes(this.HTMLAttributes, options.HTMLAttributes),
`${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`,
]
},
Expand Down Expand Up @@ -131,8 +131,11 @@ export const Mention = Node.create<MentionOptions>({
}),
]
}
const mergedOptions = { ...this.options }

mergedOptions.HTMLAttributes = mergeAttributes({ 'data-type': this.name }, this.options.HTMLAttributes, HTMLAttributes)
const html = this.options.renderHTML({
options: this.options,
options: mergedOptions,
node,
})

Expand Down

0 comments on commit 1ab920f

Please sign in to comment.