mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-23 06:11:06 +03:00
fix(Extract Text from HTML): display conversion errors
This commit is contained in:
1 parent
b4255a3e32
commit
13b8f041be
1 file changed
+8
-6
@@ -1,18 +1,20 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { getTextFromHtml, validateHtml } from './extract-text-from-html.service';
|
import { getTextFromHtml, validateHtml } from './extract-text-from-html.service';
|
||||||
import { withDefaultOnError } from '@/utils/defaults';
|
|
||||||
import type { UseValidationRule } from '@/composable/validation';
|
import type { UseValidationRule } from '@/composable/validation';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
function transformer(value: string) {
|
function transformer(value: string) {
|
||||||
return withDefaultOnError(() => {
|
if (value === '') {
|
||||||
if (value === '') {
|
return '';
|
||||||
return '';
|
}
|
||||||
}
|
try {
|
||||||
return getTextFromHtml(value);
|
return getTextFromHtml(value);
|
||||||
}, '');
|
}
|
||||||
|
catch (e: any) {
|
||||||
|
return e.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const rules: UseValidationRule<string>[] = [
|
const rules: UseValidationRule<string>[] = [
|
||||||
|
|||||||
Reference in new issue
Block a user