parent
b739fc6f38
commit
a33279ea71
|
@ -26,37 +26,32 @@ export default new class CustomCSS extends Builtin {
|
|||
}
|
||||
|
||||
async enabled() {
|
||||
// if (!window.ace) {
|
||||
// DOMManager.injectScript("ace-script", "https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js").then(() => {
|
||||
// if (window.require.original) window.require = window.require.original;
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
Object.defineProperty(window, "MonacoEnvironment", {
|
||||
value: {
|
||||
getWorkerUrl: function() {
|
||||
return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
|
||||
self.MonacoEnvironment = {
|
||||
baseUrl: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.20.0/min'
|
||||
};
|
||||
importScripts('https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.20.0/min/vs/base/worker/workerMain.min.js');`
|
||||
)}`;
|
||||
if (!window.monaco && !window.MonacoEnvironment) {
|
||||
Object.defineProperty(window, "MonacoEnvironment", {
|
||||
value: {
|
||||
getWorkerUrl: function() {
|
||||
return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
|
||||
self.MonacoEnvironment = {
|
||||
baseUrl: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.20.0/min'
|
||||
};
|
||||
importScripts('https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.20.0/min/vs/base/worker/workerMain.min.js');`
|
||||
)}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const commonjsLoader = window.require;
|
||||
delete window.module; // Make monaco think this isn't a local node script or else it freaks out
|
||||
const commonjsLoader = window.require;
|
||||
delete window.module; // Make monaco think this isn't a local node script or else it freaks out
|
||||
|
||||
DOMManager.linkStyle("monaco-style", "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.20.0/min/vs/editor/editor.main.min.css", {documentHead: true});
|
||||
await DOMManager.injectScript("monaco-script", "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.20.0/min/vs/loader.min.js");
|
||||
DOMManager.linkStyle("monaco-style", "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.20.0/min/vs/editor/editor.main.min.css", {documentHead: true});
|
||||
await DOMManager.injectScript("monaco-script", "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.20.0/min/vs/loader.min.js");
|
||||
|
||||
const amdLoader = window.require; // Grab Monaco's amd loader
|
||||
window.require = commonjsLoader; // Revert to commonjs
|
||||
this.log(amdLoader, window.require);
|
||||
amdLoader.config({paths: {vs: "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.20.0/min/vs"}});
|
||||
amdLoader(["vs/editor/editor.main"], () => {}); // exposes the monaco global
|
||||
const amdLoader = window.require; // Grab Monaco's amd loader
|
||||
window.require = commonjsLoader; // Revert to commonjs
|
||||
// this.log(amdLoader, window.require);
|
||||
amdLoader.config({paths: {vs: "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.20.0/min/vs"}});
|
||||
amdLoader(["vs/editor/editor.main"], () => {}); // exposes the monaco global
|
||||
}
|
||||
|
||||
Settings.registerPanel(this.id, Strings.Panels.customcss, {
|
||||
order: 2,
|
||||
|
|
|
@ -52,7 +52,7 @@ export default new class SettingsManager {
|
|||
|
||||
removePanel(id) {
|
||||
const location = this.panels.findIndex(c => c.id == id);
|
||||
if (!location < 0) return Logger.error("Settings", "No collection with id " + id);
|
||||
if (location < 0) return Logger.error("Settings", "No collection with id " + id);
|
||||
this.panels.splice(location, 1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue