check for simple space only

This commit is contained in:
Philipp Kühn
2021-08-20 21:02:54 +02:00
parent 00dc5ad1f1
commit b7d22bf0dc

View File

@@ -29,9 +29,7 @@ export const Mention = Node.create<MentionOptions>({
// increase range.to by one when the next node is of type "text" // increase range.to by one when the next node is of type "text"
// and starts with a space character // and starts with a space character
const nodeAfter = editor.view.state.selection.$to.nodeAfter const nodeAfter = editor.view.state.selection.$to.nodeAfter
const overrideSpace = nodeAfter?.text const overrideSpace = nodeAfter?.text?.startsWith(' ')
? /^\s/.test(nodeAfter.text)
: false
if (overrideSpace) { if (overrideSpace) {
range.to += 1 range.to += 1