Merge pull request #5816 from ConnectAI-E/feature/artifacts-svg

artifacts support svg
This commit is contained in:
Lloyd Zhou 2024-11-13 14:58:33 +08:00 committed by GitHub
commit a392daab71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -90,7 +90,11 @@ export function PreCode(props: { children: any }) {
const refText = ref.current.querySelector("code")?.innerText; const refText = ref.current.querySelector("code")?.innerText;
if (htmlDom) { if (htmlDom) {
setHtmlCode((htmlDom as HTMLElement).innerText); setHtmlCode((htmlDom as HTMLElement).innerText);
} else if (refText?.startsWith("<!DOCTYPE")) { } else if (
refText?.startsWith("<!DOCTYPE") ||
refText?.startsWith("<svg") ||
refText?.startsWith("<?xml")
) {
setHtmlCode(refText); setHtmlCode(refText);
} }
}, 600); }, 600);