Add copy invisible character tool

This commit is contained in:
2024-10-30 14:43:22 +02:00
parent e4c712d5ad
commit 19e0074563
3 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,44 @@
<template>
<h2 class="tool-title">Copy invisible character</h2>
<hr class="mt-5 mb-5" />
<div class="input-group">
<label for="result">Result</label>
<div>
<input
id="result"
class="input"
:value="toolResult"
type="text"
readonly
>
</div>
</div>
<p class="mt-3">
<button @click="copyResult" class="btn">{{ toolData.btnName }}</button>
</p>
</template>
<script>
export default {
data() {
return {
toolData: {
btnName: 'Copy',
},
toolResult: ``,
};
},
methods: {
async copyResult() {
document.getElementById("result").select();
navigator.clipboard?.writeText(this.toolResult);
document.execCommand('copy');
this.toolData.btnName = 'Copied!';
setTimeout(() => this.toolData.btnName = 'Copy', 500);
},
},
};
</script>