Added toggle for enabling/disabling auto scrolling (scrollInto functionality)
This commit is contained in:
@@ -265,6 +265,7 @@ export default {
|
|||||||
logged_out: "Logged out",
|
logged_out: "Logged out",
|
||||||
logout: "Logout",
|
logout: "Logout",
|
||||||
account: "Account",
|
account: "Account",
|
||||||
|
scrollInto_use_toggle: "Auto scroll",
|
||||||
sync: "Sync",
|
sync: "Sync",
|
||||||
syncHistory: "History",
|
syncHistory: "History",
|
||||||
syncCollections: "Collections",
|
syncCollections: "Collections",
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ export default {
|
|||||||
const rootTypeName = this.resolveRootType(type).name;
|
const rootTypeName = this.resolveRootType(type).name;
|
||||||
|
|
||||||
const target = document.getElementById(`type_${rootTypeName}`);
|
const target = document.getElementById(`type_${rootTypeName}`);
|
||||||
if (target) {
|
if (target && this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED) {
|
||||||
target.scrollIntoView({
|
target.scrollIntoView({
|
||||||
behavior: "smooth"
|
behavior: "smooth"
|
||||||
});
|
});
|
||||||
@@ -494,7 +494,8 @@ export default {
|
|||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
|
|
||||||
this.$nuxt.$loading.start();
|
this.$nuxt.$loading.start();
|
||||||
this.scrollInto("response");
|
this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED &&
|
||||||
|
this.scrollInto("response");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let headers = {};
|
let headers = {};
|
||||||
@@ -537,7 +538,8 @@ export default {
|
|||||||
async getSchema() {
|
async getSchema() {
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
this.schemaString = this.$t("loading");
|
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.
|
// Start showing the loading bar as soon as possible.
|
||||||
// The nuxt axios module will hide it when the request is made.
|
// The nuxt axios module will hide it when the request is made.
|
||||||
|
|||||||
@@ -2085,7 +2085,8 @@ export default {
|
|||||||
this.path = path;
|
this.path = path;
|
||||||
this.showPreRequestScript = usesScripts;
|
this.showPreRequestScript = usesScripts;
|
||||||
this.preRequestScript = preRequestScript;
|
this.preRequestScript = preRequestScript;
|
||||||
this.scrollInto("request");
|
this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED &&
|
||||||
|
this.scrollInto("request");
|
||||||
},
|
},
|
||||||
getVariablesFromPreRequestScript() {
|
getVariablesFromPreRequestScript() {
|
||||||
if (!this.preRequestScript) {
|
if (!this.preRequestScript) {
|
||||||
@@ -2132,7 +2133,8 @@ export default {
|
|||||||
},
|
},
|
||||||
async sendRequest() {
|
async sendRequest() {
|
||||||
this.$toast.clear();
|
this.$toast.clear();
|
||||||
this.scrollInto("response");
|
this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED &&
|
||||||
|
this.scrollInto("response");
|
||||||
|
|
||||||
if (!this.isValidURL) {
|
if (!this.isValidURL) {
|
||||||
this.$toast.error(this.$t("url_invalid_format"), {
|
this.$toast.error(this.$t("url_invalid_format"), {
|
||||||
|
|||||||
@@ -138,6 +138,21 @@
|
|||||||
</pw-toggle>
|
</pw-toggle>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<span>
|
||||||
|
<pw-toggle
|
||||||
|
:on="settings.SCROLL_INTO_ENABLED"
|
||||||
|
@change="toggleSetting('SCROLL_INTO_ENABLED')"
|
||||||
|
>
|
||||||
|
{{ $t("scrollInto_use_toggle") }}
|
||||||
|
{{
|
||||||
|
settings.SCROLL_INTO_ENABLED ? $t("enabled") : $t("disabled")
|
||||||
|
}}
|
||||||
|
</pw-toggle>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</pw-section>
|
</pw-section>
|
||||||
|
|
||||||
@@ -331,7 +346,8 @@ export default {
|
|||||||
],
|
],
|
||||||
|
|
||||||
settings: {
|
settings: {
|
||||||
THEME_CLASS: this.$store.state.postwoman.settings.THEME_CLASS || "",
|
SCROLL_INTO_ENABLED:
|
||||||
|
this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED || false,
|
||||||
THEME_COLOR: "",
|
THEME_COLOR: "",
|
||||||
THEME_TAB_COLOR: "",
|
THEME_TAB_COLOR: "",
|
||||||
THEME_COLOR_VIBRANT: true,
|
THEME_COLOR_VIBRANT: true,
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
import Vue from "vue";
|
import Vue from "vue";
|
||||||
|
|
||||||
export const SETTINGS_KEYS = [
|
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.
|
* The CSS class that should be applied to the root element.
|
||||||
* Essentially, the name of the background theme.
|
* Essentially, the name of the background theme.
|
||||||
|
|||||||
Reference in New Issue
Block a user