feat: import cURL on paste (#2037)

* feat: import cURL on paste

* feat: import cURL on paste

* feat: pasting cURL command on url field does not paste it in

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
Anwarul Islam
2021-12-23 01:57:06 +06:00
committed by GitHub
parent 10586e5288
commit 1eb9eb911e
4 changed files with 46 additions and 2 deletions

View File

@@ -11,6 +11,7 @@
<template #footer>
<span class="flex">
<ButtonPrimary
ref="importButton"
:label="`${t('import.title')}`"
@click.native="handleImport"
/>
@@ -24,7 +25,7 @@
</template>
<script setup lang="ts">
import { ref } from "@nuxtjs/composition-api"
import { ref, watch } from "@nuxtjs/composition-api"
import {
HoppRESTHeader,
HoppRESTParam,
@@ -43,6 +44,8 @@ const curl = ref("")
const curlEditor = ref<any | null>(null)
const props = defineProps<{ show: boolean; text: string }>()
useCodemirror(curlEditor, curl, {
extendedEditorConfig: {
mode: "application/x-sh",
@@ -53,7 +56,15 @@ useCodemirror(curlEditor, curl, {
environmentHighlights: false,
})
defineProps<{ show: boolean }>()
watch(
() => props.show,
() => {
if (props.show) {
curl.value = props.text.toString()
}
},
{ immediate: false }
)
const emit = defineEmits<{
(e: "hide-modal"): void