fix monaco-editor.
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
import loader, { Monaco } from "@monaco-editor/loader"
|
||||
import { isLowVersion, protocol } from "~/utils/functions"
|
||||
import * as monaco0301 from "monaco-editor"
|
||||
import { isLowVersion } from "~/utils/functions"
|
||||
|
||||
export const monaco = ref<Monaco>()
|
||||
|
||||
export async function init() {
|
||||
const version = isLowVersion ? "0.30.1" : "0.36.1"
|
||||
loader.config({
|
||||
paths: {
|
||||
vs: `${protocol}://cdn.staticfile.org/monaco-editor/${version}/min/vs`,
|
||||
},
|
||||
"vs/nls": { availableLanguages: { "*": "zh-cn" } },
|
||||
})
|
||||
if (isLowVersion) {
|
||||
loader.config({ monaco: monaco0301 })
|
||||
} else {
|
||||
loader.config({
|
||||
paths: { vs: "https://cdn.staticfile.org/monaco-editor/0.36.1/min/vs" },
|
||||
"vs/nls": { availableLanguages: { "*": "zh-cn" } },
|
||||
})
|
||||
}
|
||||
|
||||
const [m, light, dark] = await Promise.all([
|
||||
loader.init(),
|
||||
|
||||
Reference in New Issue
Block a user