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

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
}