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
.chain()
.setContent({
type: 'mention', type: 'mention',
attrs: { label: replyToUser.username, id: replyToUser.id }, attrs: { label: replyToUser.username, id: replyToUser.id },
}) })
editor.commands.focus() .insertContent(' ')
.focus()
.run()
} }
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [editor]) }, [editor])