fix: scrolling to note
This commit is contained in:
parent
2a50e6e9e7
commit
bd0186296c
1 changed files with 3 additions and 2 deletions
|
@ -302,6 +302,7 @@ const isRenote = (
|
||||||
);
|
);
|
||||||
|
|
||||||
const rootEl = shallowRef<HTMLElement>();
|
const rootEl = shallowRef<HTMLElement>();
|
||||||
|
const noteEl = shallowRef<HTMLElement>();
|
||||||
const menuButton = shallowRef<HTMLElement>();
|
const menuButton = shallowRef<HTMLElement>();
|
||||||
const menuVersionsButton = shallowRef<HTMLElement>();
|
const menuVersionsButton = shallowRef<HTMLElement>();
|
||||||
const renoteButton = shallowRef<HTMLElement>();
|
const renoteButton = shallowRef<HTMLElement>();
|
||||||
|
@ -808,12 +809,12 @@ function setScrolling() {
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
document.addEventListener('wheel', setScrolling);
|
document.addEventListener('wheel', setScrolling);
|
||||||
isScrolling = false;
|
isScrolling = false;
|
||||||
rootEl.value?.scrollIntoView({ block: 'center' });
|
noteEl.value?.scrollIntoView({ block: 'center' });
|
||||||
});
|
});
|
||||||
|
|
||||||
onUpdated(() => {
|
onUpdated(() => {
|
||||||
if (!isScrolling) {
|
if (!isScrolling) {
|
||||||
rootEl.value?.scrollIntoView({ block: 'center' });
|
noteEl.value?.scrollIntoView({ block: 'center' });
|
||||||
if (location.hash) {
|
if (location.hash) {
|
||||||
location.replace(location.hash); // Jump to highlighted reply
|
location.replace(location.hash); // Jump to highlighted reply
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue