Fix auto scroll
Wasn't actually working with the last PR. This one fixes it.
This commit is contained in:
@@ -346,6 +346,14 @@ export default {
|
|||||||
doneButton: '<i class="material-icons">done</i>',
|
doneButton: '<i class="material-icons">done</i>',
|
||||||
expandResponse: false,
|
expandResponse: false,
|
||||||
responseBodyMaxLines: 16,
|
responseBodyMaxLines: 16,
|
||||||
|
|
||||||
|
settings: {
|
||||||
|
SCROLL_INTO_ENABLED:
|
||||||
|
typeof this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED !==
|
||||||
|
"undefined"
|
||||||
|
? this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED
|
||||||
|
: true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -417,7 +425,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 && this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED) {
|
if (target && this.settings.SCROLL_INTO_ENABLED) {
|
||||||
target.scrollIntoView({
|
target.scrollIntoView({
|
||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
})
|
})
|
||||||
@@ -472,7 +480,7 @@ export default {
|
|||||||
|
|
||||||
this.$nuxt.$loading.start()
|
this.$nuxt.$loading.start()
|
||||||
this.response = this.$t("loading")
|
this.response = this.$t("loading")
|
||||||
this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED && this.scrollInto("response")
|
this.settings.SCROLL_INTO_ENABLED && this.scrollInto("response")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let headers = {}
|
let headers = {}
|
||||||
@@ -515,7 +523,7 @@ export default {
|
|||||||
async getSchema() {
|
async getSchema() {
|
||||||
const startTime = Date.now()
|
const startTime = Date.now()
|
||||||
this.schema = this.$t("loading")
|
this.schema = this.$t("loading")
|
||||||
this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED && this.scrollInto("schema")
|
this.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.
|
||||||
|
|||||||
@@ -1437,7 +1437,15 @@ export default {
|
|||||||
files: [],
|
files: [],
|
||||||
filenames: "",
|
filenames: "",
|
||||||
navigatorShare: navigator.share,
|
navigatorShare: navigator.share,
|
||||||
}
|
|
||||||
|
settings: {
|
||||||
|
SCROLL_INTO_ENABLED:
|
||||||
|
typeof this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED !==
|
||||||
|
"undefined"
|
||||||
|
? this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED
|
||||||
|
: true
|
||||||
|
}
|
||||||
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
urlExcludes: {
|
urlExcludes: {
|
||||||
@@ -1959,14 +1967,21 @@ export default {
|
|||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleUseHistory({ label, method, url, path, usesScripts, preRequestScript }) {
|
handleUseHistory({
|
||||||
this.label = label
|
label,
|
||||||
this.method = method
|
method,
|
||||||
this.url = url
|
url,
|
||||||
this.path = path
|
path,
|
||||||
this.showPreRequestScript = usesScripts
|
usesScripts,
|
||||||
this.preRequestScript = preRequestScript
|
preRequestScript
|
||||||
this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED && this.scrollInto("request")
|
}) {
|
||||||
|
this.label = label;
|
||||||
|
this.method = method;
|
||||||
|
this.url = url;
|
||||||
|
this.path = path;
|
||||||
|
this.showPreRequestScript = usesScripts;
|
||||||
|
this.preRequestScript = preRequestScript;
|
||||||
|
this.settings.SCROLL_INTO_ENABLED && this.scrollInto("request");
|
||||||
},
|
},
|
||||||
getVariablesFromPreRequestScript() {
|
getVariablesFromPreRequestScript() {
|
||||||
if (!this.preRequestScript) {
|
if (!this.preRequestScript) {
|
||||||
@@ -2001,8 +2016,8 @@ export default {
|
|||||||
return await sendNetworkRequest(requestOptions, this.$store)
|
return await sendNetworkRequest(requestOptions, this.$store)
|
||||||
},
|
},
|
||||||
async sendRequest() {
|
async sendRequest() {
|
||||||
this.$toast.clear()
|
this.$toast.clear();
|
||||||
this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED && this.scrollInto("response")
|
this.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"), {
|
||||||
|
|||||||
Reference in New Issue
Block a user