mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-02 20:22:08 +00:00
Copy to clipboard
This commit is contained in:
@@ -1,28 +1,29 @@
|
||||
<template>
|
||||
<div class="result-text-container" @click="copyToClipboard">
|
||||
<div class="result-text-container">
|
||||
<div class="text-content">
|
||||
{{ result }}
|
||||
</div>
|
||||
<div class="copy-button">
|
||||
<i class="pi pi-copy" />
|
||||
{{ result.text }}
|
||||
</div>
|
||||
|
||||
<Button
|
||||
class="copy-button"
|
||||
icon="pi pi-copy"
|
||||
text
|
||||
@click.stop="copyToClipboard(result.text ?? '')"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Button from 'primevue/button'
|
||||
|
||||
import { useCopyToClipboard } from '@/composables/useCopyToClipboard'
|
||||
import { ResultItemImpl } from '@/stores/queueStore'
|
||||
|
||||
const props = defineProps<{
|
||||
defineProps<{
|
||||
result: ResultItemImpl
|
||||
}>()
|
||||
|
||||
const copyToClipboard = async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(props.result.text)
|
||||
} catch (err) {
|
||||
console.error('Failed to copy text:', err)
|
||||
}
|
||||
}
|
||||
const { copyToClipboard } = useCopyToClipboard()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user