fix for data attributes not rendering after pr #4082 (#4980)

This commit is contained in:
MOHAMMAD RASIM 2024-04-06 00:54:54 +03:00 committed by GitHub
parent 1bcef0379f
commit 2390cf20c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View File

@ -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}`,
];
}

View File

@ -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}`,
]
},
@ -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,
})