Skip to content

Commit

Permalink
fix(sonarCloud): update strip html
Browse files Browse the repository at this point in the history
  • Loading branch information
ReidyT committed Jun 4, 2024
1 parent 2b4ac39 commit b0786d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/input/DebouncedTextEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 <p><br></p> if empty.
Expand Down

0 comments on commit b0786d1

Please sign in to comment.