feat: remain in the same position when back from a subfolder
This commit is contained in:
parent
5f64bc711a
commit
08458da31c
@ -1,9 +1,5 @@
|
||||
<template>
|
||||
<div
|
||||
id="editor-container"
|
||||
@touchmove.prevent.stop
|
||||
@wheel.prevent.stop
|
||||
>
|
||||
<div id="editor-container" @touchmove.prevent.stop @wheel.prevent.stop>
|
||||
<header-bar>
|
||||
<action icon="close" :label="$t('buttons.close')" @action="close()" />
|
||||
<title>{{ req.name }}</title>
|
||||
@ -28,7 +24,6 @@ import { mapState } from "vuex";
|
||||
import { files as api } from "@/api";
|
||||
import { theme } from "@/utils/constants";
|
||||
import buttons from "@/utils/buttons";
|
||||
import url from "@/utils/url";
|
||||
|
||||
import { version as ace_version } from "ace-builds";
|
||||
import ace from "ace-builds/src-min-noconflict/ace.js";
|
||||
@ -148,8 +143,7 @@ export default {
|
||||
|
||||
this.$store.commit("updateRequest", {});
|
||||
|
||||
let uri = url.removeLastDir(this.$route.path) + "/";
|
||||
this.$router.push({ path: uri });
|
||||
history.back();
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -383,9 +383,12 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
req: function () {
|
||||
if (window.sessionStorage.getItem("listFrozen") !=="true" && window.sessionStorage.getItem("modified") !=="true"){
|
||||
if (
|
||||
window.sessionStorage.getItem("listFrozen") !== "true" &&
|
||||
window.sessionStorage.getItem("modified") !== "true"
|
||||
) {
|
||||
// Reset the show value
|
||||
this.showLimit = 50;
|
||||
this.showLimit = this.req.numDirs + this.req.numFiles;
|
||||
|
||||
// Ensures that the listing is displayed
|
||||
Vue.nextTick(() => {
|
||||
@ -394,11 +397,21 @@ export default {
|
||||
|
||||
// Fill and fit the window with listing items
|
||||
this.fillWindow(true);
|
||||
if (window.sessionStorage.getItem(this.$route.path)) {
|
||||
document.documentElement.scrollTop = JSON.parse(
|
||||
window.sessionStorage.getItem(this.$route.path)
|
||||
)[0];
|
||||
if (!this.isMobile)
|
||||
this.addSelected(
|
||||
JSON.parse(window.sessionStorage.getItem(this.$route.path))[1]
|
||||
);
|
||||
window.sessionStorage.removeItem(this.$route.path);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (this.req.isDir) {
|
||||
window.sessionStorage.setItem("listFrozen", "false");
|
||||
window.sessionStorage.setItem("modified", "false");
|
||||
window.sessionStorage.setItem("modified", "false");
|
||||
}
|
||||
},
|
||||
},
|
||||
@ -882,9 +895,13 @@ export default {
|
||||
const windowHeight = window.innerHeight;
|
||||
|
||||
// Quantity of items needed to fill 2x of the window height
|
||||
const showQuantity = Math.ceil(
|
||||
(windowHeight + windowHeight * 2) / this.itemWeight
|
||||
);
|
||||
const showQuantity = window.sessionStorage.getItem(this.$route.path)
|
||||
? Math.ceil(
|
||||
(JSON.parse(window.sessionStorage.getItem(this.$route.path))[0] +
|
||||
windowHeight * 2) /
|
||||
this.itemWeight
|
||||
)
|
||||
: Math.ceil((windowHeight + windowHeight * 2) / this.itemWeight);
|
||||
|
||||
// Less items to display than current
|
||||
if (this.showLimit > showQuantity && !fit) return;
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div
|
||||
id="previewer"
|
||||
@touchmove.prevent.stop
|
||||
@touchmove.prevent.stop
|
||||
@wheel.prevent.stop
|
||||
@mousemove="toggleNavigation"
|
||||
@touchstart="toggleNavigation"
|
||||
>
|
||||
<header-bar v-if="showNav">
|
||||
<header-bar v-if="showNav">
|
||||
<action icon="close" :label="$t('buttons.close')" @action="close()" />
|
||||
<title>{{ name }}</title>
|
||||
<action
|
||||
@ -346,8 +346,7 @@ export default {
|
||||
close() {
|
||||
this.$store.commit("updateRequest", {});
|
||||
|
||||
let uri = url.removeLastDir(this.$route.path) + "/";
|
||||
this.$router.push({ path: uri });
|
||||
history.back();
|
||||
},
|
||||
download() {
|
||||
window.open(this.downloadUrl);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user