|
| 1 | +import Markdown from "@/components/markdown"; |
1 | 2 | import { Button } from "@/components/ui/button"; |
2 | 3 | import { Dialog } from "@/components/ui/dialog"; |
3 | 4 | import { cn } from "@/utils/cn"; |
4 | 5 | import { check, Update } from "@tauri-apps/plugin-updater"; |
5 | 6 | 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"; |
8 | 8 | import { useTranslation } from "react-i18next"; |
9 | 9 |
|
10 | 10 | export default function Introduction() { |
@@ -50,12 +50,6 @@ function CheckingUpdates({ isLatest }: { isLatest: boolean }) { |
50 | 50 | } |
51 | 51 |
|
52 | 52 | 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]); |
59 | 53 | const [downloading, setDownloading] = useState(false); |
60 | 54 | const [downloadedSize, setDownloadedSize] = useState(0); |
61 | 55 | const [totalSize, setTotalSize] = useState(0); |
@@ -95,12 +89,7 @@ function UpdateAvailable({ update }: { update: Update | null }) { |
95 | 89 | > |
96 | 90 | <h1 className="text-3xl font-bold">新版本可用</h1> |
97 | 91 | <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" /> |
104 | 93 | <div className="flex flex-col items-center gap-2"> |
105 | 94 | {downloading ? ( |
106 | 95 | <> |
|
0 commit comments