On reply, put space instead of \n after mention

This commit is contained in:
Sinclair Chen 2022-08-05 10:08:01 -07:00
parent d2be20f190
commit d8cfb902a2

View File

@ -495,13 +495,17 @@ export function CommentInputTextArea(props: {
}, },
}, },
}) })
// insert at mention // insert at mention and focus
if (replyToUser) { if (replyToUser) {
editor.commands.insertContentAt(0, { editor
type: 'mention', .chain()
attrs: { label: replyToUser.username, id: replyToUser.id }, .setContent({
}) type: 'mention',
editor.commands.focus() attrs: { label: replyToUser.username, id: replyToUser.id },
})
.insertContent(' ')
.focus()
.run()
} }
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [editor]) }, [editor])