From e9c9176032468145e2531c87618f49c5462e2991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Wed, 5 May 2021 20:50:08 +0200 Subject: [PATCH] refactoring --- packages/extension-mention/src/mention.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/extension-mention/src/mention.ts b/packages/extension-mention/src/mention.ts index 513fd835..c6165f49 100644 --- a/packages/extension-mention/src/mention.ts +++ b/packages/extension-mention/src/mention.ts @@ -74,11 +74,15 @@ export const Mention = Node.create({ }, renderHTML({ node, HTMLAttributes }) { - return ['span', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), `@${node.attrs.id}`] + return [ + 'span', + mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), + `${this.options.suggestion.char}${node.attrs.id}`, + ] }, renderText({ node }) { - return `@${node.attrs.id}` + return `${this.options.suggestion.char}${node.attrs.id}` }, addKeyboardShortcuts() { @@ -93,7 +97,7 @@ export const Mention = Node.create({ } state.doc.nodesBetween(anchor - 1, anchor, (node, pos) => { - if (node.type.name === 'mention') { + if (node.type.name === this.name) { isMention = true tr.insertText(this.options.suggestion.char || '', pos, pos + node.nodeSize)