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

add codeEditor settings

This commit is contained in:
Steve-Mcl 2021-04-29 16:53:59 +01:00
parent 64b79cd5ac
commit 69dafd6c68
4 changed files with 13 additions and 2 deletions

View File

@ -33,7 +33,7 @@ var defaultContext = {
asset: { asset: {
red: (process.env.NODE_ENV == "development")? "red/red.js":"red/red.min.js", red: (process.env.NODE_ENV == "development")? "red/red.js":"red/red.min.js",
main: (process.env.NODE_ENV == "development")? "red/main.js":"red/main.min.js", main: (process.env.NODE_ENV == "development")? "red/main.js":"red/main.min.js",
vendorMonaco: ""
} }
}; };
@ -93,6 +93,7 @@ module.exports = {
themeContext = clone(defaultContext); themeContext = clone(defaultContext);
themeSettings = null; themeSettings = null;
theme = settings.editorTheme || {}; theme = settings.editorTheme || {};
themeContext.asset.vendorMonaco = ((theme.codeEditor || {}).lib === "monaco") ? "vendor/monaco/monaco-bootstrap.js" : "";
activeTheme = theme.theme; activeTheme = theme.theme;
}, },

View File

@ -111,6 +111,7 @@
"projects-open": "Open", "projects-open": "Open",
"projects-settings": "Project Settings", "projects-settings": "Project Settings",
"showNodeLabelDefault": "Show label of newly added nodes", "showNodeLabelDefault": "Show label of newly added nodes",
"codeEditor": "Code Editor",
"groups": "Groups", "groups": "Groups",
"groupSelection": "Group selection", "groupSelection": "Group selection",
"ungroupSelection": "Ungroup selection", "ungroupSelection": "Ungroup selection",
@ -885,6 +886,9 @@
"eval": "Error evaluating expression:\n __message__" "eval": "Error evaluating expression:\n __message__"
} }
}, },
"monaco": {
"setTheme": "Set theme"
},
"jsEditor": { "jsEditor": {
"title": "JavaScript editor" "title": "JavaScript editor"
}, },

View File

@ -143,7 +143,8 @@ RED.settings = (function () {
console.groupCollapsed("Versions"); console.groupCollapsed("Versions");
console.log("jQuery",$().jquery) console.log("jQuery",$().jquery)
console.log("jQuery UI",$.ui.version); console.log("jQuery UI",$.ui.version);
console.log("ACE",ace.version); if(window.ace) { console.log("ACE",ace.version); }
if(window.monaco) { console.log("MONACO",monaco.version || "unknown"); }
console.log("D3",d3.version); console.log("D3",d3.version);
console.groupEnd(); console.groupEnd();
loadUserSettings(done); loadUserSettings(done);

View File

@ -81,6 +81,11 @@ var api = module.exports = {
if (!runtime.settings.disableEditor) { if (!runtime.settings.disableEditor) {
safeSettings.context = runtime.nodes.listContextStores(); safeSettings.context = runtime.nodes.listContextStores();
if (runtime.settings.editorTheme && runtime.settings.editorTheme.codeEditor) {
safeSettings.codeEditor = runtime.settings.editorTheme.codeEditor || {};
safeSettings.codeEditor.lib = safeSettings.codeEditor.lib || "ace";
safeSettings.codeEditor.options = safeSettings.codeEditor.options || {};
}
safeSettings.libraries = runtime.library.getLibraries(); safeSettings.libraries = runtime.library.getLibraries();
if (util.isArray(runtime.settings.paletteCategories)) { if (util.isArray(runtime.settings.paletteCategories)) {
safeSettings.paletteCategories = runtime.settings.paletteCategories; safeSettings.paletteCategories = runtime.settings.paletteCategories;