fix: scroll to message and highlight on click
This commit is contained in:
parent
2bd4f3b935
commit
f9317708da
@ -15,6 +15,7 @@
|
||||
>
|
||||
<div
|
||||
v-if="whatsapp.is_reply"
|
||||
@click="() => scrollToMessage(whatsapp.reply_to)"
|
||||
class="mb-1 cursor-pointer rounded-md border-0 border-l-4 border-green-500 bg-gray-200 px-2 py-4"
|
||||
v-html="formatWhatsAppMessage(whatsapp.reply_message)"
|
||||
/>
|
||||
@ -209,4 +210,15 @@ function messageOptions(message) {
|
||||
// },
|
||||
]
|
||||
}
|
||||
|
||||
function scrollToMessage(name) {
|
||||
const element = document.getElementById(name)
|
||||
element.scrollIntoView({ behavior: 'smooth' })
|
||||
|
||||
// Highlight the message
|
||||
element.classList.add('bg-yellow-100')
|
||||
setTimeout(() => {
|
||||
element.classList.remove('bg-yellow-100')
|
||||
}, 1000)
|
||||
}
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user