mirror of
https://github.com/Troplo/Colubrina.git
synced 2024-11-22 19:27:55 +11:00
commit
994b67b16a
1 changed files with 2 additions and 10 deletions
|
@ -1050,21 +1050,13 @@ export default {
|
||||||
this.edit.id = ""
|
this.edit.id = ""
|
||||||
this.focusInput()
|
this.focusInput()
|
||||||
},
|
},
|
||||||
autoScroll(smooth = false) {
|
autoScroll() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (!this.avoidAutoScroll) {
|
if (!this.avoidAutoScroll) {
|
||||||
try {
|
try {
|
||||||
const lastIndex = this.messages.length - 1
|
const lastIndex = this.messages.length - 1
|
||||||
const lastMessage = document.querySelector(`#message-${lastIndex}`)
|
const lastMessage = document.querySelector(`#message-${lastIndex}`)
|
||||||
if (smooth) {
|
|
||||||
lastMessage.scrollIntoView({
|
|
||||||
behavior: "smooth",
|
|
||||||
block: "nearest",
|
|
||||||
inline: "start"
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
lastMessage.scrollIntoView()
|
lastMessage.scrollIntoView()
|
||||||
}
|
|
||||||
this.autoScrollRetry = 0
|
this.autoScrollRetry = 0
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("Could not auto scroll, retrying...")
|
console.log("Could not auto scroll, retrying...")
|
||||||
|
|
Loading…
Reference in a new issue