fix: fix check for showing mention suggestion

This commit is contained in:
Philipp Kühn 2021-10-22 10:09:28 +02:00
parent f6ef4caa14
commit 5e652c94a7

View File

@ -51,7 +51,11 @@ export const Mention = Node.create<MentionOptions>({
.run()
},
allow: ({ editor, range }) => {
return editor.can().insertContentAt(range, { type: 'mention' })
const $from = editor.state.doc.resolve(range.from)
const type = editor.schema.nodes.mention
const allow = !!$from.parent.type.contentMatch.matchType(type)
return allow
},
},
},