Aevann1 2022-08-11 19:11:24 +02:00
parent cb91ccc046
commit abd3b0244f
2 changed files with 7 additions and 1 deletions

View File

@ -409,6 +409,7 @@ function emojiAddToInput(event)
let e let e
let current_word = ""; let current_word = "";
let selecting;
let emoji_index = 0; let emoji_index = 0;
function curr_word_is_emoji() function curr_word_is_emoji()
@ -419,6 +420,8 @@ function emojiAddToInput(event)
function populate_speed_emoji_modal(results, textbox) function populate_speed_emoji_modal(results, textbox)
{ {
selecting = true;
if (!results || results.size === 0) if (!results || results.size === 0)
{ {
speed_carot_modal.style.display = "none"; speed_carot_modal.style.display = "none";
@ -448,6 +451,7 @@ function emojiAddToInput(event)
if (current_word.includes("!")) result = `!${result}` if (current_word.includes("!")) result = `!${result}`
emoji_option.onclick = (e) => { emoji_option.onclick = (e) => {
selecting = false;
speed_carot_modal.style.display = "none"; speed_carot_modal.style.display = "none";
textbox.value = textbox.value.replace(new RegExp(current_word+"(?=\\s|$)", "g"), `:${result}:`) textbox.value = textbox.value.replace(new RegExp(current_word+"(?=\\s|$)", "g"), `:${result}:`)
markdown(textbox) markdown(textbox)
@ -510,6 +514,8 @@ function emojiAddToInput(event)
function speed_carot_navigate(e) function speed_carot_navigate(e)
{ {
if (!selecting) return;
let select_items = speed_carot_modal.querySelectorAll(".speed-modal-option"); let select_items = speed_carot_modal.querySelectorAll(".speed-modal-option");
if (!select_items || !curr_word_is_emoji()) return false; if (!select_items || !curr_word_is_emoji()) return false;
// Up or down arrow or enter // Up or down arrow or enter

View File

@ -21,7 +21,7 @@ set CACHE_VER = {
'js/category_modal.js': 200, 'js/category_modal.js': 200,
'js/comments+submission_listing.js': 265, 'js/comments+submission_listing.js': 265,
'js/submission_listing.js': 261, 'js/submission_listing.js': 261,
'js/emoji_modal.js': 313, 'js/emoji_modal.js': 314,
'js/formatting.js': 240, 'js/formatting.js': 240,
'js/lottery.js': 256, 'js/lottery.js': 256,
'js/marked.js': 283, 'js/marked.js': 283,