mirror of
https://github.com/OpenListTeam/OpenList-Frontend.git
synced 2026-03-13 11:20:24 +00:00
chore: use bytedance cdn default for monaco-editor
This commit is contained in:
@@ -16,8 +16,9 @@
|
||||
<script>
|
||||
window.ALIST = {
|
||||
cdn: "/CDN_URL",
|
||||
// base_path: "/BASE_PATH",
|
||||
// api: "https://console-mock.apipost.cn/app/mock/project/c1ff0991-6aca-4e1a-ffdf-cfb985292688/",
|
||||
monaco_cdn: undefined,
|
||||
base_path: undefined,
|
||||
api: undefined,
|
||||
};
|
||||
</script>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -19,7 +19,7 @@ const TextEditor = () => {
|
||||
const t = useT();
|
||||
return (
|
||||
<MaybeLoading loading={content.loading}>
|
||||
<VStack w="$full" alignItems="start">
|
||||
<VStack w="$full" alignItems="start" spacing="$2">
|
||||
<MonacoEditorLoader
|
||||
value={content()}
|
||||
theme={theme()}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// api and base_path both don't endsWith /
|
||||
|
||||
import { pathJoin } from "./path";
|
||||
|
||||
export let base_path = "";
|
||||
export const setBasePath = (path: string) => {
|
||||
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";
|
||||
@@ -1,4 +1,4 @@
|
||||
export * from "./base_url";
|
||||
export * from "./config";
|
||||
export * from "./bus";
|
||||
export * from "./log";
|
||||
export * from "./notify";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { base_path } from "./base_url";
|
||||
import { base_path } from ".";
|
||||
|
||||
export const standardizePath = (path: string, noRootSlash?: boolean) => {
|
||||
if (path.endsWith("/")) {
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user