2023-05-28 23:13:24 +02:00
|
|
|
<script setup lang="ts">
|
|
|
|
import { escape, unescape } from 'lodash';
|
2023-06-10 17:14:50 +02:00
|
|
|
|
2023-05-28 23:13:24 +02:00
|
|
|
import { useCopy } from '@/composable/copy';
|
|
|
|
|
|
|
|
const escapeInput = ref('<title>IT Tool</title>');
|
|
|
|
const escapeOutput = computed(() => escape(escapeInput.value));
|
|
|
|
const { copy: copyEscaped } = useCopy({ source: escapeOutput });
|
|
|
|
|
|
|
|
const unescapeInput = ref('<title>IT Tool</title');
|
|
|
|
const unescapeOutput = computed(() => unescape(unescapeInput.value));
|
|
|
|
const { copy: copyUnescaped } = useCopy({ source: unescapeOutput });
|
|
|
|
</script>
|
|
|
|
|
2022-04-22 20:13:37 +02:00
|
|
|
<template>
|
2023-04-20 20:49:28 +02:00
|
|
|
<c-card title="Escape html entities">
|
2022-04-22 23:31:40 +02:00
|
|
|
<n-form-item label="Your string :">
|
2022-04-22 20:13:37 +02:00
|
|
|
<n-input
|
|
|
|
v-model:value="escapeInput"
|
|
|
|
type="textarea"
|
|
|
|
placeholder="The string to escape"
|
|
|
|
:autosize="{ minRows: 2 }"
|
|
|
|
/>
|
|
|
|
</n-form-item>
|
|
|
|
|
|
|
|
<n-form-item label="Your string escaped :">
|
|
|
|
<n-input
|
|
|
|
type="textarea"
|
|
|
|
readonly
|
|
|
|
placeholder="Your string escaped"
|
2022-04-22 23:31:40 +02:00
|
|
|
:value="escapeOutput"
|
2022-04-22 20:13:37 +02:00
|
|
|
:autosize="{ minRows: 2 }"
|
|
|
|
/>
|
|
|
|
</n-form-item>
|
|
|
|
|
2023-05-27 17:36:15 +02:00
|
|
|
<div flex justify-center>
|
2023-05-28 23:13:24 +02:00
|
|
|
<c-button @click="copyEscaped">
|
|
|
|
Copy
|
|
|
|
</c-button>
|
2023-05-27 17:36:15 +02:00
|
|
|
</div>
|
2023-04-20 20:49:28 +02:00
|
|
|
</c-card>
|
|
|
|
<c-card title="Unescape html entities">
|
2022-04-22 23:31:40 +02:00
|
|
|
<n-form-item label="Your escaped string :">
|
2022-04-22 20:13:37 +02:00
|
|
|
<n-input
|
|
|
|
v-model:value="unescapeInput"
|
|
|
|
type="textarea"
|
|
|
|
placeholder="The string to unescape"
|
|
|
|
:autosize="{ minRows: 2 }"
|
|
|
|
/>
|
|
|
|
</n-form-item>
|
|
|
|
|
2022-04-22 23:31:40 +02:00
|
|
|
<n-form-item label="Your string unescaped :">
|
2022-04-22 20:13:37 +02:00
|
|
|
<n-input
|
|
|
|
:value="unescapeOutput"
|
|
|
|
type="textarea"
|
|
|
|
readonly
|
|
|
|
placeholder="Your string unescaped"
|
|
|
|
:autosize="{ minRows: 2 }"
|
|
|
|
/>
|
|
|
|
</n-form-item>
|
|
|
|
|
2023-05-27 17:36:15 +02:00
|
|
|
<div flex justify-center>
|
2023-05-28 23:13:24 +02:00
|
|
|
<c-button @click="copyUnescaped">
|
|
|
|
Copy
|
|
|
|
</c-button>
|
2023-05-27 17:36:15 +02:00
|
|
|
</div>
|
2023-04-20 20:49:28 +02:00
|
|
|
</c-card>
|
2022-04-22 20:13:37 +02:00
|
|
|
</template>
|