blob: eb4a5f3643c8530ae9adb243677736e82c600110 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
<template>
<c-card title="Escape html entities">
<n-form-item label="Your string :">
<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"
:value="escapeOutput"
:autosize="{ minRows: 2 }"
/>
</n-form-item>
<n-space justify="center">
<c-button @click="copyEscaped"> Copy </c-button>
</n-space>
</c-card>
<c-card title="Unescape html entities">
<n-form-item label="Your escaped string :">
<n-input
v-model:value="unescapeInput"
type="textarea"
placeholder="The string to unescape"
:autosize="{ minRows: 2 }"
/>
</n-form-item>
<n-form-item label="Your string unescaped :">
<n-input
:value="unescapeOutput"
type="textarea"
readonly
placeholder="Your string unescaped"
:autosize="{ minRows: 2 }"
/>
</n-form-item>
<n-space justify="center">
<c-button @click="copyUnescaped"> Copy </c-button>
</n-space>
</c-card>
</template>
<script setup lang="ts">
import { escape, unescape } from 'lodash';
import { computed, ref } from 'vue';
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>
|