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