mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-12-05 05:50:04 +08:00
feat(monaco): reintroduce meta-json-schema (#6509)
* refactor(editor): make EditorViewer controlled and unify document state handling * fix(monaco-yaml): add patchCreateWebWorker * feat(monaco): reintroduce meta-json-schema * fix(editor): reset document state on target change
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
import { loader } from "@monaco-editor/react";
|
||||
import * as monaco from "monaco-editor";
|
||||
import editorWorker from "monaco-editor/esm/vs/editor/editor.worker?worker";
|
||||
import cssWorker from "monaco-editor/esm/vs/language/css/css.worker?worker";
|
||||
import tsWorker from "monaco-editor/esm/vs/language/typescript/ts.worker?worker";
|
||||
import yamlWorker from "monaco-yaml/yaml.worker?worker";
|
||||
|
||||
self.MonacoEnvironment = {
|
||||
getWorker(_, label) {
|
||||
switch (label) {
|
||||
case "css":
|
||||
case "less":
|
||||
case "scss":
|
||||
return new cssWorker();
|
||||
case "typescript":
|
||||
case "javascript":
|
||||
return new tsWorker();
|
||||
case "yaml":
|
||||
return new yamlWorker();
|
||||
default:
|
||||
return new editorWorker();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
loader.config({ monaco });
|
||||
|
||||
loader.init().catch((error) => {
|
||||
console.error("[monaco] Monaco initialization failed:", error);
|
||||
});
|
||||
@@ -0,0 +1,2 @@
|
||||
// See https://github.com/remcohaszing/monaco-yaml?tab=readme-ov-file#why-doesnt-it-work-with-vite
|
||||
import "monaco-yaml/yaml.worker.js";
|
||||
Reference in New Issue
Block a user