diff --git a/lang/en-US.js b/lang/en-US.js index bf055db96..b9a053559 100644 --- a/lang/en-US.js +++ b/lang/en-US.js @@ -265,6 +265,7 @@ export default { logged_out: "Logged out", logout: "Logout", account: "Account", + scrollInto_use_toggle: "Auto scroll", sync: "Sync", syncHistory: "History", syncCollections: "Collections", diff --git a/pages/graphql.vue b/pages/graphql.vue index 417b66f87..fe21b2674 100644 --- a/pages/graphql.vue +++ b/pages/graphql.vue @@ -431,7 +431,7 @@ export default { const rootTypeName = this.resolveRootType(type).name; const target = document.getElementById(`type_${rootTypeName}`); - if (target) { + if (target && this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED) { target.scrollIntoView({ behavior: "smooth" }); @@ -494,7 +494,8 @@ export default { const startTime = Date.now(); this.$nuxt.$loading.start(); - this.scrollInto("response"); + this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED && + this.scrollInto("response"); try { let headers = {}; @@ -537,7 +538,8 @@ export default { async getSchema() { const startTime = Date.now(); this.schemaString = this.$t("loading"); - this.scrollInto("schema"); + this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED && + this.scrollInto("schema"); // Start showing the loading bar as soon as possible. // The nuxt axios module will hide it when the request is made. diff --git a/pages/index.vue b/pages/index.vue index c22b822a4..15a9461d2 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -2085,7 +2085,8 @@ export default { this.path = path; this.showPreRequestScript = usesScripts; this.preRequestScript = preRequestScript; - this.scrollInto("request"); + this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED && + this.scrollInto("request"); }, getVariablesFromPreRequestScript() { if (!this.preRequestScript) { @@ -2132,7 +2133,8 @@ export default { }, async sendRequest() { this.$toast.clear(); - this.scrollInto("response"); + this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED && + this.scrollInto("response"); if (!this.isValidURL) { this.$toast.error(this.$t("url_invalid_format"), { diff --git a/pages/settings.vue b/pages/settings.vue index bd8ba090a..eeb09d8a6 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -138,6 +138,21 @@ + + @@ -331,7 +346,12 @@ export default { ], settings: { - THEME_CLASS: this.$store.state.postwoman.settings.THEME_CLASS || "", + SCROLL_INTO_ENABLED: + typeof this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED !== + "undefined" + ? this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED + : true, + THEME_COLOR: "", THEME_TAB_COLOR: "", THEME_COLOR_VIBRANT: true, @@ -344,6 +364,7 @@ export default { this.$store.state.postwoman.settings.PROXY_URL || "https://postwoman.apollotv.xyz/", PROXY_KEY: this.$store.state.postwoman.settings.PROXY_KEY || "", + EXTENSIONS_ENABLED: typeof this.$store.state.postwoman.settings.EXTENSIONS_ENABLED !== "undefined" diff --git a/store/postwoman.js b/store/postwoman.js index c7cae06eb..ad7b13f63 100644 --- a/store/postwoman.js +++ b/store/postwoman.js @@ -1,6 +1,12 @@ import Vue from "vue"; export const SETTINGS_KEYS = [ + /** + * Whether or not to enable scrolling to a specified element, when certain + * actions are triggered. + */ + "SCROLL_INTO_ENABLED", + /** * The CSS class that should be applied to the root element. * Essentially, the name of the background theme.