Skip to content

Commit

Permalink
Add "Copy XML" button to PromptCreator component
Browse files Browse the repository at this point in the history
  • Loading branch information
swuecho committed Sep 14, 2024
1 parent 1995291 commit 2860018
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions web/src/views/prompt/components/PromptCreator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
</n-form>
<n-space justify="end">
<n-button @click="handleSubmit" type="primary">Generate XML</n-button>
<n-button @click="copyToClipboard" type="primary">Copy XML</n-button>
</n-space>
</n-card>
<n-card v-if="xmlOutput" title="Generated XML">
Expand Down Expand Up @@ -143,4 +144,14 @@ const generateProcessXML = (steps, indent) => {
})
return xml
}
const copyToClipboard = () => {
navigator.clipboard.writeText(xmlOutput.value)
.then(() => {
console.log('XML copied to clipboard')
})
.catch(err => {
console.error('Failed to copy XML: ', err)
})
}
</script>

0 comments on commit 2860018

Please sign in to comment.