mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-20 02:31:08 +08:00
@@ -29,11 +29,11 @@ type HTMLPreviewProps = {
|
|||||||
onLoad?: (title?: string) => void;
|
onLoad?: (title?: string) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type HTMLPreviewHander = {
|
export type HTMLPreviewHandler = {
|
||||||
reload: () => void;
|
reload: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const HTMLPreview = forwardRef<HTMLPreviewHander, HTMLPreviewProps>(
|
export const HTMLPreview = forwardRef<HTMLPreviewHandler, HTMLPreviewProps>(
|
||||||
function HTMLPreview(props, ref) {
|
function HTMLPreview(props, ref) {
|
||||||
const iframeRef = useRef<HTMLIFrameElement>(null);
|
const iframeRef = useRef<HTMLIFrameElement>(null);
|
||||||
const [frameId, setFrameId] = useState<string>(nanoid());
|
const [frameId, setFrameId] = useState<string>(nanoid());
|
||||||
@@ -207,7 +207,7 @@ export function Artifacts() {
|
|||||||
const [code, setCode] = useState("");
|
const [code, setCode] = useState("");
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [fileName, setFileName] = useState("");
|
const [fileName, setFileName] = useState("");
|
||||||
const previewRef = useRef<HTMLPreviewHander>(null);
|
const previewRef = useRef<HTMLPreviewHandler>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (id) {
|
if (id) {
|
||||||
|
@@ -17,7 +17,7 @@ import { showImageModal, FullScreen } from "./ui-lib";
|
|||||||
import {
|
import {
|
||||||
ArtifactsShareButton,
|
ArtifactsShareButton,
|
||||||
HTMLPreview,
|
HTMLPreview,
|
||||||
HTMLPreviewHander,
|
HTMLPreviewHandler,
|
||||||
} from "./artifacts";
|
} from "./artifacts";
|
||||||
import { useChatStore } from "../store";
|
import { useChatStore } from "../store";
|
||||||
import { IconButton } from "./button";
|
import { IconButton } from "./button";
|
||||||
@@ -73,7 +73,7 @@ export function Mermaid(props: { code: string }) {
|
|||||||
|
|
||||||
export function PreCode(props: { children: any }) {
|
export function PreCode(props: { children: any }) {
|
||||||
const ref = useRef<HTMLPreElement>(null);
|
const ref = useRef<HTMLPreElement>(null);
|
||||||
const previewRef = useRef<HTMLPreviewHander>(null);
|
const previewRef = useRef<HTMLPreviewHandler>(null);
|
||||||
const [mermaidCode, setMermaidCode] = useState("");
|
const [mermaidCode, setMermaidCode] = useState("");
|
||||||
const [htmlCode, setHtmlCode] = useState("");
|
const [htmlCode, setHtmlCode] = useState("");
|
||||||
const { height } = useWindowSize();
|
const { height } = useWindowSize();
|
||||||
|
Reference in New Issue
Block a user