diff --git a/client/web/plugins/com.msgbyte.mdpanel/src/group/MarkdownPanel.tsx b/client/web/plugins/com.msgbyte.mdpanel/src/group/MarkdownPanel.tsx index c1dd8f63932..65826ec32c7 100644 --- a/client/web/plugins/com.msgbyte.mdpanel/src/group/MarkdownPanel.tsx +++ b/client/web/plugins/com.msgbyte.mdpanel/src/group/MarkdownPanel.tsx @@ -54,7 +54,7 @@ const MarkdownPanel: React.FC = React.memo(() => { render={(dataMap: Record) => { return ( - + ); }} diff --git a/client/web/src/components/Markdown/render.tsx b/client/web/src/components/Markdown/render.tsx index 4431c79073f..d6ab7850168 100644 --- a/client/web/src/components/Markdown/render.tsx +++ b/client/web/src/components/Markdown/render.tsx @@ -13,8 +13,9 @@ const ReactMarkdown = Loadable(() => import('react-markdown')); export const Markdown: React.FC<{ raw: string; + allowIframe?: boolean; baseUrl?: string; -}> = React.memo(({ raw, baseUrl }) => { +}> = React.memo(({ raw, baseUrl, allowIframe }) => { const { t } = useTranslation(); const transformUrl = useCallback( (url: string) => { @@ -46,6 +47,10 @@ export const Markdown: React.FC<{ ), svg: () =>
not support svg
, iframe: (props) => { + if (!allowIframe) { + return
{t('不支持iframe')}
; + } + let src = props.src; if (!src) { @@ -53,7 +58,7 @@ export const Markdown: React.FC<{ } if (!src.startsWith('http')) { - return
only support http source
; + return
{t('只支持http路径')}
; } if (src && src.includes('?')) { @@ -61,6 +66,8 @@ export const Markdown: React.FC<{ } return