-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathmonaco.ts
More file actions
25 lines (21 loc) · 982 Bytes
/
monaco.ts
File metadata and controls
25 lines (21 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { useColorMode } from "@docusaurus/theme-common";
import * as monaco from "monaco-editor/esm/vs/editor/editor.api";
import "monaco-editor/esm/vs/editor/edcore.main";
import "monaco-editor/esm/vs/basic-languages/lua/lua.contribution";
import "monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution";
import "monaco-editor/esm/vs/language/typescript/monaco.contribution";
import EditorWorker from "worker-loader?filename=editor.worker.js!monaco-editor/esm/vs/editor/editor.worker.js";
import TsWorker from "worker-loader?filename=ts.worker.js!./ts.worker";
export { monaco };
export function useMonacoTheme() {
const { colorMode } = useColorMode();
return colorMode === "dark" ? "vs-dark" : "vs";
}
(globalThis as { MonacoEnvironment?: typeof MonacoEnvironment }).MonacoEnvironment = {
getWorker(_workerId, label) {
if (label === "typescript") {
return new TsWorker();
}
return new EditorWorker();
},
};