From abd3b0244f2e40fdc0b57b506aece2aad1c9b209 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 11 Aug 2022 19:11:24 +0200 Subject: [PATCH] fix this https://rdrama.org/post/18459/marseycapywalking-megathread-for-bugs-and-suggestions/2486746?context=8#context --- files/assets/js/emoji_modal.js | 6 ++++++ files/templates/util/assetcache.html | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/files/assets/js/emoji_modal.js b/files/assets/js/emoji_modal.js index df0fde14a..fd8a5ffad 100644 --- a/files/assets/js/emoji_modal.js +++ b/files/assets/js/emoji_modal.js @@ -409,6 +409,7 @@ function emojiAddToInput(event) let e let current_word = ""; + let selecting; let emoji_index = 0; function curr_word_is_emoji() @@ -419,6 +420,8 @@ function emojiAddToInput(event) function populate_speed_emoji_modal(results, textbox) { + selecting = true; + if (!results || results.size === 0) { speed_carot_modal.style.display = "none"; @@ -448,6 +451,7 @@ function emojiAddToInput(event) if (current_word.includes("!")) result = `!${result}` emoji_option.onclick = (e) => { + selecting = false; speed_carot_modal.style.display = "none"; textbox.value = textbox.value.replace(new RegExp(current_word+"(?=\\s|$)", "g"), `:${result}:`) markdown(textbox) @@ -510,6 +514,8 @@ function emojiAddToInput(event) function speed_carot_navigate(e) { + if (!selecting) return; + let select_items = speed_carot_modal.querySelectorAll(".speed-modal-option"); if (!select_items || !curr_word_is_emoji()) return false; // Up or down arrow or enter diff --git a/files/templates/util/assetcache.html b/files/templates/util/assetcache.html index a7fa62a2c..6dd08ab8b 100644 --- a/files/templates/util/assetcache.html +++ b/files/templates/util/assetcache.html @@ -21,7 +21,7 @@ set CACHE_VER = { 'js/category_modal.js': 200, 'js/comments+submission_listing.js': 265, 'js/submission_listing.js': 261, - 'js/emoji_modal.js': 313, + 'js/emoji_modal.js': 314, 'js/formatting.js': 240, 'js/lottery.js': 256, 'js/marked.js': 283,