diff --git a/index.html b/index.html index 5463348..665a261 100644 --- a/index.html +++ b/index.html @@ -16,8 +16,9 @@ diff --git a/src/components/MonacoEditor.tsx b/src/components/MonacoEditor.tsx index 989c66d..0d79c56 100644 --- a/src/components/MonacoEditor.tsx +++ b/src/components/MonacoEditor.tsx @@ -2,7 +2,13 @@ import { Box } from "@hope-ui/solid"; import { createEffect, createSignal, onCleanup, onMount } from "solid-js"; import { MaybeLoading } from "./FullLoading"; import loader from "@monaco-editor/loader"; +import { monaco_cdn } from "~/utils"; +loader.config({ + paths: { + vs: monaco_cdn, + }, +}); export interface MonacoEditorProps { value: string; onChange?: (value: string) => void; diff --git a/src/pages/home/preview/text-editor.tsx b/src/pages/home/preview/text-editor.tsx index 8c5cc9b..5d0da26 100644 --- a/src/pages/home/preview/text-editor.tsx +++ b/src/pages/home/preview/text-editor.tsx @@ -19,7 +19,7 @@ const TextEditor = () => { const t = useT(); return ( - + { base_path = path; @@ -26,3 +24,7 @@ if (api === "/") { if (api.endsWith("/")) { api = api.slice(0, -1); } + +export const monaco_cdn = + window.ALIST.monaco_cdn || + "https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/monaco-editor/0.33.0-dev.20220228/min/vs"; diff --git a/src/utils/index.ts b/src/utils/index.ts index 8f0b911..d4fef66 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,4 +1,4 @@ -export * from "./base_url"; +export * from "./config"; export * from "./bus"; export * from "./log"; export * from "./notify"; diff --git a/src/utils/path.ts b/src/utils/path.ts index 4799f4c..88609a6 100644 --- a/src/utils/path.ts +++ b/src/utils/path.ts @@ -1,4 +1,4 @@ -import { base_path } from "./base_url"; +import { base_path } from "."; export const standardizePath = (path: string, noRootSlash?: boolean) => { if (path.endsWith("/")) { diff --git a/src/utils/request.ts b/src/utils/request.ts index 61bfc2c..96ad979 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -1,6 +1,5 @@ import axios from "axios"; -import { api } from "./base_url"; -import { log } from "./log"; +import { api, log } from "."; const instance = axios.create({ baseURL: api + "/api",