move restoring og photo scroll position into own function
This commit is contained in:
parent
3e33af7d1d
commit
00ed6468c3
@ -494,8 +494,22 @@ export default {
|
||||
if (this.$root.$el.clientHeight <= window.document.documentElement.clientHeight + 300) {
|
||||
this.$emit("scrollRefresh");
|
||||
}
|
||||
|
||||
this.restoreScrollPosition();
|
||||
});
|
||||
}
|
||||
}).finally(() => {
|
||||
this.dirty = false;
|
||||
this.loading = false;
|
||||
this.listen = true;
|
||||
});
|
||||
},
|
||||
restoreScrollPosition() {
|
||||
const lastOpenedPhotoId = window.localStorage.getItem("last_opened_photo");
|
||||
if (!this.viewer.open && lastOpenedPhotoId) {
|
||||
if (lastOpenedPhotoId === undefined || lastOpenedPhotoId === null || this.viewer.open) {
|
||||
return;
|
||||
}
|
||||
|
||||
window.localStorage.removeItem("last_opened_photo");
|
||||
this.$nextTick(() => {
|
||||
document.querySelector(`[data-uid="${lastOpenedPhotoId}"]`)?.scrollIntoView({
|
||||
@ -504,14 +518,6 @@ export default {
|
||||
inline: 'center'
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}).finally(() => {
|
||||
this.dirty = false;
|
||||
this.loading = false;
|
||||
this.listen = true;
|
||||
});
|
||||
},
|
||||
onImportCompleted() {
|
||||
if (!this.listen) return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user