From f88cd9d8a109d74fdaaae6f863e2692881a6cb1c Mon Sep 17 00:00:00 2001 From: KindaCrayCray Date: Wed, 28 Jun 2023 17:31:13 +0200 Subject: [PATCH] Casefold capital characters in inline search --- files/assets/js/emoji_modal.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/assets/js/emoji_modal.js b/files/assets/js/emoji_modal.js index 9b5c349c4..905b52e1a 100644 --- a/files/assets/js/emoji_modal.js +++ b/files/assets/js/emoji_modal.js @@ -435,7 +435,7 @@ function update_speed_emoji_modal(event) // Get current word at string, such as ":marse" or "word" let coords = text.indexOf(' ',box_coords.pos); current_word = /:[!#a-zA-Z0-9_]+(?=\n|$)/.exec(text.slice(0, coords === -1 ? text.length : coords)); - if (current_word) current_word = current_word.toString(); + if (current_word) current_word = current_word[0].toLowerCase(); /* 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 */ @@ -451,7 +451,7 @@ function update_speed_emoji_modal(event) speed_carot_modal.style.top = modal_pos.y + box_coords.y + 14 + "px"; // Do the search (and do something with it) - const resultSet = emojisSearchDictionary.completeSearch(current_word.substr(1).replace(/#/g, "").replace(/!/g, "")) + const resultSet = emojisSearchDictionary.completeSearch(current_word.substring(1).replace(/[#!]/g, "")); const found = globalEmojis.filter(i => resultSet.has(i.name));