From 5d6715bd29ef875dab7010b8dc6ed783560f70ac Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Tue, 5 Nov 2024 09:49:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BD=BF=E7=94=A8=20dangerouslySetInner?= =?UTF-8?q?HTML=20=E6=98=BE=E7=A4=BA=20HTML?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/accounts/HtmlPreview.jsx | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/views/accounts/HtmlPreview.jsx b/src/views/accounts/HtmlPreview.jsx index 42b67dd..c056f54 100644 --- a/src/views/accounts/HtmlPreview.jsx +++ b/src/views/accounts/HtmlPreview.jsx @@ -1,22 +1,10 @@ import { Empty, Skeleton, Divider, Flex, Button } from 'antd' import { Conditional } from '@/components/Conditional' -import { isEmpty, isNotEmpty } from '@/utils/commons' - -const decodeHtml = (text) => { - - if (isEmpty(text)) return - - const temp = document.createElement('div') - temp.innerHTML = text - - return temp.innerText || temp.textContent -} +import { isNotEmpty } from '@/utils/commons' const HtmlPreview = (props) => { const { loading = false, value } = props - const html = decodeHtml(value) - if (loading) { return } @@ -24,10 +12,9 @@ const HtmlPreview = (props) => { return (
- {html} +
           
} whenFalse={}