فهرست منبع

fix: Open the link with browser

MystiPanda 1 سال پیش
والد
کامیت
9646fab22c
3فایلهای تغییر یافته به همراه525 افزوده شده و 159 حذف شده
  1. 25 25
      package.json
  2. 480 122
      pnpm-lock.yaml
  3. 20 12
      src/components/setting/mods/update-viewer.tsx

+ 25 - 25
package.json

@@ -19,48 +19,48 @@
     "@dnd-kit/core": "^6.1.0",
     "@dnd-kit/sortable": "^8.0.0",
     "@dnd-kit/utilities": "^3.2.2",
-    "@emotion/react": "^11.11.3",
-    "@emotion/styled": "^11.11.0",
+    "@emotion/react": "^11.11.4",
+    "@emotion/styled": "^11.11.5",
     "@juggle/resize-observer": "^3.4.0",
-    "@mui/icons-material": "^5.15.5",
+    "@mui/icons-material": "^5.15.15",
     "@mui/lab": "5.0.0-alpha.149",
-    "@mui/material": "^5.15.5",
-    "@mui/x-data-grid": "^6.18.7",
-    "@tauri-apps/api": "^1.5.3",
+    "@mui/material": "^5.15.15",
+    "@mui/x-data-grid": "^6.19.11",
+    "@tauri-apps/api": "^1.5.4",
     "@types/json-schema": "^7.0.15",
-    "ahooks": "^3.7.8",
-    "axios": "^1.6.5",
+    "ahooks": "^3.7.11",
+    "axios": "^1.6.8",
     "dayjs": "1.11.5",
-    "i18next": "^23.7.16",
+    "i18next": "^23.11.2",
     "lodash-es": "^4.17.21",
-    "meta-json-schema": "^1.18.3-beta",
+    "meta-json-schema": "1.18.3-beta",
     "monaco-editor": "^0.47.0",
     "monaco-yaml": "^5.1.1",
-    "nanoid": "^5.0.4",
-    "react": "^18.2.0",
-    "react-dom": "^18.2.0",
+    "nanoid": "^5.0.7",
+    "react": "^18.3.1",
+    "react-dom": "^18.3.1",
     "react-error-boundary": "^3.1.4",
-    "react-hook-form": "^7.49.3",
+    "react-hook-form": "^7.51.3",
     "react-i18next": "^13.5.0",
-    "react-router-dom": "^6.21.2",
+    "react-markdown": "^9.0.1",
+    "react-router-dom": "^6.23.0",
     "react-transition-group": "^4.4.5",
-    "react-virtuoso": "^4.6.2",
+    "react-virtuoso": "^4.7.10",
     "recoil": "^0.7.7",
-    "snarkdown": "^2.0.0",
     "swr": "^1.3.0",
-    "tar": "^6.2.0"
+    "tar": "^6.2.1"
   },
   "devDependencies": {
     "@actions/github": "^5.1.1",
-    "@tauri-apps/cli": "^1.5.9",
+    "@tauri-apps/cli": "^1.5.12",
     "@types/fs-extra": "^9.0.13",
     "@types/js-cookie": "^3.0.6",
     "@types/lodash-es": "^4.17.12",
-    "@types/react": "^18.2.48",
-    "@types/react-dom": "^18.2.18",
+    "@types/react": "^18.3.1",
+    "@types/react-dom": "^18.3.0",
     "@types/react-transition-group": "^4.4.10",
     "@vitejs/plugin-react": "^4.2.1",
-    "adm-zip": "^0.5.10",
+    "adm-zip": "^0.5.12",
     "cross-env": "^7.0.3",
     "fs-extra": "^11.2.0",
     "https-proxy-agent": "^5.0.1",
@@ -68,9 +68,9 @@
     "node-fetch": "^3.3.2",
     "prettier": "^2.8.8",
     "pretty-quick": "^3.3.1",
-    "sass": "^1.70.0",
-    "typescript": "^5.3.3",
-    "vite": "^5.0.11",
+    "sass": "^1.75.0",
+    "typescript": "^5.4.5",
+    "vite": "^5.2.10",
     "vite-plugin-monaco-editor": "^1.1.0",
     "vite-plugin-svgr": "^4.2.0"
   },

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 480 - 122
pnpm-lock.yaml


+ 20 - 12
src/components/setting/mods/update-viewer.tsx

@@ -1,8 +1,7 @@
 import useSWR from "swr";
-import snarkdown from "snarkdown";
 import { forwardRef, useImperativeHandle, useState, useMemo } from "react";
 import { useLockFn } from "ahooks";
-import { Box, LinearProgress, styled } from "@mui/material";
+import { Box, LinearProgress } from "@mui/material";
 import { useRecoilState } from "recoil";
 import { useTranslation } from "react-i18next";
 import { relaunch } from "@tauri-apps/api/process";
@@ -11,10 +10,8 @@ import { BaseDialog, DialogRef, Notice } from "@/components/base";
 import { atomUpdateState } from "@/services/states";
 import { listen, Event, UnlistenFn } from "@tauri-apps/api/event";
 import { portableFlag } from "@/pages/_layout";
+import ReactMarkdown from "react-markdown";
 
-const UpdateLog = styled(Box)(() => ({
-  "h1,h2,h3,ul,ol,p": { margin: "0.5em 0", color: "inherit" },
-}));
 let eventListener: UnlistenFn | null = null;
 
 export const UpdateViewer = forwardRef<DialogRef>((props, ref) => {
@@ -38,12 +35,11 @@ export const UpdateViewer = forwardRef<DialogRef>((props, ref) => {
     close: () => setOpen(false),
   }));
 
-  // markdown parser
-  const parseContent = useMemo(() => {
+  const markdownContent = useMemo(() => {
     if (!updateInfo?.manifest?.body) {
       return "New Version is available";
     }
-    return snarkdown(updateInfo?.manifest?.body);
+    return updateInfo?.manifest?.body;
   }, [updateInfo]);
 
   const onUpdate = useLockFn(async () => {
@@ -87,10 +83,22 @@ export const UpdateViewer = forwardRef<DialogRef>((props, ref) => {
       onCancel={() => setOpen(false)}
       onOk={onUpdate}
     >
-      <UpdateLog
-        dangerouslySetInnerHTML={{ __html: parseContent }}
-        sx={{ height: "calc(100% - 10px)", overflow: "auto" }}
-      />
+      <Box sx={{ height: "calc(100% - 10px)", overflow: "auto" }}>
+        <ReactMarkdown
+          components={{
+            a: ({ node, ...props }) => {
+              const { children } = props;
+              return (
+                <a {...props} target="_blank">
+                  {children}
+                </a>
+              );
+            },
+          }}
+        >
+          {markdownContent}
+        </ReactMarkdown>
+      </Box>
       {updateState && (
         <LinearProgress
           variant="buffer"

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است