From 148b2c7c7b40a52a0c40fac3cf1f7760131939b6 Mon Sep 17 00:00:00 2001 From: Theo Gautier Date: Fri, 8 Nov 2024 15:14:16 +0100 Subject: [PATCH] fix: retours design actualites --- components/ActualitesModal.tsx | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/components/ActualitesModal.tsx b/components/ActualitesModal.tsx index a02cb3ef0..9a094e5b5 100644 --- a/components/ActualitesModal.tsx +++ b/components/ActualitesModal.tsx @@ -14,24 +14,38 @@ export default function ActualitesModal({ onClose }: ActualitesModalProps) { const modalRef = useRef(null) const actualites = useActualites() - function formaterTexteAvecTag(texteAFormater: string) { + function formaterActus(texteAFormater: string) { const texteAssaini = sanitizeHtml(texteAFormater, { disallowedTagsMode: 'recursiveEscape', allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img']), }) - const texteEnrichi = texteAssaini + const texteDecoupeParActu = decouperParActu(texteAssaini) + const texteAvecCategorie = ajouterTagCategorie(texteDecoupeParActu) + + return parse(texteAvecCategorie) + } + + function decouperParActu(str: string) { + return str + .replace( + /

" + "" ) .replace(/}/g, '') - - return parse(texteEnrichi) } const modalTemplate = ( -
+
-
-
- {formaterTexteAvecTag(actualites?.contenu ?? '')} +
+
+ {formaterActus(actualites?.contenu ?? '')}