fix: use escapeHtml util after load text
This commit is contained in:
parent
a323bd3aa3
commit
663f1b088e
@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
|
|||||||
import hljs from "highlight.js";
|
import hljs from "highlight.js";
|
||||||
import { Button } from "@components/Button";
|
import { Button } from "@components/Button";
|
||||||
import { useToast } from "@components/Toast";
|
import { useToast } from "@components/Toast";
|
||||||
|
import { escapeHtml } from "@/utils/escapeHtml";
|
||||||
|
|
||||||
export function LoadedCode({ from }: { from: string }) {
|
export function LoadedCode({ from }: { from: string }) {
|
||||||
const [state, setState] = useState<string | undefined | null>();
|
const [state, setState] = useState<string | undefined | null>();
|
||||||
@ -11,7 +12,7 @@ export function LoadedCode({ from }: { from: string }) {
|
|||||||
(async () => {
|
(async () => {
|
||||||
const res = await fetch(from);
|
const res = await fetch(from);
|
||||||
const text = await res.text();
|
const text = await res.text();
|
||||||
setState(text);
|
setState(escapeHtml(text));
|
||||||
})();
|
})();
|
||||||
}, [from]);
|
}, [from]);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user