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>
|
|
|
|
|
|
|
|
<n-space justify="center">
|
2023-04-19 21:38:59 +02:00
|
|
|
<c-button @click="copyEscaped"> Copy </c-button>
|
2022-04-22 20:13:37 +02:00
|
|
|
</n-space>
|
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>
|
|
|
|
|
|
|
|
<n-space justify="center">
|
2023-04-19 21:38:59 +02:00
|
|
|
<c-button @click="copyUnescaped"> Copy </c-button>
|
2022-04-22 20:13:37 +02:00
|
|
|
</n-space>
|
2023-04-20 20:49:28 +02:00
|
|
|
</c-card>
|
2022-04-22 20:13:37 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2022-04-22 23:31:40 +02:00
|
|
|
import { escape, unescape } from 'lodash';
|
2022-04-22 20:13:37 +02:00
|
|
|
import { computed, ref } from 'vue';
|
2022-04-22 23:31:40 +02:00
|
|
|
import { useCopy } from '@/composable/copy';
|
2022-04-22 20:13:37 +02:00
|
|
|
|
2022-04-22 23:31:40 +02:00
|
|
|
const escapeInput = ref('<title>IT Tool</title>');
|
|
|
|
const escapeOutput = computed(() => escape(escapeInput.value));
|
|
|
|
const { copy: copyEscaped } = useCopy({ source: escapeOutput });
|
2022-04-22 20:13:37 +02:00
|
|
|
|
2022-04-22 23:31:40 +02:00
|
|
|
const unescapeInput = ref('<title>IT Tool</title');
|
|
|
|
const unescapeOutput = computed(() => unescape(unescapeInput.value));
|
|
|
|
const { copy: copyUnescaped } = useCopy({ source: unescapeOutput });
|
|
|
|
</script>
|