diff --git a/src/renderer/src/components/Preview/utils.ts b/src/renderer/src/components/Preview/utils.ts index 42b93df156..a209a6b4c8 100644 --- a/src/renderer/src/components/Preview/utils.ts +++ b/src/renderer/src/components/Preview/utils.ts @@ -18,7 +18,8 @@ export function renderSvgInShadowHost(svgContent: string, hostElement: HTMLEleme // Sanitize the SVG content const sanitizedContent = DOMPurify.sanitize(svgContent, { ADD_TAGS: ['animate', 'foreignObject', 'use'], - ADD_ATTR: ['from', 'to'] + ADD_ATTR: ['from', 'to'], + HTML_INTEGRATION_POINTS: { foreignobject: true } }) const shadowRoot = hostElement.shadowRoot || hostElement.attachShadow({ mode: 'open' }) @@ -36,6 +37,7 @@ export function renderSvgInShadowHost(svgContent: string, hostElement: HTMLEleme border-radius: var(--shadow-host-border-radius); padding: 1em; overflow: hidden; /* Prevent scrollbars, as scaling is now handled */ + white-space: normal; display: block; position: relative; width: 100%;