Expose window.monaco back

This commit is contained in:
Jonatan Kłosko 2023-12-07 13:05:31 +07:00
parent 8923e700d8
commit ad562b8e65
2 changed files with 16 additions and 13 deletions

View file

@ -1,3 +1,7 @@
// We need to set window.MonacoEnvironment before importing vs/editor/editor.api,
// because it expects MonacoEnvironment.globalAPI to be set on import
import "./monaco_environment";
// For the full list of features see [1] and [2]. The Monaco Webpack
// plugin always ignores certain imports [3], so we ignore these as
// well. On top of that, we ignore some other features which we
@ -106,19 +110,6 @@ import { PieceTreeTextBufferBuilder } from "monaco-editor/esm/vs/editor/common/m
import { settingsStore } from "../../../lib/settings";
window.MonacoEnvironment = {
// Certain browser extensions are Monaco-aware, so we expose it on
// the window object
globalAPI: true,
getWorkerUrl(_workerId, label) {
if (label === "json") {
return "/assets/language/json/json.worker.js";
}
return "/assets/editor/editor.worker.js";
},
};
// Force LF for line ending.
//
// Monaco infers EOL based on the text content if any, otherwise uses

View file

@ -0,0 +1,12 @@
window.MonacoEnvironment = {
// Certain browser extensions are Monaco-aware, so we expose it on
// the window object
globalAPI: true,
getWorkerUrl(_workerId, label) {
if (label === "json") {
return "/assets/language/json/json.worker.js";
}
return "/assets/editor/editor.worker.js";
},
};