mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-30 00:01:15 +00:00
Merge branch 'enable-zoom' of https://github.com/LemmyNet/lemmy-ui into enable-zoom
This commit is contained in:
commit
a9c3c5d0f8
4 changed files with 2 additions and 12 deletions
|
@ -15,7 +15,6 @@ import {
|
||||||
updateCommunityBlock,
|
updateCommunityBlock,
|
||||||
updatePersonBlock,
|
updatePersonBlock,
|
||||||
} from "@utils/app";
|
} from "@utils/app";
|
||||||
import { restoreScrollPosition, saveScrollPosition } from "@utils/browser";
|
|
||||||
import {
|
import {
|
||||||
getPageFromString,
|
getPageFromString,
|
||||||
getQueryParams,
|
getQueryParams,
|
||||||
|
@ -229,10 +228,6 @@ export class Community extends Component<
|
||||||
setupTippy();
|
setupTippy();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
saveScrollPosition(this.context);
|
|
||||||
}
|
|
||||||
|
|
||||||
static async fetchInitialData({
|
static async fetchInitialData({
|
||||||
client,
|
client,
|
||||||
path,
|
path,
|
||||||
|
@ -609,7 +604,6 @@ export class Community extends Component<
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
restoreScrollPosition(this.context);
|
|
||||||
setupTippy();
|
setupTippy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ import {
|
||||||
showLocal,
|
showLocal,
|
||||||
updatePersonBlock,
|
updatePersonBlock,
|
||||||
} from "@utils/app";
|
} from "@utils/app";
|
||||||
import { restoreScrollPosition, saveScrollPosition } from "@utils/browser";
|
|
||||||
import {
|
import {
|
||||||
getPageFromString,
|
getPageFromString,
|
||||||
getQueryParams,
|
getQueryParams,
|
||||||
|
@ -293,10 +292,6 @@ export class Home extends Component<any, HomeState> {
|
||||||
setupTippy();
|
setupTippy();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
saveScrollPosition(this.context);
|
|
||||||
}
|
|
||||||
|
|
||||||
static async fetchInitialData({
|
static async fetchInitialData({
|
||||||
client,
|
client,
|
||||||
auth,
|
auth,
|
||||||
|
@ -800,7 +795,6 @@ export class Home extends Component<any, HomeState> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
restoreScrollPosition(this.context);
|
|
||||||
setupTippy();
|
setupTippy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
export default function restoreScrollPosition(context: any) {
|
export default function restoreScrollPosition(context: any) {
|
||||||
const path: string = context.router.route.location.pathname;
|
const path: string = context.router.route.location.pathname;
|
||||||
const y = Number(sessionStorage.getItem(`scrollPosition_${path}`));
|
const y = Number(sessionStorage.getItem(`scrollPosition_${path}`));
|
||||||
|
|
||||||
window.scrollTo(0, y);
|
window.scrollTo(0, y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
export default function saveScrollPosition(context: any) {
|
export default function saveScrollPosition(context: any) {
|
||||||
const path: string = context.router.route.location.pathname;
|
const path: string = context.router.route.location.pathname;
|
||||||
const y = window.scrollY;
|
const y = window.scrollY;
|
||||||
|
|
||||||
sessionStorage.setItem(`scrollPosition_${path}`, y.toString());
|
sessionStorage.setItem(`scrollPosition_${path}`, y.toString());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue