Feat: stay in the same position of the list when back from a sub folder
This commit is contained in:
parent
76613336c7
commit
8a2e9dd6e9
@ -28,7 +28,6 @@ import { mapState } from "vuex";
|
|||||||
import { files as api } from "@/api";
|
import { files as api } from "@/api";
|
||||||
import { theme } from "@/utils/constants";
|
import { theme } from "@/utils/constants";
|
||||||
import buttons from "@/utils/buttons";
|
import buttons from "@/utils/buttons";
|
||||||
import url from "@/utils/url";
|
|
||||||
|
|
||||||
import { version as ace_version } from "ace-builds";
|
import { version as ace_version } from "ace-builds";
|
||||||
import ace from "ace-builds/src-min-noconflict/ace.js";
|
import ace from "ace-builds/src-min-noconflict/ace.js";
|
||||||
@ -148,8 +147,7 @@ export default {
|
|||||||
|
|
||||||
this.$store.commit("updateRequest", {});
|
this.$store.commit("updateRequest", {});
|
||||||
|
|
||||||
let uri = url.removeLastDir(this.$route.path) + "/";
|
history.back();
|
||||||
this.$router.push({ path: uri });
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -385,7 +385,7 @@ export default {
|
|||||||
req: function () {
|
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
|
// Reset the show value
|
||||||
this.showLimit = 50;
|
this.showLimit = this.req.numDirs + this.req.numFiles;
|
||||||
|
|
||||||
// Ensures that the listing is displayed
|
// Ensures that the listing is displayed
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(() => {
|
||||||
@ -394,6 +394,11 @@ export default {
|
|||||||
|
|
||||||
// Fill and fit the window with listing items
|
// Fill and fit the window with listing items
|
||||||
this.fillWindow(true);
|
this.fillWindow(true);
|
||||||
|
if (window.sessionStorage.getItem(this.$route.path)) {
|
||||||
|
this.addSelected(JSON.parse(window.sessionStorage.getItem(this.$route.path))[1]);
|
||||||
|
document.documentElement.scrollTop = JSON.parse(window.sessionStorage.getItem(this.$route.path))[0];
|
||||||
|
window.sessionStorage.removeItem(this.$route.path);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (this.req.isDir) {
|
if (this.req.isDir) {
|
||||||
@ -882,9 +887,9 @@ export default {
|
|||||||
const windowHeight = window.innerHeight;
|
const windowHeight = window.innerHeight;
|
||||||
|
|
||||||
// Quantity of items needed to fill 2x of the window height
|
// Quantity of items needed to fill 2x of the window height
|
||||||
const showQuantity = Math.ceil(
|
const showQuantity = window.sessionStorage.getItem(this.$route.path) ?
|
||||||
(windowHeight + windowHeight * 2) / this.itemWeight
|
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
|
// Less items to display than current
|
||||||
if (this.showLimit > showQuantity && !fit) return;
|
if (this.showLimit > showQuantity && !fit) return;
|
||||||
|
|||||||
@ -346,8 +346,7 @@ export default {
|
|||||||
close() {
|
close() {
|
||||||
this.$store.commit("updateRequest", {});
|
this.$store.commit("updateRequest", {});
|
||||||
|
|
||||||
let uri = url.removeLastDir(this.$route.path) + "/";
|
history.back();
|
||||||
this.$router.push({ path: uri });
|
|
||||||
},
|
},
|
||||||
download() {
|
download() {
|
||||||
window.open(this.downloadUrl);
|
window.open(this.downloadUrl);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user