feat: add handler for removing elements with destroy-on-click class upon clicking anywhere else on the screen
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline failed

This commit is contained in:
SauceyRed 2025-07-13 04:20:26 +02:00
parent 569bca810e
commit 6cec8e92b3
Signed by: sauceyred
GPG key ID: 2BF92EB6D8A5CCA7

View file

@ -25,6 +25,13 @@ onMounted(() => {
if (e.target instanceof HTMLElement && e.target.classList.contains("message-text") && e.target.contentEditable) {
e.target.contentEditable = "false";
}
const destroyOnClick = document.getElementsByClassName("destroy-on-click");
for (const element of destroyOnClick) {
const closest = (e.target as HTMLElement).closest(".destroy-on-click");
if (element != closest) {
unrender(element);
}
}
});
document.addEventListener("keyup", (e) => {
const messageReply = document.getElementById("message-reply") as HTMLDivElement;