mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-05 01:17:22 +00:00
Add smart scrolling
This commit is contained in:
parent
06125e1bee
commit
94059af89c
1 changed files with 8 additions and 1 deletions
|
|
@ -54,8 +54,15 @@ export default function ({ inbox, currentWindow }) {
|
||||||
: messages.concat(incoming))
|
: messages.concat(incoming))
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
const inputs =
|
||||||
|
textBufferEl.current.querySelectorAll('.message.input')
|
||||||
|
const lastInput =
|
||||||
|
inputs[inputs.length- 1]
|
||||||
|
|
||||||
textBufferEl.current.scrollTop =
|
textBufferEl.current.scrollTop =
|
||||||
textBufferEl.current.scrollHeight * 2
|
lastInput
|
||||||
|
? lastInput.offsetTop
|
||||||
|
: textBufferEl.current.scrollHeight * 2
|
||||||
}, 0)
|
}, 0)
|
||||||
}, [inbox])
|
}, [inbox])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue