diff --git a/modules/blox/blox/shared/js/components/Icon.jsx b/modules/blox/blox/shared/js/components/Icon.jsx index c5ce01b3..45390359 100644 --- a/modules/blox/blox/shared/js/components/Icon.jsx +++ b/modules/blox/blox/shared/js/components/Icon.jsx @@ -9,6 +9,7 @@ import { h } from "preact"; export const Icon = ({ svg, attributes }) => { if (!svg) return null; + // Clean the SVG string: decode HTML entities and TRIM whitespace let decoded = String(svg) .replace(/\\u003c/gi, "<") .replace(/\\u003e/gi, ">") @@ -17,20 +18,15 @@ export const Icon = ({ svg, attributes }) => { .replace(/>/gi, ">") .replace(/"/gi, '"') .replace(/"/gi, '"') - .replace(/&/gi, "&"); + .replace(/&/gi, "&") + .trim(); const hasWrapper = /]/i.test(decoded); if (hasWrapper) { - if (/]*class=/i.test(decoded)) { - decoded = decoded.replace(/]*?)class="([^"]*)"([^>]*)>/i, ''); - } else { - decoded = decoded.replace(/