feat: add highlighting of reply when scrolled to

This commit is contained in:
SauceyRed 2025-08-03 20:41:02 +02:00
parent 95f4bbcaf3
commit c4a31276be
Signed by: sauceyred
GPG key ID: 2BF92EB6D8A5CCA7

View file

@ -46,11 +46,22 @@ onMounted(async () => {
function scrollToReply(e: MouseEvent) { function scrollToReply(e: MouseEvent) {
e.preventDefault(); e.preventDefault();
console.log("clicked on reply box"); console.log("clicked on reply box");
const reply = document.querySelector(`.message[data-message-id="${props.replyId}"]`); let replyId: string;
if (reply) { if (props.maxWidth == "reply") {
replyId = props.replyId;
} else {
replyId = props.id;
}
const reply = document.querySelector(`.message[data-message-id="${replyId}"]`);
if (reply instanceof HTMLDivElement) {
console.log("reply:", reply); console.log("reply:", reply);
console.log("scrolling into view"); console.log("scrolling into view");
reply.scrollIntoView({ behavior: "smooth", block: "center" }); reply.scrollIntoView({ behavior: "smooth", block: "center" });
reply.style.transition = "background-color .3s";
reply.style.backgroundColor = "var(--primary-highlighted-color)";
setTimeout(() => {
reply.style.backgroundColor = "";
}, 1000);
} }
} }