fix: scrolling to note

This commit is contained in:
Marie 2024-02-03 21:35:55 +01:00
parent 2a50e6e9e7
commit bd0186296c
No known key found for this signature in database
GPG Key ID: 56569BBE47D2C828
1 changed files with 3 additions and 2 deletions

View File

@ -302,6 +302,7 @@ const isRenote = (
);
const rootEl = shallowRef<HTMLElement>();
const noteEl = shallowRef<HTMLElement>();
const menuButton = shallowRef<HTMLElement>();
const menuVersionsButton = shallowRef<HTMLElement>();
const renoteButton = shallowRef<HTMLElement>();
@ -808,12 +809,12 @@ function setScrolling() {
onMounted(() => {
document.addEventListener('wheel', setScrolling);
isScrolling = false;
rootEl.value?.scrollIntoView({ block: 'center' });
noteEl.value?.scrollIntoView({ block: 'center' });
});
onUpdated(() => {
if (!isScrolling) {
rootEl.value?.scrollIntoView({ block: 'center' });
noteEl.value?.scrollIntoView({ block: 'center' });
if (location.hash) {
location.replace(location.hash); // Jump to highlighted reply
}