From a430284aa21e3ae1f0d5654e55b2ad2852519cc2 Mon Sep 17 00:00:00 2001
From: wwf <yearningwang@iqtogether.com>
Date: 星期三, 04 六月 2025 15:17:49 +0800
Subject: [PATCH] 初始化

---
 app/components/base/svg-gallery/index.tsx |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/app/components/base/svg-gallery/index.tsx b/app/components/base/svg-gallery/index.tsx
index 94fc82c..4368df0 100644
--- a/app/components/base/svg-gallery/index.tsx
+++ b/app/components/base/svg-gallery/index.tsx
@@ -1,7 +1,6 @@
 import { useEffect, useRef, useState } from 'react'
 import { SVG } from '@svgdotjs/svg.js'
 import ImagePreview from '@/app/components/base/image-uploader/image-preview'
-import DOMPurify from 'dompurify'
 
 export const SVGRenderer = ({ content }: { content: string }) => {
   const svgRef = useRef<HTMLDivElement>(null)
@@ -39,19 +38,19 @@
         if (!(svgElement instanceof SVGElement))
           throw new Error('Invalid SVG content')
 
-        const originalWidth = Number.parseInt(svgElement.getAttribute('width') || '400', 10)
-        const originalHeight = Number.parseInt(svgElement.getAttribute('height') || '600', 10)
+        const originalWidth = parseInt(svgElement.getAttribute('width') || '400', 10)
+        const originalHeight = parseInt(svgElement.getAttribute('height') || '600', 10)
         draw.viewbox(0, 0, originalWidth, originalHeight)
 
         svgRef.current.style.width = `${Math.min(originalWidth, 298)}px`
 
-        const rootElement = draw.svg(DOMPurify.sanitize(content))
+        const rootElement = draw.svg(content)
 
         rootElement.click(() => {
           setImagePreview(svgToDataURL(svgElement as Element))
         })
       }
-      catch {
+      catch (error) {
         if (svgRef.current)
           svgRef.current.innerHTML = '<span style="padding: 1rem;">Error rendering SVG. Wait for the image content to complete.</span>'
       }

--
Gitblit v1.8.0