feat: paste button on import cURL window

This commit is contained in:
liyasthomas
2022-02-03 12:43:28 +05:30
parent f9fbe08f32
commit 4836948920
32 changed files with 68 additions and 0 deletions

View File

@@ -20,6 +20,14 @@
@click.native="hideModal"
/>
</span>
<span class="flex">
<ButtonSecondary
:svg="pasteIcon"
:label="`${t('action.paste')}`"
filled
@click.native="handlePaste"
/>
</span>
</template>
</SmartModal>
</template>
@@ -143,4 +151,20 @@ const handleImport = () => {
}
hideModal()
}
const pasteIcon = ref("clipboard")
const handlePaste = async () => {
try {
const text = await navigator.clipboard.readText()
if (text) {
curl.value = text
pasteIcon.value = "check"
setTimeout(() => (pasteIcon.value = "clipboard"), 1000)
}
} catch (e) {
console.error("Failed to copy: ", e)
toast.error(t("profile.no_permission").toString())
}
}
</script>