diff --git a/docs/src/demos/Nodes/Mention/MentionList.vue b/docs/src/demos/Nodes/Mention/MentionList.vue index 14078872..c48104fd 100644 --- a/docs/src/demos/Nodes/Mention/MentionList.vue +++ b/docs/src/demos/Nodes/Mention/MentionList.vue @@ -104,8 +104,8 @@ export default { &.is-selected, &:hover { - color: black; - background: rgba(black, 0.1); + color: #A975FF; + background: rgba(#A975FF, 0.1); } } diff --git a/docs/src/demos/Nodes/Mention/index.vue b/docs/src/demos/Nodes/Mention/index.vue index bdf54159..900e9800 100644 --- a/docs/src/demos/Nodes/Mention/index.vue +++ b/docs/src/demos/Nodes/Mention/index.vue @@ -31,6 +31,9 @@ export default { Paragraph, Text, Mention.configure({ + HTMLAttributes: { + class: 'mention', + }, suggestionOptions: { items: query => { return ['Hans', 'Philipp', 'Kris'].filter(item => item.startsWith(query)) @@ -76,7 +79,7 @@ export default { }), ], content: ` -

text

+

Hello and and !

`, }) }, @@ -86,3 +89,12 @@ export default { }, } + + diff --git a/packages/extension-mention/src/mention.ts b/packages/extension-mention/src/mention.ts index 921b4a94..a7412c2c 100644 --- a/packages/extension-mention/src/mention.ts +++ b/packages/extension-mention/src/mention.ts @@ -1,4 +1,4 @@ -import { Node } from '@tiptap/core' +import { Node, mergeAttributes } from '@tiptap/core' import Suggestion, { SuggestionOptions } from '@tiptap/suggestion' export type MentionOptions = { @@ -57,7 +57,7 @@ export const Mention = Node.create({ }, renderHTML({ node, HTMLAttributes }) { - return ['span', HTMLAttributes, `@${node.attrs.id}`] + return ['span', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), `@${node.attrs.id}`] }, renderText({ node }) {