refactoring
This commit is contained in:
@@ -74,11 +74,15 @@ export const Mention = Node.create<MentionOptions>({
|
|||||||
},
|
},
|
||||||
|
|
||||||
renderHTML({ node, HTMLAttributes }) {
|
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 }) {
|
renderText({ node }) {
|
||||||
return `@${node.attrs.id}`
|
return `${this.options.suggestion.char}${node.attrs.id}`
|
||||||
},
|
},
|
||||||
|
|
||||||
addKeyboardShortcuts() {
|
addKeyboardShortcuts() {
|
||||||
@@ -93,7 +97,7 @@ export const Mention = Node.create<MentionOptions>({
|
|||||||
}
|
}
|
||||||
|
|
||||||
state.doc.nodesBetween(anchor - 1, anchor, (node, pos) => {
|
state.doc.nodesBetween(anchor - 1, anchor, (node, pos) => {
|
||||||
if (node.type.name === 'mention') {
|
if (node.type.name === this.name) {
|
||||||
isMention = true
|
isMention = true
|
||||||
tr.insertText(this.options.suggestion.char || '', pos, pos + node.nodeSize)
|
tr.insertText(this.options.suggestion.char || '', pos, pos + node.nodeSize)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user