refactoring

This commit is contained in:
Philipp Kühn
2018-09-29 11:57:49 +02:00
parent 0bcdfb8096
commit 1ad2b6aa78
3 changed files with 17 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
import { Node } from 'tiptap'
import { replaceText } from 'tiptap-commands'
import { triggerCharacter, suggestionsPlugin } from '../plugins/suggestions'
import { suggestionsPlugin } from '../plugins/suggestions'
export default class MentionNode extends Node {
@@ -43,10 +43,11 @@ export default class MentionNode extends Node {
return [
suggestionsPlugin({
suggestionClass: 'mention-suggestion',
matcher: triggerCharacter('@', {
matcher: {
char: '@',
allowSpaces: false,
startOfLine: false,
}),
},
command: ({ position, attrs, schema }) => {
return replaceText(position, schema.nodes.mention, attrs)
},