mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-20 21:23:08 +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">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { getTextFromHtml, validateHtml } from './extract-text-from-html.service';
|
||||
import { withDefaultOnError } from '@/utils/defaults';
|
||||
import type { UseValidationRule } from '@/composable/validation';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
function transformer(value: string) {
|
||||
return withDefaultOnError(() => {
|
||||
if (value === '') {
|
||||
return '';
|
||||
}
|
||||
if (value === '') {
|
||||
return '';
|
||||
}
|
||||
try {
|
||||
return getTextFromHtml(value);
|
||||
}, '');
|
||||
}
|
||||
catch (e: any) {
|
||||
return e.toString();
|
||||
}
|
||||
}
|
||||
|
||||
const rules: UseValidationRule<string>[] = [
|
||||
|
||||
Reference in new issue
Block a user