Don't add space if empty string
This commit is contained in:
parent
9cc590be1b
commit
0c45f515f0
|
@ -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)
|
||||||
? ''
|
? ''
|
||||||
|
|
Loading…
Reference in a new issue