fix inline emoji picker

pull/221/head
Aevann 2024-01-15 15:49:14 +02:00
parent 8c5eafccb7
commit 788afc3df7
1 changed files with 6 additions and 2 deletions

View File

@ -136,8 +136,12 @@ function update_inline_emoji_modal(event)
// Get current word at string, such as ":marse" or "word"
let coords = text.indexOf(' ',box_coords.pos);
current_word = /(?:^|\s):[!#a-zA-Z0-9_]+(?=\n|$)/.exec(text.slice(0, coords === -1 ? text.length : coords));
if (current_word) current_word = current_word[0].toLowerCase();
current_word = /(^|\s):[!#a-zA-Z0-9_]+(?=\n|$)/.exec(text.slice(0, coords === -1 ? text.length : coords));
if (current_word) {
current_word = current_word[0].toLowerCase();
if (current_word.startsWith(' :'))
current_word = current_word.substring(1)
}
/* We could also check emoji_typing_state here, which is less accurate but more efficient. I've
* kept it unless someone wants to provide an option to toggle it for performance */