Don't add space if empty string

This commit is contained in:
Lim Chee Aun 2024-05-25 09:16:03 +08:00
parent 9cc590be1b
commit 0c45f515f0

View file

@ -1398,9 +1398,11 @@ function Compose({
const { selectionStart, selectionEnd } = textarea; const { selectionStart, selectionEnd } = textarea;
const text = textarea.value; const text = textarea.value;
const textBeforeEmoji = text.slice(0, selectionStart); 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 textAfterEmoji = text.slice(selectionEnd);
const spaceAfterEmoji = /^[\s\t\n\r]/.test(textAfterEmoji) const spaceAfterEmoji = /^[\s\t\n\r]/.test(textAfterEmoji)
? '' ? ''