From b0786d1b24e227cb3a315107d45932511fc67dac Mon Sep 17 00:00:00 2001 From: Thibault Reidy Date: Tue, 4 Jun 2024 17:52:07 +0200 Subject: [PATCH] fix(sonarCloud): update strip html --- src/components/input/DebouncedTextEditor.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/input/DebouncedTextEditor.tsx b/src/components/input/DebouncedTextEditor.tsx index be1f23873..05b931cad 100644 --- a/src/components/input/DebouncedTextEditor.tsx +++ b/src/components/input/DebouncedTextEditor.tsx @@ -3,11 +3,11 @@ import { useEffect, useState } from 'react'; import TextEditor from '@graasp/ui/text-editor'; import { hooks } from '@/config/queryClient'; +import { stripHtml } from '@/utils/item'; const { useDebounce } = hooks; export const DEBOUNCE_MS = 1000; -const HTML_REGEXP = /<(.|\n)*?>/g; type Props = { id?: string; @@ -35,7 +35,7 @@ export const DebouncedTextEditor = ({ }, [debouncedValue]); const isHTMLValueEmpty = (html: string) => - html.replace(HTML_REGEXP, '').trim().length === 0; + stripHtml(html).trim().length === 0; const handleValueUpdated = (newValue: string) => { // ReactQuill Textarea return


if empty.