1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #3732 from node-red/fix-monaco-default

Fix defaulting to monaco if settings does not contain codeEditor
This commit is contained in:
Nick O'Leary 2022-07-03 20:55:16 +01:00 committed by GitHub
commit b2bb656d30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -101,7 +101,10 @@ module.exports = {
}
themeSettings = null;
theme = settings.editorTheme || {};
themeContext.asset.vendorMonaco = ((theme.codeEditor || {}).lib === "monaco") ? "vendor/monaco/monaco-bootstrap.js" : "";
themeContext.asset.vendorMonaco = "vendor/monaco/monaco-bootstrap.js"
if (theme.codeEditor && theme.codeEditor.lib === 'ace') {
themeContext.asset.vendorMonaco = ''
}
activeTheme = theme.theme;
},

View File

@ -51,7 +51,7 @@ describe("api/editor/theme", function () {
context.should.have.a.property("asset");
context.asset.should.have.a.property("red", "red/red.min.js");
context.asset.should.have.a.property("main", "red/main.min.js");
context.asset.should.have.a.property("vendorMonaco", "");
context.asset.should.have.a.property("vendorMonaco", "vendor/monaco/monaco-bootstrap.js");
should.not.exist(theme.settings());
});
@ -69,16 +69,16 @@ describe("api/editor/theme", function () {
}
});
it("Adds monaco bootstrap when enabled", async function () {
it("Does not add monaco bootstrap when ace selected", async function () {
theme.init({
editorTheme: {
codeEditor: {
lib: 'monaco'
lib: 'ace'
}
}
});
var context = await theme.context();
context.asset.should.have.a.property("vendorMonaco", "vendor/monaco/monaco-bootstrap.js");
context.asset.should.have.a.property("vendorMonaco", "");
});
it("picks up custom theme", async function () {