Skip to content

Commit dd537ba

Browse files
committed
🐛 修复关于页面报错
1 parent f511a8a commit dd537ba

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

app/src/pages/_sub_window/SettingsWindow/about/_introduction.tsx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import Markdown from "@/components/markdown";
12
import { Button } from "@/components/ui/button";
23
import { Dialog } from "@/components/ui/dialog";
34
import { cn } from "@/utils/cn";
45
import { check, Update } from "@tauri-apps/plugin-updater";
56
import { Check, Download, Loader2 } from "lucide-react";
6-
import MarkdownIt from "markdown-it";
7-
import { useEffect, useMemo, useState } from "react";
7+
import { useEffect, useState } from "react";
88
import { useTranslation } from "react-i18next";
99

1010
export default function Introduction() {
@@ -50,12 +50,6 @@ function CheckingUpdates({ isLatest }: { isLatest: boolean }) {
5050
}
5151

5252
function UpdateAvailable({ update }: { update: Update | null }) {
53-
const updateBodyHtml = useMemo(() => {
54-
if (!update) return "";
55-
return MarkdownIt({
56-
breaks: true,
57-
}).render(update.body ?? "");
58-
}, [update]);
5953
const [downloading, setDownloading] = useState(false);
6054
const [downloadedSize, setDownloadedSize] = useState(0);
6155
const [totalSize, setTotalSize] = useState(0);
@@ -95,12 +89,7 @@ function UpdateAvailable({ update }: { update: Update | null }) {
9589
>
9690
<h1 className="text-3xl font-bold">新版本可用</h1>
9791
<h2 className="text-xl">{update?.version}</h2>
98-
<div
99-
dangerouslySetInnerHTML={{
100-
__html: updateBodyHtml,
101-
}}
102-
className="flex-1 overflow-y-auto rounded-xl bg-black/20 p-4"
103-
></div>
92+
<Markdown source={update?.body ?? ""} className="flex-1 overflow-y-auto rounded-xl bg-black/20 p-4" />
10493
<div className="flex flex-col items-center gap-2">
10594
{downloading ? (
10695
<>

0 commit comments

Comments
 (0)