mirror of
https://github.com/PrimalHQ/primal-web-app.git
synced 2024-10-03 02:10:55 +00:00
Fix emoji input for messages and notes
This commit is contained in:
parent
2783819eeb
commit
c2e050be72
@ -161,7 +161,12 @@ const EditBox: Component<{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isMentioning() && !isEmojiInput() && e.key === ':' && previousChar === ' ') {
|
||||
if (!isMentioning() && !isEmojiInput() && e.key === ':') {
|
||||
// Ignore if `@` is a part of a word
|
||||
if (textArea.selectionStart > 0 && ![' ', '\r\n', '\r', '\n'].includes(textArea.value[textArea.selectionStart-1])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
emojiCursorPosition = getCaretCoordinates(textArea, textArea.selectionStart);
|
||||
setEmojiInput(true);
|
||||
return false;
|
||||
|
@ -376,6 +376,12 @@ const Messages: Component = () => {
|
||||
}
|
||||
|
||||
if (!isMentioning() && !isEmojiInput() && e.key === ':') {
|
||||
|
||||
// Ignore if `:` is a part of a word
|
||||
if (newMessageInput.selectionStart > 0 && ![' ', '\r\n', '\r', '\n'].includes(newMessageInput.value[newMessageInput.selectionStart-1])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
emojiCursorPosition = getCaretCoordinates(newMessageInput, newMessageInput.selectionStart);
|
||||
setEmojiInput(true);
|
||||
return false;
|
||||
@ -869,7 +875,7 @@ const Messages: Component = () => {
|
||||
|
||||
const taRect = newMessageInput.getBoundingClientRect();
|
||||
|
||||
let newBottom = taRect.height - emojiCursorPosition.top;
|
||||
let newBottom = taRect.height - emojiCursorPosition.top + 32;
|
||||
let newLeft = emojiCursorPosition.left;
|
||||
|
||||
emojiOptions.style.bottom = `${newBottom}px`;
|
||||
|
Loading…
Reference in New Issue
Block a user