save window stats on all close types
This commit is contained in:
parent
fe44d23453
commit
e7fd5a0bfa
5 changed files with 54 additions and 32 deletions
|
|
@ -4,6 +4,18 @@ export default function useScroll(element: string) {
|
|||
|
||||
let isScrolledToBottom: boolean;
|
||||
|
||||
// Set the initial scroll position.
|
||||
const setScroll = () => {
|
||||
const view = document.getElementById(element)
|
||||
|
||||
if (view) {
|
||||
view.scrollTo({
|
||||
top: view.scrollHeight - view.clientHeight,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Update isScrolledToBottom
|
||||
const updateScrollRef = () => {
|
||||
const view = document.getElementById(element)
|
||||
|
|
@ -31,7 +43,8 @@ export default function useScroll(element: string) {
|
|||
|
||||
return {
|
||||
updateScrollRef,
|
||||
adjustScroll
|
||||
adjustScroll,
|
||||
setScroll,
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue