代码优化

This commit is contained in:
xintaofei
2026-03-15 16:20:54 +08:00
parent 838185fe35
commit 9688248200
3 changed files with 3 additions and 5 deletions

View File

@@ -7,7 +7,7 @@
"build": "next build", "build": "next build",
"lint": "eslint", "lint": "eslint",
"tauri": "tauri", "tauri": "tauri",
"postinstall": "cp -r node_modules/monaco-editor/min/vs public/vs" "postinstall": "node -e \"const fs=require('fs');fs.cpSync('node_modules/monaco-editor/min/vs','public/vs',{recursive:true,force:true})\""
}, },
"dependencies": { "dependencies": {
"@base-ui/react": "^1.1.0", "@base-ui/react": "^1.1.0",

View File

@@ -7,6 +7,7 @@ import { useTranslations } from "next-intl"
import { useFolderContext } from "@/contexts/folder-context" import { useFolderContext } from "@/contexts/folder-context"
import { defineMonacoThemes, useMonacoThemeSync } from "@/lib/monaco-themes" import { defineMonacoThemes, useMonacoThemeSync } from "@/lib/monaco-themes"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
import "@/lib/monaco-local"
type RowMarker = "none" | "added" | "deleted" | "modified" type RowMarker = "none" | "added" | "deleted" | "modified"
type DiffFileMode = "modified" | "added" | "deleted" | "renamed" type DiffFileMode = "modified" | "added" | "deleted" | "renamed"
@@ -71,8 +72,6 @@ interface HunkPreviewLine {
marker: RowMarker marker: RowMarker
} }
import "@/lib/monaco-local"
const MonacoEditor = dynamic(async () => import("@monaco-editor/react"), { const MonacoEditor = dynamic(async () => import("@monaco-editor/react"), {
ssr: false, ssr: false,
}) })

View File

@@ -15,6 +15,7 @@ import {
ContextMenuTrigger, ContextMenuTrigger,
} from "@/components/ui/context-menu" } from "@/components/ui/context-menu"
import { defineMonacoThemes, useMonacoThemeSync } from "@/lib/monaco-themes" import { defineMonacoThemes, useMonacoThemeSync } from "@/lib/monaco-themes"
import "@/lib/monaco-local"
const AUTO_SAVE_DELAY_MS = 5000 const AUTO_SAVE_DELAY_MS = 5000
@@ -291,8 +292,6 @@ function setEditorHiddenAreas(
hiddenAreaEditor.setHiddenAreas?.(ranges) hiddenAreaEditor.setHiddenAreas?.(ranges)
} }
import "@/lib/monaco-local"
const MonacoEditor = dynamic(async () => import("@monaco-editor/react"), { const MonacoEditor = dynamic(async () => import("@monaco-editor/react"), {
ssr: false, ssr: false,
}) })