diff --git a/files/assets/js/emoji_modal/emoji_modal.js b/files/assets/js/emoji_modal/emoji_modal.js index d96a36c75..ce31f5ad3 100644 --- a/files/assets/js/emoji_modal/emoji_modal.js +++ b/files/assets/js/emoji_modal/emoji_modal.js @@ -253,7 +253,8 @@ function openEmojiModal(t, inputTargetIDName) switch (emojiEngineState) { case "inactive": emojiEngineState = "loading" - makeEmojisSearchDictionary(); + if (searchDictionaryState == "inactive") + makeEmojisSearchDictionary(); return fetchEmojis(); case "loading": // this works because once the fetch completes, the first keystroke callback will fire and use the current value diff --git a/files/assets/js/emoji_modal/search_dictionary.js b/files/assets/js/emoji_modal/search_dictionary.js index ad7981c34..6f9895ae3 100644 --- a/files/assets/js/emoji_modal/search_dictionary.js +++ b/files/assets/js/emoji_modal/search_dictionary.js @@ -1,4 +1,5 @@ -// tags dictionary. KEEP IT SORT +let searchDictionaryState = "inactive"; + class EmoijsDictNode { constructor(tag, name) { @@ -6,6 +7,7 @@ class EmoijsDictNode this.emojiNames = [name]; } } + const emojisSearchDictionary = { dict: [], @@ -85,6 +87,6 @@ function makeEmojisSearchDictionary() { emojisSearchDictionary.updateTag(emoji.tags[i], emoji.name); } - emojiSpeedEngineState = "ready"; + searchDictionaryState = "ready"; }) } diff --git a/files/assets/js/emoji_modal/speed_emoji_modal.js b/files/assets/js/emoji_modal/speed_emoji_modal.js index 1ff2a23d1..ca82cbdab 100644 --- a/files/assets/js/emoji_modal/speed_emoji_modal.js +++ b/files/assets/js/emoji_modal/speed_emoji_modal.js @@ -1,4 +1,3 @@ -let emojiSpeedEngineState = "inactive"; let emoji_typing_state = false; let globalEmojis; @@ -211,9 +210,9 @@ function insertGhostDivs(element) { function openSpeedModal() { - switch (emojiSpeedEngineState) { + switch (searchDictionaryState) { case "inactive": - emojiSpeedEngineState = "loading" + searchDictionaryState = "loading" return makeEmojisSearchDictionary(); case "loading": // this works because once the fetch completes, the first keystroke callback will fire and use the current value