feat: make smart url feild the default input
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
:class="[
|
:class="[
|
||||||
color
|
color
|
||||||
? `text-${color}-800 bg-${color}-200 hover:text-${color}-900 hover:bg-${color}-300 focus:text-${color}-900 focus:bg-${color}-300`
|
? `text-${color}-800 bg-${color}-200 hover:text-${color}-900 hover:bg-${color}-300 focus:text-${color}-900 focus:bg-${color}-300`
|
||||||
: `text-primary bg-accent hover:bg-accentDark focus:bg-accentDark`,
|
: `text-white bg-accent hover:bg-accentDark focus:bg-accentDark`,
|
||||||
label ? 'px-4' : 'px-2',
|
label ? 'px-4' : 'px-2',
|
||||||
rounded ? 'rounded-full' : 'rounded',
|
rounded ? 'rounded-full' : 'rounded',
|
||||||
{ 'opacity-75 cursor-not-allowed': disabled },
|
{ 'opacity-75 cursor-not-allowed': disabled },
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
focus:outline-none focus:border-accent
|
focus:outline-none focus:border-accent
|
||||||
"
|
"
|
||||||
:value="newMethod"
|
:value="newMethod"
|
||||||
autofocus
|
|
||||||
readonly
|
readonly
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@@ -45,7 +44,13 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1 inline-flex">
|
<div class="flex-1 inline-flex">
|
||||||
|
<SmartUrlField
|
||||||
|
v-if="EXPERIMENTAL_URL_BAR_ENABLED"
|
||||||
|
v-model="newEndpoint"
|
||||||
|
@enter="newSendRequest()"
|
||||||
|
/>
|
||||||
<input
|
<input
|
||||||
|
v-else
|
||||||
id="url"
|
id="url"
|
||||||
v-model="newEndpoint"
|
v-model="newEndpoint"
|
||||||
class="
|
class="
|
||||||
@@ -65,10 +70,10 @@
|
|||||||
type="text"
|
type="text"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
:placeholder="$t('url')"
|
:placeholder="$t('url')"
|
||||||
|
autofocus
|
||||||
@keyup.enter="newSendRequest()"
|
@keyup.enter="newSendRequest()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- <SmartUrlField v-else v-model="uri" /> -->
|
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<ButtonPrimary
|
<ButtonPrimary
|
||||||
id="send"
|
id="send"
|
||||||
@@ -200,6 +205,7 @@ import { runRESTRequest$ } from "~/helpers/RequestRunner"
|
|||||||
import { useStreamSubscriber, useStream } from "~/helpers/utils/composables"
|
import { useStreamSubscriber, useStream } from "~/helpers/utils/composables"
|
||||||
import { defineActionHandler } from "~/helpers/actions"
|
import { defineActionHandler } from "~/helpers/actions"
|
||||||
import { copyToClipboard } from "~/helpers/utils/clipboard"
|
import { copyToClipboard } from "~/helpers/utils/clipboard"
|
||||||
|
import { getSettingSubject } from "~/newstore/settings"
|
||||||
|
|
||||||
const methods = [
|
const methods = [
|
||||||
"GET",
|
"GET",
|
||||||
@@ -356,5 +362,12 @@ export default defineComponent({
|
|||||||
;(this.$refs.options as any).tippy().hide()
|
;(this.$refs.options as any).tippy().hide()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
subscriptions() {
|
||||||
|
return {
|
||||||
|
EXPERIMENTAL_URL_BAR_ENABLED: getSettingSubject(
|
||||||
|
"EXPERIMENTAL_URL_BAR_ENABLED"
|
||||||
|
),
|
||||||
|
}
|
||||||
|
},
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -5,7 +5,13 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="url-field-container">
|
<div class="url-field-container">
|
||||||
<div ref="editor" class="url-field" contenteditable="true"></div>
|
<div
|
||||||
|
ref="editor"
|
||||||
|
:placeholder="$t('url')"
|
||||||
|
class="url-field"
|
||||||
|
contenteditable="true"
|
||||||
|
@keyup.enter="$emit('enter')"
|
||||||
|
></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -35,7 +41,7 @@ export default {
|
|||||||
highlight: [
|
highlight: [
|
||||||
{
|
{
|
||||||
text: /(<<\w+>>)/g,
|
text: /(<<\w+>>)/g,
|
||||||
style: "VAR",
|
style: "text-white bg-accentDark rounded px-1.5 py-0.5 mx-0.5",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
highlightEnabled: true,
|
highlightEnabled: true,
|
||||||
@@ -389,18 +395,45 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style lang="scss" scoped>
|
||||||
.VAR {
|
[contenteditable="true"]:empty {
|
||||||
@apply font-bold;
|
@apply h-8;
|
||||||
@apply text-accent;
|
|
||||||
|
line-height: 1.9;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
@apply text-secondary;
|
||||||
|
@apply opacity-75;
|
||||||
|
@apply pointer-events-none;
|
||||||
|
@apply block;
|
||||||
|
|
||||||
|
content: attr(placeholder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.url-field-container {
|
.url-field-container {
|
||||||
@apply inline-grid;
|
@apply inline-grid;
|
||||||
|
@apply w-full;
|
||||||
}
|
}
|
||||||
|
|
||||||
.url-field {
|
.url-field {
|
||||||
@apply border-dashed border-divider;
|
@apply flex;
|
||||||
|
@apply items-center;
|
||||||
|
@apply justify-items-start;
|
||||||
|
@apply bg-primaryLight;
|
||||||
|
@apply border;
|
||||||
|
@apply border-divider;
|
||||||
|
@apply font-semibold;
|
||||||
|
@apply font-mono;
|
||||||
|
@apply flex-1;
|
||||||
|
@apply text-secondaryDark;
|
||||||
|
@apply py-1;
|
||||||
|
@apply px-4;
|
||||||
|
@apply transition;
|
||||||
|
@apply truncate;
|
||||||
|
@apply focus:outline-none;
|
||||||
|
@apply focus:border-accent;
|
||||||
|
@apply truncate;
|
||||||
@apply whitespace-nowrap;
|
@apply whitespace-nowrap;
|
||||||
@apply overflow-x-auto;
|
@apply overflow-x-auto;
|
||||||
@apply resize-none;
|
@apply resize-none;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export const defaultSettings: SettingsType = {
|
|||||||
PROXY_URL: "https://proxy.hoppscotch.io/",
|
PROXY_URL: "https://proxy.hoppscotch.io/",
|
||||||
PROXY_KEY: "",
|
PROXY_KEY: "",
|
||||||
EXTENSIONS_ENABLED: true,
|
EXTENSIONS_ENABLED: true,
|
||||||
EXPERIMENTAL_URL_BAR_ENABLED: false,
|
EXPERIMENTAL_URL_BAR_ENABLED: true,
|
||||||
URL_EXCLUDES: {
|
URL_EXCLUDES: {
|
||||||
auth: true,
|
auth: true,
|
||||||
httpUser: true,
|
httpUser: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user