allow middleclick on inline suggestors

pull/225/head
Aevann 2024-03-09 08:51:14 +02:00
parent 8e2a19e80b
commit 21a2ad3491
3 changed files with 23 additions and 6 deletions

View File

@ -7799,3 +7799,7 @@ table.border-0 * {
.inline-modal-option.user-option span {
margin-left: 0 !important;
}
.inline-modal-option a {
color: var(--black);
}

View File

@ -99,11 +99,15 @@ function populate_inline_group_modal(results, textbox)
let group_option = document.createElement("div");
group_option.className = "inline-modal-option group-option " + (i === 1 ? "selected" : "");
group_option.tabIndex = 0;
let group_option_text = document.createElement("span");
let group_option_link = document.createElement("a");
group_option_link.href = `/!${name}`
let group_option_text = document.createElement("span");
group_option_text.textContent = name;
group_option.addEventListener('click', () => {
group_option_link.addEventListener('click', () => {
e.preventDefault();
close_inline_emoji_modal()
textbox.value = textbox.value.replace(new RegExp(current_word+"(?=\\s|$)", "gi"), `!${name} `)
textbox.focus()
@ -111,7 +115,9 @@ function populate_inline_group_modal(results, textbox)
markdown(textbox)
}
});
group_option.appendChild(group_option_text);
group_option.appendChild(group_option_link);
group_option_link.appendChild(group_option_text);
inline_carot_modal.appendChild(group_option);
}
if (i === 0) inline_carot_modal.style.display = "none";

View File

@ -99,6 +99,10 @@ function populate_inline_user_modal(results, textbox)
let user_option = document.createElement("div");
user_option.className = "inline-modal-option user-option " + (i === 1 ? "selected" : "");
user_option.tabIndex = 0;
let user_option_link = document.createElement("a");
user_option_link.href = `/@${name}`
let user_option_img = document.createElement("img");
user_option_img.className = "pp20";
user_option_img.src = `/@${name}/pic`
@ -107,7 +111,8 @@ function populate_inline_user_modal(results, textbox)
user_option_text.textContent = name;
user_option.addEventListener('click', () => {
user_option_link.addEventListener('click', (e) => {
e.preventDefault();
close_inline_emoji_modal()
textbox.value = textbox.value.replace(new RegExp(current_word+"(?=\\s|$)", "gi"), `@${name} `)
textbox.focus()
@ -115,8 +120,10 @@ function populate_inline_user_modal(results, textbox)
markdown(textbox)
}
});
user_option.appendChild(user_option_img);
user_option.appendChild(user_option_text);
user_option.appendChild(user_option_link);
user_option_link.appendChild(user_option_img);
user_option_link.appendChild(user_option_text);
inline_carot_modal.appendChild(user_option);
}
if (i === 0) inline_carot_modal.style.display = "none";