mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-19 12:10:17 +09:00
fix: 修复查看全部按钮导致artifacts失效
This commit is contained in:
parent
a6b14c7910
commit
cd49c12181
@ -79,6 +79,7 @@ export function PreCode(props: { children: any }) {
|
||||
setMermaidCode((mermaidDom as HTMLElement).innerText);
|
||||
}
|
||||
const htmlDom = ref.current.querySelector("code.language-html");
|
||||
const refText = ref.current?.innerText;
|
||||
if (htmlDom) {
|
||||
setHtmlCode((htmlDom as HTMLElement).innerText);
|
||||
} else if (refText?.startsWith("<!DOCTYPE")) {
|
||||
@ -86,11 +87,6 @@ export function PreCode(props: { children: any }) {
|
||||
}
|
||||
}, 600);
|
||||
|
||||
useEffect(() => {
|
||||
setTimeout(renderArtifacts, 1);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [refText]);
|
||||
|
||||
const enableArtifacts = useMemo(
|
||||
() => plugins?.includes(Plugin.Artifacts),
|
||||
[plugins],
|
||||
@ -119,6 +115,7 @@ export function PreCode(props: { children: any }) {
|
||||
codeElement.style.whiteSpace = "pre-wrap";
|
||||
}
|
||||
});
|
||||
setTimeout(renderArtifacts, 1);
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
@ -314,7 +314,9 @@ code{
|
||||
height: fit-content;
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
pointer-events: none;
|
||||
button{
|
||||
pointer-events: auto;
|
||||
margin-top: 3em;
|
||||
margin-bottom: 4em;
|
||||
padding: 5px 16px;
|
||||
|
Loading…
Reference in New Issue
Block a user