diff --git a/src/components/compose.jsx b/src/components/compose.jsx index ea1c348c..d618f809 100644 --- a/src/components/compose.jsx +++ b/src/components/compose.jsx @@ -1398,9 +1398,11 @@ function Compose({ const { selectionStart, selectionEnd } = textarea; const text = textarea.value; const textBeforeEmoji = text.slice(0, selectionStart); - const spaceBeforeEmoji = /[\s\t\n\r]$/.test(textBeforeEmoji) - ? '' - : ' '; + const spaceBeforeEmoji = textBeforeEmoji + ? /[\s\t\n\r]$/.test(textBeforeEmoji) + ? '' + : ' ' + : ''; const textAfterEmoji = text.slice(selectionEnd); const spaceAfterEmoji = /^[\s\t\n\r]/.test(textAfterEmoji) ? ''