Customise help link label/url

This commit is contained in:
Nick O'Leary 2015-04-13 11:35:52 +01:00
parent 6ff540ed08
commit b0de8abb63
3 changed files with 27 additions and 3 deletions

View File

@ -165,7 +165,10 @@ var RED = (function() {
]}, ]},
null, null,
{id:"btn-keyboard-shortcuts",label:"Keyboard Shortcuts",onselect:RED.keyboard.showHelp}, {id:"btn-keyboard-shortcuts",label:"Keyboard Shortcuts",onselect:RED.keyboard.showHelp},
{id:"btn-help",label:"Node-RED Website", href:"http://nodered.org/docs"} {id:"btn-help",
label: RED.settings.theme("help.label","Node-RED Website"),
href: RED.settings.theme("help.url","http://nodered.org/docs")
}
] ]
}); });
@ -179,7 +182,7 @@ var RED = (function() {
RED.clipboard.init(); RED.clipboard.init();
RED.view.init(); RED.view.init();
RED.deploy.init(RED.settings.editorTheme?RED.settings.editorTheme.deployButton:null); RED.deploy.init(RED.settings.theme("deployButton",null));
RED.keyboard.add(/* ? */ 191,{shift:true},function(){RED.keyboard.showHelp();d3.event.preventDefault();}); RED.keyboard.add(/* ? */ 191,{shift:true},function(){RED.keyboard.showHelp();d3.event.preventDefault();});
RED.comms.connect(); RED.comms.connect();

View File

@ -119,13 +119,30 @@ RED.settings = (function () {
}); });
}; };
function theme(property,defaultValue) {
if (!RED.settings.editorTheme) {
return defaultValue;
}
var parts = property.split(".");
var v = RED.settings.editorTheme;
try {
for (var i=0;i<parts.length;i++) {
v = v[parts[i]];
}
return v;
} catch(err) {
return defaultValue;
}
}
return { return {
init: init, init: init,
load: load, load: load,
set: set, set: set,
get: get, get: get,
remove: remove remove: remove,
theme: theme
} }
}) })
(); ();

View File

@ -141,6 +141,10 @@ module.exports = {
} }
} }
} }
if (theme.help) {
themeSettings.help = theme.help;
}
return themeApp; return themeApp;
} }
}, },