Add copy invisible character tool

This commit is contained in:
Illya Marchenko 2024-10-30 14:43:22 +02:00
parent e4c712d5ad
commit 19e0074563
Signed by: stuzer05
GPG Key ID: A6ABAAA9268F9F4F
3 changed files with 50 additions and 0 deletions

View File

@ -32,6 +32,11 @@ const router = createRouter({
name: "%_of_number",
component: () => import("../views/general/PercentOfNumber.vue"),
},
{
path: "/copy_invisible_character",
name: "copy_invisible_character",
component: () => import("../views/general/CopyInvisibleCharacter.vue"),
},
/**
* String manipulation

View File

@ -25,6 +25,7 @@ export const useToolsStore = defineStore("tools", {
table_to_mediawiki_table: "Table to Mediawiki table",
humans_txt: "humans.txt generator",
"%_of_number": "% of number",
copy_invisible_character: "Copy invisible character",
},
Docker: {
docker_convert_run_compose: "Convert run compose",

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>