From c7fbbc61d43b4671fae29ca8e6d5ac28bddfee72 Mon Sep 17 00:00:00 2001 From: Filip Michalski Date: Thu, 23 Jan 2025 14:39:10 +0100 Subject: [PATCH] Replace br with br/ for svg --- designer/client/src/components/graph/EspNode/stickyNote.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer/client/src/components/graph/EspNode/stickyNote.ts b/designer/client/src/components/graph/EspNode/stickyNote.ts index b86de7fa43e..79be1017419 100644 --- a/designer/client/src/components/graph/EspNode/stickyNote.ts +++ b/designer/client/src/components/graph/EspNode/stickyNote.ts @@ -82,11 +82,12 @@ const escapeHtmlContent = (content: string) => const foreignObject = (stickyNote: StickyNote): MarkupNodeJSON => { try { const contentWithHtmlTagsSanitized = escapeHtmlContent(stickyNote.content); - const parsed = DOMPurify.sanitize(marked.parse(contentWithHtmlTagsSanitized, { renderer }), { ADD_ATTR: ["target"] }); + let parsed = DOMPurify.sanitize(marked.parse(contentWithHtmlTagsSanitized, { renderer }), { ADD_ATTR: ["target"] }); + parsed = parsed.replace(//g, "
"); // SVG does not allow tag without closing and DOMPurify always remove closing tag. return prepareSvgObject(parsed); } catch (error) { - console.error("Failed to parse markdown:", error); - return prepareSvgObject("[!] Could not parse markdown content [!]\n
" + escapeHtmlContent(stickyNote.content)); + console.error("Error: Could not parse markdown:", error); + return prepareSvgObject("[!] Could not parse markdown content [!]\n

" + escapeHtmlContent(stickyNote.content)); } };