This commit is contained in:
2023-01-20 12:29:32 +08:00
parent 40fae1c7c0
commit 0b2d9e3efd
23 changed files with 271 additions and 150 deletions

View File

@@ -0,0 +1,19 @@
import loader, { Monaco } from "@monaco-editor/loader"
export const monaco = ref<Monaco>()
export async function init() {
loader.config({
paths: { vs: "https://cdn.staticfile.org/monaco-editor/0.34.1/min/vs" },
"vs/nls": { availableLanguages: { "*": "zh-cn" } },
})
const [m, light, dark] = await Promise.all([
loader.init(),
fetch("/light.json").then((t) => t.json()),
fetch("/dark.json").then((t) => t.json()),
])
monaco.value = m
monaco.value.editor.defineTheme("light", light)
monaco.value.editor.defineTheme("dark", dark)
}